diff options
-rw-r--r-- | world/map/npc/magic/level1-lesser-heal.txt | 8 | ||||
-rw-r--r-- | world/map/npc/magic/level2-arrow-hail.txt | 20 | ||||
-rw-r--r-- | world/map/npc/magic/level2-barrier.txt | 9 | ||||
-rw-r--r-- | world/map/npc/magic/level2-flying-backpack.txt | 3 | ||||
-rw-r--r-- | world/map/npc/magic/level2-happy-curse.txt | 5 | ||||
-rw-r--r-- | world/map/npc/magic/level2-hide.txt | 3 | ||||
-rw-r--r-- | world/map/npc/magic/level2-lay-on-hands.txt | 6 | ||||
-rw-r--r-- | world/map/npc/magic/level2-protect.txt | 9 | ||||
-rw-r--r-- | world/map/npc/magic/level2-rain.txt | 12 | ||||
-rw-r--r-- | world/map/npc/magic/level3-necromancy.txt | 3 |
10 files changed, 34 insertions, 44 deletions
diff --git a/world/map/npc/magic/level1-lesser-heal.txt b/world/map/npc/magic/level1-lesser-heal.txt index d03031d6..d195956f 100644 --- a/world/map/npc/magic/level1-lesser-heal.txt +++ b/world/map/npc/magic/level1-lesser-heal.txt @@ -33,8 +33,12 @@ L_NotMe: L_Continue: if (getskilllv(SKILL_MAGIC_DARK) >= 1) sc_start SC_HALT_REGENERATE, 2000, 0; - if (attachrid(@target_id) != 1) end; // XXX: to avoid the ugly attachrid method we would need some kind of `run_as` builtin - if (!(isdead())) heal 200, 0, 1; + if (get(Hp, @target_id) < 1) end; + addtimer 0, strnpcinfo(0) + "::OnSlowHeal", @target_id; + end; + +OnSlowHeal: + heal 200, 0, 1; end; L_Mouboo: diff --git a/world/map/npc/magic/level2-arrow-hail.txt b/world/map/npc/magic/level2-arrow-hail.txt index 3be14f1a..c7deb852 100644 --- a/world/map/npc/magic/level2-arrow-hail.txt +++ b/world/map/npc/magic/level2-arrow-hail.txt @@ -4,7 +4,7 @@ end; OnCast: - if(call("magic_checks")) end; + if(call("magic_checks")) end; if (getskilllv(.school) < .level) end; if (getskilllv(SKILL_MAGIC) < .level) end; if (Sp < 25) end; @@ -65,8 +65,8 @@ OnNearbyNpc: end; OnLaunch: - if(attachrid(.caster) != 1) destroy; // destroy if caster is missing - if(getmap() != strnpcinfo(3)) destroy; // destroy if caster left the map + if(get(BL_ID, .caster) != .caster) destroy; // destroy if caster is missing + if(getmap(.caster) != strnpcinfo(3)) destroy; // destroy if caster left the map set .hit, .hit + 1; if(.hit > .max_hit) destroy; set .launch, 0; @@ -78,11 +78,11 @@ S_Launch: npcareawarp .area_x - 6, .area_y - 6, .area_x + 6, .area_y + 6, 0, strnpcinfo(0); misceffect FX_ARROW_HAIL; set .done, 0; - foreach 2, strnpcinfo(3), getnpcx(), getnpcy(), getnpcx(), getnpcy(), strnpcinfo(0) + "::OnHit"; - if (PVP_CHANNEL || getmapflag(getmap(), MF_PVP)) - foreach 0, strnpcinfo(3), getnpcx(), getnpcy(), getnpcx(), getnpcy(), strnpcinfo(0) + "::OnHit"; - if(!.done && getx() == getnpcx() && gety() == getnpcy()) - heal 0 - (.damage + rand(.damage_bonus) + rand(.damage_bonus)), 0; // injure caster + foreach 2, strnpcinfo(3), getnpcx(), getnpcy(), getnpcx(), getnpcy(), strnpcinfo(0) + "::OnHit", .caster; + if (get(PVP_CHANNEL, .caster) || getmapflag(getmap(.caster), MF_PVP)) + foreach 0, strnpcinfo(3), getnpcx(), getnpcy(), getnpcx(), getnpcy(), strnpcinfo(0) + "::OnHit", .caster; + if(!.done && get(POS_X, .caster) == getnpcx() && get(POS_Y, .caster) == getnpcy()) + set Hp, get(Hp, .caster) - (.damage + rand(.damage_bonus) + rand(.damage_bonus)), .caster; // injure caster set .launch, .launch + 1; if(.launch < 3) goto S_Launch; return; @@ -92,8 +92,8 @@ OnTimer30000: destroy; OnHit: - if(attachrid(.caster) != 1) destroy; // destroy if caster is missing - if(getmap() != strnpcinfo(3)) destroy; // destroy if caster left the map + if(get(BL_ID, .caster) != .caster) destroy; // destroy if caster is missing + if(getmap(.caster) != strnpcinfo(3)) destroy; // destroy if caster left the map if(target(.caster, @target_id, 16) != 16 && .caster != @target_id) end; if((get(BL_TYPE, @target_id) & 1) == 0) end; // either mob or pc diff --git a/world/map/npc/magic/level2-barrier.txt b/world/map/npc/magic/level2-barrier.txt index 9afd4f38..9526ee5a 100644 --- a/world/map/npc/magic/level2-barrier.txt +++ b/world/map/npc/magic/level2-barrier.txt @@ -11,11 +11,7 @@ if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id) == 1) set @target_id, BL_ID; // fallback to self - set @asorm_caster, BL_ID, @target_id; - if (attachrid(@target_id) != 1) end; - set @target_hat, getequipid(equip_head), @asorm_caster; - if (attachrid(@asorm_caster) != 1) end; - if (@target_hat == 888) end; // FIXME: this whole 5 line block could be done with only one line if we modify getequipid OR make equip_ into params + if (getequipid(equip_head, strcharinfo(0, @target_id)) == 888) end; set @_M_BLOCK, 1; // block casting, until the timer clears it addtimer 1000, "Magic Timer::OnClear"; // set the new debuff @@ -31,8 +27,7 @@ set @asorm_time, .@time, @target_id; sc_start SC_MBARRIER, .@time, max(30,(@spellpower/8))+20, @target_id; message @args$, "Barrier : You are surrounded by a magical barrier."; - if (attachrid(@target_id) != 1) end; - addtimer @asorm_time, strnpcinfo(0)+"::OnEnd"; + addtimer @asorm_time, strnpcinfo(0)+"::OnEnd", @target_id; end; OnEnd: diff --git a/world/map/npc/magic/level2-flying-backpack.txt b/world/map/npc/magic/level2-flying-backpack.txt index 5e19468e..87c7d644 100644 --- a/world/map/npc/magic/level2-flying-backpack.txt +++ b/world/map/npc/magic/level2-flying-backpack.txt @@ -22,8 +22,7 @@ set @plugh_time, (@spellpower*500)+5000, @target_id; sc_start SC_FLYING_BACKPACK, @plugh_time, 0, @target_id; message @args$, "Backpack : Your backpack is lifted by a mystical force; you no longer feel it pressing on your back."; - if (attachrid(@target_id) != 1) end; - addtimer @plugh_time, strnpcinfo(0)+"::OnEnd"; + addtimer @plugh_time, strnpcinfo(0)+"::OnEnd", @target_id; end; OnEnd: diff --git a/world/map/npc/magic/level2-happy-curse.txt b/world/map/npc/magic/level2-happy-curse.txt index dbfea17a..a82dce21 100644 --- a/world/map/npc/magic/level2-happy-curse.txt +++ b/world/map/npc/magic/level2-happy-curse.txt @@ -23,9 +23,8 @@ set @joyplim_count, 1, @target_id; set @joyplim_emote, if_then_else(getskilllv(SKILL_MAGIC_DARK) > 1, EMOTE_EVIL, EMOTE_HAPPY), @target_id; set @joyplim_total, (@spellpower/10), @target_id; - if (attachrid(@target_id) != 1) end; - emotion @joyplim_emote, "self"; - addtimer 500, strnpcinfo(0)+"::OnEmote"; + emotion @joyplim_emote, strcharinfo(0, @target_id); + addtimer 500, strnpcinfo(0)+"::OnEmote", @target_id; end; OnEmote: diff --git a/world/map/npc/magic/level2-hide.txt b/world/map/npc/magic/level2-hide.txt index ff67e6a5..6d9c125d 100644 --- a/world/map/npc/magic/level2-hide.txt +++ b/world/map/npc/magic/level2-hide.txt @@ -26,8 +26,7 @@ sc_start SC_HIDE, .@time, 0, @target_id; message @args$, "Magic : You are hidden!"; if (BL_ID != @target_id) message strcharinfo(0), "Magic : You hid someone!"; - if (attachrid(@target_id) != 1) end; - addtimer @anwiltyp_time, strnpcinfo(0)+"::OnEnd"; + addtimer @anwiltyp_time, strnpcinfo(0)+"::OnEnd", @target_id; end; OnEnd: diff --git a/world/map/npc/magic/level2-lay-on-hands.txt b/world/map/npc/magic/level2-lay-on-hands.txt index 22287497..0affb210 100644 --- a/world/map/npc/magic/level2-lay-on-hands.txt +++ b/world/map/npc/magic/level2-lay-on-hands.txt @@ -28,7 +28,6 @@ L_Pay: set .@heal_value, if_then_else(.@payment < .@available, .@needed+1-1, (.@available * 200) / .@fraction); // FIXME / XXX why the f do I need to do +1-1 ? if (.@payment > .@available) set .@payment, .@available; - set @inma_power, .@heal_value, @target_id; set @mexp, min(.exp_gain, .@payment/100); callfunc "gain_heal_xp"; @@ -39,8 +38,9 @@ L_Pay: if (.@dark) heal .@bad, 0; sc_start SC_HALT_REGENERATE, if_then_else(.@dark, 5000, 10000), 0; - if (attachrid(@target_id) != 1) end; - if (!(isdead())) heal @inma_power, 0; + set .@thp, get(Hp, @target_id); + if (.@thp < 1) end; + set Hp, .@thp + .@heal_value, @target_id; end; L_Mouboo: diff --git a/world/map/npc/magic/level2-protect.txt b/world/map/npc/magic/level2-protect.txt index db11105f..659efdc1 100644 --- a/world/map/npc/magic/level2-protect.txt +++ b/world/map/npc/magic/level2-protect.txt @@ -11,11 +11,7 @@ if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id)) set @target_id, BL_ID; // fallback to self - set @betsanc_caster, BL_ID, @target_id; - if (attachrid(@target_id) != 1) end; - set @target_hat, getequipid(equip_head), @betsanc_caster; - if (attachrid(@betsanc_caster) != 1) end; - if (@target_hat == 888) end; // FIXME: this whole 5 line block could be done with only one line if we modify getequipid + if (getequipid(equip_head, strcharinfo(0, @target_id)) == 888) end; if (distance(BL_ID, @target_id) >= (@spellpower/30)+2) set @target_id, BL_ID; if (get(@antiprotect, @target_id) > 0) end; @@ -33,8 +29,7 @@ set @betsanc_time, .@time, @target_id; sc_start SC_PHYS_SHIELD, .@time, max(15,(@spellpower/20))+5, @target_id; message @args$, "Shield : You feel more protected."; - if (attachrid(@target_id) != 1) end; - addtimer @betsanc_time, strnpcinfo(0)+"::OnEnd"; + addtimer @betsanc_time, strnpcinfo(0)+"::OnEnd", @target_id; end; OnEnd: diff --git a/world/map/npc/magic/level2-rain.txt b/world/map/npc/magic/level2-rain.txt index d3718170..32a2c0f8 100644 --- a/world/map/npc/magic/level2-rain.txt +++ b/world/map/npc/magic/level2-rain.txt @@ -63,8 +63,8 @@ L_Tree: close; OnLaunch: - if(attachrid(.caster) != 1) destroy; // destroy if caster is missing - if(getmap() != strnpcinfo(3)) destroy; // destroy if caster left the map + if(get(BL_ID, .caster) != .caster) destroy; // destroy if caster is missing + if(getmap(.caster) != strnpcinfo(3)) destroy; // destroy if caster left the map set .count, .count + 1; if(.count > .max) destroy; set .launch, 0; @@ -75,14 +75,14 @@ OnLaunch: S_Launch: npcareawarp .initial_x - .radius, .initial_y - .radius, .initial_x + .radius, .initial_y + .radius, 0, strnpcinfo(0); misceffect FX_RAIN; - foreach 2, strnpcinfo(3), getnpcx()-1, getnpcy()-1, getnpcx()+1, getnpcy()+1, strnpcinfo(0) + "::OnHit"; + foreach 2, strnpcinfo(3), getnpcx()-1, getnpcy()-1, getnpcx()+1, getnpcy()+1, strnpcinfo(0) + "::OnHit", .caster; set .launch, .launch + 1; if(.launch < .max_launch) goto S_Launch; return; OnHit: - if(attachrid(.caster) != 1) destroy; // destroy if caster is missing - if(getmap() != strnpcinfo(3)) destroy; // destroy if caster left the map + if(get(BL_ID, .caster) != .caster) destroy; // destroy if caster is missing + if(getmap(.caster) != strnpcinfo(3)) destroy; // destroy if caster left the map if(target(.caster, @target_id, 16) != 16 && .caster != @target_id) end; if((get(BL_TYPE, @target_id) & 1) == 0) end; // either mob or pc if(get(ELTTYPE, @target_id) == ELT_FIRE) @@ -90,7 +90,7 @@ OnHit: end; OnDestroy: - debugmes "kaflosh timeout! [this shouldn't happen]"; + debugmes "kaflosh timeout! [this shouldn't happen]"; // XXX: looks like this CAN happen with higher levels of magic, so we might want to cap max charges destroy; OnInit: diff --git a/world/map/npc/magic/level3-necromancy.txt b/world/map/npc/magic/level3-necromancy.txt index 57f5a6cc..2cd6724d 100644 --- a/world/map/npc/magic/level3-necromancy.txt +++ b/world/map/npc/magic/level3-necromancy.txt @@ -24,8 +24,7 @@ set @necromancer, CHAR_ID, @target_id; // tell the target who is reviving them - if (attachrid(@target_id) != 1) end; - addtimer 6000, strnpcinfo(0)+"::OnRevive"; // TODO: make it take more or less time depending on the spell power + addtimer 6000, strnpcinfo(0)+"::OnRevive", @target_id; // TODO: make it take more or less time depending on the spell power end; OnRevive: |