summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c26
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/skill.c196
-rw-r--r--src/map/skill.h4
5 files changed, 89 insertions, 141 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 21aea2593..ae0c1da54 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3116,7 +3116,7 @@ struct Damage battle_calc_attack( int attack_type,
return d;
}
-int battle_calc_return_damage(struct block_list *bl, int damage, int flag) {
+int battle_calc_return_damage(struct block_list *bl, int *damage, int flag) {
struct map_session_data *sd=NULL;
struct status_change *sc;
int rdamage = 0;
@@ -3125,21 +3125,22 @@ int battle_calc_return_damage(struct block_list *bl, int damage, int flag) {
sc = status_get_sc(bl);
if(flag&BF_WEAPON) {
+ //Bounces back part of the damage.
if (flag & BF_SHORT) {
if (sd && sd->short_weapon_damage_return)
{
- rdamage += damage * sd->short_weapon_damage_return / 100;
+ rdamage += *damage * sd->short_weapon_damage_return / 100;
if(rdamage < 1) rdamage = 1;
}
if (sc && sc->data[SC_REFLECTSHIELD].timer != -1)
{
- rdamage += damage * sc->data[SC_REFLECTSHIELD].val2 / 100;
+ rdamage += *damage * sc->data[SC_REFLECTSHIELD].val2 / 100;
if (rdamage < 1) rdamage = 1;
}
} else if (flag & BF_LONG) {
if (sd && sd->long_weapon_damage_return)
{
- rdamage += damage * sd->long_weapon_damage_return / 100;
+ rdamage += *damage * sd->long_weapon_damage_return / 100;
if (rdamage < 1) rdamage = 1;
}
}
@@ -3147,10 +3148,10 @@ int battle_calc_return_damage(struct block_list *bl, int damage, int flag) {
// magic_damage_return by [AppleGirl] and [Valaris]
if(flag&BF_MAGIC)
{
- if(sd && sd->magic_damage_return > 0 )
- {
- rdamage += damage * sd->magic_damage_return / 100;
- if(rdamage < 1) rdamage = 1;
+ if(sd && sd->magic_damage_return && rand()%100 < sd->magic_damage_return)
+ { //Bounces back full damage, you take none.
+ rdamage = *damage;
+ *damage = 0;
}
}
return rdamage;
@@ -3252,11 +3253,12 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
damage = wd.damage + wd.damage2;
if (damage > 0 && src != target) {
- rdamage = battle_calc_return_damage(target, damage, wd.flag);
- if (rdamage > 0)
+ rdamage = battle_calc_return_damage(target, &damage, wd.flag);
+ if (rdamage > 0) {
clif_damage(src, src, tick, wd.amotion, wd.dmotion, rdamage, 1, 4, 0);
- //Use Reflect Shield to signal this kind of skill trigger. [Skotlex]
- skill_additional_effect(target,src,CR_REFLECTSHIELD, 1,BF_WEAPON,tick);
+ //Use Reflect Shield to signal this kind of skill trigger. [Skotlex]
+ skill_additional_effect(target,src,CR_REFLECTSHIELD, 1,BF_WEAPON,tick);
+ }
}
clif_damage(src, target, tick, wd.amotion, wd.dmotion, wd.damage, wd.div_ , wd.type, wd.damage2);
diff --git a/src/map/battle.h b/src/map/battle.h
index 3f3e28c11..3746ea7b1 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -25,7 +25,7 @@ struct block_list;
struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int flag);
-int battle_calc_return_damage(struct block_list *bl, int damage, int flag);
+int battle_calc_return_damage(struct block_list *bl, int *damage, int flag);
int battle_attr_fix(struct block_list *src, struct block_list *target, int damage,int atk_elem,int def_elem);
diff --git a/src/map/clif.c b/src/map/clif.c
index ccf647414..074f918ab 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -4609,7 +4609,7 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un
WFIFOW(fd,12)=unit->bl.y;
WFIFOB(fd,14)=unit->group->unit_id;
WFIFOB(fd,15)=1;
- if(unit->group->unit_id==0xb0) { // Graffiti [Valaris]
+ if(unit->group->unit_id==UNT_GRAFFITI) { // Graffiti [Valaris]
WFIFOB(fd,16)=1;
memcpy(WFIFOP(fd,17),unit->group->valstr,MESSAGE_SIZE);
} else {
diff --git a/src/map/skill.c b/src/map/skill.c
index 0c689a40f..124ad04b1 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1421,7 +1421,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
else
tbl = src;
- if (tbl != src && !battle_check_range(src, tbl, skill_get_range2(src, skillid, skilllv)))
+ if (tbl != bl && !battle_check_range(bl, tbl, skill_get_range2(bl, skillid, skilllv)))
continue; //Autoskills DO check for target-src range. [Skotlex]
switch (skill_get_casttype(skillid)) {
@@ -1743,6 +1743,9 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
damage = dmg.damage + dmg.damage2;
+ if (damage > 0 && src != bl && src == dsrc)
+ rdamage = battle_calc_return_damage(bl, &damage, dmg.flag);
+
if(lv==15)
lv=-1;
@@ -1860,9 +1863,6 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
} //Switch End
}
- if (damage > 0 && src != bl && src == dsrc)
- rdamage = battle_calc_return_damage(bl, damage, dmg.flag);
-
//武器スキル?ここまで
switch(skillid){
case AS_SPLASHER:
@@ -1987,7 +1987,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
battle_heal(NULL,bl,0,-sp,0);
}
- if (/*(skillid || flag) &&*/ rdamage>0) { //Is the skillid/flag check really necessary? [Skotlex]
+ if (rdamage>0) {
if (attack_type&BF_WEAPON)
battle_delay_damage(tick+dmg.amotion,bl,src,0,0,0,rdamage,ATK_DEF,0);
else
@@ -2541,7 +2541,6 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s
case MC_MAMMONITE: /* ?マ?ナイト */
case TF_DOUBLE:
case AC_DOUBLE: /* ダブルストレイフィング */
- case AC_SHOWER: /* ア??シャ?? */
case AS_SONICBLOW: /* ソニックブ?? */
case KN_PIERCE: /* ピア?ス */
case KN_SPEARBOOMERANG: /* スピアブ??ラン */
@@ -2770,6 +2769,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s
case AS_GRIMTOOTH: /* グリムトゥ?ス */
case MC_CARTREVOLUTION: /* カ?トレヴォリュ?ション */
case NPC_SPLASHATTACK: /* スプラッシュアタック */
+ case AC_SHOWER: //Targetted skill implementation.
if(flag&1){
/* 個別にダ??ジを?える */
if(bl->id!=skill_area_temp[1]){
@@ -2778,15 +2778,12 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s
}
} else {
skill_area_temp[1]=bl->id;
- skill_area_temp[2]=bl->x;
- skill_area_temp[3]=bl->y;
- /* まずタ?ゲットに?U?を加える */
- skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,0);
- /* その後タ?ゲット以外の範??の敵全?に??を?sう */
map_foreachinrange(skill_area_sub, bl,
skill_get_splash(skillid, skilllv), BL_CHAR,
src,skillid,skilllv,tick, flag|BCT_ENEMY|1,
skill_castend_damage_id);
+ //Skill-attack at the end in case it has knockback. [Skotlex]
+ skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,0);
}
break;
@@ -3279,10 +3276,26 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
case NPC_SMOKING: //Since it is a self skill, this one ends here rather than in damage_id. [Skotlex]
return skill_castend_damage_id (src, bl, skillid, skilllv, tick, flag);
+ case WE_CALLPARTNER:
+ case WE_CALLPARENT:
+ case WE_CALLBABY:
+ { //Find a random spot to place the skill. [Skotlex]
+ short x,y;
+ i = skill_get_splash(skillid, skilllv);
+ x = src->x + i;
+ y = src->y + i;
+ if (map_random_dir(src, &x, &y))
+ return skill_castend_pos2(src,x,y,skillid,skilllv,tick,0);
+ else {
+ if (sd) clif_skill_fail(sd,skillid,0,0);
+ return 0;
+ }
+ }
case CR_GRANDCROSS:
case NPC_GRANDDARKNESS:
- //These two are actually ground placed.
+ //These are actually ground placed.
return skill_castend_pos2(src,src->x,src->y,skillid,skilllv,tick,0);
+
//Until they're at right position - gs_ground- [Vicious]
case NJ_KAENSIN:
case NJ_HYOUSYOURAKU:
@@ -5070,23 +5083,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
}
break;
- case WE_CALLPARTNER: /* あなたに?いたい */
- if(sd){
- if((dstsd = pc_get_partner(sd)) == NULL){
- clif_skill_fail(sd,skillid,0,0);
- map_freeblock_unlock();
- return 0;
- }
- if(map[sd->bl.m].flag.nomemo || map[sd->bl.m].flag.nowarpto || map[dstsd->bl.m].flag.nowarp){
- clif_skill_teleportmessage(sd,1);
- map_freeblock_unlock();
- return 0;
- }
- skill_unitsetting(src,skillid,skilllv,sd->bl.x,sd->bl.y,0);
- pc_blockskill_start (sd, skillid, skill_get_time(skillid, skilllv));
- }
- break;
-
// parent-baby skills
case WE_BABY:
if(sd){
@@ -5104,49 +5100,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
}
break;
- case WE_CALLPARENT:
- if(sd){
- struct map_session_data *f_sd = pc_get_father(sd);
- struct map_session_data *m_sd = pc_get_mother(sd);
- // if neither was found
- if(!f_sd && !m_sd){
- clif_skill_fail(sd,skillid,0,0);
- map_freeblock_unlock();
- return 0;
- }
- if(map[sd->bl.m].flag.nomemo || map[sd->bl.m].flag.nowarpto)
- {
- clif_skill_teleportmessage(sd,1);
- map_freeblock_unlock();
- return 0;
- }
- if((!f_sd && m_sd && map[m_sd->bl.m].flag.nowarp) ||
- (!m_sd && f_sd && map[f_sd->bl.m].flag.nowarp))
- { //Case where neither one can be warped.
- clif_skill_teleportmessage(sd,1);
- map_freeblock_unlock();
- return 0;
- }
- //Warp those that can be warped.
- if (f_sd && !map[f_sd->bl.m].flag.nowarp)
- pc_setpos(f_sd,map[sd->bl.m].index,sd->bl.x,sd->bl.y,3);
- if (m_sd && !map[m_sd->bl.m].flag.nowarp)
- pc_setpos(m_sd,map[sd->bl.m].index,sd->bl.x,sd->bl.y,3);
- }
- break;
-
- case WE_CALLBABY:
- if(sd && dstsd)
- {
- if(map[sd->bl.m].flag.nomemo || map[sd->bl.m].flag.nowarpto || map[dstsd->bl.m].flag.nowarp){
- clif_skill_teleportmessage(sd,1);
- map_freeblock_unlock();
- return 0;
- }
- pc_setpos(dstsd,map[sd->bl.m].index,sd->bl.x,sd->bl.y,3);
- }
- break;
-
case PF_HPCONVERSION: /* ライフ置き換え */
clif_skill_nodamage(src, bl, skillid, skilllv, 1);
if (sd) {
@@ -5979,8 +5932,7 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil
if(skillid != WZ_METEOR &&
skillid != AM_CANNIBALIZE &&
skillid != AM_SPHEREMINE &&
- skillid != CR_CULTIVATION &&
- skillid != AC_SHOWER)
+ skillid != CR_CULTIVATION)
clif_skill_poseffect(src,skillid,skilllv,x,y,tick);
switch(skillid)
@@ -5998,17 +5950,6 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil
skill_castend_damage_id);
break;
- case AC_SHOWER:
- { //One of the few skills that can attack traps.
- i = skill_get_splash(skillid, skilllv);
- clif_skill_poseffect(src,skillid,skilllv,x,y,tick);
- map_foreachinarea (skill_area_sub,
- src->m, x-i, y-i, x+i, y+i, BL_CHAR|BL_SKILL,
- src, skillid, skilllv, tick, flag|BCT_ENEMY|1,
- skill_castend_damage_id);
- }
- break;
-
case BS_HAMMERFALL:
i = skill_get_splash(skillid, skilllv);
map_foreachinarea (skill_area_sub,
@@ -6052,6 +5993,10 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil
case PF_FOGWALL: /* フォグウォ?ル */
case PF_SPIDERWEB: /* スパイダ?ウェッブ */
case HT_TALKIEBOX: /* ト?キ?ボックス */
+ case WE_CALLPARTNER:
+ case WE_CALLPARENT:
+ case WE_CALLBABY:
+ case AC_SHOWER: //Ground-placed skill implementation.
skill_unitsetting(src,skillid,skilllv,x,y,0);
break;
@@ -6423,6 +6368,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
int count=0;
int target,interval,range,unit_flag;
struct skill_unit_layout *layout;
+ struct map_session_data *sd;
struct status_change *sc;
int active_flag=1;
@@ -6435,6 +6381,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
unit_flag = skill_get_unit_flag(skillid);
layout = skill_get_unit_layout(skillid,skilllv,src,x,y);
+ BL_CAST(BL_PC, src, sd);
sc= status_get_sc(src); // for traps, firewall and fogwall - celest
if (sc && !sc->count)
sc = NULL;
@@ -6592,15 +6539,40 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
val1 = 55 + skilllv*5; //Elemental Resistance
val2 = skilllv*10; //Status ailment resistance
break;
- case BD_ETERNALCHAOS:
- break;
case PF_FOGWALL: /* フォグウォ?ル */
if(sc && sc->data[SC_DELUGE].timer!=-1) limit *= 2;
break;
-
case RG_GRAFFITI: /* Graffiti */
count=1; // Leave this at 1 [Valaris]
break;
+ case WE_CALLPARTNER:
+ if (!sd)
+ return NULL;
+ if (map[src->m].flag.nowarpto) {
+ clif_skill_teleportmessage(sd,1);
+ return NULL;
+ }
+ val1 = sd->status.partner_id;
+ break;
+ case WE_CALLPARENT:
+ if (!sd)
+ return NULL;
+ if (map[src->m].flag.nowarpto) {
+ clif_skill_teleportmessage(sd,1);
+ return NULL;
+ }
+ val1 = sd->status.father;
+ val2 = sd->status.mother;
+ break;
+ case WE_CALLBABY:
+ if (!sd)
+ return NULL;
+ if (map[src->m].flag.nowarpto) {
+ clif_skill_teleportmessage(sd,1);
+ return NULL;
+ }
+ val1 = sd->status.child;
+ break;
}
if (val3==0 && (flag&2 || (sc && sc->data[SC_MAGICPOWER].timer != -1)))
@@ -6933,6 +6905,10 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign
break;
}
+ case UNT_ARROWSHOWER:
+ skill_attack(BF_WEAPON,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
+ break;
+
case UNT_MAGIC_SKILLS:
skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
break;
@@ -7386,15 +7362,15 @@ int skill_unit_onlimit(struct skill_unit *src,unsigned int tick)
case UNT_ICEWALL: /* アイスウォ?ル */
clif_changemapcell(src->bl.m,src->bl.x,src->bl.y,src->val2,1);
break;
- case UNT_CALLPARTNER: /* あなたに?いたい */
+ case UNT_CALLFAMILY: /* あなたに?いたい */
{
struct map_session_data *sd = NULL;
- if((sd = map_id2sd(sg->src_id)) == NULL)
- return 0;
- if((sd = pc_get_partner(sd)) == NULL)
- return 0;
-
- pc_setpos(sd,map[src->bl.m].index,src->bl.x,src->bl.y,3);
+ if(src->val1 && (sd = map_charid2sd(src->val1))
+ && !map[sd->bl.m].flag.nowarp)
+ pc_setpos(sd,map[src->bl.m].index,src->bl.x,src->bl.y,3);
+ if(src->val2 && (sd = map_charid2sd(src->val2))
+ && !map[sd->bl.m].flag.nowarp)
+ pc_setpos(sd,map[src->bl.m].index,src->bl.x,src->bl.y,3);
}
break;
}
@@ -7940,12 +7916,6 @@ int skill_check_condition(struct map_session_data *sd,int type)
}
}
break;
- case WE_CALLPARTNER: /* あなたに逢いたい */
- if(!sd->status.partner_id){
- clif_skill_fail(sd,skill,0,0);
- return 0;
- }
- break;
case AM_CANNIBALIZE: /* バイオプラント */
case AM_SPHEREMINE: /* スフィア?マイン */
if(type&1){
@@ -8602,17 +8572,6 @@ int skill_use_id (struct map_session_data *sd, int target_id, int skill_num, int
return 0;
}
break;
- case WE_CALLBABY:
- tsd = pc_get_child(sd);
- bl = (struct block_list *)tsd;
- if (bl)
- target_id = bl->id;
- else
- {
- clif_skill_fail(sd,skill_num,0,0);
- return 0;
- }
- break;
}
if (bl == NULL && (bl = map_id2bl(target_id)) == NULL)
return 0;
@@ -8738,19 +8697,6 @@ int skill_use_id (struct map_session_data *sd, int target_id, int skill_num, int
casttime *= distance_bl(&sd->bl, bl);
break;
- // parent-baby skills
- case WE_BABY:
- case WE_CALLPARENT:
- {
- struct map_session_data *f_sd = pc_get_father(sd);
- struct map_session_data *m_sd = pc_get_mother(sd);
-
- // set target as any one of the parent
- if (f_sd) target_id = f_sd->bl.id;
- else if (m_sd) target_id = m_sd->bl.id;
- else return 0; // neither are found
- }
- break;
case HP_BASILICA: /* バジリカ */
{
// cancel Basilica if already in effect
diff --git a/src/map/skill.h b/src/map/skill.h
index 54982bd4d..0939d6f9e 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -872,7 +872,7 @@ enum {
UNT_FIREWALL,
UNT_WARP_WAITING,
UNT_WARP_ACTIVE,
-
+ UNT_ARROWSHOWER = 0x82, //TODO: Get actual unit id.
UNT_SANCTUARY = 0x83,
UNT_MAGNUS,
UNT_PNEUMA,
@@ -918,7 +918,7 @@ enum {
UNT_SERVICEFORYOU,
UNT_GRAFFITI,
UNT_DEMONSTRATION,
- UNT_CALLPARTNER,
+ UNT_CALLFAMILY,
UNT_GOSPEL,
UNT_BASILICA,