summaryrefslogtreecommitdiff
path: root/world/map/npc
diff options
context:
space:
mode:
Diffstat (limited to 'world/map/npc')
-rw-r--r--world/map/npc/magic/level1-flare-dart.txt25
-rw-r--r--world/map/npc/magic/level1-magic-blade.txt34
-rw-r--r--world/map/npc/magic/level2-lightning-strike.txt57
-rw-r--r--world/map/npc/magic/level2-magic-knuckles.txt23
-rw-r--r--world/map/npc/magic/level2-shear.txt23
-rw-r--r--world/map/npc/magic/level2-toxic-dart.txt29
6 files changed, 132 insertions, 59 deletions
diff --git a/world/map/npc/magic/level1-flare-dart.txt b/world/map/npc/magic/level1-flare-dart.txt
index 2f17c499..6c0ef303 100644
--- a/world/map/npc/magic/level1-flare-dart.txt
+++ b/world/map/npc/magic/level1-flare-dart.txt
@@ -11,17 +11,28 @@
callfunc "adjust_spellpower";
set Sp, Sp - 10;
misceffect FX_MAGIC_BLACK, strcharinfo(0);
- 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";
+ setarray @flarspell[0],
+ sqrt(@spellpower) * 5, //dmg
+ (BaseLevel/3) + 5, // dmg bonus
+ (@spellpower/50) + 3, // charges
+ (((200 - Agi) * 1200) / 200); // delay
callfunc "magic_exp";
- end;
+ goto L_FreeRecast;
OnAttack:
+ if (target(BL_ID, @target_id, 50) != 50) goto L_FreeRecast; // 0x20 | 0x02 | 0x10
misceffect FX_MAGIC_BLACK, strcharinfo(0);
- if (target(BL_ID, @target_id, 50) != 50) end; // 0x20 | 0x02 | 0x10
- void call("elt_damage", @flar_damage, @flar_dmg_bonus, ELT_WATER, ELT_FIRE, FX_MAGIC_BLACK);
+ void call("elt_damage", @flarspell[0], @flarspell[1], ELT_WATER, ELT_FIRE, FX_MAGIC_BLACK);
+ set @flarspell[2], @flarspell[2] - 1;
+ goto L_FreeRecast;
+
+L_FreeRecast:
+ if (@flarspell[2] > 0)
+ addtimer 0, strnpcinfo(0) + "::OnSetRecast";
+ end;
+
+OnSetRecast:
+ overrideattack 1, @flarspell[3], 4, ATTACK_ICON_GENERIC, 34, strnpcinfo(0)+"::OnAttack";
end;
OnInit:
diff --git a/world/map/npc/magic/level1-magic-blade.txt b/world/map/npc/magic/level1-magic-blade.txt
index 262a08a1..ad39c244 100644
--- a/world/map/npc/magic/level1-magic-blade.txt
+++ b/world/map/npc/magic/level1-magic-blade.txt
@@ -4,26 +4,38 @@
if (Sp < 9) end;
set .@level, getskilllv(.school);
if (getskilllv(SKILL_MAGIC) < .level) end;
- set @chiza_component$, "";
- if (.@level <= 2 && countitem("SharpKnife") >= 1) set @chiza_component$, "SharpKnife";
- elif (.@level <= 2 && countitem("Knife") >= 1) set @chiza_component$, "Knife";
+ if (.@level <= 2 && countitem("SharpKnife") >= 1) set .@component$, "SharpKnife";
+ elif (.@level <= 2 && countitem("Knife") >= 1) set .@component$, "Knife";
elif (.@level <= 2) end;
- if (@chiza_component$ != "") delitem @chiza_component$, 1;
+ 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_BLACK, strcharinfo(0);
- set .@delay, (((200 - Agi) * 1200) / 200);
- overrideattack (@spellpower/15)+10, .@delay, 1, ATTACK_ICON_GENERIC, 30, strnpcinfo(0)+"::OnAttack";
+ 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";
- set @chiza_str, Str; // do not allow to equip light armor, cast, and then switch to heavy armor to get bonus str
- end;
+ goto L_FreeRecast;
OnAttack:
- if (target(BL_ID, @target_id, 22) != 22) end; // 0x10 | 0x02 | 0x04
- set .@dmg, if_then_else(@chiza_component$ == "Knife", 40, 60);
- void call("melee_damage", @spellpower, @target_id, (.@dmg + rand(@chiza_str + 5)));
+ 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 1, @chizaspell[3], 1, ATTACK_ICON_GENERIC, 30, strnpcinfo(0)+"::OnAttack";
end;
OnInit:
diff --git a/world/map/npc/magic/level2-lightning-strike.txt b/world/map/npc/magic/level2-lightning-strike.txt
index 67d1a72e..3032d5ab 100644
--- a/world/map/npc/magic/level2-lightning-strike.txt
+++ b/world/map/npc/magic/level2-lightning-strike.txt
@@ -12,24 +12,37 @@
callfunc "adjust_spellpower";
set Sp, Sp - 20;
misceffect FX_MAGIC_BLACK, strcharinfo(0);
- set @ingrav_sp, @spellpower;
- set @ingrav_luk, Luk;
- set .@delay, (((200 - Agi) * 3000) / 200);
- overrideattack (@spellpower/90)+1, .@delay, 8, ATTACK_ICON_GENERIC, 31, strnpcinfo(0)+"::OnAttack";
+ setarray @ingravspell[0],
+ @spellpower,
+ Luk,
+ ((@spellpower/90)+1), // charges
+ (((200 - Agi) * 3000) / 200), // delay
+ 0, // in_rain
+ 0; // target id (tmp)
+
callfunc "magic_exp";
- end;
+ goto L_FreeRecast;
OnAttack:
- if (target(BL_ID, @target_id, 22) != 22) end; // 0x10 | 0x02 | 0x04
+ if (target(BL_ID, @target_id, 22) != 22) L_FreeRecast; // 0x10 | 0x02 | 0x04
- set @ingrav_rain, 0;
set .@p, get(.max_radius, "rain") + 1;
- set @ingrav_target, @target_id; // store it because foreach overwrites it
+ 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, @ingrav_target; // now restore it
+ 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;
- if (@ingrav_rain & 1) goto L_InRain;
- void call("elt_damage", @ingrav_sp, (@ingrav_sp/2)+1, ELT_EARTH, ELT_WIND, FX_LIGHTNING1 + rand(3));
+L_FreeRecast:
+ if (@ingravspell[2] > 0)
+ addtimer 0, strnpcinfo(0) + "::OnSetRecast";
+ end;
+
+OnSetRecast:
+ overrideattack 1, @ingravspell[3], 8, ATTACK_ICON_GENERIC, 31, strnpcinfo(0)+"::OnAttack";
end;
OnNpc:
@@ -37,24 +50,24 @@ OnNpc:
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 @ar[0], .@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 >= @ar[0] && POS_Y >= @ar[1] && POS_X <= @ar[2] && POS_Y <= @ar[3])
- set @ingrav_rain, @ingrav_rain | 1;
+ 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 @used, 0;
- foreach 0, getmap(), @ar[0], @ar[1], @ar[2], @ar[3], strnpcinfo(0)+"::OnEntityInRain";
- if (@used >= 1 && (@ingrav_luk + rand(200)) >= 150) end;
+ 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 - @ingrav_sp, 0;
- end;
+ heal 0 - @ingravspell[0], 0;
+ goto L_FreeRecast;
OnEntityInRain:
if (target(BL_ID, @target_id, 16) != 16) end; // 0x10
- if (@ingrav_luk + rand(200) <= 175) end;
- set @used, @used + 1;
- void call("elt_damage", @ingrav_sp/6, (((@ingrav_sp/2)+1)/3)+1, ELT_EARTH, ELT_WIND, FX_LIGHTNING1 + rand(3));
+ 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:
diff --git a/world/map/npc/magic/level2-magic-knuckles.txt b/world/map/npc/magic/level2-magic-knuckles.txt
index 3f4d4667..0984a7fd 100644
--- a/world/map/npc/magic/level2-magic-knuckles.txt
+++ b/world/map/npc/magic/level2-magic-knuckles.txt
@@ -12,14 +12,27 @@
callfunc "adjust_spellpower";
set Sp, Sp - 20;
misceffect FX_MAGIC_BLACK, strcharinfo(0);
- set .@delay, (((200 - Agi) * 1300) / 200);
- overrideattack (@spellpower/10)+10, .@delay, 1, ATTACK_ICON_GENERIC, 34, strnpcinfo(0)+"::OnAttack";
+ setarray @upmarmuspell[0],
+ @spellpower,
+ ((@spellpower/10) + 10), // charges
+ (((200 - Agi) * 1300) / 200), // delay
+ Str; // do not allow to equip light armor, cast, and then switch to heavy armor to get bonus str
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;
+ goto L_FreeRecast;
OnAttack:
- void call("melee_damage", @spellpower, @target_id, (30 + rand((@upmaru_str*2) + 5)));
+ if (target(BL_ID, @target_id, 22) != 22) goto L_FreeRecast; // 0x10 | 0x02 | 0x04
+ void call("melee_damage", @upmarmuspell[0], @target_id, (30 + rand((@upmarmuspell[3]*2) + 5)));
+ set @upmarmuspell[1], @upmarmuspell[1] - 1;
+ goto L_FreeRecast;
+
+L_FreeRecast:
+ if (@upmarmuspell[1] > 0)
+ addtimer 0, strnpcinfo(0) + "::OnSetRecast";
+ end;
+
+OnSetRecast:
+ overrideattack 1, @upmarmuspell[2], 1, ATTACK_ICON_GENERIC, 34, strnpcinfo(0)+"::OnAttack";
end;
OnInit:
diff --git a/world/map/npc/magic/level2-shear.txt b/world/map/npc/magic/level2-shear.txt
index c76b1093..af825727 100644
--- a/world/map/npc/magic/level2-shear.txt
+++ b/world/map/npc/magic/level2-shear.txt
@@ -9,18 +9,19 @@
callfunc "adjust_spellpower";
set Sp, Sp - 23;
misceffect FX_MAGIC_GREEN, strcharinfo(0);
- set .@delay, (((200 - Agi) * 2000) / 200);
- overrideattack 1, .@delay, 1, ATTACK_ICON_SHEARING, 30, strnpcinfo(0)+"::OnAttack";
+ setarray @chipchipspell[0],
+ @spellpower,
+ (((200 - Agi) * 2000) / 200); //delay
+ overrideattack 1, @chipchipspell[1], 1, ATTACK_ICON_SHEARING, 30, strnpcinfo(0)+"::OnAttack";
callfunc "magic_exp";
- set @chipchip_sp, @spellpower;
end;
OnAttack:
- if (isloggedin(@target_id)) end; // can not shear a player
- if (sc_check(SC_SHEARED, @target_id)) end; // mob already sheared
- if (target(BL_ID, @target_id, 22) != 22) end; // 0x10 | 0x02 | 0x04
+ 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(@chipchip_sp));
+ set .@score, rand(1000 - rand(@chipchipspell[0]));
set .@id, get(Class, @target_id); // get the mob ID
if (.@id == 1020 && .@score < 300) set .@item$, "WhiteFur"; // Fluffy
@@ -41,6 +42,14 @@ OnAttack:
callfunc "QuestSagathaHappy";
end;
+L_FreeRecast:
+ addtimer 0, strnpcinfo(0) + "::OnSetRecast"; // we can't do it while already overridden, until it reaches a script terminator
+ end;
+
+OnSetRecast:
+ overrideattack 1, @chipchipspell[1], 1, ATTACK_ICON_SHEARING, 30, strnpcinfo(0)+"::OnAttack";
+ end;
+
OnInit:
set .school, SKILL_MAGIC_NATURE;
set .invocation$, chr(MAGIC_SYMBOL) + "chipchip"; // used in npcs that refer to this spell
diff --git a/world/map/npc/magic/level2-toxic-dart.txt b/world/map/npc/magic/level2-toxic-dart.txt
index a14710d6..357ae32b 100644
--- a/world/map/npc/magic/level2-toxic-dart.txt
+++ b/world/map/npc/magic/level2-toxic-dart.txt
@@ -12,18 +12,33 @@
callfunc "adjust_spellpower";
set Sp, Sp - 15;
misceffect FX_MAGIC_DARKRED, strcharinfo(0);
- 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";
+ 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";
- end;
+ goto L_FreeRecast;
OnAttack:
+ if (target(BL_ID, @target_id, 50) != 50) goto L_FreeRecast; // 0x20 | 0x02 | 0x10
misceffect FX_MAGIC_DARKRED, strcharinfo(0);
- if (target(BL_ID, @target_id, 50) != 50) end; // 0x20 | 0x02 | 0x10
- void call("elt_damage", @phlex_damage[0], @phlex_damage[1], ELT_NEUTRAL, ELT_POISON, FX_FIRE_BURST);
+ void call("elt_damage", @phlexspell[0], @phlexspell[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;
+ 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;
+
+OnSetRecast:
+ overrideattack 1, @phlexspell[2], 4, ATTACK_ICON_GENERIC, 31, strnpcinfo(0)+"::OnAttack";
end;
OnInit: