diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-06-07 01:14:26 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-06-07 01:14:26 -0300 |
commit | 34c40836458aa7a549962606c814a62ad3847467 (patch) | |
tree | 332ce74cd9448c4acc03ff6efc14376591e1e4ab | |
parent | 88e7ffb2ec3f992fd38a4a093f0d746714c4b51f (diff) | |
download | serverdata-34c40836458aa7a549962606c814a62ad3847467.tar.gz serverdata-34c40836458aa7a549962606c814a62ad3847467.tar.bz2 serverdata-34c40836458aa7a549962606c814a62ad3847467.tar.xz serverdata-34c40836458aa7a549962606c814a62ad3847467.zip |
AdjustSpellpower() and AdjustAttackpower()
Complementary functions for harm()
-rw-r--r-- | npc/config/magic.txt | 21 | ||||
-rw-r--r-- | npc/functions/hub.txt | 7 |
2 files changed, 23 insertions, 5 deletions
diff --git a/npc/config/magic.txt b/npc/config/magic.txt index 9f0282fc4..f01dfebc8 100644 --- a/npc/config/magic.txt +++ b/npc/config/magic.txt @@ -15,6 +15,27 @@ // MAGIC_SUBCLASS // Bitmasked magic subclass. +// AdjustSpellpower(power=100, {target=@skillTarget{, type=HARM_MAGI}}) +function script AdjustSpellpower { + .@power=getarg(0, 100); + .@target=getarg(1, @skillTarget); + .@type=getarg(2, HARM_MAGI); + .@src=getcharid(3); + + .@dmg=calcdmg(.@src, .@target, .@type); + .@dmg = .@dmg * .@power / 100; + return .@dmg; +} + +// An alias for simplification +// AdjustAttackpower(power=100, {target=@skillTarget{, type=HARM_PHYS}}) +function script AdjustAttackpower { + .@power=getarg(0, 100); + .@target=getarg(1, @skillTarget); + .@type=getarg(2, HARM_PHYS); + return AdjustSpellpower(.@power, .@target, .@type); +} + // SkillID, EXP Points function script GetManaExp { .@sk=getarg(0); diff --git a/npc/functions/hub.txt b/npc/functions/hub.txt index a2a01bebf..a318873b0 100644 --- a/npc/functions/hub.txt +++ b/npc/functions/hub.txt @@ -289,11 +289,8 @@ function script HUB_SkillInvoke { case TMW2_JUDGMENT: debugmes "Target: %d (%d,%d)", @skillTarget, @skillTargetX, @skillTargetY; areasc2(getmap(), @skillTargetX, @skillTargetY, 2, 10000, SC_BLOODING, BL_MOB|BL_PC); - .@type=any(HARM_PHYS, HARM_MAGI); - .@dmg=calcdmg(getcharid(3), @skillTarget, .@type); - // Adjusted power: 300 - .@dmg=.@dmg*300/100; - harm(@skillTarget, .@dmg, .@type, Ele_Holy); + .@dmg=AdjustSpellpower(300); + harm(@skillTarget, .@dmg, HARM_MAGI, Ele_Holy); break; case TMW2_PARUM: SK_parum(); |