From 40add9a2181ef5cb2d8804eeb01c0a190d6c8ee5 Mon Sep 17 00:00:00 2001 From: mekolat Date: Wed, 30 Mar 2016 19:52:24 -0400 Subject: slowly getting things done explain the debug spell is deprecated upmarmu typo cooldown fix make maps with updated converter, make nodes update permissions --- world/map/npc/magic/README.md | 22 ++----------------- world/map/npc/magic/_import.txt | 1 + world/map/npc/magic/_procedures.txt | 19 +++++++++++----- world/map/npc/magic/level0-wand.txt | 12 ++++++----- world/map/npc/magic/level1-aggravate.txt | 5 +++-- world/map/npc/magic/level1-detect-magic.txt | 7 +++--- world/map/npc/magic/level1-experience.txt | 7 +++--- world/map/npc/magic/level1-flare-dart.txt | 14 ++++++------ world/map/npc/magic/level1-grow-alizarin.txt | 5 +++-- world/map/npc/magic/level1-grow-cobalt.txt | 5 +++-- world/map/npc/magic/level1-grow-gamboge.txt | 5 +++-- world/map/npc/magic/level1-grow-mauve.txt | 5 +++-- world/map/npc/magic/level1-lesser-heal.txt | 7 +++--- world/map/npc/magic/level1-magic-blade.txt | 8 ++++--- world/map/npc/magic/level1-make-sulphur.txt | 5 +++-- world/map/npc/magic/level1-sense-spouse.txt | 25 ++++++++++++++++++++++ world/map/npc/magic/level1-summon-maggots.txt | 5 +++-- world/map/npc/magic/level1-transmute-wood.txt | 5 +++-- world/map/npc/magic/level2-arrow-hail.txt | 9 +++++--- world/map/npc/magic/level2-barrier.txt | 6 ++++-- world/map/npc/magic/level2-detect-players.txt | 7 +++--- world/map/npc/magic/level2-enchant-lifestone.txt | 5 +++-- world/map/npc/magic/level2-flying-backpack.txt | 6 ++++-- world/map/npc/magic/level2-happy-curse.txt | 5 +++-- world/map/npc/magic/level2-hide.txt | 6 ++++-- world/map/npc/magic/level2-lay-on-hands.txt | 5 +++-- world/map/npc/magic/level2-lightning-strike.txt | 10 +++++---- world/map/npc/magic/level2-magic-knuckles.txt | 10 +++++---- world/map/npc/magic/level2-make-arrows.txt | 5 +++-- world/map/npc/magic/level2-make-iron-powder.txt | 5 +++-- world/map/npc/magic/level2-make-shirt.txt | 5 +++-- world/map/npc/magic/level2-make-short-tanktop.txt | 5 +++-- world/map/npc/magic/level2-make-tanktop.txt | 5 +++-- world/map/npc/magic/level2-protect.txt | 6 ++++-- world/map/npc/magic/level2-rain.txt | 9 ++++---- world/map/npc/magic/level2-shear.txt | 8 ++++--- world/map/npc/magic/level2-summon-fluffies.txt | 5 +++-- world/map/npc/magic/level2-summon-mouboo.txt | 5 +++-- world/map/npc/magic/level2-summon-pinkie.txt | 5 +++-- world/map/npc/magic/level2-summon-snakes.txt | 5 +++-- .../map/npc/magic/level2-summon-spiky-mushroom.txt | 5 +++-- .../map/npc/magic/level2-summon-wickedmushroom.txt | 5 +++-- world/map/npc/magic/level2-toxic-dart.txt | 13 +++++------ world/map/npc/magic/level3-necromancy.txt | 3 ++- 44 files changed, 197 insertions(+), 128 deletions(-) create mode 100644 world/map/npc/magic/level1-sense-spouse.txt (limited to 'world/map/npc/magic') diff --git a/world/map/npc/magic/README.md b/world/map/npc/magic/README.md index 187c7c04..57ab5131 100644 --- a/world/map/npc/magic/README.md +++ b/world/map/npc/magic/README.md @@ -1,23 +1,3 @@ -# To-do -- [X] finish the missing spells and push them so they can be tested -- [ ] Deal with the removal of the following spells from magic to NPCs or Commands - - [X] Ched - - [X] merge-concentration-potions - - [ ] Auldsbel - - [ ] make-short-tanktop - - [ ] make-tanktop - - [ ] make-shirt - - [ ] make-concentration-potion - - [X] Wyara - - [ ] sense-spouse - ---- ---- -to see other things that needs to be done do a grep for `TODO`, `FIXME` in this folder. -To see a list of things that needs further thoughts do a grep for `XXX`. - ---- ---- - [ ] 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?) @@ -49,6 +29,8 @@ To see a list of things that needs further thoughts do a grep for `XXX`. - [ ] `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 diff --git a/world/map/npc/magic/_import.txt b/world/map/npc/magic/_import.txt index 52a6a55c..2ef595af 100644 --- a/world/map/npc/magic/_import.txt +++ b/world/map/npc/magic/_import.txt @@ -12,6 +12,7 @@ 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 diff --git a/world/map/npc/magic/_procedures.txt b/world/map/npc/magic/_procedures.txt index 57a83fa9..df750f73 100644 --- a/world/map/npc/magic/_procedures.txt +++ b/world/map/npc/magic/_procedures.txt @@ -1,6 +1,6 @@ function|script|magic_register { - debugmes ">> Register " + .invocation$ + " @ " + strnpcinfo(0); + //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; @@ -8,12 +8,21 @@ function|script|magic_register return; } +// this can only be done with a npc so... +-|script|Magic Timer|32767 +{ + end; +OnClear: + set @_M_BLOCK, 0; + end; +} + // this function is call()-only function|script|magic_checks { set .@r, 0; if(getpvpflag(1)) set .@r, 1; // FIXME: make HIDDEN into a param - if((gettimetick(2) - MAGIC_CAST_TICK) < 0) set .@r, 2; // check if last debuff ended + if(@_M_BLOCK) set .@r, 2; // check if last debuff ended if(Hp < 1) set .@r, 3; // can not cast when dead return .@r; } @@ -22,10 +31,10 @@ function|script|elt_damage { // args are damage, dmgplus(mutation), bonus_elt, malus_elt, effect set .@dmg, getarg(0) + rand(getarg(1)); - if(elttype(@target_id) == getarg(3)) // malus + if(get(ELTTYPE, @target_id) == getarg(3)) // malus set .@dmg, .@dmg / 3; - if(elttype(@target_id) == getarg(2)) // bonus - set .@dmg, ((eltlvl(@target_id) + 4) * .@dmg) / 4; + 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); diff --git a/world/map/npc/magic/level0-wand.txt b/world/map/npc/magic/level0-wand.txt index f0938713..1a512c0c 100644 --- a/world/map/npc/magic/level0-wand.txt +++ b/world/map/npc/magic/level0-wand.txt @@ -5,10 +5,12 @@ if(@WandAttack != 1) goto L_Failed; // here we install - set MAGIC_CAST_TICK, gettimetick(2) + 5; // set the new debuff + set @_M_BLOCK, 1; // block casting, until the timer clears it + addtimer 500, "Magic Timer::OnClear"; // set the new debuff callfunc "adjust_spellpower"; misceffect FX_MAGIC_GENERIC, strcharinfo(0); - overrideattack (@Wand + (@spellpower / 10)), 1200, 3, ATTACK_ICON_GENERIC, @WandID, strnpcinfo(0)+"::OnAttack"; + set .@delay, (((200 - Agi) * 1200) / 200); + overrideattack (@Wand + (@spellpower / 10)), .@delay, 3, ATTACK_ICON_GENERIC, @WandID, strnpcinfo(0)+"::OnAttack"; callfunc "magic_exp"; end; @@ -62,9 +64,9 @@ L_Failed: end; OnInit: - setarray .Wands[0], 758, 1171; - setarray .WandsPwr[0], 2, 1; - setarray .WandsAnim[0], 35, 33; + setarray .Wands[0], 0, 758, 1171; + setarray .WandsPwr[0], 0, 2, 1; + setarray .WandsAnim[0], 0, 35, 33; set .school, SKILL_MAGIC; set .invocation$, chr(MAGIC_SYMBOL) + "confringo"; // used in npcs that refer to this spell void call("magic_register"); diff --git a/world/map/npc/magic/level1-aggravate.txt b/world/map/npc/magic/level1-aggravate.txt index 1aaa9fc7..5b3d5674 100644 --- a/world/map/npc/magic/level1-aggravate.txt +++ b/world/map/npc/magic/level1-aggravate.txt @@ -1,9 +1,10 @@ -|script|spell-aggravate|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 3) end; if (getskilllv(.school) < .level) end; - set MAGIC_CAST_TICK, gettimetick(2) + 1; // set the new debuff + 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; diff --git a/world/map/npc/magic/level1-detect-magic.txt b/world/map/npc/magic/level1-detect-magic.txt index e64a499a..e975e952 100644 --- a/world/map/npc/magic/level1-detect-magic.txt +++ b/world/map/npc/magic/level1-detect-magic.txt @@ -1,9 +1,10 @@ -|script|detect-magic|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 3) end; if (getskilllv(.school) < .level) end; - set MAGIC_CAST_TICK, gettimetick(2) + 6; // set the new debuff + 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_GENERIC, strcharinfo(0); @@ -15,7 +16,7 @@ OnNearbyNpc: set .@e$, strnpcinfo(2,@target_id); - if(.@e$ == "#_M" || .@e$ == "#MAGIC") + if(.@e$ == "#_M" || .@e$ == "#MAGIC" || get(.IS_MAGIC, @target_id)) misceffect FX_MAGIC_DEFAULT, @target_id; end; diff --git a/world/map/npc/magic/level1-experience.txt b/world/map/npc/magic/level1-experience.txt index 2c283eaa..36ad8179 100644 --- a/world/map/npc/magic/level1-experience.txt +++ b/world/map/npc/magic/level1-experience.txt @@ -1,8 +1,9 @@ -|script|spell-experience|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 1) end; - set MAGIC_CAST_TICK, gettimetick(2) + 1; // set the new debuff + 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"; @@ -35,6 +36,6 @@ OnInit: set .level, 1; set .exp_gain, 0; void call("magic_register"); - setarray .MAX_MAGIC_EXP[0], 0, 100, 1200, 8000, 40000, 65535; + 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 index 6b6657b6..29a4f3c1 100644 --- a/world/map/npc/magic/level1-flare-dart.txt +++ b/world/map/npc/magic/level1-flare-dart.txt @@ -1,25 +1,27 @@ -|script|flare-dart|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 10) end; set @level, getskilllv(.school); if (@level < .level) end; if (@level <= 2 && countitem("SulphurPowder") >= 1) delitem "SulphurPowder", 1; elif (@level <= 2) end; - set MAGIC_CAST_TICK, gettimetick(2) + 1; // set the new debuff + 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_BLACK, strcharinfo(0); - set @damage, sqrt(@spellpower) * 5; - set @dmg_bonus, (BaseLevel/3) + 5; - overrideattack (@spellpower/50)+3, 1200, 4, ATTACK_ICON_GENERIC, 34, strnpcinfo(0)+"::OnAttack"; + set @flar_damage, sqrt(@spellpower) * 5; + set @flar_dmg_bonus, (BaseLevel/3) + 5; + set .@delay, (((200 - Agi) * 1200) / 200); + overrideattack (@spellpower/50)+3, .@delay, 4, ATTACK_ICON_GENERIC, 34, strnpcinfo(0)+"::OnAttack"; callfunc "magic_exp"; end; OnAttack: misceffect FX_MAGIC_BLACK, strcharinfo(0); if (target(BL_ID, @target_id, 50) != 50) end; // 0x20 | 0x02 | 0x10 - void call("elt_damage", @damage, @dmg_bonus, ELT_WATER, ELT_FIRE, FX_MAGIC_BLACK); + void call("elt_damage", @flar_damage, @flar_dmg_bonus, ELT_WATER, ELT_FIRE, FX_MAGIC_BLACK); end; OnInit: diff --git a/world/map/npc/magic/level1-grow-alizarin.txt b/world/map/npc/magic/level1-grow-alizarin.txt index c44a4f47..bc88380d 100644 --- a/world/map/npc/magic/level1-grow-alizarin.txt +++ b/world/map/npc/magic/level1-grow-alizarin.txt @@ -1,12 +1,13 @@ -|script|grow-alizarin|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 4) end; if (getskilllv(.school) < .level) end; if (countitem("AlizarinHerb") < 1 || countitem("Root") < 1) end; delitem "AlizarinHerb", 1; delitem "Root", 1; - set MAGIC_CAST_TICK, gettimetick(2) + 2; // set the new debuff + 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_GREEN, strcharinfo(0); diff --git a/world/map/npc/magic/level1-grow-cobalt.txt b/world/map/npc/magic/level1-grow-cobalt.txt index 1eb923b2..cc7d1b33 100644 --- a/world/map/npc/magic/level1-grow-cobalt.txt +++ b/world/map/npc/magic/level1-grow-cobalt.txt @@ -1,12 +1,13 @@ -|script|grow-cobalt|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 4) end; if (getskilllv(.school) < .level) end; if (countitem("CobaltHerb") < 1 || countitem("Root") < 1) end; delitem "CobaltHerb", 1; delitem "Root", 1; - set MAGIC_CAST_TICK, gettimetick(2) + 2; // set the new debuff + 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_GREEN, strcharinfo(0); diff --git a/world/map/npc/magic/level1-grow-gamboge.txt b/world/map/npc/magic/level1-grow-gamboge.txt index 4ac779a8..559c99e8 100644 --- a/world/map/npc/magic/level1-grow-gamboge.txt +++ b/world/map/npc/magic/level1-grow-gamboge.txt @@ -1,12 +1,13 @@ -|script|grow-gamboge|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 4) end; if (getskilllv(.school) < .level) end; if (countitem("GambogeHerb") < 1 || countitem("Root") < 1) end; delitem "GambogeHerb", 1; delitem "Root", 1; - set MAGIC_CAST_TICK, gettimetick(2) + 2; // set the new debuff + 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_GREEN, strcharinfo(0); diff --git a/world/map/npc/magic/level1-grow-mauve.txt b/world/map/npc/magic/level1-grow-mauve.txt index 1744660a..5ae266e2 100644 --- a/world/map/npc/magic/level1-grow-mauve.txt +++ b/world/map/npc/magic/level1-grow-mauve.txt @@ -1,12 +1,13 @@ -|script|grow-mauve|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 4) end; if (getskilllv(.school) < .level) end; if (countitem("MauveHerb") < 1 || countitem("Root") < 1) end; delitem "MauveHerb", 1; delitem "Root", 1; - set MAGIC_CAST_TICK, gettimetick(2) + 2; // set the new debuff + 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_GREEN, strcharinfo(0); diff --git a/world/map/npc/magic/level1-lesser-heal.txt b/world/map/npc/magic/level1-lesser-heal.txt index c4c74dd7..17f48b95 100644 --- a/world/map/npc/magic/level1-lesser-heal.txt +++ b/world/map/npc/magic/level1-lesser-heal.txt @@ -1,8 +1,7 @@ -|script|lesser-heal|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 6) end; - set MAGIC_CAST_TICK, gettimetick(2) + 1; // set the new debuff if (getskilllv(.school) < .level) end; set @target_id, getcharid(3, @args$); if (@target_id < 1 || !(isloggedin(@target_id))) set @target_id, BL_ID; // fallback to self @@ -11,6 +10,8 @@ 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; @@ -32,7 +33,7 @@ L_NotMe: L_Continue: if (getskilllv(SKILL_MAGIC_DARK) >= 1) sc_start SC_HALT_REGENERATE, 2000, 0; if (attachrid(@target_id) != 1) end; // XXX: to avoid the ugly attachrid method we would need some kind of `run_as` builtin - if (!(isdead())) heal 200, 1, 1; + if (!(isdead())) heal 200, 0, 1; end; L_Mouboo: diff --git a/world/map/npc/magic/level1-magic-blade.txt b/world/map/npc/magic/level1-magic-blade.txt index 915cb018..954675fe 100644 --- a/world/map/npc/magic/level1-magic-blade.txt +++ b/world/map/npc/magic/level1-magic-blade.txt @@ -1,6 +1,6 @@ -|script|magic-blade|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 9) end; set .@level, getskilllv(.school); if (.@level < .level) end; @@ -9,11 +9,13 @@ elif (.@level <= 2 && countitem("Knife") >= 1) set @chiza_component$, "Knife"; elif (.@level <= 2) end; if (@chiza_component$ != "") delitem @chiza_component$, 1; - set MAGIC_CAST_TICK, gettimetick(2) + 1; // set the new debuff + 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_BLACK, strcharinfo(0); - overrideattack (@spellpower/15)+10, 1200, 1, ATTACK_ICON_GENERIC, 30, strnpcinfo(0)+"::OnAttack"; + set .@delay, (((200 - Agi) * 1200) / 200); + overrideattack (@spellpower/15)+10, .@delay, 1, ATTACK_ICON_GENERIC, 30, strnpcinfo(0)+"::OnAttack"; callfunc "magic_exp"; set @chiza_str, Str; // do not allow to equip light armor, cast, and then switch to heavy armor to get bonus str end; diff --git a/world/map/npc/magic/level1-make-sulphur.txt b/world/map/npc/magic/level1-make-sulphur.txt index fe175265..a181d057 100644 --- a/world/map/npc/magic/level1-make-sulphur.txt +++ b/world/map/npc/magic/level1-make-sulphur.txt @@ -1,10 +1,11 @@ -|script|make-sulphur|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 4) end; if (getskilllv(.school) < .level) end; if (countitem("PileOfAsh") >= 1) delitem "PileOfAsh", 1; else end; - set MAGIC_CAST_TICK, gettimetick(2) + 4; // set the new debuff + 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_RED, strcharinfo(0); diff --git a/world/map/npc/magic/level1-sense-spouse.txt b/world/map/npc/magic/level1-sense-spouse.txt new file mode 100644 index 00000000..1766276c --- /dev/null +++ b/world/map/npc/magic/level1-sense-spouse.txt @@ -0,0 +1,25 @@ +-|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)) + 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 index 9247e56c..5daddd8a 100644 --- a/world/map/npc/magic/level1-summon-maggots.txt +++ b/world/map/npc/magic/level1-summon-maggots.txt @@ -3,13 +3,14 @@ end; OnCast: - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 21) end; if (getskilllv(.school) < .level) end; if (countitem("MaggotSlime") < 1 || countitem("Root") < 1) end; delitem "MaggotSlime", 1; delitem "Root", 1; - set MAGIC_CAST_TICK, gettimetick(2) + 20; // set the new debuff + 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_BLUE, strcharinfo(0); diff --git a/world/map/npc/magic/level1-transmute-wood.txt b/world/map/npc/magic/level1-transmute-wood.txt index 9ec8403e..935ed2fa 100644 --- a/world/map/npc/magic/level1-transmute-wood.txt +++ b/world/map/npc/magic/level1-transmute-wood.txt @@ -1,10 +1,11 @@ -|script|spell-transmute-wood|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 5) end; if (getskilllv(.school) < .level) end; if (countitem("RawLog") >= 1) delitem "RawLog", 1; else end; - set MAGIC_CAST_TICK, gettimetick(2) + 4; // set the new debuff + 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_RED, strcharinfo(0); diff --git a/world/map/npc/magic/level2-arrow-hail.txt b/world/map/npc/magic/level2-arrow-hail.txt index f1a3686b..3be14f1a 100644 --- a/world/map/npc/magic/level2-arrow-hail.txt +++ b/world/map/npc/magic/level2-arrow-hail.txt @@ -4,7 +4,7 @@ end; OnCast: - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (getskilllv(.school) < .level) end; if (getskilllv(SKILL_MAGIC) < .level) end; if (Sp < 25) end; @@ -16,7 +16,8 @@ OnCast: else end; delitem "SulphurPowder", 1; set Sp, Sp - 25; - set MAGIC_CAST_TICK, gettimetick(2) + 5; // set the new debuff + 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; @@ -77,7 +78,9 @@ 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 3, strnpcinfo(3), getnpcx(), getnpcy(), getnpcx(), getnpcy(), strnpcinfo(0) + "::OnHit"; + foreach 2, strnpcinfo(3), getnpcx(), getnpcy(), getnpcx(), getnpcy(), strnpcinfo(0) + "::OnHit"; + if (PVP_CHANNEL || getmapflag(getmap(), MF_PVP)) + foreach 0, strnpcinfo(3), getnpcx(), getnpcy(), getnpcx(), getnpcy(), strnpcinfo(0) + "::OnHit"; if(!.done && getx() == getnpcx() && gety() == getnpcy()) heal 0 - (.damage + rand(.damage_bonus) + rand(.damage_bonus)), 0; // injure caster set .launch, .launch + 1; diff --git a/world/map/npc/magic/level2-barrier.txt b/world/map/npc/magic/level2-barrier.txt index 8d74414a..3f78677b 100644 --- a/world/map/npc/magic/level2-barrier.txt +++ b/world/map/npc/magic/level2-barrier.txt @@ -1,6 +1,6 @@ -|script|magic barrier|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 15) end; set .@level, getskilllv(.school); if (.@level < .level) end; @@ -16,7 +16,8 @@ if (attachrid(@asorm_caster) != 1) end; if (@target_hat == 888) end; // FIXME: this whole 5 line block could be done with only one line if we modify getequipid OR make equip_ into params - set MAGIC_CAST_TICK, gettimetick(2) + 1; // set the new debuff + 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_BLUE, strcharinfo(0); @@ -34,6 +35,7 @@ end; OnEnd: + if (sc_check(SC_MBARRIER) != 1) end; message strcharinfo(0), "Barrier : Your magical barrier dissipates."; misceffect FX_MAGIC_DEFAULT, strcharinfo(0); end; diff --git a/world/map/npc/magic/level2-detect-players.txt b/world/map/npc/magic/level2-detect-players.txt index 41ab2e03..9867b700 100644 --- a/world/map/npc/magic/level2-detect-players.txt +++ b/world/map/npc/magic/level2-detect-players.txt @@ -1,12 +1,13 @@ -|script|detect-players|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 7) end; if (getskilllv(.school) < .level) end; - set MAGIC_CAST_TICK, gettimetick(2) + 1; // XXX the casttime is 300 so should this be 0 ? + 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_DARKRED, strcharinfo(0); + misceffect FX_MAGIC_GENERIC, strcharinfo(0); callfunc "magic_exp"; set @inwilt$, ""; set .@d, @spellpower/2; diff --git a/world/map/npc/magic/level2-enchant-lifestone.txt b/world/map/npc/magic/level2-enchant-lifestone.txt index 19cc0a84..ba8536bf 100644 --- a/world/map/npc/magic/level2-enchant-lifestone.txt +++ b/world/map/npc/magic/level2-enchant-lifestone.txt @@ -1,6 +1,6 @@ -|script|enchant-lifestone|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 15) end; if (getskilllv(.school) < .level) end; if (countitem("BugLeg") >= 1) delitem "BugLeg", 1; @@ -17,7 +17,8 @@ L_Herbs: goto L_Proceed; L_Proceed: - set MAGIC_CAST_TICK, gettimetick(2) + 4; // set the new debuff + 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_GENERIC, strcharinfo(0); diff --git a/world/map/npc/magic/level2-flying-backpack.txt b/world/map/npc/magic/level2-flying-backpack.txt index 2480ef14..b87fba02 100644 --- a/world/map/npc/magic/level2-flying-backpack.txt +++ b/world/map/npc/magic/level2-flying-backpack.txt @@ -1,13 +1,14 @@ -|script|flying-backpack|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + 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 MAGIC_CAST_TICK, gettimetick(2) + 1; // set the new debuff + 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_GREEN, strcharinfo(0); @@ -25,6 +26,7 @@ end; OnEnd: + if (sc_check(SC_FLYING_BACKPACK) != 1) end; message strcharinfo(0), "Backpack : Your backpack is no longer levitating."; misceffect FX_MAGIC_GENERIC, strcharinfo(0); end; diff --git a/world/map/npc/magic/level2-happy-curse.txt b/world/map/npc/magic/level2-happy-curse.txt index a6e314dd..190c7d23 100644 --- a/world/map/npc/magic/level2-happy-curse.txt +++ b/world/map/npc/magic/level2-happy-curse.txt @@ -1,6 +1,6 @@ -|script|happy-curse|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 13) end; set .@level, getskilllv(.school); if (.@level < .level) end; @@ -10,7 +10,8 @@ set @target_id, getcharid(3, @args$); if (@target_id < 1 || !(isloggedin(@target_id))) set @target_id, BL_ID; // fallback to self - set MAGIC_CAST_TICK, gettimetick(2) + 1; // set the new debuff + 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_GREEN, strcharinfo(0); diff --git a/world/map/npc/magic/level2-hide.txt b/world/map/npc/magic/level2-hide.txt index d6bf538c..1895cff1 100644 --- a/world/map/npc/magic/level2-hide.txt +++ b/world/map/npc/magic/level2-hide.txt @@ -1,6 +1,6 @@ -|script|spell-hide|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 11) end; set .@level, getskilllv(.school); if (.@level < .level) end; @@ -10,7 +10,8 @@ set @target_id, getcharid(3, @args$); if (@target_id < 1 || !(isloggedin(@target_id))) set @target_id, BL_ID; // fallback to self - set MAGIC_CAST_TICK, gettimetick(2) + 1; // set the new debuff + 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_BLUE, strcharinfo(0); @@ -29,6 +30,7 @@ end; OnEnd: + if (sc_check(SC_HIDE) != 1) end; message strcharinfo(0), "Magic : You are no longer hidden."; misceffect FX_MAGIC_GENERIC, strcharinfo(0); end; diff --git a/world/map/npc/magic/level2-lay-on-hands.txt b/world/map/npc/magic/level2-lay-on-hands.txt index ab5b2616..4e3a1e9c 100644 --- a/world/map/npc/magic/level2-lay-on-hands.txt +++ b/world/map/npc/magic/level2-lay-on-hands.txt @@ -1,6 +1,6 @@ -|script|lay-on-hands|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 10) end; if (getskilllv(.school) < .level) end; if (getskilllv(SKILL_MAGIC) < .level) end; @@ -16,7 +16,8 @@ goto L_Pay; L_Pay: - set MAGIC_CAST_TICK, gettimetick(2) + 1; // XXX should this be 0 ? + 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_WHITE, strcharinfo(0); // on caster misceffect FX_MAGIC_WHITE, @args$; // on target diff --git a/world/map/npc/magic/level2-lightning-strike.txt b/world/map/npc/magic/level2-lightning-strike.txt index c9cf4602..67d1a72e 100644 --- a/world/map/npc/magic/level2-lightning-strike.txt +++ b/world/map/npc/magic/level2-lightning-strike.txt @@ -1,19 +1,21 @@ -|script|lightning-strike|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + 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 MAGIC_CAST_TICK, gettimetick(2) + 1; // set the new debuff + 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_BLACK, strcharinfo(0); set @ingrav_sp, @spellpower; set @ingrav_luk, Luk; - overrideattack (@spellpower/90)+1, 3000, 8, ATTACK_ICON_GENERIC, 31, strnpcinfo(0)+"::OnAttack"; + set .@delay, (((200 - Agi) * 3000) / 200); + overrideattack (@spellpower/90)+1, .@delay, 8, ATTACK_ICON_GENERIC, 31, strnpcinfo(0)+"::OnAttack"; callfunc "magic_exp"; end; @@ -42,7 +44,7 @@ OnNpc: L_InRain: set @used, 0; - foreach 3, getmap(), @ar[0], @ar[1], @ar[2], @ar[3], strnpcinfo(0)+"::OnEntityInRain"; + foreach 0, getmap(), @ar[0], @ar[1], @ar[2], @ar[3], strnpcinfo(0)+"::OnEntityInRain"; if (@used >= 1 && (@ingrav_luk + rand(200)) >= 150) end; misceffect FX_LIGHTNING1 + rand(3), strcharinfo(0); heal 0 - @ingrav_sp, 0; diff --git a/world/map/npc/magic/level2-magic-knuckles.txt b/world/map/npc/magic/level2-magic-knuckles.txt index a91feeb2..3f4d4667 100644 --- a/world/map/npc/magic/level2-magic-knuckles.txt +++ b/world/map/npc/magic/level2-magic-knuckles.txt @@ -1,17 +1,19 @@ -|script|magic-knuckles|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + 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("Beer") >= 1) delitem "Beer", 1; elif (.@level <= 3) end; - set MAGIC_CAST_TICK, gettimetick(2) + 1; // set the new debuff + 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_BLACK, strcharinfo(0); - overrideattack (@spellpower/10)+10, 1300, 1, ATTACK_ICON_GENERIC, 34, strnpcinfo(0)+"::OnAttack"; + set .@delay, (((200 - Agi) * 1300) / 200); + overrideattack (@spellpower/10)+10, .@delay, 1, ATTACK_ICON_GENERIC, 34, strnpcinfo(0)+"::OnAttack"; callfunc "magic_exp"; set @upmaru_str, Str; // do not allow to equip light armor, cast, and then switch to heavy armor to get bonus str end; @@ -22,7 +24,7 @@ OnAttack: OnInit: set .school, SKILL_MAGIC_WAR; - set .invocation$, chr(MAGIC_SYMBOL) + "upmaru"; // used in npcs that refer to this spell + 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; diff --git a/world/map/npc/magic/level2-make-arrows.txt b/world/map/npc/magic/level2-make-arrows.txt index db3250a6..5bad035b 100644 --- a/world/map/npc/magic/level2-make-arrows.txt +++ b/world/map/npc/magic/level2-make-arrows.txt @@ -1,12 +1,13 @@ -|script|make-arrows|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + 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 MAGIC_CAST_TICK, gettimetick(2) + 5; // set the new debuff + 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_RED, strcharinfo(0); diff --git a/world/map/npc/magic/level2-make-iron-powder.txt b/world/map/npc/magic/level2-make-iron-powder.txt index 7cf7a134..55bdd0b9 100644 --- a/world/map/npc/magic/level2-make-iron-powder.txt +++ b/world/map/npc/magic/level2-make-iron-powder.txt @@ -1,12 +1,13 @@ -|script|make-iron-powder|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + 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 MAGIC_CAST_TICK, gettimetick(2) + 5; // set the new debuff + 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_RED, strcharinfo(0); diff --git a/world/map/npc/magic/level2-make-shirt.txt b/world/map/npc/magic/level2-make-shirt.txt index 8585a509..b7a1570f 100644 --- a/world/map/npc/magic/level2-make-shirt.txt +++ b/world/map/npc/magic/level2-make-shirt.txt @@ -1,10 +1,11 @@ -|script|make-shirt|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 25) end; if (getskilllv(.school) < .level) end; if (countitem("CottonCloth") >= 5) delitem "CottonCloth", 5; else end; - set MAGIC_CAST_TICK, gettimetick(2) + 5; // set the new debuff + 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_RED, strcharinfo(0); diff --git a/world/map/npc/magic/level2-make-short-tanktop.txt b/world/map/npc/magic/level2-make-short-tanktop.txt index 69297483..eee48425 100644 --- a/world/map/npc/magic/level2-make-short-tanktop.txt +++ b/world/map/npc/magic/level2-make-short-tanktop.txt @@ -1,10 +1,11 @@ -|script|make-short-tanktop|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 25) end; if (getskilllv(.school) < .level) end; if (countitem("CottonCloth") >= 3) delitem "CottonCloth", 3; else end; - set MAGIC_CAST_TICK, gettimetick(2) + 5; // set the new debuff + 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_RED, strcharinfo(0); diff --git a/world/map/npc/magic/level2-make-tanktop.txt b/world/map/npc/magic/level2-make-tanktop.txt index cec49d2e..678cf650 100644 --- a/world/map/npc/magic/level2-make-tanktop.txt +++ b/world/map/npc/magic/level2-make-tanktop.txt @@ -1,10 +1,11 @@ -|script|make-tanktop|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 25) end; if (getskilllv(.school) < .level) end; if (countitem("CottonCloth") >= 4) delitem "CottonCloth", 4; else end; - set MAGIC_CAST_TICK, gettimetick(2) + 5; // set the new debuff + 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_RED, strcharinfo(0); diff --git a/world/map/npc/magic/level2-protect.txt b/world/map/npc/magic/level2-protect.txt index bee84133..e66aab3a 100644 --- a/world/map/npc/magic/level2-protect.txt +++ b/world/map/npc/magic/level2-protect.txt @@ -1,6 +1,6 @@ -|script|protect|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 14) end; set .@level, getskilllv(.school); if (.@level < .level) end; @@ -16,7 +16,8 @@ if (attachrid(@betsanc_caster) != 1) end; if (@target_hat == 888) end; // FIXME: this whole 5 line block could be done with only one line if we modify getequipid - set MAGIC_CAST_TICK, gettimetick(2) + 2; // set the new debuff + 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_GREEN, strcharinfo(0); @@ -34,6 +35,7 @@ end; OnEnd: + if (sc_check(SC_PHYS_SHIELD) != 1) end; message strcharinfo(0), "Shield : You feel less protected."; misceffect FX_MAGIC_SHIELD_ENDS, strcharinfo(0); end; diff --git a/world/map/npc/magic/level2-rain.txt b/world/map/npc/magic/level2-rain.txt index 2d13cc8d..d3718170 100644 --- a/world/map/npc/magic/level2-rain.txt +++ b/world/map/npc/magic/level2-rain.txt @@ -4,7 +4,7 @@ end; OnCast: - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (getskilllv(.school) < .level) end; if (getskilllv(SKILL_MAGIC) < .level) end; if (Sp < 17) end; @@ -14,7 +14,8 @@ OnCast: if (getskilllv(.school) < 4 && countitem("BottleOfWater") >= 1) delitem "BottleOfWater", 1; elif (getskilllv(.school) < 4) end; set Sp, Sp - 17; - set MAGIC_CAST_TICK, gettimetick(2) + 3; // set the new debuff + 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 @@ -74,7 +75,7 @@ OnLaunch: S_Launch: npcareawarp .initial_x - .radius, .initial_y - .radius, .initial_x + .radius, .initial_y + .radius, 0, strnpcinfo(0); misceffect FX_RAIN; - foreach 3, strnpcinfo(3), getnpcx()-1, getnpcy()-1, getnpcx()+1, getnpcy()+1, strnpcinfo(0) + "::OnHit"; + foreach 2, strnpcinfo(3), getnpcx()-1, getnpcy()-1, getnpcx()+1, getnpcy()+1, strnpcinfo(0) + "::OnHit"; set .launch, .launch + 1; if(.launch < .max_launch) goto S_Launch; return; @@ -84,7 +85,7 @@ OnHit: if(getmap() != 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(elttype(@target_id) == ELT_FIRE) + if(get(ELTTYPE, @target_id) == ELT_FIRE) injure .caster, @target_id, rand((@spellpower/15)+5)+2; end; diff --git a/world/map/npc/magic/level2-shear.txt b/world/map/npc/magic/level2-shear.txt index afa6a59e..c76b1093 100644 --- a/world/map/npc/magic/level2-shear.txt +++ b/world/map/npc/magic/level2-shear.txt @@ -1,14 +1,16 @@ -|script|shear|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 23) end; if (getskilllv(SKILL_MAGIC) < .level) end; if (getskilllv(.school) < .level) end; - set MAGIC_CAST_TICK, gettimetick(2) + 1; // set the new debuff + 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_GREEN, strcharinfo(0); - overrideattack 1, 2000, 1, ATTACK_ICON_SHEARING, 30, strnpcinfo(0)+"::OnAttack"; + set .@delay, (((200 - Agi) * 2000) / 200); + overrideattack 1, .@delay, 1, ATTACK_ICON_SHEARING, 30, strnpcinfo(0)+"::OnAttack"; callfunc "magic_exp"; set @chipchip_sp, @spellpower; end; diff --git a/world/map/npc/magic/level2-summon-fluffies.txt b/world/map/npc/magic/level2-summon-fluffies.txt index 32fcd750..cd754e33 100644 --- a/world/map/npc/magic/level2-summon-fluffies.txt +++ b/world/map/npc/magic/level2-summon-fluffies.txt @@ -3,14 +3,15 @@ end; OnCast: - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 39) 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 MAGIC_CAST_TICK, gettimetick(2) + 20; // set the new debuff + 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_BLUE, strcharinfo(0); diff --git a/world/map/npc/magic/level2-summon-mouboo.txt b/world/map/npc/magic/level2-summon-mouboo.txt index 5055362f..8eb074c6 100644 --- a/world/map/npc/magic/level2-summon-mouboo.txt +++ b/world/map/npc/magic/level2-summon-mouboo.txt @@ -3,14 +3,15 @@ end; OnCast: - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 35) 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 MAGIC_CAST_TICK, gettimetick(2) + 20; // set the new debuff + 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_BLUE, strcharinfo(0); diff --git a/world/map/npc/magic/level2-summon-pinkie.txt b/world/map/npc/magic/level2-summon-pinkie.txt index f4716749..b91ec1d9 100644 --- a/world/map/npc/magic/level2-summon-pinkie.txt +++ b/world/map/npc/magic/level2-summon-pinkie.txt @@ -3,14 +3,15 @@ end; OnCast: - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 35) 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 MAGIC_CAST_TICK, gettimetick(2) + 20; // set the new debuff + 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_BLUE, strcharinfo(0); diff --git a/world/map/npc/magic/level2-summon-snakes.txt b/world/map/npc/magic/level2-summon-snakes.txt index 4998fded..7490c506 100644 --- a/world/map/npc/magic/level2-summon-snakes.txt +++ b/world/map/npc/magic/level2-summon-snakes.txt @@ -3,7 +3,7 @@ end; OnCast: - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 40) end; if (getskilllv(SKILL_MAGIC) < .level) end; if (getskilllv(.school) < .level) end; @@ -11,7 +11,8 @@ OnCast: if (OrumQuest <= 40) end; delitem "DarkCrystal", 1; delitem "SnakeEgg", 1; - set MAGIC_CAST_TICK, gettimetick(2) + 15; // set the new debuff + 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_DARKRED, strcharinfo(0); diff --git a/world/map/npc/magic/level2-summon-spiky-mushroom.txt b/world/map/npc/magic/level2-summon-spiky-mushroom.txt index 97d916b0..39ad9ecd 100644 --- a/world/map/npc/magic/level2-summon-spiky-mushroom.txt +++ b/world/map/npc/magic/level2-summon-spiky-mushroom.txt @@ -3,14 +3,15 @@ end; OnCast: - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 33) 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 MAGIC_CAST_TICK, gettimetick(2) + 20; // set the new debuff + 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_BLUE, strcharinfo(0); diff --git a/world/map/npc/magic/level2-summon-wickedmushroom.txt b/world/map/npc/magic/level2-summon-wickedmushroom.txt index 3960437a..df17742f 100644 --- a/world/map/npc/magic/level2-summon-wickedmushroom.txt +++ b/world/map/npc/magic/level2-summon-wickedmushroom.txt @@ -3,7 +3,7 @@ end; OnCast: - if(call("magic_checks")) end; // << I wish we had functions that could return >> + if(call("magic_checks")) end; if (Sp < 35) end; if (getskilllv(SKILL_MAGIC) < .level) end; if (getskilllv(.school) < .level) end; @@ -11,7 +11,8 @@ OnCast: if (OrumQuest <= 36) end; delitem "DarkCrystal", 1; delitem "SmallMushroom", 1; - set MAGIC_CAST_TICK, gettimetick(2) + 15; // set the new debuff + 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_DARKRED, strcharinfo(0); diff --git a/world/map/npc/magic/level2-toxic-dart.txt b/world/map/npc/magic/level2-toxic-dart.txt index 9674b64f..a14710d6 100644 --- a/world/map/npc/magic/level2-toxic-dart.txt +++ b/world/map/npc/magic/level2-toxic-dart.txt @@ -1,26 +1,27 @@ -|script|toxic-dart|32767 { - if(call("magic_checks")) end; // << I wish we had functions that could return >> + 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 MAGIC_CAST_TICK, gettimetick(2) + 1; // set the new debuff + 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_DARKRED, strcharinfo(0); - set @damage, sqrt(@spellpower) * 5; - set @dmg_bonus, (BaseLevel/3) + 5; - overrideattack (@spellpower/75)+3, 1200, 4, ATTACK_ICON_GENERIC, 31, strnpcinfo(0)+"::OnAttack"; + setarray @phlex_damage[0], (sqrt(@spellpower) * 5), ((BaseLevel/3) + 5); + set .@delay, (((200 - Agi) * 1200) / 200); + overrideattack (@spellpower/75)+3, .@delay, 4, ATTACK_ICON_GENERIC, 31, strnpcinfo(0)+"::OnAttack"; callfunc "magic_exp"; end; OnAttack: misceffect FX_MAGIC_DARKRED, strcharinfo(0); if (target(BL_ID, @target_id, 50) != 50) end; // 0x20 | 0x02 | 0x10 - void call("elt_damage", @damage, @dmg_bonus, ELT_NEUTRAL, ELT_POISON, FX_FIRE_BURST); + void call("elt_damage", @phlex_damage[0], @phlex_damage[1], ELT_NEUTRAL, ELT_POISON, FX_FIRE_BURST); 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, 5000+(@spellpower*1200), max(15,@spellpower/15)+5, @target_id; end; diff --git a/world/map/npc/magic/level3-necromancy.txt b/world/map/npc/magic/level3-necromancy.txt index 66643d39..ef2d761f 100644 --- a/world/map/npc/magic/level3-necromancy.txt +++ b/world/map/npc/magic/level3-necromancy.txt @@ -16,7 +16,8 @@ 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 MAGIC_CAST_TICK, gettimetick(2) + 20; + 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 -- cgit v1.2.3-60-g2f50