summaryrefslogtreecommitdiff
path: root/world/map/npc/magic
diff options
context:
space:
mode:
Diffstat (limited to 'world/map/npc/magic')
-rw-r--r--world/map/npc/magic/README.md54
-rw-r--r--world/map/npc/magic/_import.txt48
-rw-r--r--world/map/npc/magic/_procedures.txt242
-rw-r--r--world/map/npc/magic/event-alonsoalonsy.txt137
-rw-r--r--world/map/npc/magic/event-summon-managuardian.txt60
-rw-r--r--world/map/npc/magic/event-summon-manatyrant.txt61
-rw-r--r--world/map/npc/magic/level0-antiprotect.txt23
-rw-r--r--world/map/npc/magic/level0-discharge.txt18
-rw-r--r--world/map/npc/magic/level0-reapercry.txt245
-rw-r--r--world/map/npc/magic/level0-wand.txt84
-rw-r--r--world/map/npc/magic/level1-aggravate.txt29
-rw-r--r--world/map/npc/magic/level1-detect-magic.txt34
-rw-r--r--world/map/npc/magic/level1-experience.txt46
-rw-r--r--world/map/npc/magic/level1-flare-dart.txt51
-rw-r--r--world/map/npc/magic/level1-grow-alizarin.txt37
-rw-r--r--world/map/npc/magic/level1-grow-cobalt.txt37
-rw-r--r--world/map/npc/magic/level1-grow-gamboge.txt37
-rw-r--r--world/map/npc/magic/level1-grow-mauve.txt37
-rw-r--r--world/map/npc/magic/level1-lesser-heal.txt55
-rw-r--r--world/map/npc/magic/level1-magic-blade.txt55
-rw-r--r--world/map/npc/magic/level1-make-sulphur.txt25
-rw-r--r--world/map/npc/magic/level1-sense-spouse.txt25
-rw-r--r--world/map/npc/magic/level1-summon-maggots.txt57
-rw-r--r--world/map/npc/magic/level1-transmute-wood.txt37
-rw-r--r--world/map/npc/magic/level2-arrow-hail.txt118
-rw-r--r--world/map/npc/magic/level2-barrier.txt49
-rw-r--r--world/map/npc/magic/level2-detect-players.txt34
-rw-r--r--world/map/npc/magic/level2-enchant-lifestone.txt36
-rw-r--r--world/map/npc/magic/level2-flying-backpack.txt44
-rw-r--r--world/map/npc/magic/level2-happy-curse.txt43
-rw-r--r--world/map/npc/magic/level2-hide.txt47
-rw-r--r--world/map/npc/magic/level2-lay-on-hands.txt81
-rw-r--r--world/map/npc/magic/level2-lightning-strike.txt89
-rw-r--r--world/map/npc/magic/level2-magic-knuckles.txt55
-rw-r--r--world/map/npc/magic/level2-make-arrows.txt27
-rw-r--r--world/map/npc/magic/level2-make-iron-powder.txt27
-rw-r--r--world/map/npc/magic/level2-make-shirt.txt25
-rw-r--r--world/map/npc/magic/level2-make-short-tanktop.txt25
-rw-r--r--world/map/npc/magic/level2-make-tanktop.txt25
-rw-r--r--world/map/npc/magic/level2-protect.txt50
-rw-r--r--world/map/npc/magic/level2-rain.txt107
-rw-r--r--world/map/npc/magic/level2-shear.txt68
-rw-r--r--world/map/npc/magic/level2-summon-fluffies.txt58
-rw-r--r--world/map/npc/magic/level2-summon-mouboo.txt58
-rw-r--r--world/map/npc/magic/level2-summon-pinkie.txt58
-rw-r--r--world/map/npc/magic/level2-summon-snakes.txt64
-rw-r--r--world/map/npc/magic/level2-summon-spiky-mushroom.txt58
-rw-r--r--world/map/npc/magic/level2-summon-wickedmushroom.txt63
-rw-r--r--world/map/npc/magic/level2-toxic-dart.txt57
-rw-r--r--world/map/npc/magic/level3-necromancy.txt54
50 files changed, 0 insertions, 2954 deletions
diff --git a/world/map/npc/magic/README.md b/world/map/npc/magic/README.md
deleted file mode 100644
index 57ab5131..00000000
--- a/world/map/npc/magic/README.md
+++ /dev/null
@@ -1,54 +0,0 @@
-- [ ] check the new builtins and make sure they work as intended
- - [ ] `puppet`
- - [ ] check what happens when making a puppet whose name already exist (maybe it replaces?)
- - [ ] `destroy`
- - [ ] `registercmd`
- - [ ] check what happens when registering a command that was already registered
- - [ ] `target`
- - [ ] `get`
- - [ ] the new `set`
- - [ ] `min`
- - [ ] `max`
- - [ ] `pow`
- - [ ] `sqrt`
- - [ ] `cbrt`
- - [ ] `elttype`
- - [ ] `eltlvl`
- - [ ] `injure`
- - [ ] `elif`
- - [ ] `else`
- - [ ] `getnpcid`
- - [ ] `overrideattack`
- - [ ] `summon`
- - [ ] `addnpctimer`
- - [ ] `explode`
- - [ ] `foreach`
- - [ ] modified `areatimer`
- - [ ] `aggravate`
- - [ ] `getdir`
- - [ ] `distance`
- - [ ] `if_then_else`
-
- - I do not like `void`, feels like an ugly workaround; we should make `puppet` and `call` work in both function context and statement context
-
----
-- [ ] test the spells
- - [ ] test with no target
- - [ ] test with a npc target
- - [ ] random npc not part of any quest
- - [ ] injured mouboo
- - [ ] also test on a **player** with the name `Mouboo` or `mouboo`
- - [ ] druid tree
- - [ ] test with a mob target
- - [ ] mob with clear path (walkable)
- - [ ] mob with no clear path (unwalkable, blocked by collision)
- - [ ] mob out of attack range
- - [ ] test with a player target
- - [ ] both the caster and the target have pvp disabled
- - [ ] both the caster and the target have pvp enabled
- - [ ] the caster has pvp enabled and the target has pvp disabled
- - [ ] the caster has pvp disabled and the target has pvp enabled
- - [ ] test with the spouse as target
-
----
-- [ ] Once everything is done, remove this file
diff --git a/world/map/npc/magic/_import.txt b/world/map/npc/magic/_import.txt
deleted file mode 100644
index a106c9f7..00000000
--- a/world/map/npc/magic/_import.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-npc: npc/magic/_procedures.txt
-npc: npc/magic/level0-antiprotect.txt
-npc: npc/magic/level0-discharge.txt
-npc: npc/magic/level0-reapercry.txt
-npc: npc/magic/level0-wand.txt
-npc: npc/magic/level1-aggravate.txt
-npc: npc/magic/level1-experience.txt
-npc: npc/magic/level1-lesser-heal.txt
-npc: npc/magic/level1-transmute-wood.txt
-npc: npc/magic/level1-make-sulphur.txt
-npc: npc/magic/level1-flare-dart.txt
-npc: npc/magic/level1-magic-blade.txt
-npc: npc/magic/level1-grow-mauve.txt
-npc: npc/magic/level1-grow-alizarin.txt
-npc: npc/magic/level1-grow-gamboge.txt
-npc: npc/magic/level1-grow-cobalt.txt
-npc: npc/magic/level1-summon-maggots.txt
-npc: npc/magic/level1-sense-spouse.txt
-npc: npc/magic/level1-detect-magic.txt
-npc: npc/magic/level2-arrow-hail.txt
-npc: npc/magic/level2-make-arrows.txt
-npc: npc/magic/level2-make-iron-powder.txt
-npc: npc/magic/level2-magic-knuckles.txt
-npc: npc/magic/level2-summon-snakes.txt
-npc: npc/magic/level2-summon-wickedmushroom.txt
-npc: npc/magic/level2-summon-spiky-mushroom.txt
-npc: npc/magic/level2-summon-fluffies.txt
-npc: npc/magic/level2-summon-mouboo.txt
-npc: npc/magic/level2-summon-pinkie.txt
-npc: npc/magic/level2-toxic-dart.txt
-npc: npc/magic/level2-enchant-lifestone.txt
-npc: npc/magic/level2-flying-backpack.txt
-npc: npc/magic/level2-protect.txt
-npc: npc/magic/level2-barrier.txt
-npc: npc/magic/level2-hide.txt
-npc: npc/magic/level2-happy-curse.txt
-npc: npc/magic/level2-detect-players.txt
-npc: npc/magic/level2-shear.txt
-npc: npc/magic/level2-lightning-strike.txt
-npc: npc/magic/level2-rain.txt
-npc: npc/magic/level2-lay-on-hands.txt
-npc: npc/magic/level2-make-short-tanktop.txt
-npc: npc/magic/level2-make-tanktop.txt
-npc: npc/magic/level2-make-shirt.txt
-npc: npc/magic/level3-necromancy.txt
-npc: npc/magic/event-alonsoalonsy.txt
-npc: npc/magic/event-summon-managuardian.txt
-npc: npc/magic/event-summon-manatyrant.txt
diff --git a/world/map/npc/magic/_procedures.txt b/world/map/npc/magic/_procedures.txt
deleted file mode 100644
index 66f356c7..00000000
--- a/world/map/npc/magic/_procedures.txt
+++ /dev/null
@@ -1,242 +0,0 @@
-function|script|magic_register
-{
- //debugmes ">> Register " + .invocation$ + " @ " + strnpcinfo(0);
- set .@ext$, if_then_else(getarg(0,"") != "", "::"+getarg(0), "");
- registercmd .invocation$, strnpcinfo(0) + .@ext$; // register the spell
- set .index, $@magic_index;
- set $@magic_index, $@magic_index + 1;
- return;
-}
-
-// this can only be done with a npc so...
--|script|Magic Timer|32767
-{
- end;
-
-OnLogin:
- set @_M_BLOCK, 2;
- //if (MAGIC_EXPERIENCE < 0)
- // set MAGIC_EXPERIENCE, 0; // bug fix
- // ^ XXX: check if negative MAGIC_EXPERIENCE is desirable
- addtimer 10000, "Magic Timer::OnClear";
- end;
-
-OnClear:
- set @_M_BLOCK, 0;
- end;
-}
-
-// this function is call()-only
-function|script|magic_checks
-{
- set .@flags, getarg(0);
- set .@nonmagic, .@flags & (1<<0);
-
- if (GM >= 50) goto L_Return; // event managers have no restrictions
- if(HIDDEN) goto L_Hidden; // can not cast with @hide
- if(@_M_BLOCK == 2) goto L_Login; // login warmup
- if(@_M_BLOCK) goto L_Blocked; // check if last debuff ended
- if(Hp < 1) goto L_Dead; // can not cast when dead
- if (MATK1 < 1 && .@nonmagic < 1) goto L_Greybar; // can not cast with a grey mana bar
- if ($@xmas_time && $@xmas_time != $@xmas_reward_time) goto L_Christmas2020;
- return 0;
-
-L_Hidden:
- smsg SMSG_FAILURE, "Magic: Impossible to cast while hidden!";
- return 1;
-
-L_Blocked:
- smsg SMSG_FAILURE, "Magic: Impossible to cast while a cooldown is in effect. Please wait.";
- return 2;
-
-L_Dead:
- smsg SMSG_FAILURE, "Magic: Impossible to cast while dead!";
- return 3;
-
-L_Greybar:
- smsg SMSG_FAILURE, "Magic: Impossible to cast with 0 m.atk. This might happen if your mana bar is grey. Some equipment can reduce your m.atk.";
- return 4;
-
-L_Login:
- smsg SMSG_FAILURE, "Magic: Impossible to cast for 10s after logging in.";
- return 5;
-
-L_Xmas2020:
- smsg SMSG_FAILURE, "Magic: Jack Frost's magical powers prevented your summoning!";
- return 6;
-
-
-L_Christmas2020:
- if (gettime(7) != 2020)
- goto L_Return;
-
- // If it is not Astral nor Dark I don't really care
- if (.school != SKILL_MAGIC_ASTRAL && .school != SKILL_MAGIC_DARK)
- goto L_Return;
-
- // TODO: Not all astral nor all dark magic are summons
- // But I don't have that sort of fine grained control in TMWA
- // So I must whitelist a few invocations and hope they cover everything
- if (.invocation$ == "#asorm" || .invocation$ == "#anwiltyp" || .invocation$ == "#phlex")
- goto L_Return;
-
- // Not in burst time, so not really important?
- // Actually, nevermind, that would not use snowball >__>
-
- // Unallowed in the map
- if (getmap() == "034-1" || getmap() == "033-1" || getmap() == "046-1" || getmap() == "047-1")
- goto L_Xmas2020;
-
- // Other map? Don't care
- goto L_Return;
-
-L_Return:
- return 0;
-}
-
-function|script|elt_damage
-{
- // args are damage, dmgplus(mutation), bonus_elt, malus_elt, effect
- set .@dmg, getarg(0) + rand(getarg(1));
- if(get(ELTTYPE, @target_id) == getarg(3)) // malus
- set .@dmg, .@dmg / 3;
- if(get(ELTTYPE, @target_id) == getarg(2)) // bonus
- set .@dmg, ((get(ELTLVL, @target_id) + 4) * .@dmg) / 4;
- set .@source, .caster;
- if (!.@source) set .@source, getcharid(3);
-
- injure .@source, @target_id, (.@dmg * (100 - get(MDEF1, @target_id))) / 100;
- if (getarg(4) != FX_NONE) misceffect getarg(4), @target_id;
- return;
-}
-
-function|script|melee_damage
-{
- // args are spell power, target id, dmg
- if ((getarg(0) - rand(100)) < (get(BaseLevel, getarg(1)) + get(MDEF1, getarg(1))))
- injure BL_ID, getarg(1), 0;
- else injure BL_ID, getarg(1), (getarg(2) * (100 - get(MDEF1, @target_id))) / 100;
- return;
-}
-
-function|script|magic_create_item
-{
- // FIXME / XXX: IMO, using Luk for this is very bad and unfair
- set .@exp, (MAGIC_EXPERIENCE & (BYTE_0_MASK | BYTE_1_MASK)) >> BYTE_0_SHIFT;
- set .@score, (.@exp + rand(min(@spellpower, ((.@exp / 3) + 1))));
- set @create_params[2], 1; // success flag
- if (.@score >= @create_params[1]) goto L_Perfect;
- set @create_params[2], 0; // success flag
- set .@score, .@score + rand(Luk) + rand(Luk);
- if (.@score < (@create_params[1] / 3)) goto L_Backfire;
- if (.@score < ((@create_params[1] * 2) / 3)) goto L_Iten;
- message strcharinfo(0), "Magic : ##3##BYour spell takes on a mind of its own!";
- if (rand(3) == 1) getitem @create_items$[1], 1; // bad item
- return;
-
-L_Iten:
- if (rand(5) != 2) goto L_Escape;
- message strcharinfo(0), "Magic : ##3##BYour spell solidifies into the shape of a mysterious object!";
- getitem "Iten", 1;
- return;
-
-L_Escape:
- message strcharinfo(0), "Magic : ##3##BYour spell escapes!";
- return;
-
-L_Backfire:
- message strcharinfo(0), "Magic : ##3##BYour spell backfires!";
- if (rand(110) < Luk) heal 0 - ((BaseLevel+1)*(BaseLevel+2)*(rand(28)+3)), 0;
- else heal 0 - (BaseLevel + 1), 0;
- return;
-
-L_Perfect:
- getitem @create_items$[0], @create_params[0]; // good item
- return;
-}
-
-function|script|bit
-{
- //0 name
- //1 mask
- //2 shift
- //3 value
-
- return ((getarg(0) & ~(getarg(1) << getarg(2))) | ((getarg(3) & getarg(1)) << getarg(2)));
-}
-
-function|script|magic_exp
-{
- set @last_index, (MAGIC_EXPERIENCE >> 16) & 0xFF;
- set @last_exp, MAGIC_EXPERIENCE & 0xFFFF;
-
- //debugmes "old spell index: " + @last_index;
- //debugmes "new spell index: " + .index;
-
- if(getskilllv(SKILL_MAGIC) < (.level + 3) && .index != @last_index)
- goto L_Gain;
- //debugmes "same as last spell => don't proceed";
- goto L_Return;
-
-L_Gain:
- if(.exp_gain < 1) goto L_Return; // only the spells that have exp register here. If you
- // remove this line then players can cast a spell with
- // no cost, then a spell with a reagents, then another
- // spell with no costs and still get the exp
- set @new_exp, min(0xFFFF, @last_exp + .exp_gain);
- //debugmes "old magic exp: "+ @last_exp;
- //debugmes "new magic exp: "+ @new_exp;
- set MAGIC_EXPERIENCE, call("bit", MAGIC_EXPERIENCE, 0xFFFF, 0, @new_exp);
- set MAGIC_EXPERIENCE, call("bit", MAGIC_EXPERIENCE, 0xFF, 16, .index);
- goto L_Return;
-
-L_Return:
- return;
-}
-
-function|script|adjust_spellpower
-{
- set @spellpower, MATK1 + getskilllv(SKILL_MAGIC) + getskilllv(.school) + 10;
- if((.school != SKILL_MAGIC_NATURE) && (.school != SKILL_MAGIC_LIFE)) goto L_Return;
- if(@args$ == "" || !@args$ || getpartnerid2() == 0) goto L_Return;
- if(getcharid(3, @args$) < 1 || getpartnerid2() != getcharid(3, @args$) || !(isloggedin(getcharid(3, @args$))))
- goto L_Return;
- //debugmes "You targeted your spouse!";
- // XXX: the spell power increases when the target is the spouse so one could
- // just do #modrilax (spouse) right?
- //
- // ... let's just forget about spouse for now
- goto L_Return;
-
-L_Return:
- return;
-}
-
-function|script|gain_heal_xp
-{
- set .@value, getarg(0);
- set .@gain, getarg(1);
- set .@value_divisor, getarg(2);
- set .@base_xp_factor, getarg(3);
-
- set .@last_heal_xp, ((MAGIC_EXPERIENCE >> 24) & 0xFF);
-
- if ((.@value / .@value_divisor) <= (10 + .@last_heal_xp + rand(.@last_heal_xp + 1) + rand(.@last_heal_xp + 1)))
- goto L_Return;
-
- set .@heal_xp, min(0xFF, .@last_heal_xp + .@gain); // XXX: maybe switch to 7F
-
- getexp (.@base_xp_factor * .@heal_xp), 0;
-
- // FIXME: extract_heal_xp
-
- //debugmes "old heal exp: "+ .@last_heal_xp;
-
- set MAGIC_EXPERIENCE, call("bit", MAGIC_EXPERIENCE, 0xFF, 24, .@heal_xp);
-
- //debugmes "new heal exp: "+ ((MAGIC_EXPERIENCE >> 24) & 0xFF);
- return 1;
-
-L_Return:
- return 0;
-}
diff --git a/world/map/npc/magic/event-alonsoalonsy.txt b/world/map/npc/magic/event-alonsoalonsy.txt
deleted file mode 100644
index 04f5db02..00000000
--- a/world/map/npc/magic/event-alonsoalonsy.txt
+++ /dev/null
@@ -1,137 +0,0 @@
-// #alonsialonso
-// Replacement of Easter 2010 spell
-// Known as "World Shift Spell"
-//
-// Variables:
-// @alonso -> Nods to DoomsdayAct5() that you'll pay in petals
-
--|script|alonsialonso|32767
-{
- if (call("magic_checks", 1)) end;
- callfunc "magic_exp";
-
- // Not during Act 5 of Doomsday
- if ($DOOMSDAY != 3) end;
-
- // Rule 1: Mushroom Spot
- if (isin("057-1", 125, 62, 127, 64))
- goto L_ShroomRule;
-
- // Rule 2: Underworld Chapel
- if (isin("070-1", 134, 30, 134, 30))
- goto L_ChapelRule;
-
- // Rule 3: Tulimshar MMVI
- //if (isin("003-1", 42, 92, 46, 95))
- // goto L_TulimRule;
-
- // General rule: Simulate death
- if (countitem("DarkPetal"))
- goto L_EmulateDeath;
-
- message strcharinfo(0), "You cannot shift worlds at this time.";
- end;
-
-//////////////////////////////////////////////////////
-L_ShroomRule:
- if (!$@halloween_time) end;
- if (!$DOOMSDAY_TWARP) end;
- if ($DOOMSDAY_TJANDE == 1) end;
-
- mes ".:: Eternal Seals Gate ::.";
- mes "";
- mes "One of the many (?) passages leading to the Underworld.";
- mes "During halloween, it is weakened enough to allow beings to cross.";
- mes "Perhaps it could be widened?";
- next;
- menu
- "Leave", L_Close,
- "[Dark Magic] Check Status", L_ShroomCheck,
- "[Dangerous] Try to cross", L_ShroomCross;
-
-L_ShroomCheck:
- if (getskilllv(SKILL_MAGIC_DARK) > 0)
- mes "Status: "+if_then_else($DOOMSDAY_CNT2 < 150,
- "##1Insufficient##0", "##2Sufficient##0")+
- if_then_else(getskilllv(SKILL_MAGIC_DARK) > 1,
- " ("+($DOOMSDAY_CNT2*100/150)+" %)", "");
- else
- mes "Status: ##8Unknown##0";
- close;
-
-L_ShroomCross:
- if ($DOOMSDAY_CNT2 < 150)
- goto L_FailCross;
- if (Hp < 1)
- close;
-
- // Warp you to Underworld
- warp "070-1", 30, 92;
- message strcharinfo(0), "World Shift : Shifted to Underworld (Area 70)";
- misceffect FX_PENTAGRAM_BUILDUP, strcharinfo(0);
- close;
-
-//////////////////////////////////////////////////////
-L_ChapelRule:
- if ($DOOMSDAY_TJANDE == 1) end;
- if (!$@halloween_time) end;
-
- mes ".:: Eternal Seals Gate ::.";
- mes "";
- mes "This chapel is clearly unlocked.";
- mes "The lock seems to have been removed ##BOn purpose, from the outside.##b";
- mes "This is probably where Tormenta lives.";
- next;
- mes "##9Warning: This is the Underworld and it may defy common logic.";
- mes "Are you ready?##0";
- mes "##1Cost: 1x [@@666|@@]";
- next;
- menu
- "Cancel", L_Close,
- "Open the gate!", L_GateCheck;
-
-L_GateCheck:
- if (!(countitem("BlackRose")))
- close;
-
- close2;
- misceffect FX_PENTAGRAM_BUILDUP, strcharinfo(0);
- addtimer 6000, "alonsialonso::OnChapelCross";
- end;
-
-OnChapelCross:
- if (Hp < 1)
- end;
- if (!(countitem("BlackRose")))
- end;
-
- // Payment Execution
- delitem "BlackRose", 1;
- getitem "DarkPetal", 1;
-
- // Warp you to Tulimshar MMVI
- warp "003-1", 142, 22;
- message strcharinfo(0), "World Shift : Shifted to Tulimshar (Area MMVI)";
- misceffect FX_PENTAGRAM_BUILDUP, strcharinfo(0);
- end;
-
-//////////////////////////////////////////////////////
-L_EmulateDeath:
- set @alonso, 1;
- callfunc "DoomsdayAct5";
- end;
-
-L_Close:
- close;
-
-L_FailCross:
- warp "045-1", 105, 125;
- close;
-
-//////////////////////////////////////////////////////
-OnInit:
- set .invocation$, chr(MAGIC_SYMBOL) + "alonsialonso"; // used in npcs that refer to this spell
- registercmd .invocation$, strnpcinfo(0);
- end;
-}
-
diff --git a/world/map/npc/magic/event-summon-managuardian.txt b/world/map/npc/magic/event-summon-managuardian.txt
deleted file mode 100644
index bad1213c..00000000
--- a/world/map/npc/magic/event-summon-managuardian.txt
+++ /dev/null
@@ -1,60 +0,0 @@
--|script|summon-jande|32767
-{
- end;
-
-OnCast:
- if(call("magic_checks")) end;
- // FIXME: Incomplete check, should still work during sieges
- if (getmapflag(getmap(), MF_TOWN)) end;
- if (Sp < 100) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (countitem("TinyManaElixir") < 1) end;
- if (!$DOOMSDAY_SUMMON) end;
- if (@ddcooldown > gettimetick(2)) goto L_Cooldown;
- delitem "TinyManaElixir", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 15000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 100;
- misceffect FX_MAGIC_MAGGOT_CAST, strcharinfo(0);
- callfunc "magic_exp";
- set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
- set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
- if (.@puppet < 1) end;
- set .master, BL_ID, .@puppet;
- set .lifetime, (@spellpower*9)+60000, .@puppet;
- set @ddcooldown, gettimetick(2)+70; // This is measured in seconds
- addnpctimer 10000, .@puppet$+"::OnSummon";
- addnpctimer 11000, .@puppet$+"::OnDestroy";
- end;
-
-OnSummon:
- if (!(isloggedin(.master))) destroy;
- if(get(Hp, .master) < 1) destroy; // destroy if master is missing
- if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map
- specialeffect FX_MAGIC_MAGGOT_SPAWN;
- set .@x, getnpcx();
- set .@y, getnpcy();
- set .@map$, strnpcinfo(3);
- callsub S_SummonAll;
- end;
-
-OnDestroy:
- destroy;
-
-S_SummonAll:
- summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1138, 2, .lifetime;
- destroy;
-
-L_Cooldown:
- message strcharinfo(0), "This skill is in forced cooldown; Please wait your first summon to expire.";
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_ASTRAL;
- set .invocation$, chr(MAGIC_SYMBOL) + "jande"; // used in npcs that refer to this spell
- void call("magic_register", "OnCast");
- set .level, 1;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/event-summon-manatyrant.txt b/world/map/npc/magic/event-summon-manatyrant.txt
deleted file mode 100644
index f91b2a87..00000000
--- a/world/map/npc/magic/event-summon-manatyrant.txt
+++ /dev/null
@@ -1,61 +0,0 @@
--|script|summon-tyrant|32767
-{
- end;
-
-OnCast:
- if(call("magic_checks")) end;
- if ($DOOMSDAY_SUMMON < 2) end;
- if (getmapflag(getmap(), MF_TOWN)) end;
- if (Sp < 100) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (countitem("LargeManaElixir") < 1) end;
- if (@dd4cooldown > gettimetick(2)) goto L_Cooldown;
- delitem "LargeManaElixir", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 15000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 100;
- misceffect FX_MAGIC_MAGGOT_CAST, strcharinfo(0);
- callfunc "magic_exp";
- set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
- set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
- if (.@puppet < 1) end;
- set .master, BL_ID, .@puppet;
- set .lifetime, (@spellpower*9)+150000, .@puppet;
- set @dd4cooldown, gettimetick(2)+160; // This is measured in seconds
- addnpctimer 10000, .@puppet$+"::OnSummon";
- addnpctimer 11000, .@puppet$+"::OnDestroy";
- // Causes caster to heal (I thought in converting MP to HP but meh)
- heal 30000, 0;
- end;
-
-OnSummon:
- if (!(isloggedin(.master))) destroy;
- if(get(Hp, .master) < 1) destroy; // destroy if master is missing
- if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map
- specialeffect FX_MAGIC_MAGGOT_SPAWN;
- set .@x, getnpcx();
- set .@y, getnpcy();
- set .@map$, strnpcinfo(3);
- callsub S_SummonAll;
- end;
-
-OnDestroy:
- destroy;
-
-S_SummonAll:
- summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1150, 2, .lifetime;
- destroy;
-
-L_Cooldown:
- message strcharinfo(0), "This skill is in forced cooldown; Please wait your first summon to expire.";
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_ASTRAL;
- set .invocation$, chr(MAGIC_SYMBOL) + "manatez"; // used in npcs that refer to this spell
- void call("magic_register", "OnCast");
- set .level, 1;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level0-antiprotect.txt b/world/map/npc/magic/level0-antiprotect.txt
deleted file mode 100644
index 129d3c62..00000000
--- a/world/map/npc/magic/level0-antiprotect.txt
+++ /dev/null
@@ -1,23 +0,0 @@
--|script|antiprotect|32767
-{
- if(call("magic_checks", 1)) end;
- callfunc "magic_exp";
-
- if (@antiprotect)
- goto L_Disable;
-
- sc_end SC_PHYS_SHIELD;
- message strcharinfo(0), "Shield : You are now protected against betsanc until you cast detsanc again or logout.";
- set @antiprotect, 1;
- end;
-
-L_Disable:
- message strcharinfo(0), "Shield : You are no longer protected against betsanc.";
- set @antiprotect, 0;
- end;
-
-OnInit:
- set .invocation$, chr(MAGIC_SYMBOL) + "detsanc"; // used in npcs that refer to this spell
- registercmd .invocation$, strnpcinfo(0);
- end;
-}
diff --git a/world/map/npc/magic/level0-discharge.txt b/world/map/npc/magic/level0-discharge.txt
deleted file mode 100644
index 7b2cfa8c..00000000
--- a/world/map/npc/magic/level0-discharge.txt
+++ /dev/null
@@ -1,18 +0,0 @@
--|script|discharge spell|32767
-{
- if(call("magic_checks")) end;
- callfunc "magic_exp";
-
- // tell the spells they were discharged
- // XXX: maybe we could make it do area damage when you discharge (release your energy all of a sudden)
- addtimer 0, "::OnDischarge"; // seeks OnDischarge in ALL npcs
- end;
-
-OnInit:
- set .school, SKILL_MAGIC;
- set .invocation$, chr(MAGIC_SYMBOL) + "discharge"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 0;
- set .exp_gain, 0;
- end;
-}
diff --git a/world/map/npc/magic/level0-reapercry.txt b/world/map/npc/magic/level0-reapercry.txt
deleted file mode 100644
index f96c3cea..00000000
--- a/world/map/npc/magic/level0-reapercry.txt
+++ /dev/null
@@ -1,245 +0,0 @@
-// #reapercry
-// Spell to warp to Keshlam Outskirts
-// Variable: @reapercry -> Holds summon state
-//
-// If this was Evol2 engine, I would be able to easily use bitmasks,
-// Having a custom password sequence unique per character.
-// But alas, on TMWA, I can't really abuse player variables.
-// So I allow you to cheat. Or not. Lemme think. Account variable...
-
-// Returns true if player inside candle area
-// call("alacriuspos", bitwise)
-function|script|alacriuspos
-{
- set @alacriusp, 0;
-
- // Left side
- if (1 == getarg(0) && #CRYPT_PASSWORD & getarg(0))
- goto L_25_53_29_56;
- if (2 == getarg(0) && #CRYPT_PASSWORD & getarg(0))
- goto L_20_47_22_51;
- if (4 == getarg(0) && #CRYPT_PASSWORD & getarg(0))
- goto L_22_40_25_43;
- if (8 == getarg(0) && #CRYPT_PASSWORD & getarg(0))
- goto L_29_40_32_43;
- if (16 == getarg(0) && #CRYPT_PASSWORD & getarg(0))
- goto L_32_47_35_50;
- if (32 == getarg(0) && #CRYPT_PASSWORD & getarg(0))
- goto L_25_53_29_56;
- // Left not set
- if (1 == getarg(0))
- goto L_29_40_32_43;
- if (2 == getarg(0))
- goto L_32_47_35_50;
- if (4 == getarg(0))
- goto L_25_53_29_56;
- if (8 == getarg(0))
- goto L_20_47_22_51;
- if (16 == getarg(0))
- goto L_22_40_25_43;
- if (32 == getarg(0))
- goto L_29_40_32_43;
- // Right side
- if (64 == getarg(0) && #CRYPT_PASSWORD & getarg(0))
- goto L_49_53_53_56;
- if (128 == getarg(0) && #CRYPT_PASSWORD & getarg(0))
- goto L_43_47_46_51;
- if (256 == getarg(0) && #CRYPT_PASSWORD & getarg(0))
- goto L_46_40_49_43;
- if (512 == getarg(0) && #CRYPT_PASSWORD & getarg(0))
- goto L_53_40_56_43;
- if (1024 == getarg(0) && #CRYPT_PASSWORD & getarg(0))
- goto L_56_47_58_50;
- if (2048 == getarg(0) && #CRYPT_PASSWORD & getarg(0))
- goto L_49_53_53_56;
- // Right side not set
- if (64 == getarg(0))
- goto L_53_40_56_43;
- if (128 == getarg(0))
- goto L_56_47_58_50;
- if (256 == getarg(0))
- goto L_49_53_53_56;
- if (512 == getarg(0))
- goto L_43_47_46_51;
- if (1024 == getarg(0))
- goto L_46_40_49_43;
- if (2048 == getarg(0))
- goto L_53_40_56_43;
-
- // Nope, all wrong
- set @alacriusp, 0;
- return;
-
-// Left Side Labels
-L_29_40_32_43:
- set @alacriusp, isin("027-8", 29, 40, 32, 43);
- return;
-L_22_40_25_43:
- set @alacriusp, isin("027-8", 22, 40, 25, 43);
- return;
-L_20_47_22_51:
- set @alacriusp, isin("027-8", 20, 47, 22, 51);
- return;
-L_25_53_29_56:
- set @alacriusp, isin("027-8", 25, 53, 29, 56);
- return;
-L_32_47_35_50:
- set @alacriusp, isin("027-8", 32, 47, 35, 50);
- return;
-
-// Right Side Labels
-L_53_40_56_43:
- set @alacriusp, isin("027-8", 53, 40, 56, 43);
- return;
-L_46_40_49_43:
- set @alacriusp, isin("027-8", 46, 40, 49, 43);
- return;
-L_43_47_46_51:
- set @alacriusp, isin("027-8", 43, 47, 46, 51);
- return;
-L_49_53_53_56:
- set @alacriusp, isin("027-8", 49, 53, 53, 56);
- return;
-L_56_47_58_50:
- set @alacriusp, isin("027-8", 56, 47, 58, 50);
- return;
-
-}
-
--|script|reapercry|32767
-{
- if(call("magic_checks", 1)) end;
- callfunc "magic_exp";
-
- // Not in Terogan's Room
- if (getmap() != "027-8") end;
-
- // Terogan is asleep
- if (!$@CRYPT_FIGHT3) end;
-
- // No password is set o.o
- if (!#CRYPT_PASSWORD) end;
-
- // Switch the quest state
- if (@reapercry == 0)
- goto L_Check0;
- if (@reapercry == 1)
- goto L_Check1;
- if (@reapercry == 2)
- goto L_Check2;
- if (@reapercry == 3)
- goto L_Check3;
- if (@reapercry == 4)
- goto L_Check4;
- if (@reapercry == 5)
- goto L_Check5;
-
- // Something went wrong!!
- end;
-
-//////////////////////////////////////////////////////
-L_Check0:
- void call("alacriuspos", 1);
- if (@alacriusp) goto L_Exec0;
- void call("alacriuspos", 64);
- if (@alacriusp) goto L_Exec0;
-
- set @reapercry, 0;
- misceffect FX_MAGIC_DARK_EXPLOSION, strcharinfo(0);
- end;
-
-L_Exec0:
- misceffect FX_FIRE_EXPLOSION, strcharinfo(0); // Hmm FIXME
- set @reapercry, 1;
- end;
-
-//////////////////////////////////////////////////////
-L_Check1:
- void call("alacriuspos", 2);
- if (@alacriusp) goto L_Exec1;
- void call("alacriuspos", 128);
- if (@alacriusp) goto L_Exec1;
-
- set @reapercry, 0;
- misceffect FX_MAGIC_DARK_EXPLOSION, strcharinfo(0);
- end;
-
-L_Exec1:
- misceffect FX_FIRE_EXPLOSION, strcharinfo(0); // Hmm FIXME
- set @reapercry, 2;
- end;
-
-//////////////////////////////////////////////////////
-L_Check2:
- void call("alacriuspos", 4);
- if (@alacriusp) goto L_Exec2;
- void call("alacriuspos", 256);
- if (@alacriusp) goto L_Exec2;
-
- set @reapercry, 0;
- misceffect FX_MAGIC_DARK_EXPLOSION, strcharinfo(0);
- end;
-
-L_Exec2:
- misceffect FX_FIRE_EXPLOSION, strcharinfo(0); // Hmm FIXME
- set @reapercry, 3;
- end;
-
-//////////////////////////////////////////////////////
-L_Check3:
- void call("alacriuspos", 8);
- if (@alacriusp) goto L_Exec3;
- void call("alacriuspos", 512);
- if (@alacriusp) goto L_Exec3;
-
- set @reapercry, 0;
- misceffect FX_MAGIC_DARK_EXPLOSION, strcharinfo(0);
- end;
-
-L_Exec3:
- misceffect FX_FIRE_EXPLOSION, strcharinfo(0); // Hmm FIXME
- set @reapercry, 4;
- end;
-
-//////////////////////////////////////////////////////
-L_Check4:
- void call("alacriuspos", 16);
- if (@alacriusp) goto L_Exec4;
- void call("alacriuspos", 1024);
- if (@alacriusp) goto L_Exec4;
-
- set @reapercry, 0;
- misceffect FX_MAGIC_DARK_EXPLOSION, strcharinfo(0);
- end;
-
-L_Exec4:
- misceffect FX_FIRE_EXPLOSION, strcharinfo(0); // Hmm FIXME
- set @reapercry, 5;
- end;
-
-//////////////////////////////////////////////////////
-L_Check5:
- void call("alacriuspos", 32);
- if (@alacriusp) goto L_Exec5;
- void call("alacriuspos", 2048);
- if (@alacriusp) goto L_Exec5;
-
- set @reapercry, 0;
- misceffect FX_MAGIC_DARK_EXPLOSION, strcharinfo(0);
- end;
-
-L_Exec5:
- // This means cast sequence complete
- // Maybe FX_MAGIC_BLUE_TELEPORT? (iilia's effect)
- set @reapercry, 0;
- getexp 100000, 0;
- misceffect FX_MAGIC_TELEPORT, strcharinfo(0);
- warp "099-7", 75, 36;
- end;
-
-//////////////////////////////////////////////////////
-OnInit:
- set .invocation$, chr(MAGIC_SYMBOL) + "reapercry"; // used in npcs that refer to this spell
- registercmd .invocation$, strnpcinfo(0);
- end;
-}
diff --git a/world/map/npc/magic/level0-wand.txt b/world/map/npc/magic/level0-wand.txt
deleted file mode 100644
index 5e29f2ca..00000000
--- a/world/map/npc/magic/level0-wand.txt
+++ /dev/null
@@ -1,84 +0,0 @@
--|script|spell-wand|32767
-{
- if(call("magic_checks")) goto L_Failed;
- set @wandspell[0], 0; // reset state
- callfunc "adjust_spellpower";
- callsub S_Loop; // set up wand
- if(@wandspell[0] < 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
- misceffect FX_MAGIC_WAND_CAST, strcharinfo(0);
-
- callfunc "magic_exp";
- goto L_FreeRecast;
-
-L_FreeRecast:
- if (@wandspell[4] > 0)
- addtimer 0, strnpcinfo(0) + "::OnSetRecast";
- end;
-
-OnDischarge:
- if (@wandspell[4] < 1) end;
- set @wandspell[4], 0;
- misceffect FX_MAGIC_DISCHARGE, strcharinfo(0);
- overrideattack;
- end;
-
-OnSetRecast:
- overrideattack @wandspell[3], 3, ATTACK_ICON_GENERIC, @wandspell[0], strnpcinfo(0)+"::OnAttack", @wandspell[4];
- end;
-
-OnAttack:
- if(target(BL_ID, @target_id, 22) != 22) goto L_FreeRecast; // 0x02 | 0x04 | 0x10
- if (Sp < @wandspell[1]) goto L_LowSp;
- set Sp, (Sp - @wandspell[1]);
- void call("elt_damage", @wandspell[2],@wandspell[2],ELT_NEUTRAL,ELT_NEUTRAL,FX_NONE);
- set @wandspell[4], @wandspell[4] - 1;
- goto L_FreeRecast;
-
-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 .@pwr, .WandsPwr[.@wand_loop];
- if (QL_MORGAN == 2)
- set QL_MORGAN, 3;
- setarray @wandspell[0],
- .WandsAnim[.@wand_loop], // wand anim/id
- (.@pwr * (BaseLevel / 15) + 2), // wand cost
- (.@pwr * (@spellpower / 3)), // wand dmg
- (((200 - Agi) * 1200) / 200), //delay
- (.@pwr + (@spellpower / 10)); // charges
- return;
-
-S_NoWand:
- message strcharinfo(0), "Wand : ##3##BYou need a wand Equipped!";
- return;
-
-L_LowSp:
- message strcharinfo(0), "Wand : ##3##BOut of Mana";
- end;
-
-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, OVERRIDE_WAND_STAFF, OVERRIDE_WAND_WAND;
- 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;
-}
diff --git a/world/map/npc/magic/level1-aggravate.txt b/world/map/npc/magic/level1-aggravate.txt
deleted file mode 100644
index c550efc3..00000000
--- a/world/map/npc/magic/level1-aggravate.txt
+++ /dev/null
@@ -1,29 +0,0 @@
--|script|spell-aggravate|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 3) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 1000, "Magic Timer::OnClear"; // set the new debuff
- set @args$, ""; callfunc "adjust_spellpower"; // we reset @args$ because this spell should not have a target
- set @distance, (2 + (@spellpower / 50));
- set Sp, Sp - 3;
- misceffect FX_MAGIC_AGGRAVATE_CAST, strcharinfo(0);
- callfunc "magic_exp";
- foreach 2, getmap(), (POS_X - @distance), (POS_Y - @distance), (POS_X + @distance), (POS_Y + @distance), strnpcinfo(0) + "::OnMob";
- end;
-
-OnMob:
- if (target(BL_ID, @target_id, 0x20) != 0x20) end; // line of sight
- aggravate @target_id;
- misceffect FX_MAGIC_AGGRAVATE_HIT, @target_id;
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_NATURE;
- set .invocation$, chr(MAGIC_SYMBOL) + "itenplz"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 1;
- set .exp_gain, 0;
- end;
-}
diff --git a/world/map/npc/magic/level1-detect-magic.txt b/world/map/npc/magic/level1-detect-magic.txt
deleted file mode 100644
index e8a588a5..00000000
--- a/world/map/npc/magic/level1-detect-magic.txt
+++ /dev/null
@@ -1,34 +0,0 @@
--|script|detect-magic|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 3) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 6000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 3;
- misceffect FX_MAGIC_DETECT_CAST, strcharinfo(0);
- set .@range, (@spellpower/50)+1;
- foreach 1, getmap(), POS_X - .@range, POS_Y - .@range, POS_X + .@range, POS_Y + .@range,
- strnpcinfo(0) + "::OnNearbyNpc";
- if (getmap() == "099-4")
- addtimer 10, "#TMWFinalExam::OnMiteyo";
- if (getmap() == "099-5")
- addtimer 10, "#TMWFinalExam::OnMiteyo";
- callfunc "magic_exp";
- end;
-
-OnNearbyNpc:
- set .@e$, strnpcinfo(2,@target_id);
- if(.@e$ == "#_M" || .@e$ == "#MAGIC" || get(.IS_MAGIC, @target_id))
- misceffect FX_MAGIC_DETECT_HIT, @target_id;
- end;
-
-OnInit:
- set .school, SKILL_MAGIC;
- set .invocation$, chr(MAGIC_SYMBOL) + "miteyo"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 1;
- set .exp_gain, 0;
- end;
-}
diff --git a/world/map/npc/magic/level1-experience.txt b/world/map/npc/magic/level1-experience.txt
deleted file mode 100644
index c29f57b3..00000000
--- a/world/map/npc/magic/level1-experience.txt
+++ /dev/null
@@ -1,46 +0,0 @@
--|script|spell-experience|32767
-{
- //debugmes MAGIC_EXPERIENCE;
- //debugmes (MAGIC_EXPERIENCE >> 0) & 0xFFFF; // magic exp
- //debugmes (MAGIC_EXPERIENCE >> 16) & 0xFF; // last spell index
- //debugmes (MAGIC_EXPERIENCE >> 24) & 0xFF; // heal exp
-
- if(call("magic_checks")) end;
- if (Sp < 1) end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 1000, "Magic Timer::OnClear"; // set the new debuff
- set @level, getskilllv(.school);
- if (@level < .level) end;
- callfunc "adjust_spellpower";
- set Sp, Sp - 1;
- misceffect FX_MAGIC_EXP_CAST, strcharinfo(0);
- callfunc "magic_exp";
- set @ratio, ((@last_exp*10) - rand(.MAX_MAGIC_EXP[@level]/30))/.MAX_MAGIC_EXP[@level];
-
- set @mes$, "You feel completely overwhelmed by your magic.";
- if(@ratio == 1) set @mes$, "You feel quite overwhelmed by your magic, but are beginning to see patterns.";
- if(@ratio == 2) set @mes$, "You feel that you have only the bare minimum of control over your magic.";
- if(@ratio == 3) set @mes$, "Trying to control your magic is still rather troublesome.";
- if(@ratio == 4) set @mes$, "You feel you still have a few difficulties in controlling your magic.";
- if(@ratio == 5) set @mes$, "You feel somewhat in control of your magic.";
- if(@ratio == 6) set @mes$, "You feel mostly in control of your magic.";
- if(@ratio == 7) set @mes$, "You feel quite in control of your magic.";
- if(@ratio == 8) set @mes$, "You feel that you have very good control of your magic.";
- if(@ratio == 9) set @mes$, "You feel in almost perfect control of your magic.";
- if(@ratio >= 10) set @mes$, "You feel in perfect control of your magic" + if_then_else(@level >= MAX_MAGIC_LEVEL, ".", ", and seem on the verge of something more... perhaps you should see the Mana Seed to ask for more magic?");
- if(@ratio >= 20) set @mes$, "You have perfect control of what you understand now, but there is now a distinct sensation of something more, something indescribable. If only the Mana Seed would give more magic to you...";
- if(@ratio >= 45) set @mes$, "Magic flows naturally from you, readily and with ease. Your understanding of what you can currently control at present is flawless, far beyond your requirements to cast magic at this level.";
- if(@ratio >= 45 && @level < MAX_MAGIC_LEVEL) set @mes$, @mes$ + " Surely the Mana Seed will more than readily offer more magic for such a proficient user.";
- if(@level >= 5) set @mes$, "You are as proficient at magic as you can possibly be."; // this is the maximum magic level
- message strcharinfo(0), "Magic : ##3##B"+@mes$;
- end;
-
-OnInit:
- set .school, SKILL_MAGIC;
- set .invocation$, chr(MAGIC_SYMBOL) + "abizit"; // used in npcs that refer to this spell
- set .level, 1;
- set .exp_gain, 0;
- void call("magic_register");
- setarray .MAX_MAGIC_EXP[0], 0, 0, 100, 1200, 8000, 40000, 65535;
- end;
-}
diff --git a/world/map/npc/magic/level1-flare-dart.txt b/world/map/npc/magic/level1-flare-dart.txt
deleted file mode 100644
index e85ce3e8..00000000
--- a/world/map/npc/magic/level1-flare-dart.txt
+++ /dev/null
@@ -1,51 +0,0 @@
--|script|flare-dart|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 10) end;
- set @level, getskilllv(.school);
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (@level <= 2 && countitem("SulphurPowder") >= 1) delitem "SulphurPowder", 1;
- elif (@level <= 2) end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 500, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 10;
- misceffect FX_MAGIC_DART_CAST, strcharinfo(0);
- setarray @flarspell[0],
- sqrt(@spellpower) * 5, //dmg
- (BaseLevel/3) + 5, // dmg bonus
- (@spellpower/50) + 3, // charges
- (((200 - Agi) * 1200) / 200); // delay
- callfunc "magic_exp";
- goto L_FreeRecast;
-
-OnAttack:
- if (target(BL_ID, @target_id, 50) != 50) goto L_FreeRecast; // 0x20 | 0x02 | 0x10
- void call("elt_damage", @flarspell[0], @flarspell[1], ELT_WATER, ELT_FIRE, FX_NONE);
- set @flarspell[2], @flarspell[2] - 1;
- goto L_FreeRecast;
-
-L_FreeRecast:
- if (@flarspell[2] > 0)
- addtimer 0, strnpcinfo(0) + "::OnSetRecast";
- end;
-
-OnDischarge:
- if (@flarspell[2] < 1) end;
- set @flarspell[2], 0;
- misceffect FX_MAGIC_DISCHARGE, strcharinfo(0);
- overrideattack;
- end;
-
-OnSetRecast:
- overrideattack @flarspell[3], 4, ATTACK_ICON_GENERIC, OVERRIDE_DART, strnpcinfo(0)+"::OnAttack", @flarspell[2];
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_WAR;
- set .invocation$, chr(MAGIC_SYMBOL) + "flar"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 1;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level1-grow-alizarin.txt b/world/map/npc/magic/level1-grow-alizarin.txt
deleted file mode 100644
index 1d7bc696..00000000
--- a/world/map/npc/magic/level1-grow-alizarin.txt
+++ /dev/null
@@ -1,37 +0,0 @@
--|script|grow-alizarin|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 4) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (countitem("AlizarinHerb") < 1 || countitem("Root") < 1) end;
- delitem "AlizarinHerb", 1;
- delitem "Root", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 2000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 4;
- misceffect FX_MAGIC_GROW_CAST, strcharinfo(0);
- setarray @summon[0], 0, (getskilllv(.school)/2)+1;
- callfunc "magic_exp";
- addtimer 4000-(@spellpower-9), strnpcinfo(0)+"::OnSummon";
- end;
-
-OnSummon:
- misceffect FX_MAGIC_GROW_SPAWN, strcharinfo(0);
- callsub S_SummonAll;
- end;
-
-S_SummonAll:
- summon getmap(), rand(POS_X-2,POS_X+2), rand(POS_Y-2,POS_Y+2), BL_ID, 1032, 1, (@spellpower*50)+10000;
- set @summon[0], @summon[0] + 1;
- if (@summon[0] < @summon[1]) goto S_SummonAll;
- return;
-
-OnInit:
- set .school, SKILL_MAGIC_NATURE;
- set .invocation$, chr(MAGIC_SYMBOL) + "modriphoo"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 1;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level1-grow-cobalt.txt b/world/map/npc/magic/level1-grow-cobalt.txt
deleted file mode 100644
index dc84318d..00000000
--- a/world/map/npc/magic/level1-grow-cobalt.txt
+++ /dev/null
@@ -1,37 +0,0 @@
--|script|grow-cobalt|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 4) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (countitem("CobaltHerb") < 1 || countitem("Root") < 1) end;
- delitem "CobaltHerb", 1;
- delitem "Root", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 2000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 4;
- misceffect FX_MAGIC_GROW_CAST, strcharinfo(0);
- setarray @summon[0], 0, (getskilllv(.school)/2)+1;
- callfunc "magic_exp";
- addtimer 4000-(@spellpower-9), strnpcinfo(0)+"::OnSummon";
- end;
-
-OnSummon:
- misceffect FX_MAGIC_GROW_SPAWN, strcharinfo(0);
- callsub S_SummonAll;
- end;
-
-S_SummonAll:
- summon getmap(), rand(POS_X-2,POS_X+2), rand(POS_Y-2,POS_Y+2), BL_ID, 1030, 1, (@spellpower*50)+10000;
- set @summon[0], @summon[0] + 1;
- if (@summon[0] < @summon[1]) goto S_SummonAll;
- return;
-
-OnInit:
- set .school, SKILL_MAGIC_NATURE;
- set .invocation$, chr(MAGIC_SYMBOL) + "modrisump"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 1;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level1-grow-gamboge.txt b/world/map/npc/magic/level1-grow-gamboge.txt
deleted file mode 100644
index 25df5b03..00000000
--- a/world/map/npc/magic/level1-grow-gamboge.txt
+++ /dev/null
@@ -1,37 +0,0 @@
--|script|grow-gamboge|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 4) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (countitem("GambogeHerb") < 1 || countitem("Root") < 1) end;
- delitem "GambogeHerb", 1;
- delitem "Root", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 2000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 4;
- misceffect FX_MAGIC_GROW_CAST, strcharinfo(0);
- setarray @summon[0], 0, (getskilllv(.school)/2)+1;
- callfunc "magic_exp";
- addtimer 4000-(@spellpower-9), strnpcinfo(0)+"::OnSummon";
- end;
-
-OnSummon:
- misceffect FX_MAGIC_GROW_SPAWN, strcharinfo(0);
- callsub S_SummonAll;
- end;
-
-S_SummonAll:
- summon getmap(), rand(POS_X-2,POS_X+2), rand(POS_Y-2,POS_Y+2), BL_ID, 1031, 1, (@spellpower*50)+10000;
- set @summon[0], @summon[0] + 1;
- if (@summon[0] < @summon[1]) goto S_SummonAll;
- return;
-
-OnInit:
- set .school, SKILL_MAGIC_NATURE;
- set .invocation$, chr(MAGIC_SYMBOL) + "modriyikam"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 1;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level1-grow-mauve.txt b/world/map/npc/magic/level1-grow-mauve.txt
deleted file mode 100644
index 8c0d32ff..00000000
--- a/world/map/npc/magic/level1-grow-mauve.txt
+++ /dev/null
@@ -1,37 +0,0 @@
--|script|grow-mauve|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 4) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (countitem("MauveHerb") < 1 || countitem("Root") < 1) end;
- delitem "MauveHerb", 1;
- delitem "Root", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 2000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 4;
- misceffect FX_MAGIC_GROW_CAST, strcharinfo(0);
- setarray @summon[0], 0, (getskilllv(.school)/2)+1;
- callfunc "magic_exp";
- addtimer 4000-(@spellpower-9), strnpcinfo(0)+"::OnSummon";
- end;
-
-OnSummon:
- misceffect FX_MAGIC_GROW_SPAWN, strcharinfo(0);
- callsub S_SummonAll;
- end;
-
-S_SummonAll:
- summon getmap(), rand(POS_X-2,POS_X+2), rand(POS_Y-2,POS_Y+2), BL_ID, 1029, 1, (@spellpower*50)+10000;
- set @summon[0], @summon[0] + 1;
- if (@summon[0] < @summon[1]) goto S_SummonAll;
- return;
-
-OnInit:
- set .school, SKILL_MAGIC_NATURE;
- set .invocation$, chr(MAGIC_SYMBOL) + "modrilax"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 1;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level1-lesser-heal.txt b/world/map/npc/magic/level1-lesser-heal.txt
deleted file mode 100644
index b2cd4741..00000000
--- a/world/map/npc/magic/level1-lesser-heal.txt
+++ /dev/null
@@ -1,55 +0,0 @@
--|script|lesser-heal|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 6) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- set @target_id, getcharid(3, @args$);
- if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id) == 1)
- set @target_id, BL_ID; // fallback to self
- if (get(GM, @target_id) == 1) end;
- if (@args$ == "Mouboo" || @args$ == "mouboo") goto L_Mouboo;
- set .@range, (((MATK1 + getskilllv(SKILL_MAGIC) + getskilllv(.school) + 10) / 100) + 2);
- if (distance(BL_ID, @target_id) >= .@range) end;
- if (PVP_CHANNEL != get(PVP_CHANNEL, @target_id) && get(PVP_CHANNEL, @target_id) != 0) end;
- if (countitem("Lifestone") < 1) end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 500, "Magic Timer::OnClear"; // set the new debuff
- delitem "Lifestone", 1;
- callfunc "adjust_spellpower";
- set Sp, Sp - 6;
- misceffect FX_MAGIC_HEAL_CAST, strcharinfo(0);
- callfunc "magic_exp";
- if (@target_id != BL_ID) goto L_NotMe;
- goto L_Continue;
-
-L_NotMe:
- misceffect FX_MAGIC_HEAL_HIT, @target_id;
- if (get(Hp, @target_id) < 1) end;
- void call("gain_heal_xp", min(200, (get(MaxHp, @target_id) - get(Hp, @target_id))), 1, 2, 2);
- goto L_Continue;
-
-L_Continue:
- if (getskilllv(SKILL_MAGIC_DARK) >= 1) sc_start SC_HALT_REGENERATE, 2000, 0;
- if (get(Hp, @target_id) < 1) end;
- addtimer 0, strnpcinfo(0) + "::OnSlowHeal", @target_id;
- end;
-
-OnSlowHeal:
- heal 200, 0, 1;
- end;
-
-L_Mouboo:
- set @target_id, getnpcid("Mouboo");
- set .@range, (((MATK1 + getskilllv(SKILL_MAGIC) + getskilllv(.school) + 10) / 100) + 2);
- if (distance(BL_ID, @target_id) >= .@range) end;
- mes "Magic : ##3##BThis spell has no effect on animals.";
- close;
-
-OnInit:
- set .school, SKILL_MAGIC_LIFE;
- set .invocation$, chr(MAGIC_SYMBOL) + "lum"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 1;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level1-magic-blade.txt b/world/map/npc/magic/level1-magic-blade.txt
deleted file mode 100644
index 1c6c891f..00000000
--- a/world/map/npc/magic/level1-magic-blade.txt
+++ /dev/null
@@ -1,55 +0,0 @@
--|script|magic-blade|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 9) end;
- set .@level, getskilllv(.school);
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (.@level <= 2 && countitem("SharpKnife") >= 1) set .@component$, "SharpKnife";
- elif (.@level <= 2 && countitem("Knife") >= 1) set .@component$, "Knife";
- elif (.@level <= 2) end;
- if (.@component$ != "") delitem .@component$, 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 500, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 9;
- misceffect FX_MAGIC_BLADE_CAST, strcharinfo(0);
- setarray @chizaspell[0],
- if_then_else(.@component$ == "Knife", 40, 60), // dmg
- Str, // do not allow to equip light armor, cast, and then switch to heavy armor to get bonus str
- (@spellpower/15) + 10, // charges
- (((200 - Agi) * 1200) / 200), // delay
- @spellpower;
-
- callfunc "magic_exp";
- goto L_FreeRecast;
-
-OnDischarge:
- if (@chizaspell[2] < 1) end;
- set @chizaspell[2], 0;
- misceffect FX_MAGIC_DISCHARGE, strcharinfo(0);
- overrideattack;
- end;
-
-OnAttack:
- if (target(BL_ID, @target_id, 22) != 22) goto L_FreeRecast; // 0x10 | 0x02 | 0x04
- void call("melee_damage", @chizaspell[4], @target_id, (@chizaspell[0] + rand(@chizaspell[1] + 5)));
- set @chizaspell[2], @chizaspell[2] - 1;
- goto L_FreeRecast;
-
-L_FreeRecast:
- if (@chizaspell[2] > 0)
- addtimer 0, strnpcinfo(0) + "::OnSetRecast";
- end;
-
-OnSetRecast:
- overrideattack @chizaspell[3], 1, ATTACK_ICON_GENERIC, OVERRIDE_BLADE, strnpcinfo(0)+"::OnAttack", @chizaspell[2];
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_WAR;
- set .invocation$, chr(MAGIC_SYMBOL) + "chiza"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 1;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level1-make-sulphur.txt b/world/map/npc/magic/level1-make-sulphur.txt
deleted file mode 100644
index 89584954..00000000
--- a/world/map/npc/magic/level1-make-sulphur.txt
+++ /dev/null
@@ -1,25 +0,0 @@
--|script|make-sulphur|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 4) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (countitem("PileOfAsh") >= 1) delitem "PileOfAsh", 1; else end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 4000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 4;
- misceffect FX_MAGIC_SULPHUR_CAST, strcharinfo(0);
- setarray @create_params[0], (@spellpower/100)+1+(rand(max(1,(800-@spellpower)))/180), 50;
- setarray @create_items$[0], "SulphurPowder", "PileOfAsh";
- callfunc "magic_create_item";
- callfunc "magic_exp";
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_TRANSMUTE;
- set .invocation$, chr(MAGIC_SYMBOL) + "gole"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 1;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level1-sense-spouse.txt b/world/map/npc/magic/level1-sense-spouse.txt
deleted file mode 100644
index fe95c094..00000000
--- a/world/map/npc/magic/level1-sense-spouse.txt
+++ /dev/null
@@ -1,25 +0,0 @@
--|script|sense-spouse|32767
-{
- set .@m, getpartnerid2();
- if (.@m < 1)
- goto L_NotMarried;
- if (isloggedin(.@m) < 1)
- goto L_NotOnline;
- if (sc_check(SC_HIDE, .@m) || getpvpflag(1, .@m) || get(INVISIBLE, .@m))
- goto L_NotOnline;
- message strcharinfo(0), "Spouse : Your spouse is... somewhere.";
- end;
-
-L_NotOnline:
- message strcharinfo(0), "Spouse : Your spouse is not online, or maybe just hiding from you.";
- end;
-
-L_NotMarried:
- message strcharinfo(0), "Spouse : You are not married, or no longer married (sorry for being the one telling you the bad news).";
- end;
-
-OnInit:
- set .invocation$, chr(MAGIC_SYMBOL) + "inzuwilt"; // used in npcs that refer to this spell
- registercmd .invocation$, strnpcinfo(0);
- end;
-}
diff --git a/world/map/npc/magic/level1-summon-maggots.txt b/world/map/npc/magic/level1-summon-maggots.txt
deleted file mode 100644
index 98ca6096..00000000
--- a/world/map/npc/magic/level1-summon-maggots.txt
+++ /dev/null
@@ -1,57 +0,0 @@
--|script|summon-maggots|32767
-{
- end;
-
-OnCast:
- if(call("magic_checks")) end;
- if (Sp < 21) end;
- if (getmapflag(getmap(), MF_TOWN)) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (countitem("MaggotSlime") < 1 || countitem("Root") < 1) end;
- delitem "MaggotSlime", 1;
- delitem "Root", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 20000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 21;
- misceffect FX_MAGIC_MAGGOT_CAST, strcharinfo(0);
- callfunc "magic_exp";
- set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
- set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
- if (.@puppet < 1) end;
- set .count, ((sqrt(@spellpower)+(@spellpower/15))/5)+1, .@puppet;
- set .master, BL_ID, .@puppet;
- set .lifetime, (@spellpower*50)+10000, .@puppet;
- addnpctimer 5000-(@spellpower*5), .@puppet$+"::OnSummon";
- addnpctimer 6000, .@puppet$+"::OnDestroy";
- end;
-
-OnSummon:
- if (!(isloggedin(.master))) destroy;
- if(get(Hp, .master) < 1) destroy; // destroy if master is missing
- if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map
- specialeffect FX_MAGIC_MAGGOT_SPAWN;
- set .@i, 0;
- set .@x, getnpcx();
- set .@y, getnpcy();
- set .@map$, strnpcinfo(3);
- callsub S_SummonAll;
- end;
-
-OnDestroy:
- destroy;
-
-S_SummonAll:
- summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1002, 2, .lifetime;
- set .@i, .@i + 1;
- if (.@i < .count) goto S_SummonAll;
- destroy;
-
-OnInit:
- set .school, SKILL_MAGIC_ASTRAL;
- set .invocation$, chr(MAGIC_SYMBOL) + "kalmurk"; // used in npcs that refer to this spell
- void call("magic_register", "OnCast");
- set .level, 1;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level1-transmute-wood.txt b/world/map/npc/magic/level1-transmute-wood.txt
deleted file mode 100644
index c2763f1c..00000000
--- a/world/map/npc/magic/level1-transmute-wood.txt
+++ /dev/null
@@ -1,37 +0,0 @@
--|script|spell-transmute-wood|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 5) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (countitem("RawLog") >= 1) delitem "RawLog", 1; else end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 4000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 5;
- misceffect FX_MAGIC_WOOD_CAST, strcharinfo(0);
- if (@args$ == "boo") goto L_Mouboo;
- elif (@args$ == "lurk") goto L_Skytlurk;
- else message strcharinfo(0), "Magic : ##3##BYou do not know how to transmute wood into this kind of animal."; // FIXME: write a better sentence
- end;
-
-L_Mouboo:
- setarray @create_params[0], 1, 40;
- setarray @create_items$[0], "MoubooFigurine", "WarpedLog";
- callfunc "magic_create_item";
- callfunc "magic_exp";
- end;
-
-L_Skytlurk:
- if (rand(2) == 1) getitem "Iten", 1;
- else getitem "WarpedLog", 1;
- message strcharinfo(0), "Magic : ##3##BYou have no idea what a Skrytlurk looks like.";
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_TRANSMUTE;
- set .invocation$, chr(MAGIC_SYMBOL) + "parum"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 1;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level2-arrow-hail.txt b/world/map/npc/magic/level2-arrow-hail.txt
deleted file mode 100644
index 24866b1c..00000000
--- a/world/map/npc/magic/level2-arrow-hail.txt
+++ /dev/null
@@ -1,118 +0,0 @@
--|script|arrow-hail|32767
-{
- // we can not start here because for the puppets this is OnClick
- end;
-
-OnCast:
- if(call("magic_checks")) end;
- if (getskilllv(.school) < .level) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (Sp < 25) end;
- explode .@map_ext[0], getmap(), "-";
- if (.@map_ext[1] != 1 && getmap() != "099-5") end; // XXX this is fugly, in the future let's use MF_OUTSIDE to detect if a map is "outside" or "inside"
- if (getmapflag(getmap(), MF_TOWN)) end;
- if (countitem("Arrow") >= 20 && countitem("SulphurPowder") >= 1) delitem "Arrow", 20;
- elif (countitem("IronArrow") >= 20 && countitem("SulphurPowder") >= 1) delitem "IronArrow", 20;
- else end;
- delitem "SulphurPowder", 1;
- set Sp, Sp - 25;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 5000, "Magic Timer::OnClear"; // set the new debuff
-
- setarray @away[0], POS_X, POS_Y, getdir(), (.range + 1), 0;
- callsub S_AwayFrom;
-
- set @nearby, 0;
- foreach 1, getmap(), @away[0] - 14, @away[1] - 14, @away[0] + 14, @away[1] + 14,
- strnpcinfo(0) + "::OnNearbyNpc";
- if (@nearby) goto L_Absorb;
-
- callfunc "adjust_spellpower";
- set @new_npc_name$, "#" + strnpcinfo(0) + "#" + getcharid(3); // make a unique puppet name for every player
- callfunc "magic_exp";
- misceffect FX_MAGIC_AHAIL_CAST, strcharinfo(0);
- set @spell_npc, puppet(getmap(), POS_X, POS_Y, @new_npc_name$, 127); // clone npc => get puppet id
- if (@spell_npc < 1) end;
- set .max_hit, (@spellpower / 8), @spell_npc; // set .max_hit in the puppet
- set .caster, getcharid(3), @spell_npc; // tell the puppet who controls it
- set .damage, 125, @spell_npc;
- set .damage_bonus, (@spellpower / 5), @spell_npc;
- set .area_x, @away[0], @spell_npc; set .area_y, @away[1], @spell_npc;
- donpcevent @new_npc_name$+"::OnLaunch"; // start the puppet timer and strike
- initnpctimer @new_npc_name$; // start the destroy timer
- end;
-
-S_AwayFrom:
- if(@away[2] == 6 && !(iscollision(getmap(), (@away[0] + 1), @away[1]))) // right
- set @away[0], @away[0] + 1;
- if(@away[2] == 4 && !(iscollision(getmap(), @away[0], (@away[1] - 1)))) // up
- set @away[1], @away[1] - 1;
- if(@away[2] == 2 && !(iscollision(getmap(), (@away[0] - 1), @away[1]))) // left
- set @away[0], @away[0] - 1;
- if(@away[2] == 0 && !(iscollision(getmap(), @away[0], (@away[1] + 1)))) // down
- set @away[1], @away[1] + 1;
- set @away[4], @away[4] + 1;
- if(@away[4] < @away[3]) goto S_AwayFrom;
- return;
-
-L_Absorb:
- message strcharinfo(0), "##3Arrow Hail : ##BA nearby arrow hail absorbs your magic!";
- end;
-
-OnNearbyNpc:
- explode .@nearby$[0], strnpcinfo(0,@target_id), "#";
- if(.@nearby$[0] == "arrow-hail" || .@nearby$[1] == "arrow-hail")
- set @nearby, @nearby + 1;
- end;
-
-OnLaunch:
- if (!(isloggedin(.caster))) destroy;
- if(get(Hp, .caster) < 1) 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;
- callsub S_Launch;
- addnpctimer 250 + rand(50) + rand(50), strnpcinfo(0)+"::OnLaunch"; // loop until max
- end;
-
-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", .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;
-
-OnTimer30000:
- debugmes "frillyar timeout! [this shouldn't happen]";
- destroy;
-
-OnHit:
- if (!(isloggedin(.caster))) destroy;
- if(get(Hp, .caster) < 1) 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
- set .@damage, .damage + rand(.damage_bonus) + rand(.damage_bonus);
- if(.caster != @target_id)
- set .@damage, (.@damage * (100 - get(MDEF1, @target_id))) / 100;
- injure .caster, @target_id, .@damage;
- set .done, 1;
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_WAR;
- set .range, 7;
- set .invocation$, chr(MAGIC_SYMBOL) + "frillyar"; // used in npcs that refer to this spell
- void call("magic_register", "OnCast");
- set .level, 2;
- set .exp_gain, 2;
- end;
-}
diff --git a/world/map/npc/magic/level2-barrier.txt b/world/map/npc/magic/level2-barrier.txt
deleted file mode 100644
index ed695b77..00000000
--- a/world/map/npc/magic/level2-barrier.txt
+++ /dev/null
@@ -1,49 +0,0 @@
--|script|magic barrier|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 15) end;
- set .@level, getskilllv(.school);
- if (.@level < .level) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (.@level <= 3 && countitem("SmallMushroom") >= 1) delitem "SmallMushroom", 1;
- elif (.@level <= 3) end;
- set @target_id, getcharid(3, @args$);
- if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id) == 1)
- set @target_id, BL_ID; // fallback to self
- if (get(GM, @target_id) == 1) end;
- if (get(Hp, @target_id) < 1) end;
- 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
- callfunc "adjust_spellpower";
- set Sp, Sp - 15;
- misceffect FX_MAGIC_BARRIER_CAST, strcharinfo(0);
- callfunc "magic_exp";
-
- if (distance(BL_ID, @target_id) >= (@spellpower/30)+2) set @target_id, BL_ID;
- if (BL_ID == @target_id) set @args$, strcharinfo(0);
- if (BL_ID != @target_id) misceffect FX_MAGIC_BARRIER_HIT, @args$;
- set .@time, (@spellpower*200)+2000;
- 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.";
- set @asorm_future, gettimetick(0) + @asorm_time - 100, @target_id;
- addtimer @asorm_time - 100, strnpcinfo(0)+"::OnEnd", @target_id;
- end;
-
-OnEnd:
- if (gettimetick(0) - @asorm_future < 0) end;
- if (sc_check(SC_MBARRIER) != 1) end;
- message strcharinfo(0), "Barrier : Your magical barrier dissipates.";
- misceffect FX_MAGIC_BARRIER_END, strcharinfo(0);
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_ASTRAL;
- set .invocation$, chr(MAGIC_SYMBOL) + "asorm"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 3;
- end;
-}
diff --git a/world/map/npc/magic/level2-detect-players.txt b/world/map/npc/magic/level2-detect-players.txt
deleted file mode 100644
index 20961ec6..00000000
--- a/world/map/npc/magic/level2-detect-players.txt
+++ /dev/null
@@ -1,34 +0,0 @@
--|script|detect-players|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 7) end;
- if (getskilllv(.school) < .level) end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 300, "Magic Timer::OnClear";
- callfunc "adjust_spellpower";
- set Sp, Sp - 7;
- misceffect FX_MAGIC_WHO_CAST, strcharinfo(0);
- callfunc "magic_exp";
- set @inwilt$, "";
- set .@d, @spellpower/2;
- foreach 0, getmap(), POS_X - .@d, POS_Y - .@d, POS_X + .@d, POS_Y + .@d, strnpcinfo(0)+"::OnPC";
- message strcharinfo(0), if_then_else(@inwilt$=="", "You sense no-one else nearby.", "You sense the following: "+@inwilt$);
- end;
-
-OnPC:
- if (@target_id == BL_ID) end; // do not count the caster
- if (sc_check(SC_HIDE, @target_id)) end; // do not count players with anwiltyp
- if (getpvpflag(1, @target_id)) end; // do not count hidden GMs
- if (get(INVISIBLE, @target_id) == 1) end; // do not count invisible GMs
- if (@inwilt$ != "") set @inwilt$, @inwilt$ + ", ";
- set @inwilt$, @inwilt$ + strcharinfo(0, @target_id) + if_then_else(@spellpower > 99, "("+get(BaseLevel, @target_id)+")", "");
- end;
-
-OnInit:
- set .school, SKILL_MAGIC;
- set .invocation$, chr(MAGIC_SYMBOL) + "inwilt"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 0;
- end;
-}
diff --git a/world/map/npc/magic/level2-enchant-lifestone.txt b/world/map/npc/magic/level2-enchant-lifestone.txt
deleted file mode 100644
index b64f9855..00000000
--- a/world/map/npc/magic/level2-enchant-lifestone.txt
+++ /dev/null
@@ -1,36 +0,0 @@
--|script|enchant-lifestone|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 15) end;
- if (getskilllv(.school) < .level) end;
- if (countitem("BugLeg") >= 1) delitem "BugLeg", 1;
- elif (countitem("MaggotSlime") >= 1) delitem "MaggotSlime", 1;
- elif (countitem("MauveHerb") >= 1 && countitem("AlizarinHerb") >= 1 && countitem("CobaltHerb") >= 1 && countitem("GambogeHerb") >= 1) goto L_Herbs;
- else end;
- goto L_Proceed;
-
-L_Herbs:
- delitem "MauveHerb", 1;
- delitem "AlizarinHerb", 1;
- delitem "CobaltHerb", 1;
- delitem "GambogeHerb", 1;
- goto L_Proceed;
-
-L_Proceed:
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 4000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 15;
- misceffect FX_MAGIC_STONE_CAST, strcharinfo(0);
- getitem "Lifestone", 1;
- callfunc "magic_exp";
- end;
-
-OnInit:
- set .school, SKILL_MAGIC;
- set .invocation$, chr(MAGIC_SYMBOL) + "manpahil"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level2-flying-backpack.txt b/world/map/npc/magic/level2-flying-backpack.txt
deleted file mode 100644
index 84c95e70..00000000
--- a/world/map/npc/magic/level2-flying-backpack.txt
+++ /dev/null
@@ -1,44 +0,0 @@
--|script|flying-backpack|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 12) end;
- set .@level, getskilllv(.school);
- if (.@level < .level) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (.@level <= 3 && countitem("SilkCocoon") >= 1) delitem "SilkCocoon", 1;
- elif (.@level <= 3) end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 1000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 12;
- misceffect FX_MAGIC_FLYING_CAST, strcharinfo(0);
- callfunc "magic_exp";
- set @target_id, getcharid(3, @args$);
- if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id) == 1)
- set @target_id, BL_ID; // fallback to self
- if (distance(BL_ID, @target_id) >= (@spellpower/30)+2) set @target_id, BL_ID;
- if (get(GM, @target_id) == 1) end;
- if (BL_ID != @target_id) misceffect FX_MAGIC_FLYING_HIT, @args$;
- if (BL_ID == @target_id) set @args$, strcharinfo(0);
- 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.";
- set @plugh_future, gettimetick(0) + @plugh_time - 100, @target_id;
- addtimer @plugh_time - 100, strnpcinfo(0)+"::OnEnd", @target_id;
- end;
-
-OnEnd:
- if (gettimetick(0) - @plugh_future < 0) end;
- if (sc_check(SC_FLYING_BACKPACK) != 1) end;
- message strcharinfo(0), "Backpack : Your backpack is no longer levitating.";
- misceffect FX_MAGIC_FLYING_END, strcharinfo(0);
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_NATURE;
- set .invocation$, chr(MAGIC_SYMBOL) + "plugh"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level2-happy-curse.txt b/world/map/npc/magic/level2-happy-curse.txt
deleted file mode 100644
index 535afa11..00000000
--- a/world/map/npc/magic/level2-happy-curse.txt
+++ /dev/null
@@ -1,43 +0,0 @@
--|script|happy-curse|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 13) end;
- set .@level, getskilllv(.school);
- if (.@level < .level) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (.@level <= 3 && countitem("GingerBreadMan") >= 1) delitem "GingerBreadMan", 1;
- elif (.@level <= 3) end;
-
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 1000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 13;
- misceffect FX_MAGIC_JOY_CAST, strcharinfo(0);
- callfunc "magic_exp";
-
- set @distance, (@spellpower / 100) + 1;
- foreach 0, getmap(), (POS_X - @distance), (POS_Y - @distance), (POS_X + @distance), (POS_Y + @distance), strnpcinfo(0) + "::OnHit";
- end;
-
-OnHit:
- 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;
- emotion @joyplim_emote, strcharinfo(0, @target_id);
- addtimer 500, strnpcinfo(0)+"::OnEmote", @target_id;
- end;
-
-OnEmote:
- emotion @joyplim_emote, "self";
- set @joyplim_count, @joyplim_count + 1;
- if (@joyplim_count < @joyplim_total) addtimer 500, strnpcinfo(0)+"::OnEmote";
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_NATURE;
- set .invocation$, chr(MAGIC_SYMBOL) + "joyplim"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level2-hide.txt b/world/map/npc/magic/level2-hide.txt
deleted file mode 100644
index b129a163..00000000
--- a/world/map/npc/magic/level2-hide.txt
+++ /dev/null
@@ -1,47 +0,0 @@
--|script|spell-hide|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 11) end;
- set .@level, getskilllv(.school);
- if (.@level < .level) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (.@level <= 3 && countitem("CottonCloth") >= 1) delitem "CottonCloth", 1;
- elif (.@level <= 3) end;
- set @target_id, getcharid(3, @args$);
- if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id))
- set @target_id, BL_ID; // fallback to self
- if (get(GM, @target_id) == 1) end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 1000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 11;
- misceffect FX_MAGIC_HIDE_CAST, strcharinfo(0);
- callfunc "magic_exp";
-
- if (distance(BL_ID, @target_id) >= (@spellpower/30)+2) set @target_id, BL_ID;
- if (BL_ID == @target_id) set @args$, strcharinfo(0);
- if (BL_ID != @target_id) misceffect FX_MAGIC_HIDE_HIT, @args$;
- set .@time, (@spellpower*2500)+5000;
- set @anwiltyp_time, .@time, @target_id;
- 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!";
- set @anwiltyp_future, gettimetick(0) + @anwiltyp_time - 100, @target_id;
- addtimer @anwiltyp_time, strnpcinfo(0)+"::OnEnd", @target_id;
- end;
-
-OnEnd:
- if (gettimetick(0) - @anwiltyp_future < 0) end;
- if (sc_check(SC_HIDE) != 1) end;
- message strcharinfo(0), "Magic : You are no longer hidden.";
- misceffect FX_MAGIC_HIDE_END, strcharinfo(0);
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_ASTRAL;
- set .invocation$, chr(MAGIC_SYMBOL) + "anwiltyp"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 2;
- end;
-}
diff --git a/world/map/npc/magic/level2-lay-on-hands.txt b/world/map/npc/magic/level2-lay-on-hands.txt
deleted file mode 100644
index 29d9292b..00000000
--- a/world/map/npc/magic/level2-lay-on-hands.txt
+++ /dev/null
@@ -1,81 +0,0 @@
--|script|lay-on-hands|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 10) end;
- if (getskilllv(.school) < .level) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (@args$ == "Mouboo" || @args$ == "mouboo") goto L_Mouboo;
- set @target_id, getcharid(3, @args$);
- if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id) || BL_ID == @target_id) end;
- if (get(GM, @target_id) == 1) end;
- if (Hp <= get(MaxHp, @target_id) / 20) end; // hp needs to be > 1/20 * target hp
- callfunc "adjust_spellpower";
- if (getmap() == "099-4") goto L_SpecialRules4;
- if (getmap() == "099-5") goto L_SpecialRules5;
- if (distance(BL_ID, @target_id) >= (((sqrt(@spellpower)*12)+@spellpower)/100)+2) end;
- if (sc_check(SC_HALT_REGENERATE,@target_id)) end;
- if (getequipid(equip_head, @args$) == 888) end; // magic gm top hat
- set @needed, get(MaxHp, @target_id) - get(Hp, @target_id);
- goto L_Pay;
-
-L_Pay:
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 500, "Magic Timer::OnClear"; // XXX should this be 0 ?
- set Sp, Sp - 10;
- misceffect FX_MAGIC_LAY_CAST, strcharinfo(0); // on caster
- misceffect FX_MAGIC_LAY_HIT, @args$; // on target
-
- if (get(Hp, @target_id) < 1) end;
-
- set .@fraction, max(80, 200 - (Vit + (@spellpower/10))); // pay at least 40%
- set .@payment, (@needed * .@fraction) / 200;
- set .@available, Hp - (MaxHp / 20);
- 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 @mexp, min(.exp_gain, .@payment/100);
- void call("gain_heal_xp", @heal_value, 1, 1, 3);
- callfunc "magic_exp";
-
- set .@dark, getskilllv(SKILL_MAGIC_DARK) >= 2; // true if dark magic user
- set .@bad, (MaxHp/20)*(0-1);
- if (.@dark && GM < 20) heal .@bad, 0;
- sc_start SC_HALT_REGENERATE, if_then_else(.@dark, 5000, 10000), 0;
-
- set .@thp, get(Hp, @target_id);
- if (.@thp < 1) end;
- set Hp, max(.@thp, .@thp + @heal_value), @target_id;
- end;
-
-L_Mouboo:
- set @target_id, getnpcid("Mouboo");
- callfunc "adjust_spellpower";
- if (distance(BL_ID, @target_id) >= (((sqrt(@spellpower) * 12) + @spellpower) / 100) + 2) end;
- misceffect FX_MAGIC_LAY_CAST, strcharinfo(0); // on caster
- misceffect FX_MAGIC_LAY_HIT, @target_id; // on target
- callfunc "QuestMoubooHeal";
- end;
-
-// Special rules for a couple special maps
-L_SpecialRules4:
- if (getmap(@target_id) != "099-5") end;
- if (sc_check(SC_HALT_REGENERATE,@target_id)) end;
- if (getequipid(equip_head, @args$) == 888) end; // magic gm top hat
- set @needed, get(MaxHp, @target_id) - get(Hp, @target_id);
- goto L_Pay;
-L_SpecialRules5:
- if (getmap(@target_id) != "099-4") end;
- if (sc_check(SC_HALT_REGENERATE,@target_id)) end;
- if (getequipid(equip_head, @args$) == 888) end; // magic gm top hat
- set @needed, get(MaxHp, @target_id) - get(Hp, @target_id);
- goto L_Pay;
-
-OnInit:
- set .school, SKILL_MAGIC_LIFE;
- set .invocation$, chr(MAGIC_SYMBOL) + "inma"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 1; // this is MAX possible exp
- end;
-}
diff --git a/world/map/npc/magic/level2-lightning-strike.txt b/world/map/npc/magic/level2-lightning-strike.txt
deleted file mode 100644
index d454abc6..00000000
--- a/world/map/npc/magic/level2-lightning-strike.txt
+++ /dev/null
@@ -1,89 +0,0 @@
--|script|lightning-strike|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 20) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- set .@level, getskilllv(.school);
- if (.@level < .level) end;
- if (.@level <= 3 && countitem("IronPowder") >= 1) delitem "IronPowder", 1;
- elif (.@level <= 3) end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 1000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 20;
- misceffect FX_MAGIC_BOLT_CAST, strcharinfo(0);
- setarray @ingravspell[0],
- @spellpower,
- Luk,
- ((@spellpower/90)+1), // charges
- (((200 - Agi) * 3000) / 200), // delay
- 0, // in_rain
- 0; // target id (tmp)
- if (getequipid(equip_misc1) == 5253 || getequipid(equip_misc2) == 5253)
- set @ingravspell[3], @ingravspell[3]*8/10+1;
-
- callfunc "magic_exp";
- goto L_FreeRecast;
-
-OnAttack:
- if (target(BL_ID, @target_id, 0x36) != 0x36) goto L_FreeRecast; // 0x10 | 0x02 | 0x04 | 0x20
-
- set .@p, get(.max_radius, "rain") + 1;
- set @ingravspell[5], @target_id; // store it because foreach overwrites it
- foreach 1, getmap(), POS_X-.@p, POS_Y-.@p, POS_X+.@p, POS_Y+.@p, strnpcinfo(0)+"::OnNpc";
- set @target_id, @ingravspell[5]; // now restore it
-
- set @ingravspell[2], @ingravspell[2] - 1;
- if (@ingravspell[4] & 1) goto L_InRain;
- void call("elt_damage", @ingravspell[0], (@ingravspell[0]/2)+1, ELT_EARTH, ELT_WIND, FX_LIGHTNING1 + rand(3));
- goto L_FreeRecast;
-
-L_FreeRecast:
- if (@ingravspell[2] > 0)
- addtimer 0, strnpcinfo(0) + "::OnSetRecast";
- end;
-
-OnDischarge:
- if (@ingravspell[2] < 1) end;
- set @ingravspell[2], 0;
- misceffect FX_MAGIC_DISCHARGE, strcharinfo(0);
- overrideattack;
- end;
-
-OnSetRecast:
- overrideattack @ingravspell[3], 8, ATTACK_ICON_GENERIC, 31, strnpcinfo(0)+"::OnAttack", @ingravspell[2];
- end;
-
-OnNpc:
- set .@name$, strnpcinfo(0,@target_id);
- explode .@nearby$[0], .@name$, "#";
- if (.@nearby$[0] != "rain" && .@nearby$[1] != "rain") end;
- setarray .@l[0], getnpcx(.@name$), getnpcy(.@name$), get(.radius, @target_id); // kaflosh x, y, radius
- setarray @ingravspell[6], .@l[0]-.@l[2], .@l[1]-.@l[2], .@l[0]+.@l[2], .@l[1]+.@l[2]; // kaflosh x1, y1, x2, y2 <= this is "area"
- if (POS_X >= @ingravspell[6] && POS_Y >= @ingravspell[7] && POS_X <= @ingravspell[8] && POS_Y <= @ingravspell[9])
- set @ingravspell[4], @ingravspell[4] | 1;
- end;
-
-L_InRain:
- set @ingravspell[10], 0;
- foreach 0, getmap(), @ingravspell[6], @ingravspell[7], @ingravspell[8], @ingravspell[9], strnpcinfo(0)+"::OnEntityInRain";
- if (@ingravspell[10] >= 1 && (@ingravspell[1] + rand(200)) >= 150) goto L_FreeRecast;
- misceffect FX_LIGHTNING1 + rand(3), strcharinfo(0);
- heal 0 - @ingravspell[0], 0;
- goto L_FreeRecast;
-
-OnEntityInRain:
- if (target(BL_ID, @target_id, 16) != 16) end; // 0x10
- if (@ingravspell[1] + rand(200) <= 175) end;
- set @ingravspell[10], @ingravspell[10] + 1;
- void call("elt_damage", @ingravspell[0]/6, (((@ingravspell[0]/2)+1)/3)+1, ELT_EARTH, ELT_WIND, FX_LIGHTNING1 + rand(3));
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_WAR;
- set .invocation$, chr(MAGIC_SYMBOL) + "ingrav"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 2;
- end;
-}
diff --git a/world/map/npc/magic/level2-magic-knuckles.txt b/world/map/npc/magic/level2-magic-knuckles.txt
deleted file mode 100644
index acc3405d..00000000
--- a/world/map/npc/magic/level2-magic-knuckles.txt
+++ /dev/null
@@ -1,55 +0,0 @@
--|script|magic-knuckles|32767
-{
- if (call("magic_checks")) end;
- if (Sp < 20) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- set .@level, getskilllv(.school);
- if (.@level < .level) end;
- if (getequipid(equip_hand1) != -1 || getequipid(equip_hand2) != -1) end;
- if (.@level <= 3 && countitem("Beer") >= 1) delitem "Beer", 1;
- elif (.@level <= 3) end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 500, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 20;
- misceffect FX_MAGIC_KNUCKLE_CAST, strcharinfo(0);
- setarray @upmarmuspell[0],
- BASE_ATK, // dmg
- ((@spellpower/10) + ((Dex * 8)/(sqrt(BaseLevel + 34)) + 20)), // charges (you get more at lower levels)
- (sqrt(300 - (Agi * 2)) + (5/2)), // delay
- Agi, // dmg bonus
- (((BaseLevel/5) + Str) * 2); // do not allow to equip light armor, cast, and then switch to heavy armor to get bonus str
- callfunc "magic_exp";
- goto L_FreeRecast;
-
-OnAttack:
- if (getequipid(equip_hand1) != -1 || getequipid(equip_hand2) != -1) goto OnDischarge;
- if (target(BL_ID, @target_id, 22) != 22) goto L_FreeRecast; // 0x10 | 0x02 | 0x04
- void call("elt_damage", @upmarmuspell[0], (@upmarmuspell[3] + @upmarmuspell[4]), ELT_WATER, ELT_FIRE, FX_NONE);
- set @upmarmuspell[1], @upmarmuspell[1] - 1;
- goto L_FreeRecast;
-
-L_FreeRecast:
- if (@upmarmuspell[1] > 0)
- addtimer 0, strnpcinfo(0) + "::OnSetRecast";
- end;
-
-OnDischarge:
- if (@upmarmuspell[1] < 1) end;
- set @upmarmuspell[1], 0;
- misceffect FX_MAGIC_DISCHARGE, strcharinfo(0);
- overrideattack;
- end;
-
-OnSetRecast:
- overrideattack (@upmarmuspell[2] * @upmarmuspell[2]), 1, ATTACK_ICON_GENERIC, OVERRIDE_KNUCKLES, strnpcinfo(0)+"::OnAttack", @upmarmuspell[1]; // delay needs to be squared
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_WAR;
- set .invocation$, chr(MAGIC_SYMBOL) + "upmarmu"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level2-make-arrows.txt b/world/map/npc/magic/level2-make-arrows.txt
deleted file mode 100644
index fa0a6b31..00000000
--- a/world/map/npc/magic/level2-make-arrows.txt
+++ /dev/null
@@ -1,27 +0,0 @@
--|script|make-arrows|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 8) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (getskilllv(.school) < .level) end;
- if (countitem("RawLog") < 1) end;
- delitem "RawLog", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 5000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 8;
- misceffect FX_MAGIC_ARROW_CAST, strcharinfo(0);
- setarray @create_params[0], (@spellpower/40)+1+(rand(max(1,(800-@spellpower)))/80), 500;
- setarray @create_items$[0], "Arrow", "WarpedLog";
- callfunc "magic_create_item";
- callfunc "magic_exp";
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_TRANSMUTE;
- set .invocation$, chr(MAGIC_SYMBOL) + "kularzufrill"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level2-make-iron-powder.txt b/world/map/npc/magic/level2-make-iron-powder.txt
deleted file mode 100644
index 6f1c11b2..00000000
--- a/world/map/npc/magic/level2-make-iron-powder.txt
+++ /dev/null
@@ -1,27 +0,0 @@
--|script|make-iron-powder|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 8) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (getskilllv(.school) < .level) end;
- if (countitem("IronOre") < 1) end;
- delitem "IronOre", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 5000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 8;
- misceffect FX_MAGIC_IRONP_CAST, strcharinfo(0);
- setarray @create_params[0], (@spellpower/140)+1+(rand(max(1,(900-@spellpower)))/220), 700;
- setarray @create_items$[0], "IronPowder", "IronOre";
- callfunc "magic_create_item";
- callfunc "magic_exp";
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_TRANSMUTE;
- set .invocation$, chr(MAGIC_SYMBOL) + "zukminbirf"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 3;
- end;
-}
diff --git a/world/map/npc/magic/level2-make-shirt.txt b/world/map/npc/magic/level2-make-shirt.txt
deleted file mode 100644
index 838ffadd..00000000
--- a/world/map/npc/magic/level2-make-shirt.txt
+++ /dev/null
@@ -1,25 +0,0 @@
--|script|make-shirt|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 25) end;
- if (getskilllv(.school) < .level) end;
- if (countitem("CottonCloth") >= 5) delitem "CottonCloth", 5; else end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 5000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 25;
- misceffect FX_MAGIC_SHIRT_CAST, strcharinfo(0);
- setarray @create_params[0], 1, 425;
- setarray @create_items$[0], "CottonShirt", "CottonCloth";
- callfunc "magic_create_item";
- callfunc "magic_exp";
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_TRANSMUTE;
- set .invocation$, chr(MAGIC_SYMBOL) + "patmuploo"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 2;
- end;
-}
diff --git a/world/map/npc/magic/level2-make-short-tanktop.txt b/world/map/npc/magic/level2-make-short-tanktop.txt
deleted file mode 100644
index b722d9dd..00000000
--- a/world/map/npc/magic/level2-make-short-tanktop.txt
+++ /dev/null
@@ -1,25 +0,0 @@
--|script|make-short-tanktop|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 25) end;
- if (getskilllv(.school) < .level) end;
- if (countitem("CottonCloth") >= 3) delitem "CottonCloth", 3; else end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 5000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 25;
- misceffect FX_MAGIC_SHIRT_CAST, strcharinfo(0);
- setarray @create_params[0], 1, 250;
- setarray @create_items$[0], "ShortTankTop", "CottonCloth";
- callfunc "magic_create_item";
- callfunc "magic_exp";
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_TRANSMUTE;
- set .invocation$, chr(MAGIC_SYMBOL) + "patviloree"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 2;
- end;
-}
diff --git a/world/map/npc/magic/level2-make-tanktop.txt b/world/map/npc/magic/level2-make-tanktop.txt
deleted file mode 100644
index b8f40932..00000000
--- a/world/map/npc/magic/level2-make-tanktop.txt
+++ /dev/null
@@ -1,25 +0,0 @@
--|script|make-tanktop|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 25) end;
- if (getskilllv(.school) < .level) end;
- if (countitem("CottonCloth") >= 4) delitem "CottonCloth", 4; else end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 5000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 25;
- misceffect FX_MAGIC_SHIRT_CAST, strcharinfo(0);
- setarray @create_params[0], 1, 350;
- setarray @create_items$[0], "TankTop", "CottonCloth";
- callfunc "magic_create_item";
- callfunc "magic_exp";
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_TRANSMUTE;
- set .invocation$, chr(MAGIC_SYMBOL) + "patloree"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 2;
- end;
-}
diff --git a/world/map/npc/magic/level2-protect.txt b/world/map/npc/magic/level2-protect.txt
deleted file mode 100644
index 4e3b9f88..00000000
--- a/world/map/npc/magic/level2-protect.txt
+++ /dev/null
@@ -1,50 +0,0 @@
--|script|protect|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 14) end;
- set .@level, getskilllv(.school);
- if (.@level < .level) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (.@level <= 3 && countitem("HardSpike") < 1) end;
- set @target_id, getcharid(3, @args$);
- if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id))
- set @target_id, BL_ID; // fallback to self
- if (get(GM, @target_id) == 1) end;
- if (get(Hp, @target_id) < 1) end;
- 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;
- if (.@level <= 3) delitem "HardSpike", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 1500, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 14;
- misceffect FX_MAGIC_SHIELD_CAST, strcharinfo(0);
- callfunc "magic_exp";
-
- if (BL_ID == @target_id) set @args$, strcharinfo(0);
- misceffect FX_MAGIC_SHIELD, @args$;
- set .@time, (@spellpower*1000)+5000;
- 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.";
- set @betsanc_future, gettimetick(0) + @betsanc_time - 100, @target_id;
- addtimer @betsanc_time - 100, strnpcinfo(0)+"::OnEnd", @target_id;
- end;
-
-OnEnd:
- if (gettimetick(0) - @betsanc_future < 0) end;
- if (sc_check(SC_PHYS_SHIELD) != 1) end;
- message strcharinfo(0), "Shield : You feel less protected.";
- misceffect FX_MAGIC_SHIELD_ENDS, strcharinfo(0);
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_NATURE;
- set .invocation$, chr(MAGIC_SYMBOL) + "betsanc"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 2;
- end;
-}
diff --git a/world/map/npc/magic/level2-rain.txt b/world/map/npc/magic/level2-rain.txt
deleted file mode 100644
index fac98690..00000000
--- a/world/map/npc/magic/level2-rain.txt
+++ /dev/null
@@ -1,107 +0,0 @@
--|script|rain|32767
-{
- // we can not start here because for the puppets this is OnClick
- end;
-
-OnCast:
- if(call("magic_checks")) end;
- if (getskilllv(.school) < .level) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (Sp < 17) end;
- explode .@map_ext[0], getmap(), "-";
- if (.@map_ext[1] != 1 && getmap() != "099-5") end; // XXX this is fugly, in the future let's use MF_OUTSIDE to detect if a map is "outside" or "inside"
- if (getmapflag(getmap(), MF_TOWN)) end;
- if (getskilllv(.school) < 4 && countitem("BottleOfWater") >= 1) delitem "BottleOfWater", 1;
- elif (getskilllv(.school) < 4) end;
- set Sp, Sp - 17;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 3000, "Magic Timer::OnClear"; // set the new debuff
-
- callfunc "adjust_spellpower";
- set @krad, min(.max_radius,(min(@spellpower,200)/30)+3); // kaflosh radius
-
- set @nearby, 0;
- foreach 1, getmap(), POS_X - .max_radius, POS_Y - .max_radius, POS_X + .max_radius, POS_Y + .max_radius,
- strnpcinfo(0) + "::OnNearbyNpc";
- if (@nearby) goto L_Absorb;
-
- set @new_npc_name$, "#" + strnpcinfo(0) + "#" + getcharid(3); // make a unique puppet name for every player
- callfunc "magic_exp";
- misceffect FX_MAGIC_RAIN_CAST, strcharinfo(0);
- set @spell_npc, puppet(getmap(), POS_X, POS_Y, @new_npc_name$, 127); // clone npc => get puppet id
- if (@spell_npc < 1) end;
- set .caster, getcharid(3), @spell_npc; // tell the puppet who controls it
- set .radius, @krad, @spell_npc; // this is also used by ingrav, don't rename
- set .initial_x, POS_X, @spell_npc;
- set .initial_y, POS_Y, @spell_npc;
- set .max, @spellpower/3, @spell_npc;
- set .max_launch, min(200,@spellpower/2)/100, @spell_npc;
- donpcevent @new_npc_name$+"::OnLaunch"; // start
- addnpctimer 30000, @new_npc_name$+"::OnDestroy"; // this is just a failsafe in case the npc is not properly destroyed
- if(isin("011-1", 85, 31, 103, 45)) goto L_Pumpkins;
- end;
-
-L_Absorb:
- message strcharinfo(0), "##3Rain : ##BA nearby raincloud absorbs your magic.";
- end;
-
-OnNearbyNpc:
- explode .@nearby$[0], strnpcinfo(0,@target_id), "#";
- if(.@nearby$[1] == "DruidTree0" || .@nearby$[1] == "DruidTree0") goto L_Tree;
- if(.@nearby$[0] == "rain" || .@nearby$[1] == "rain")
- set @nearby, @nearby + 1;
- end;
-
-L_Pumpkins:
- callfunc "HalloweenQuestWaterPumpkins";
- end;
-
-L_Tree:
- set .@x, get(POS_X, @target_id); set .@y, get(POS_Y, @target_id);
- if (.@x < POS_X-@krad || .@y < POS_Y-@krad || .@x > POS_X+@krad || .@y > POS_Y+@krad) end; // in max radius but not in puppet area
- set @flag, 1;
- callfunc "QuestTreeTrigger";
- close;
-
-OnLaunch:
- if (!(isloggedin(.caster))) destroy;
- if(get(Hp, .caster) < 1) 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;
- callsub S_Launch;
- addnpctimer 400 + rand(100), strnpcinfo(0)+"::OnLaunch"; // loop until max
- end;
-
-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", .caster;
- set .launch, .launch + 1;
- if(.launch < .max_launch) goto S_Launch;
- return;
-
-OnHit:
- if (!(isloggedin(.caster))) destroy;
- if(get(Hp, .caster) < 1) 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)
- injure .caster, @target_id, ((rand((@spellpower/15)+5)+2) * (100 - get(MDEF1, @target_id))) / 100;
- end;
-
-OnDestroy:
- 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:
- set .school, SKILL_MAGIC_NATURE;
- set .invocation$, chr(MAGIC_SYMBOL) + "kaflosh"; // used in npcs that refer to this spell
- void call("magic_register", "OnCast");
- set .level, 2;
- set .exp_gain, 1;
- set .max_radius, 15;
- end;
-}
diff --git a/world/map/npc/magic/level2-shear.txt b/world/map/npc/magic/level2-shear.txt
deleted file mode 100644
index 325e0863..00000000
--- a/world/map/npc/magic/level2-shear.txt
+++ /dev/null
@@ -1,68 +0,0 @@
--|script|shear|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 23) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (getskilllv(.school) < .level) end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 1000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 23;
- misceffect FX_MAGIC_SHEAR_CAST, strcharinfo(0);
- setarray @chipchipspell[0],
- @spellpower,
- (((200 - Agi) * 2000) / 200); //delay
- callfunc "magic_exp";
- goto L_FreeRecast;
-
-OnAttack:
- if (isloggedin(@target_id)) goto L_FreeRecast; // can not shear a player
- if (sc_check(SC_SHEARED, @target_id)) goto L_FreeRecast; // mob already sheared
- if (target(BL_ID, @target_id, 22) != 22) goto L_FreeRecast; // 0x10 | 0x02 | 0x04
- sc_start SC_SHEARED, 600000, 0, @target_id;
- set .@score, rand(1000 - rand(@chipchipspell[0]));
- set .@id, get(Class, @target_id); // get the mob ID
- set @chipchipspell[2], 0;
-
- if (.@id == 1020 && .@score < 300) set .@item$, "WhiteFur"; // Fluffy
- elif (.@id == 1027 && .@score < 300) set .@item$, "WhiteFur"; // EasterFluffy
- elif (.@id == 1019 && .@score < 250) set .@item$, "HardSpike"; // SpikyMushroom
- elif (.@id == 1028 && .@score < 175) set .@item$, "CottonCloth"; // Mouboo
- elif (.@id == 1029 && .@score < 700) set .@item$, "MauveHerb"; // MauvePlant
- elif (.@id == 1030 && .@score < 700) set .@item$, "CobaltHerb"; // CobaltPlant
- elif (.@id == 1031 && .@score < 700) set .@item$, "GambogeHerb"; // GambogePlant
- elif (.@id == 1032 && .@score < 700) set .@item$, "AlizarinHerb"; // AlizarinPlant
- elif (.@id == 1035 && .@score < 300) set .@item$, "SilkCocoon"; // SilkWorm
- elif (.@id == 1018 && .@score < 180) set .@item$, "PinkAntenna"; // Pinkie
- else end;
- makeitem .@item$, 1, getmap(), rand(POS_X - 1, POS_X + 1), rand(POS_Y - 1, POS_Y + 1);
-
- if (.@id != 1020 && .@id != 1028 && .@id != 1018 && rand(2) != 1) end;
- set @value, 1;
- callfunc "QuestSagathaHappy";
- end;
-
-L_FreeRecast:
- set @chipchipspell[2], 1;
- addtimer 0, strnpcinfo(0) + "::OnSetRecast"; // we can't do it while already overridden, until it reaches a script terminator
- end;
-
-OnDischarge:
- if (@chipchipspell[2] < 1) end;
- set @chipchipspell[2], 0;
- misceffect FX_MAGIC_DISCHARGE, strcharinfo(0);
- overrideattack;
- end;
-
-OnSetRecast:
- overrideattack @chipchipspell[1], 1, ATTACK_ICON_SHEARING, OVERRIDE_SHEAR, strnpcinfo(0)+"::OnAttack", @chipchipspell[2];
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_NATURE;
- set .invocation$, chr(MAGIC_SYMBOL) + "chipchip"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 0;
- end;
-}
diff --git a/world/map/npc/magic/level2-summon-fluffies.txt b/world/map/npc/magic/level2-summon-fluffies.txt
deleted file mode 100644
index b614e4a3..00000000
--- a/world/map/npc/magic/level2-summon-fluffies.txt
+++ /dev/null
@@ -1,58 +0,0 @@
--|script|smfluffies|32767
-{
- end;
-
-OnCast:
- if(call("magic_checks")) end;
- if (Sp < 39) end;
- if (getmapflag(getmap(), MF_TOWN)) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (getskilllv(.school) < .level) end;
- if (countitem("WhiteFur") < 1 || countitem("Root") < 1) end;
- delitem "WhiteFur", 1;
- delitem "Root", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 20000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 39;
- misceffect FX_MAGIC_FLUFFY_CAST, strcharinfo(0);
- callfunc "magic_exp";
- set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
- set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
- if (.@puppet < 1) end;
- set .count, (@spellpower/170)+1+(@spellpower/430), .@puppet;
- set .master, BL_ID, .@puppet;
- set .lifetime, @spellpower*350, .@puppet;
- addnpctimer 5000-(@spellpower*8), .@puppet$+"::OnSummon";
- addnpctimer 6000, .@puppet$+"::OnDestroy";
- end;
-
-OnSummon:
- if (!(isloggedin(.master))) destroy;
- if(get(Hp, .master) < 1) destroy; // destroy if master is missing
- if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map
- specialeffect FX_MAGIC_FLUFFY_SPAWN;
- set .@i, 0;
- set .@x, getnpcx();
- set .@y, getnpcy();
- set .@map$, strnpcinfo(3);
- callsub S_SummonAll;
- end;
-
-OnDestroy:
- destroy;
-
-S_SummonAll:
- summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1020, 2, .lifetime;
- set .@i, .@i + 1;
- if (.@i < .count) goto S_SummonAll;
- destroy;
-
-OnInit:
- set .school, SKILL_MAGIC_ASTRAL;
- set .invocation$, chr(MAGIC_SYMBOL) + "kalakarenk"; // used in npcs that refer to this spell
- void call("magic_register", "OnCast");
- set .level, 2;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level2-summon-mouboo.txt b/world/map/npc/magic/level2-summon-mouboo.txt
deleted file mode 100644
index dfa60e57..00000000
--- a/world/map/npc/magic/level2-summon-mouboo.txt
+++ /dev/null
@@ -1,58 +0,0 @@
--|script|smmouboo|32767
-{
- end;
-
-OnCast:
- if(call("magic_checks")) end;
- if (Sp < 35) end;
- if (getmapflag(getmap(), MF_TOWN)) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (getskilllv(.school) < .level) end;
- if (countitem("MoubooFigurine") < 1 || countitem("Root") < 1) end;
- delitem "MoubooFigurine", 1;
- delitem "Root", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 20000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 35;
- misceffect FX_MAGIC_MOUBOO_CAST, strcharinfo(0);
- callfunc "magic_exp";
- set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
- set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
- if (.@puppet < 1) end;
- set .count, (@spellpower/270)+1, .@puppet;
- set .master, BL_ID, .@puppet;
- set .lifetime, @spellpower*100, .@puppet;
- addnpctimer 4000-(@spellpower*9), .@puppet$+"::OnSummon";
- addnpctimer 6000, .@puppet$+"::OnDestroy";
- end;
-
-OnSummon:
- if (!(isloggedin(.master))) destroy;
- if(get(Hp, .master) < 1) destroy; // destroy if master is missing
- if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map
- specialeffect FX_MAGIC_MOUBOO_SPAWN;
- set .@i, 0;
- set .@x, getnpcx();
- set .@y, getnpcy();
- set .@map$, strnpcinfo(3);
- callsub S_SummonAll;
- end;
-
-OnDestroy:
- destroy;
-
-S_SummonAll:
- summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1028, 2, .lifetime;
- set .@i, .@i + 1;
- if (.@i < .count) goto S_SummonAll;
- destroy;
-
-OnInit:
- set .school, SKILL_MAGIC_ASTRAL;
- set .invocation$, chr(MAGIC_SYMBOL) + "kalboo"; // used in npcs that refer to this spell
- void call("magic_register", "OnCast");
- set .level, 2;
- set .exp_gain, 2;
- end;
-}
diff --git a/world/map/npc/magic/level2-summon-pinkie.txt b/world/map/npc/magic/level2-summon-pinkie.txt
deleted file mode 100644
index efcb014c..00000000
--- a/world/map/npc/magic/level2-summon-pinkie.txt
+++ /dev/null
@@ -1,58 +0,0 @@
--|script|smpinkie|32767
-{
- end;
-
-OnCast:
- if(call("magic_checks")) end;
- if (Sp < 35) end;
- if (getmapflag(getmap(), MF_TOWN)) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (getskilllv(.school) < .level) end;
- if (countitem("PinkAntenna") < 1 || countitem("Root") < 1) end;
- delitem "PinkAntenna", 1;
- delitem "Root", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 20000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 35;
- misceffect FX_MAGIC_PINKY_CAST, strcharinfo(0);
- callfunc "magic_exp";
- set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
- set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
- if (.@puppet < 1) end;
- set .count, (@spellpower/120)+1, .@puppet;
- set .master, BL_ID, .@puppet;
- set .lifetime, @spellpower*150, .@puppet;
- addnpctimer 5000-(@spellpower*9), .@puppet$+"::OnSummon";
- addnpctimer 6000, .@puppet$+"::OnDestroy";
- end;
-
-OnSummon:
- if (!(isloggedin(.master))) destroy;
- if(get(Hp, .master) < 1) destroy; // destroy if master is missing
- if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map
- specialeffect FX_MAGIC_PINKY_SPAWN;
- set .@i, 0;
- set .@x, getnpcx();
- set .@y, getnpcy();
- set .@map$, strnpcinfo(3);
- callsub S_SummonAll;
- end;
-
-OnDestroy:
- destroy;
-
-S_SummonAll:
- summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1018, 2, .lifetime;
- set .@i, .@i + 1;
- if (.@i < .count) goto S_SummonAll;
- destroy;
-
-OnInit:
- set .school, SKILL_MAGIC_ASTRAL;
- set .invocation$, chr(MAGIC_SYMBOL) + "kalgina"; // used in npcs that refer to this spell
- void call("magic_register", "OnCast");
- set .level, 2;
- set .exp_gain, 2;
- end;
-}
diff --git a/world/map/npc/magic/level2-summon-snakes.txt b/world/map/npc/magic/level2-summon-snakes.txt
deleted file mode 100644
index 2e2021ae..00000000
--- a/world/map/npc/magic/level2-summon-snakes.txt
+++ /dev/null
@@ -1,64 +0,0 @@
--|script|summon-snakes|32767
-{
- end;
-
-OnCast:
- if(call("magic_checks")) end;
- if (Sp < 40) end;
- if (getmapflag(getmap(), MF_TOWN)) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (getskilllv(.school) < .level) end;
- if (countitem("DarkCrystal") < 1 || countitem("SnakeEgg") < 1) end;
- if (OrumQuest <= 40) end;
- delitem "DarkCrystal", 1;
- delitem "SnakeEgg", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 15000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 40;
- misceffect FX_MAGIC_SNAKE_CAST, strcharinfo(0);
- callfunc "magic_exp";
- set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
- set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
- if (.@puppet < 1) end;
- set .count, (@spellpower/300)+1, .@puppet;
- set .master, BL_ID, .@puppet;
- set .lifetime, @spellpower*80, .@puppet;
- addnpctimer 4000-(@spellpower*9), .@puppet$+"::OnSummon";
- addnpctimer 6000, .@puppet$+"::OnDestroy";
- end;
-
-OnSummon:
- if (!(isloggedin(.master))) destroy;
- if(get(Hp, .master) < 1) destroy; // destroy if master is missing
- if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map
- specialeffect FX_MAGIC_SNAKE_SPAWN;
- set .@i, 0;
- set .@x, getnpcx();
- set .@y, getnpcy();
- set .@map$, strnpcinfo(3);
- callsub S_SummonAll;
- end;
-
-OnDestroy:
- destroy;
-
-S_SummonAll:
- set .@sn, rand(0, 3);
-
- if (.@sn == 0) summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1021, 2, .lifetime;
- elif (.@sn == 1) summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1010, 2, .lifetime;
- elif (.@sn == 2) summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1026, 2, .lifetime;
- elif (.@sn == 3) summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1034, 2, .lifetime;
- set .@i, .@i + 1;
- if (.@i < .count) goto S_SummonAll;
- destroy;
-
-OnInit:
- set .school, SKILL_MAGIC_DARK;
- set .invocation$, chr(MAGIC_SYMBOL) + "halhiss"; // used in npcs that refer to this spell
- void call("magic_register", "OnCast");
- set .level, 2;
- set .exp_gain, 3;
- end;
-}
diff --git a/world/map/npc/magic/level2-summon-spiky-mushroom.txt b/world/map/npc/magic/level2-summon-spiky-mushroom.txt
deleted file mode 100644
index ff861283..00000000
--- a/world/map/npc/magic/level2-summon-spiky-mushroom.txt
+++ /dev/null
@@ -1,58 +0,0 @@
--|script|smsmushrooms|32767
-{
- end;
-
-OnCast:
- if(call("magic_checks")) end;
- if (Sp < 33) end;
- if (getmapflag(getmap(), MF_TOWN)) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (getskilllv(.school) < .level) end;
- if (countitem("HardSpike") < 1 || countitem("Root") < 1) end;
- delitem "HardSpike", 1;
- delitem "Root", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 20000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 33;
- misceffect FX_MAGIC_SPIKY_CAST, strcharinfo(0);
- callfunc "magic_exp";
- set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
- set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
- if (.@puppet < 1) end;
- set .count, (@spellpower/120)+1, .@puppet;
- set .master, BL_ID, .@puppet;
- set .lifetime, @spellpower*400, .@puppet;
- addnpctimer 5000-(@spellpower*9), .@puppet$+"::OnSummon";
- addnpctimer 6000, .@puppet$+"::OnDestroy";
- end;
-
-OnSummon:
- if (!(isloggedin(.master))) destroy;
- if(get(Hp, .master) < 1) destroy; // destroy if master is missing
- if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map
- specialeffect FX_MAGIC_SPIKY_SPAWN;
- set .@i, 0;
- set .@x, getnpcx();
- set .@y, getnpcy();
- set .@map$, strnpcinfo(3);
- callsub S_SummonAll;
- end;
-
-OnDestroy:
- destroy;
-
-S_SummonAll:
- summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1019, 2, .lifetime;
- set .@i, .@i + 1;
- if (.@i < .count) goto S_SummonAll;
- destroy;
-
-OnInit:
- set .school, SKILL_MAGIC_ASTRAL;
- set .invocation$, chr(MAGIC_SYMBOL) + "kalrenk"; // used in npcs that refer to this spell
- void call("magic_register", "OnCast");
- set .level, 2;
- set .exp_gain, 1;
- end;
-}
diff --git a/world/map/npc/magic/level2-summon-wickedmushroom.txt b/world/map/npc/magic/level2-summon-wickedmushroom.txt
deleted file mode 100644
index dc5fb72d..00000000
--- a/world/map/npc/magic/level2-summon-wickedmushroom.txt
+++ /dev/null
@@ -1,63 +0,0 @@
--|script|smwmushroom|32767
-{
- end;
-
-OnCast:
- if(call("magic_checks")) end;
- if (Sp < 35) end;
- if (getmapflag(getmap(), MF_TOWN)) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- if (getskilllv(.school) < .level) end;
- if (countitem("DarkCrystal") < 1 || countitem("SmallMushroom") < 1) end;
- if (OrumQuest <= 36) end;
- delitem "DarkCrystal", 1;
- delitem "SmallMushroom", 1;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 15000, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 35;
- misceffect FX_MAGIC_WICKED_CAST, strcharinfo(0);
- callfunc "magic_exp";
- set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
- set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
- if (.@puppet < 1) end;
- set .count, (@spellpower/250)+1, .@puppet;
- set .master, BL_ID, .@puppet;
- set .lifetime, @spellpower*80, .@puppet;
- addnpctimer 4000-(@spellpower*9), .@puppet$+"::OnSummon";
- addnpctimer 6000, .@puppet$+"::OnDestroy";
- end;
-
-OnSummon:
- if (!(isloggedin(.master))) destroy;
- if(get(Hp, .master) < 1) destroy; // destroy if master is missing
- if(getmap(.master) != strnpcinfo(3)) destroy; // destroy if master left the map
- specialeffect FX_MAGIC_WICKED_SPAWN;
- set .@i, 0;
- set .@x, getnpcx();
- set .@y, getnpcy();
- set .@map$, strnpcinfo(3);
- callsub S_SummonAll;
- end;
-
-OnDestroy:
- destroy;
-
-S_SummonAll:
- set .@rnd, rand(0, 9);
-
- if (.@rnd < 6) summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1106, 2, .lifetime;
- elif (.@rnd < 9) summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1130, 2, .lifetime;
- elif (.@rnd == 9) summon .@map$, rand(.@x-2,.@x+2), rand(.@y-2,.@y+2), .master, 1013, 2, .lifetime;
- set .@i, .@i + 1;
- if (.@i < .count) goto S_SummonAll;
- destroy;
-
-OnInit:
- set .school, SKILL_MAGIC_DARK;
- set .invocation$, chr(MAGIC_SYMBOL) + "helorp"; // used in npcs that refer to this spell
- void call("magic_register", "OnCast");
- set .level, 2;
- set .exp_gain, 3;
- end;
-}
diff --git a/world/map/npc/magic/level2-toxic-dart.txt b/world/map/npc/magic/level2-toxic-dart.txt
deleted file mode 100644
index 5f611262..00000000
--- a/world/map/npc/magic/level2-toxic-dart.txt
+++ /dev/null
@@ -1,57 +0,0 @@
--|script|toxic-dart|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 15) end;
- set .@level, getskilllv(.school);
- if (.@level < .level) end;
- if (OrumQuest <= 37) end;
- if (.@level <= 2 && countitem("Root") >= 2) delitem "Root", 2;
- elif (.@level <= 2) end;
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 500, "Magic Timer::OnClear"; // set the new debuff
- callfunc "adjust_spellpower";
- set Sp, Sp - 15;
- misceffect FX_MAGIC_TDART_CAST, strcharinfo(0);
- setarray @phlexspell[0],
- (sqrt(@spellpower) * 5), // elt damage
- ((BaseLevel/3) + 5), // elt damage bonus
- (((200 - Agi) * 1200) / 200), // delay
- ((@spellpower/75) + 3), // charges
- (5000+(@spellpower*1200)), // poison duration
- (max(15,@spellpower/15)+5); // poison strength
-
- callfunc "magic_exp";
- goto L_FreeRecast;
-
-OnAttack:
- if (target(BL_ID, @target_id, 50) != 50) goto L_FreeRecast; // 0x20 | 0x02 | 0x10
- void call("elt_damage", @phlexspell[0], @phlexspell[1], ELT_NEUTRAL, ELT_POISON, FX_NONE);
- if(@target_id != BL_ID && isloggedin(@target_id)) // this is a dirty trick to check if the target is a player
- sc_start sc_poison, @phlexspell[4], @phlexspell[5], @target_id;
- set @phlexspell[3], @phlexspell[3] - 1;
- goto L_FreeRecast;
-
-L_FreeRecast:
- if (@phlexspell[3] > 0)
- addtimer 0, strnpcinfo(0) + "::OnSetRecast";
- end;
-
-OnDischarge:
- if (@phlexspell[3] < 1) end;
- set @phlexspell[3], 0;
- misceffect FX_MAGIC_DISCHARGE, strcharinfo(0);
- overrideattack;
- end;
-
-OnSetRecast:
- overrideattack @phlexspell[2], 4, ATTACK_ICON_GENERIC, OVERRIDE_TDART, strnpcinfo(0)+"::OnAttack", @phlexspell[3];
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_DARK;
- set .invocation$, chr(MAGIC_SYMBOL) + "phlex"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 2;
- set .exp_gain, 3;
- end;
-}
diff --git a/world/map/npc/magic/level3-necromancy.txt b/world/map/npc/magic/level3-necromancy.txt
deleted file mode 100644
index 2cd6724d..00000000
--- a/world/map/npc/magic/level3-necromancy.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-// see https://tmworld.uservoice.com/forums/255809-general/suggestions/6051818-sacrifice
-// author: gumi
--|script|necromancy|32767
-{
- if(call("magic_checks")) end;
- if (Sp < 50) end;
- if (getskilllv(.school) < .level) end;
- if (getskilllv(SKILL_MAGIC) < .level) end;
- set @target_id, getcharid(3, @args$);
- if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id)) end;
- if (get(Hp, @target_id) > 0) end;
- if (Hp < (get(MaxHp, @target_id) / 3)) end; // hp must be at least a third of the max hp of the target
- callfunc "adjust_spellpower";
- if (distance(BL_ID, @target_id) >= (((sqrt(@spellpower)*12)+@spellpower)/100)+2) end;
- if (get(@necromancer, @target_id) > 0) end; // someone else is already trying to resurrect this player
- if (getmapflag(getmap(), MF_NOSAVE)) end; // do not allow for maps like illia or candor
- if (countitem("Soul") >= 1) delitem "Soul", 1; else end;
-
- set @_M_BLOCK, 1; // block casting, until the timer clears it
- addtimer 20000, "Magic Timer::OnClear";
- set Sp, Sp - 50;
- misceffect FX_MAGIC_DARKRED, strcharinfo(0); // on caster
- misceffect FX_PENTAGRAM_BUILDUP, @args$; // on target
-
- set @necromancer, CHAR_ID, @target_id; // tell the target who is reviving them
-
- addtimer 6000, strnpcinfo(0)+"::OnRevive", @target_id; // TODO: make it take more or less time depending on the spell power
- end;
-
-OnRevive:
- set .@necro, get(BL_ID, @necromancer);
- if (.@necro < 1) goto L_Clean;
- if (get(Hp, .@necro) < 1) end;
- misceffect FX_PENTAGRAM_BURST, strcharinfo(0);
- misceffect FX_CRITICAL, strcharinfo(0, .@necro);
- heal 1, 0; // revive
- set Hp, 1;
- set Sp, 0;
- set Hp, 1, .@necro;
- set Sp, 0, .@necro;
- goto L_Clean;
-
-L_Clean:
- set @necromancer, 0;
- end;
-
-OnInit:
- set .school, SKILL_MAGIC_DARK;
- set .invocation$, chr(MAGIC_SYMBOL) + "nevela"; // used in npcs that refer to this spell
- void call("magic_register");
- set .level, 3;
- set .exp_gain, 1;
- end;
-}