summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--npc/config/magic.txt21
-rw-r--r--npc/functions/hub.txt7
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();