summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c186
1 files changed, 107 insertions, 79 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index a4ebff9f1..8410a77d0 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2361,11 +2361,11 @@ static int skill_counter_additional_effect(struct block_list *src, struct block_
) {
// Soul Drain should only work on targeted spells [Skotlex]
if( pc_issit(sd) ) pc->setstand(sd); // Character stuck in attacking animation while 'sitting' fix. [Skotlex]
- if( skill->get_nk(skill_id)&NK_SPLASH && skill->area_temp[1] != bl->id )
+ if (skill->get_nk(skill_id)&NK_SPLASH && skill->area_temp[1] != bl->id) {
;
- else {
+ } else {
clif->skill_nodamage(src,bl,HW_SOULDRAIN,rate,1);
- status->heal(src, 0, status->get_lv(bl)*(95+15*rate)/100, 2);
+ status->heal(src, 0, status->get_lv(bl)*(95+15*rate)/100, STATUS_HEAL_SHOWEFFECT);
}
}
@@ -2388,9 +2388,9 @@ static int skill_counter_additional_effect(struct block_list *src, struct block_
sc->data[SC_SOULLINK]->val3 = 0; //Clear bounced spell check.
}
}
- if( hp || sp ) {
+ if (hp != 0 || sp != 0) {
// updated to force healing to allow healing through berserk
- status->heal(src, hp, sp, battle_config.show_hp_sp_gain ? 3 : 1);
+ status->heal(src, hp, sp, STATUS_HEAL_FORCED | (battle_config.show_hp_sp_gain ? STATUS_HEAL_SHOWEFFECT : STATUS_HEAL_DEFAULT));
}
}
@@ -2588,7 +2588,7 @@ static int skill_break_equip(struct block_list *bl, unsigned short where, int ra
pc->unequipitem(sd, j, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE);
}
}
- clif->equiplist(sd);
+ clif->equipList(sd);
}
return where; //Return list of pieces broken.
@@ -2745,7 +2745,11 @@ static int skill_magic_reflect(struct block_list *src, struct block_list *bl, in
static int skill_attack(int attack_type, struct block_list *src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag)
{
struct Damage dmg;
+#if MAGIC_REFLECTION_TYPE
struct status_data *sstatus, *tstatus;
+#else
+ struct status_data *tstatus;
+#endif
struct status_change *sc;
struct map_session_data *sd, *tsd;
int type;
@@ -2780,7 +2784,9 @@ static int skill_attack(int attack_type, struct block_list *src, struct block_li
)
return 0;
+#if MAGIC_REFLECTION_TYPE
sstatus = status->get_status_data(src);
+#endif
tstatus = status->get_status_data(bl);
sc = status->get_sc(bl);
if (sc && !sc->count) sc = NULL; //Don't need it.
@@ -2893,7 +2899,7 @@ static int skill_attack(int attack_type, struct block_list *src, struct block_li
sp = sp * sc->data[SC_MAGICROD]->val2 / 100;
if(skill_id == WZ_WATERBALL && skill_lv > 1)
sp = sp/((skill_lv|1)*(skill_lv|1)); //Estimate SP cost of a single water-ball
- status->heal(bl, 0, sp, 2);
+ status->heal(bl, 0, sp, STATUS_HEAL_SHOWEFFECT);
}
}
@@ -3212,8 +3218,8 @@ static int skill_attack(int attack_type, struct block_list *src, struct block_li
}
tsd->reproduceskill_id = copy_skill;
- pc_setglobalreg(tsd, script->add_str("REPRODUCE_SKILL"), copy_skill);
- pc_setglobalreg(tsd, script->add_str("REPRODUCE_SKILL_LV"), lv);
+ pc_setglobalreg(tsd, script->add_variable("REPRODUCE_SKILL"), copy_skill);
+ pc_setglobalreg(tsd, script->add_variable("REPRODUCE_SKILL_LV"), lv);
tsd->status.skill[cidx].id = copy_skill;
tsd->status.skill[cidx].lv = lv;
@@ -3236,8 +3242,8 @@ static int skill_attack(int attack_type, struct block_list *src, struct block_li
lv = plagiarismlvl;
tsd->cloneskill_id = copy_skill;
- pc_setglobalreg(tsd, script->add_str("CLONE_SKILL"), copy_skill);
- pc_setglobalreg(tsd, script->add_str("CLONE_SKILL_LV"), lv);
+ pc_setglobalreg(tsd, script->add_variable("CLONE_SKILL"), copy_skill);
+ pc_setglobalreg(tsd, script->add_variable("CLONE_SKILL_LV"), lv);
tsd->status.skill[cidx].id = copy_skill;
tsd->status.skill[cidx].lv = lv;
@@ -4132,7 +4138,7 @@ static int skill_activate_reverberation(struct block_list *bl, va_list ap)
if( su->alive && (sg = su->group) != NULL && sg->skill_id == WM_REVERBERATION && sg->unit_id == UNT_REVERBERATION ) {
int64 tick = timer->gettick();
clif->changetraplook(bl,UNT_USED_TRAPS);
- map->foreachinrange(skill->trap_splash, bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, bl, tick);
+ skill->trap_do_splash(bl, sg->skill_id, sg->skill_lv, sg->bl_flag, tick);
su->limit = DIFF_TICK32(tick,sg->tick)+1500;
sg->unit_id = UNT_USED_TRAPS;
}
@@ -4471,7 +4477,7 @@ static int skill_castend_damage_id(struct block_list *src, struct block_list *bl
if( skill_id == MO_EXTREMITYFIST ) {
mbl = src;
i = 3; // for Asura(from caster)
- status->set_sp(src, 0, 0);
+ status->set_sp(src, 0, STATUS_HEAL_DEFAULT);
status_change_end(src, SC_EXPLOSIONSPIRITS, INVALID_TIMER);
status_change_end(src, SC_BLADESTOP, INVALID_TIMER);
#ifdef RENEWAL
@@ -4481,9 +4487,9 @@ static int skill_castend_damage_id(struct block_list *src, struct block_list *bl
status_change_end(src, SC_NJ_NEN, INVALID_TIMER);
status_change_end(src, SC_HIDING, INVALID_TIMER);
#ifdef RENEWAL
- status->set_hp(src, max(status_get_max_hp(src)/100, 1), 0);
+ status->set_hp(src, max(status_get_max_hp(src)/100, 1), STATUS_HEAL_DEFAULT);
#else // not RENEWAL
- status->set_hp(src, 1, 0);
+ status->set_hp(src, 1, STATUS_HEAL_DEFAULT);
#endif // RENEWAL
}
dir = map->calc_dir(src,bl->x,bl->y);
@@ -4597,7 +4603,7 @@ static int skill_castend_damage_id(struct block_list *src, struct block_list *bl
heal = skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, sflag);
if (skill_id == NPC_VAMPIRE_GIFT && heal > 0) {
clif->skill_nodamage(NULL, src, AL_HEAL, heal, 1);
- status->heal(src,heal,0,0);
+ status->heal(src, heal, 0, STATUS_HEAL_DEFAULT);
}
if (skill_id == SU_SCRATCH && status->get_lv(src) >= 30 && (rnd() % 100 < (int)(status->get_lv(src) / 30) + 10)) // TODO: Need activation chance.
skill->addtimerskill(src, tick + skill->get_delay(skill_id, skill_lv), bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag);
@@ -4965,7 +4971,7 @@ static int skill_castend_damage_id(struct block_list *src, struct block_list *bl
src, src, bl, skill_id, skill_lv, tick, flag);
if (heal > 0){
clif->skill_nodamage(NULL, src, AL_HEAL, heal, 1);
- status->heal(src, heal, 0, 0);
+ status->heal(src, heal, 0, STATUS_HEAL_DEFAULT);
}
}
break;
@@ -5076,7 +5082,7 @@ static int skill_castend_damage_id(struct block_list *src, struct block_list *bl
heal = 0; // Don't absorb heal from Ice Walls or other skill units.
if( heal && rnd()%100 < rate ) {
- status->heal(src, heal, 0, 0);
+ status->heal(src, heal, 0, STATUS_HEAL_DEFAULT);
clif->skill_nodamage(NULL, src, AL_HEAL, heal, 1);
}
}
@@ -5837,7 +5843,7 @@ static int skill_castend_id(int tid, int64 tick, int id, intptr_t data)
//When Asura fails... (except when it fails from Fog of Wall)
//Consume SP/spheres
skill->consume_requirement(sd,ud->skill_id, ud->skill_lv,1);
- status->set_sp(src, 0, 0);
+ status->set_sp(src, 0, STATUS_HEAL_DEFAULT);
sc = &sd->sc;
if (sc->count) {
//End states
@@ -6120,7 +6126,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
clif->skill_nodamage (src, bl, skill_id, heal, 1);
if( tsc && tsc->data[SC_AKAITSUKI] && heal && skill_id != HLIF_HEAL )
heal = ~heal + 1;
- heal_get_jobexp = status->heal(bl,heal,0,0);
+ heal_get_jobexp = status->heal(bl, heal, 0, STATUS_HEAL_DEFAULT);
if(sd && dstsd && heal > 0 && sd != dstsd && battle_config.heal_exp > 0){
heal_get_jobexp = heal_get_jobexp * battle_config.heal_exp / 100;
@@ -6153,8 +6159,8 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
clif->updatestatus(sd,SP_BASEEXP);
clif->updatestatus(sd,SP_JOBEXP);
}
- status->set_hp(src, 1, 0);
- status->set_sp(src, 0, 0);
+ status->set_hp(src, 1, STATUS_HEAL_DEFAULT);
+ status->set_sp(src, 0, STATUS_HEAL_DEFAULT);
break;
} else if (status->isdead(bl) && flag&1) { //Revive
skill->area_temp[0]++; //Count it in, then fall-through to the Resurrection code.
@@ -6327,7 +6333,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
break;
case SA_INSTANTDEATH:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- status->set_hp(bl,1,0);
+ status->set_hp(bl, 1, STATUS_HEAL_DEFAULT);
break;
case SA_QUESTION:
case SA_GRAVITY:
@@ -6752,7 +6758,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
}
sd->mission_mobid = id;
sd->mission_count = 0;
- pc_setglobalreg(sd,script->add_str("TK_MISSION_ID"), id);
+ pc_setglobalreg(sd,script->add_variable("TK_MISSION_ID"), id);
clif->mission_info(sd, id, 0);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
}
@@ -6905,7 +6911,8 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
if (dstsd && dstsd->charm_type != CHARM_TYPE_NONE && dstsd->charm_count > 0) {
pc->del_charm(dstsd, dstsd->charm_count, dstsd->charm_type);
}
- if (sp) status->heal(src, 0, sp, 3);
+ if (sp != 0)
+ status->heal(src, 0, sp, STATUS_HEAL_FORCED | STATUS_HEAL_SHOWEFFECT);
clif->skill_nodamage(src,bl,skill_id,skill_lv,sp?1:0);
}
break;
@@ -7267,7 +7274,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
case NV_FIRSTAID:
clif->skill_nodamage(src,bl,skill_id,5,1);
- status->heal(bl,5,0,0);
+ status->heal(bl, 5, 0, STATUS_HEAL_DEFAULT);
break;
case AL_CURE:
@@ -7344,7 +7351,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
case MER_SCAPEGOAT:
if( mer && mer->master ) {
- status->heal(&mer->master->bl, mer->battle_status.hp, 0, 2);
+ status->heal(&mer->master->bl, mer->battle_status.hp, 0, STATUS_HEAL_SHOWEFFECT);
status->damage(src, src, mer->battle_status.max_hp, 0, 0, 1);
}
break;
@@ -7661,7 +7668,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
if( tsc && tsc->data[SC_EXTREMITYFIST2] )
sp = 0;
#endif
- status->heal(bl,(int)hp,sp,0);
+ status->heal(bl, (int)hp, sp, STATUS_HEAL_DEFAULT);
}
break;
case AM_CP_WEAPON:
@@ -7836,7 +7843,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
sp = skill->get_sp(skill_id,skill_lv);
sp = sp * tsc->data[SC_MAGICROD]->val2 / 100;
if(sp < 1) sp = 1;
- status->heal(bl,0,sp,2);
+ status->heal(bl, 0, sp, STATUS_HEAL_SHOWEFFECT);
status_percent_damage(bl, src, 0, -20, false); //20% max SP damage.
} else {
struct unit_data *ud = unit->bl2ud(bl);
@@ -7868,8 +7875,8 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
if (sp) //Recover some of the SP used
sp = sp*(25*(skill_lv-1))/100;
- if(hp || sp)
- status->heal(src, hp, sp, 2);
+ if (hp != 0 || sp != 0)
+ status->heal(src, hp, sp, STATUS_HEAL_SHOWEFFECT);
}
}
break;
@@ -8112,14 +8119,14 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
{
int hp_rate = skill_lv == 0 ? 0 : skill->get_hp_rate(skill_id, skill_lv);
int gain_hp = tstatus->max_hp*abs(hp_rate)/100; // The earned is the same % of the target HP than it cost the caster. [Skotlex]
- clif->skill_nodamage(src,bl,skill_id,status->heal(bl, gain_hp, 0, 0),1);
+ clif->skill_nodamage(src, bl, skill_id, status->heal(bl, gain_hp, 0, STATUS_HEAL_DEFAULT), 1);
}
break;
case WE_FEMALE:
{
int sp_rate = skill_lv == 0 ? 0 : skill->get_sp_rate(skill_id, skill_lv);
int gain_sp = tstatus->max_sp*abs(sp_rate)/100;// The earned is the same % of the target SP than it cost the caster. [Skotlex]
- clif->skill_nodamage(src,bl,skill_id,status->heal(bl, 0, gain_sp, 0),1);
+ clif->skill_nodamage(src, bl, skill_id, status->heal(bl, 0, gain_sp, STATUS_HEAL_DEFAULT), 1);
}
break;
@@ -8159,7 +8166,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
break;
}
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
- status->heal(bl,0,sp,2);
+ status->heal(bl, 0, sp, STATUS_HEAL_SHOWEFFECT);
}
break;
@@ -8314,7 +8321,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
}
dstmd->state.soul_change_flag = 1;
sp2 = sstatus->max_sp * 3 /100;
- status->heal(src, 0, sp2, 2);
+ status->heal(src, 0, sp2, STATUS_HEAL_SHOWEFFECT);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
break;
}
@@ -8326,8 +8333,8 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
if( tsc && tsc->data[SC_EXTREMITYFIST2] )
sp1 = tstatus->sp;
#endif // RENEWAL
- status->set_sp(src, sp2, 3);
- status->set_sp(bl, sp1, 3);
+ status->set_sp(src, sp2, STATUS_HEAL_FORCED | STATUS_HEAL_SHOWEFFECT);
+ status->set_sp(bl, sp1, STATUS_HEAL_FORCED | STATUS_HEAL_SHOWEFFECT);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
}
break;
@@ -8365,7 +8372,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
clif->skill_nodamage(NULL,bl,AL_HEAL,hp,1);
if(sp > 0)
clif->skill_nodamage(NULL,bl,MG_SRECOVERY,sp,1);
- status->heal(bl,hp,sp,0);
+ status->heal(bl, hp, sp, STATUS_HEAL_DEFAULT);
}
break;
// Full Chemical Protection
@@ -8454,7 +8461,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
sc_start(src,bl,SC_INCATKRATE,100,-50,skill->get_time2(skill_id,skill_lv));
break;
case 5: // 2000HP heal, random teleported
- status->heal(src, 2000, 0, 0);
+ status->heal(src, 2000, 0, STATUS_HEAL_DEFAULT);
if( !map_flag_vs(bl->m) )
unit->warp(bl, -1,-1,-1, CLR_TELEPORT);
break;
@@ -8531,7 +8538,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
if (skill_id == SL_SUPERNOVICE && dstsd && dstsd->die_counter && !(rnd()%100)) {
//Erase death count 1% of the casts
dstsd->die_counter = 0;
- pc_setglobalreg(dstsd,script->add_str("PC_DIE_COUNTER"), 0);
+ pc_setglobalreg(dstsd,script->add_variable("PC_DIE_COUNTER"), 0);
clif->specialeffect(bl, 0x152, AREA);
//SC_SOULLINK invokes status_calc_pc for us.
}
@@ -8748,7 +8755,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
//Eh? why double skill packet?
clif->skill_nodamage(src,bl,AL_HEAL,hp,1);
clif->skill_nodamage(src,bl,skill_id,hp,1);
- status->heal(bl, hp, 0, 0);
+ status->heal(bl, hp, 0, STATUS_HEAL_DEFAULT);
}
break;
// Homun single-target support skills [orn]
@@ -8895,7 +8902,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
int heal = status_get_max_hp(bl) * 25 / 100;
clif->skill_nodamage(src,bl,skill_id,skill_lv,
sc_start(src,bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
- status->heal(bl,heal,0,1);
+ status->heal(bl, heal, 0, STATUS_HEAL_FORCED);
status->change_clear_buffs(bl,4);
}
break;
@@ -8949,7 +8956,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
value = status_get_max_hp(bl) * 25 / 100;
status->change_clear_buffs(bl,4);
skill->area_temp[5] &= ~0x20;
- status->heal(bl,value,0,1);
+ status->heal(bl, value, 0, STATUS_HEAL_FORCED);
type = SC_REFRESH;
}else if( skill->area_temp[5]&0x40 ){
skill->area_temp[5] &= ~0x40;
@@ -9134,7 +9141,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
clif->skill_nodamage(bl, bl, skill_id, heal, 1);
if( tsc && tsc->data[SC_AKAITSUKI] && heal )
heal = ~heal + 1;
- status->heal(bl, heal, 0, 1);
+ status->heal(bl, heal, 0, STATUS_HEAL_FORCED);
}
} else if( sd )
party->foreachsamemap(skill->area_sub, sd, skill->get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill->castend_nodamage_id);
@@ -9410,7 +9417,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
pc->setmadogear(sd, false);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
skill->castend_damage_id(src, src, skill_id, skill_lv, tick, flag);
- status->set_sp(src, 0, 0);
+ status->set_sp(src, 0, STATUS_HEAL_DEFAULT);
}
break;
@@ -9449,7 +9456,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
case 5: hp = 23; break;
}
heal = tstatus->max_hp * hp / 100;
- status->heal(bl,heal,0,2);
+ status->heal(bl, heal, 0, STATUS_HEAL_SHOWEFFECT);
clif->skill_nodamage(src, bl, skill_id, skill_lv, heal);
}
break;
@@ -9527,7 +9534,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
int sp = 100 * skill_lv;
if( dstmd ) sp = dstmd->level * 2;
if( status_zap(bl,0,sp) )
- status->heal(src,0,sp/2,3);//What does flag 3 do? [Rytech]
+ status->heal(src, 0, sp / 2, STATUS_HEAL_FORCED | STATUS_HEAL_SHOWEFFECT);
}
if ( tsc && tsc->data[SC__UNLUCKY] && skill_id == SC_UNLUCKY) {
//If the target was successfully inflected with the Unlucky status, give 1 of 3 random status's.
@@ -9651,7 +9658,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
case 3:
sc_start(src, bl, SC_SHIELDSPELL_REF, 100, opt, INFINITE_DURATION); // HP Recovery
val = sstatus->max_hp * ((status->get_lv(src) / 10) + (shield->refine + 1)) / 100;
- status->heal(bl, val, 0, 2);
+ status->heal(bl, val, 0, STATUS_HEAL_SHOWEFFECT);
status_change_end(bl,SC_SHIELDSPELL_REF,INVALID_TIMER);
break;
}
@@ -9794,7 +9801,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
}
heal = 120 * skill_lv + status_get_max_hp(bl) * (2 + skill_lv) / 100;
- status->heal(bl, heal, 0, 0);
+ status->heal(bl, heal, 0, STATUS_HEAL_DEFAULT);
if( (tsc && tsc->opt1) && (rnd()%100 < ((skill_lv * 5) + (status_get_dex(src) + status->get_lv(src)) / 4) - (1 + (rnd() % 10))) ) {
status_change_end(bl, SC_STONE, INVALID_TIMER);
@@ -9865,7 +9872,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
heal = 1;
status->fixed_revive(bl, heal, 0);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- status->set_sp(bl, 0, 0);
+ status->set_sp(bl, 0, STATUS_HEAL_DEFAULT);
}
}
break;
@@ -10202,7 +10209,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
}
e_hp = ed->battle_status.max_hp * 10 / 100;
e_sp = ed->battle_status.max_sp * 10 / 100;
- status->heal(&ed->bl,e_hp,e_sp,3);
+ status->heal(&ed->bl, e_hp, e_sp, STATUS_HEAL_FORCED | STATUS_HEAL_SHOWEFFECT);
clif->skill_nodamage(src,&ed->bl,skill_id,skill_lv,1);
}
break;
@@ -10512,7 +10519,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
}
}
heal = 5 * status->get_lv(&hd->bl) + status->base_matk(&hd->bl, &hd->battle_status, status->get_lv(&hd->bl));
- status->heal(bl, heal, 0, 0);
+ status->heal(bl, heal, 0, STATUS_HEAL_DEFAULT);
clif->skill_nodamage(src, src, skill_id, skill_lv, clif->skill_nodamage(src, bl, AL_HEAL, heal, 1));
status->change_start(src, src, type, 1000, skill_lv, 0, 0, 0, skill->get_time(skill_id,skill_lv), SCFLAG_NOAVOID|SCFLAG_FIXEDTICK|SCFLAG_FIXEDRATE);
status->change_start(src, bl, type, 1000, skill_lv, 0, 0, 0, skill->get_time(skill_id,skill_lv), SCFLAG_NOAVOID|SCFLAG_FIXEDTICK|SCFLAG_FIXEDRATE);
@@ -12638,7 +12645,7 @@ static int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int
if (sg->src_id == bl->id)
break; //Does not affect the caster.
clif->changetraplook(&src->bl,UNT_USED_TRAPS);
- map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
+ skill->trap_do_splash(&src->bl, sg->skill_id, sg->skill_lv, sg->bl_flag, tick);
sg->unit_id = UNT_USED_TRAPS;
sg->limit = DIFF_TICK32(tick,sg->tick) + 1500;
break;
@@ -12794,7 +12801,7 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
clif->skill_nodamage(&src->bl, bl, AL_HEAL, heal, 1);
if (tsc && tsc->data[SC_AKAITSUKI] && heal)
heal = ~heal + 1;
- status->heal(bl, heal, 0, 0);
+ status->heal(bl, heal, 0, STATUS_HEAL_DEFAULT);
if (diff >= 500)
sg->val1--;
}
@@ -12815,7 +12822,7 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
if (status->isimmune(bl))
heal = 0;
clif->skill_nodamage(&src->bl, bl, AL_HEAL, heal, 1);
- status->heal(bl, heal, 0, 0);
+ status->heal(bl, heal, 0, STATUS_HEAL_DEFAULT);
}
break;
@@ -12932,7 +12939,7 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
}
- map->foreachinrange(skill->trap_splash, &src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl, tick);
+ skill->trap_do_splash(&src->bl, sg->skill_id, sg->skill_lv, sg->bl_flag, tick);
sg->unit_id = UNT_USED_TRAPS; //Changed ID so it does not invoke a for each in area again.
}
break;
@@ -12963,10 +12970,10 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
case UNT_FREEZINGTRAP:
case UNT_FIREPILLAR_ACTIVE:
case UNT_CLAYMORETRAP:
- if( sg->unit_id == UNT_FIRINGTRAP || sg->unit_id == UNT_ICEBOUNDTRAP || sg->unit_id == UNT_CLAYMORETRAP )
- map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &src->bl,tick);
+ if (sg->unit_id == UNT_FIRINGTRAP || sg->unit_id == UNT_ICEBOUNDTRAP || sg->unit_id == UNT_CLAYMORETRAP)
+ skill->trap_do_splash(&src->bl, sg->skill_id, sg->skill_lv, sg->bl_flag | BL_SKILL | ~BCT_SELF, tick);
else
- map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
+ skill->trap_do_splash(&src->bl, sg->skill_id, sg->skill_lv, sg->bl_flag, tick);
if (sg->unit_id != UNT_FIREPILLAR_ACTIVE)
clif->changetraplook(&src->bl, sg->unit_id==UNT_LANDMINE?UNT_FIREPILLAR_ACTIVE:UNT_USED_TRAPS);
sg->limit=DIFF_TICK32(tick,sg->tick)+1500 +
@@ -13026,7 +13033,7 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
if( tsc && tsc->data[SC_AKAITSUKI] && heal )
heal = ~heal + 1;
clif->skill_nodamage(&src->bl, bl, AL_HEAL, heal, 1);
- status->heal(bl, heal, 0, 0);
+ status->heal(bl, heal, 0, STATUS_HEAL_DEFAULT);
}
}
break;
@@ -13080,7 +13087,7 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
case 0: // Heal 1~9999 HP
heal = rnd() %9999+1;
clif->skill_nodamage(ss,bl,AL_HEAL,heal,1);
- status->heal(bl,heal,0,0);
+ status->heal(bl, heal, 0, STATUS_HEAL_DEFAULT);
break;
case 1: // End all negative status
status->change_clear_buffs(bl,2);
@@ -13197,9 +13204,7 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
case UNT_GROUNDDRIFT_POISON:
case UNT_GROUNDDRIFT_WATER:
case UNT_GROUNDDRIFT_FIRE:
- map->foreachinrange(skill->trap_splash,&src->bl,
- skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag,
- &src->bl,tick);
+ skill->trap_do_splash(&src->bl, sg->skill_id, sg->skill_lv, sg->bl_flag, tick);
sg->unit_id = UNT_USED_TRAPS;
//clif->changetraplook(&src->bl, UNT_FIREPILLAR_ACTIVE);
sg->limit=DIFF_TICK32(tick,sg->tick)+1500;
@@ -13227,7 +13232,7 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
}
hp = tstatus->max_hp * hp / 100;
sp = tstatus->max_sp * sp / 100;
- status->heal(bl, hp, sp, 2);
+ status->heal(bl, hp, sp, STATUS_HEAL_SHOWEFFECT);
sc_start(ss, bl, type, 100, sg->skill_lv, (sg->interval * 3) + 100);
}
// Reveal hidden players every 5 seconds.
@@ -13260,7 +13265,7 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
case UNT_REVERBERATION:
clif->changetraplook(&src->bl,UNT_USED_TRAPS);
- map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
+ skill->trap_do_splash(&src->bl, sg->skill_id, sg->skill_lv, sg->bl_flag, tick);
sg->limit = DIFF_TICK32(tick,sg->tick)+1500;
sg->unit_id = UNT_USED_TRAPS;
break;
@@ -13349,7 +13354,7 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
clif->skill_nodamage(&src->bl, bl, AL_HEAL, hp, 0);
if( tsc && tsc->data[SC_AKAITSUKI] && hp )
hp = ~hp + 1;
- status->heal(bl, hp, 0, 0);
+ status->heal(bl, hp, 0, STATUS_HEAL_DEFAULT);
sc_start(ss, bl, type, 100, sg->skill_lv, sg->interval + 100);
}
break;
@@ -13363,13 +13368,13 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
int hp = tstatus->max_hp / 100; //+1% each 5s
if ((sg->val3) % 5) { //each 5s
if (tstatus->def_ele == skill->get_ele(sg->skill_id,sg->skill_lv)) {
- status->heal(bl, hp, 0, 2);
+ status->heal(bl, hp, 0, STATUS_HEAL_SHOWEFFECT);
} else if( (sg->unit_id == UNT_FIRE_INSIGNIA && tstatus->def_ele == ELE_EARTH)
|| (sg->unit_id == UNT_WATER_INSIGNIA && tstatus->def_ele == ELE_FIRE)
|| (sg->unit_id == UNT_WIND_INSIGNIA && tstatus->def_ele == ELE_WATER)
|| (sg->unit_id == UNT_EARTH_INSIGNIA && tstatus->def_ele == ELE_WIND)
) {
- status->heal(bl, -hp, 0, 0);
+ status->heal(bl, -hp, 0, STATUS_HEAL_DEFAULT);
}
}
sg->val3++; //timer
@@ -16133,7 +16138,7 @@ static void skill_repairweapon(struct map_session_data *sd, int idx)
item->attribute |= ATTR_BROKEN;
item->attribute ^= ATTR_BROKEN; /* clear broken state */
- clif->equiplist(target_sd);
+ clif->equipList(target_sd);
pc->delitem(sd, pc->search_inventory(sd, material), 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME); // FIXME: is this the correct reason flag?
@@ -16216,7 +16221,7 @@ static void skill_weaponrefine(struct map_session_data *sd, int idx)
}
clif->delitem(sd, idx, 1, DELITEM_NORMAL);
clif->upgrademessage(sd->fd, 0,item->nameid);
- clif->inventorylist(sd);
+ clif->inventoryList(sd);
clif->refine(sd->fd,0,idx,item->refine);
if (ep)
pc->equipitem(sd,idx,ep);
@@ -16624,10 +16629,10 @@ static int skill_detonator(struct block_list *bl, va_list ap)
case UNT_CLAYMORETRAP:
case UNT_FIRINGTRAP:
case UNT_ICEBOUNDTRAP:
- map->foreachinrange(skill->trap_splash,bl,skill->get_splash(su->group->skill_id,su->group->skill_lv),su->group->bl_flag|BL_SKILL|~BCT_SELF,bl,su->group->tick);
+ skill->trap_do_splash(bl, su->group->skill_id, su->group->skill_lv, su->group->bl_flag | BL_SKILL | ~BCT_SELF, su->group->tick);
break;
default:
- map->foreachinrange(skill->trap_splash,bl,skill->get_splash(su->group->skill_id,su->group->skill_lv),su->group->bl_flag,bl,su->group->tick);
+ skill->trap_do_splash(bl, su->group->skill_id, su->group->skill_lv, su->group->bl_flag, su->group->tick);
}
clif->changetraplook(bl, UNT_USED_TRAPS);
su->group->limit = DIFF_TICK32(timer->gettick(),su->group->tick) +
@@ -16760,6 +16765,27 @@ static int skill_chastle_mob_changetarget(struct block_list *bl, va_list ap)
return 0;
}
+/**
+ * Does final adjustments (e.g. count enemies affected by splash) then runs trap splash function (skill_trap_splash).
+ *
+ * @param bl : trap skill unit's bl
+ * @param skill_id : Trap Skill ID
+ * @param skill_lv : Trap Skill Level
+ * @param bl_flag : Flag representing units affected by this trap
+ * @param tick : tick related to this trap
+ */
+static void skill_trap_do_splash(struct block_list *bl, uint16 skill_id, uint16 skill_lv, int bl_flag, int64 tick)
+{
+ int enemy_count = 0;
+
+ if (skill->get_nk(skill_id) & NK_SPLASHSPLIT) {
+ enemy_count = map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR, bl, skill_id, skill_lv, tick, BCT_ENEMY, skill->area_sub_count);
+ enemy_count = max(1, enemy_count); // Don't let enemy_count be 0 when spliting trap damage
+ }
+
+ map->foreachinrange(skill->trap_splash, bl, skill->get_splash(skill_id, skill_lv), bl_flag, bl, tick, enemy_count);
+}
+
/*==========================================
*
*------------------------------------------*/
@@ -16770,6 +16796,7 @@ static int skill_trap_splash(struct block_list *bl, va_list ap)
struct skill_unit *src_su = NULL;
struct skill_unit_group *sg;
struct block_list *ss;
+ int enemy_count = va_arg(ap, int);
nullpo_ret(bl);
nullpo_ret(src);
@@ -16864,7 +16891,7 @@ static int skill_trap_splash(struct block_list *bl, va_list ap)
}
/* Fall through */
default:
- skill->attack(skill->get_type(sg->skill_id),ss,src,bl,sg->skill_id,sg->skill_lv,tick,0);
+ skill->attack(skill->get_type(sg->skill_id), ss, src, bl, sg->skill_id, sg->skill_lv, tick, enemy_count);
break;
}
return 1;
@@ -17579,7 +17606,7 @@ static int skill_unit_timer_sub(union DBKey key, struct DBData *data, va_list ap
break;
}
clif->changetraplook(bl,UNT_USED_TRAPS);
- map->foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
+ skill->trap_do_splash(bl, group->skill_id, group->skill_lv, group->bl_flag, tick);
group->limit = DIFF_TICK32(tick,group->tick)+1500;
su->limit = DIFF_TICK32(tick,group->tick)+1500;
group->unit_id = UNT_USED_TRAPS;
@@ -18480,7 +18507,7 @@ static int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int n
{ //Cooking items.
clif->specialeffect(&sd->bl, 608, AREA);
if( sd->cook_mastery < 1999 )
- pc_setglobalreg(sd, script->add_str("COOK_MASTERY"),sd->cook_mastery + ( 1 << ( (skill->dbs->produce_db[idx].itemlv - 11) / 2 ) ) * 5);
+ pc_setglobalreg(sd, script->add_variable("COOK_MASTERY"),sd->cook_mastery + ( 1 << ( (skill->dbs->produce_db[idx].itemlv - 11) / 2 ) ) * 5);
}
break;
}
@@ -18591,7 +18618,7 @@ static int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int n
{ //Cooking items.
clif->specialeffect(&sd->bl, 609, AREA);
if( sd->cook_mastery > 0 )
- pc_setglobalreg(sd, script->add_str("COOK_MASTERY"), sd->cook_mastery - ( 1 << ((skill->dbs->produce_db[idx].itemlv - 11) / 2) ) - ( ( ( 1 << ((skill->dbs->produce_db[idx].itemlv - 11) / 2) ) >> 1 ) * 3 ));
+ pc_setglobalreg(sd, script->add_variable("COOK_MASTERY"), sd->cook_mastery - ( 1 << ((skill->dbs->produce_db[idx].itemlv - 11) / 2) ) - ( ( ( 1 << ((skill->dbs->produce_db[idx].itemlv - 11) / 2) ) >> 1 ) * 3 ));
}
}
}
@@ -18967,7 +18994,7 @@ static int skill_destroy_trap(struct block_list *bl, va_list ap)
case UNT_CLAYMORETRAP:
case UNT_FIRINGTRAP:
case UNT_ICEBOUNDTRAP:
- map->foreachinrange(skill->trap_splash,&su->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &su->bl,tick);
+ skill->trap_do_splash(&su->bl, sg->skill_id, sg->skill_lv, sg->bl_flag | BL_SKILL | ~BCT_SELF, tick);
break;
case UNT_LANDMINE:
case UNT_BLASTMINE:
@@ -18976,7 +19003,7 @@ static int skill_destroy_trap(struct block_list *bl, va_list ap)
case UNT_FLASHER:
case UNT_FREEZINGTRAP:
case UNT_CLUSTERBOMB:
- map->foreachinrange(skill->trap_splash,&su->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &su->bl,tick);
+ skill->trap_do_splash(&su->bl, sg->skill_id, sg->skill_lv, sg->bl_flag, tick);
break;
}
// Traps aren't recovered.
@@ -21572,6 +21599,7 @@ void skill_defaults(void)
skill->onskillusage = skill_onskillusage;
skill->cell_overlap = skill_cell_overlap;
skill->timerskill = skill_timerskill;
+ skill->trap_do_splash = skill_trap_do_splash;
skill->trap_splash = skill_trap_splash;
skill->check_condition_mercenary = skill_check_condition_mercenary;
skill->locate_element_field = skill_locate_element_field;