summaryrefslogtreecommitdiff
path: root/world/map/npc/magic
diff options
context:
space:
mode:
authorWushin <pasekei@gmail.com>2016-05-11 16:50:15 -0500
committerWushin <pasekei@gmail.com>2016-05-11 16:50:15 -0500
commit6fb28669713684116e3598cbfad078bffb7f0531 (patch)
treed478ccf6e0ed83ab1e6aa59f09b74f14c55dd0cc /world/map/npc/magic
parent9218cfaba1337e0098f147cd58d0496bdaf14728 (diff)
parenta25fa832a47e27a56be017bbb58b85ba7f072507 (diff)
downloadserverdata-6fb28669713684116e3598cbfad078bffb7f0531.tar.gz
serverdata-6fb28669713684116e3598cbfad078bffb7f0531.tar.bz2
serverdata-6fb28669713684116e3598cbfad078bffb7f0531.tar.xz
serverdata-6fb28669713684116e3598cbfad078bffb7f0531.zip
Merge pull request #496 from mekolat/end-message
a bit of everything
Diffstat (limited to 'world/map/npc/magic')
-rw-r--r--world/map/npc/magic/_procedures.txt36
-rw-r--r--world/map/npc/magic/level2-barrier.txt4
-rw-r--r--world/map/npc/magic/level2-flying-backpack.txt4
-rw-r--r--world/map/npc/magic/level2-hide.txt2
-rw-r--r--world/map/npc/magic/level2-protect.txt7
5 files changed, 39 insertions, 14 deletions
diff --git a/world/map/npc/magic/_procedures.txt b/world/map/npc/magic/_procedures.txt
index bdeb6140..95b5cd93 100644
--- a/world/map/npc/magic/_procedures.txt
+++ b/world/map/npc/magic/_procedures.txt
@@ -14,7 +14,7 @@ function|script|magic_register
end;
OnLogin:
- set @_M_BLOCK, 1;
+ set @_M_BLOCK, 2;
addtimer 10000, "Magic Timer::OnClear";
end;
@@ -26,14 +26,32 @@ OnClear:
// this function is call()-only
function|script|magic_checks
{
- set .@r, 0;
- if(HIDDEN) set .@r, 1; // can not cast with @hide
- if(@_M_BLOCK) set .@r, 2; // check if last debuff ended
- if(Hp < 1) set .@r, 3; // can not cast when dead
- if (MATK1 < 1) set .@r, 4; // can not cast with a grey mana bar
- if (.@r)
- smsg SMSG_FAILURE, "Magic: Impossible to cast right now.";
- return .@r;
+ 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) goto L_Greybar; // can not cast with a grey mana bar
+ 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;
}
function|script|elt_damage
diff --git a/world/map/npc/magic/level2-barrier.txt b/world/map/npc/magic/level2-barrier.txt
index 9526ee5a..3b7ffb77 100644
--- a/world/map/npc/magic/level2-barrier.txt
+++ b/world/map/npc/magic/level2-barrier.txt
@@ -27,10 +27,12 @@
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.";
- addtimer @asorm_time, strnpcinfo(0)+"::OnEnd", @target_id;
+ 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_DEFAULT, strcharinfo(0);
diff --git a/world/map/npc/magic/level2-flying-backpack.txt b/world/map/npc/magic/level2-flying-backpack.txt
index 87c7d644..36e936fd 100644
--- a/world/map/npc/magic/level2-flying-backpack.txt
+++ b/world/map/npc/magic/level2-flying-backpack.txt
@@ -22,10 +22,12 @@
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.";
- addtimer @plugh_time, strnpcinfo(0)+"::OnEnd", @target_id;
+ 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_GENERIC, strcharinfo(0);
diff --git a/world/map/npc/magic/level2-hide.txt b/world/map/npc/magic/level2-hide.txt
index 6d9c125d..f720dd43 100644
--- a/world/map/npc/magic/level2-hide.txt
+++ b/world/map/npc/magic/level2-hide.txt
@@ -26,10 +26,12 @@
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_GENERIC, strcharinfo(0);
diff --git a/world/map/npc/magic/level2-protect.txt b/world/map/npc/magic/level2-protect.txt
index 659efdc1..38ea6a7d 100644
--- a/world/map/npc/magic/level2-protect.txt
+++ b/world/map/npc/magic/level2-protect.txt
@@ -6,7 +6,6 @@
if (.@level < .level) end;
if (getskilllv(SKILL_MAGIC) < .level) end;
if (.@level <= 3 && countitem("HardSpike") < 1) end;
- 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
@@ -15,7 +14,7 @@
if (distance(BL_ID, @target_id) >= (@spellpower/30)+2) set @target_id, BL_ID;
if (get(@antiprotect, @target_id) > 0) end;
- delitem "HardSpike", 1;
+ 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";
@@ -29,10 +28,12 @@
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.";
- addtimer @betsanc_time, strnpcinfo(0)+"::OnEnd", @target_id;
+ 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);