summaryrefslogtreecommitdiff
path: root/world/map/npc/magic/level0-wand.txt
diff options
context:
space:
mode:
Diffstat (limited to 'world/map/npc/magic/level0-wand.txt')
-rw-r--r--world/map/npc/magic/level0-wand.txt76
1 files changed, 76 insertions, 0 deletions
diff --git a/world/map/npc/magic/level0-wand.txt b/world/map/npc/magic/level0-wand.txt
new file mode 100644
index 00000000..07fbb025
--- /dev/null
+++ b/world/map/npc/magic/level0-wand.txt
@@ -0,0 +1,76 @@
+-|script|spell-wand|32767
+{
+ if(call("magic_checks")) goto L_Failed;
+ callsub S_CheckWand;
+ if(@WandAttack != 1) goto L_Failed;
+
+ // here we install
+ set @_M_BLOCK, 1; // block casting, until the timer clears it
+ addtimer 500, "Magic Timer::OnClear"; // set the new debuff
+ callfunc "adjust_spellpower";
+ misceffect FX_MAGIC_GENERIC, strcharinfo(0);
+ set .@delay, (((200 - Agi) * 1200) / 200);
+ overrideattack (@Wand + (@spellpower / 10)), .@delay, 3, ATTACK_ICON_GENERIC, @WandID, strnpcinfo(0)+"::OnAttack";
+ callfunc "magic_exp";
+ end;
+
+OnAttack:
+ callsub S_CheckWand;
+ if(@WandAttack != 1) goto L_Failed;
+ if(target(BL_ID, @target_id, 22) != 22) goto L_Failed; // 0x02 | 0x04 | 0x10
+ set Sp, (Sp - @WandCost);
+ set @damage, (@Wand * (@spellpower / 3));
+ void call("elt_damage", @damage,@damage,ELT_NEUTRAL,ELT_NEUTRAL,FX_MAGIC_RED);
+ end;
+
+S_CheckWand:
+ set @Wand, 0;
+ set @wand_loop, 0;
+ goto S_Loop;
+
+S_Loop:
+ if ((getequipid(equip_hand1) == .Wands[@wand_loop]) || (getequipid(equip_hand2) == .Wands[@wand_loop]))
+ goto S_SetWand;
+ set @wand_loop, (@wand_loop + 1);
+ if (@wand_loop >= getarraysize(.Wands))
+ goto S_NoWand;
+ goto S_Loop;
+
+S_SetWand:
+ set @Wand, .WandsPwr[@wand_loop];
+ set @WandID, .WandsAnim[@wand_loop];
+ if (QL_MORGAN == 2)
+ set QL_MORGAN, 3;
+ set @WandCost, (@Wand * (BaseLevel / 15) + 2);
+ set @WandAttack, 0;
+ if (Sp < @WandCost)
+ goto S_LowSp;
+ set @WandAttack, 1; // everything is fine
+ return;
+
+S_NoWand:
+ message strcharinfo(0), "Wand : ##3##BYou need a wand Equipped!";
+ set @WandAttack, 0;
+ return;
+
+S_LowSp:
+ message strcharinfo(0), "Wand : ##3##BOut of Mana";
+ set @WandAttack, 0;
+ return;
+
+L_Failed:
+ //misceffect FX_ELECTRICITY_RED, strcharinfo(0); // XXX: do we show an effect on fail?
+ //debugmes "cast or attack failed";
+ end;
+
+OnInit:
+ setarray .Wands[0], 0, 758, 1171;
+ setarray .WandsPwr[0], 0, 2, 1;
+ setarray .WandsAnim[0], 0, 35, 33;
+ set .school, SKILL_MAGIC;
+ set .invocation$, chr(MAGIC_SYMBOL) + "confringo"; // used in npcs that refer to this spell
+ void call("magic_register");
+ set .level, 0;
+ set .exp_gain, 1;
+ end;
+}