From 1d40cf4b2cf1120f0b54c6ad9bd850de3dd6b8b9 Mon Sep 17 00:00:00 2001 From: mekolat Date: Sun, 24 Apr 2016 13:56:25 -0400 Subject: makes spells respect @invisible --- world/map/npc/magic/_procedures.txt | 2 +- world/map/npc/magic/level1-lesser-heal.txt | 3 ++- world/map/npc/magic/level1-sense-spouse.txt | 2 +- world/map/npc/magic/level2-barrier.txt | 3 ++- world/map/npc/magic/level2-detect-players.txt | 3 ++- world/map/npc/magic/level2-flying-backpack.txt | 3 ++- world/map/npc/magic/level2-happy-curse.txt | 5 +++-- world/map/npc/magic/level2-hide.txt | 3 ++- world/map/npc/magic/level2-lay-on-hands.txt | 2 +- world/map/npc/magic/level2-protect.txt | 3 ++- world/map/npc/magic/level3-necromancy.txt | 2 +- 11 files changed, 19 insertions(+), 12 deletions(-) diff --git a/world/map/npc/magic/_procedures.txt b/world/map/npc/magic/_procedures.txt index d3c63bf7..b53aaa7c 100644 --- a/world/map/npc/magic/_procedures.txt +++ b/world/map/npc/magic/_procedures.txt @@ -27,7 +27,7 @@ OnClear: function|script|magic_checks { set .@r, 0; - if(getpvpflag(1)) set .@r, 1; // FIXME: make HIDDEN into a param + 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 (.@r) diff --git a/world/map/npc/magic/level1-lesser-heal.txt b/world/map/npc/magic/level1-lesser-heal.txt index fcd9897a..d03031d6 100644 --- a/world/map/npc/magic/level1-lesser-heal.txt +++ b/world/map/npc/magic/level1-lesser-heal.txt @@ -4,7 +4,8 @@ if (Sp < 6) end; if (getskilllv(SKILL_MAGIC) < .level) end; set @target_id, getcharid(3, @args$); - if (@target_id < 1 || !(isloggedin(@target_id))) set @target_id, BL_ID; // fallback to self + if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id) == 1) + set @target_id, BL_ID; // fallback to self if (@args$ == "Mouboo" || @args$ == "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; diff --git a/world/map/npc/magic/level1-sense-spouse.txt b/world/map/npc/magic/level1-sense-spouse.txt index 1766276c..fe95c094 100644 --- a/world/map/npc/magic/level1-sense-spouse.txt +++ b/world/map/npc/magic/level1-sense-spouse.txt @@ -5,7 +5,7 @@ goto L_NotMarried; if (isloggedin(.@m) < 1) goto L_NotOnline; - if (sc_check(SC_HIDE, .@m) || getpvpflag(1, .@m)) + if (sc_check(SC_HIDE, .@m) || getpvpflag(1, .@m) || get(INVISIBLE, .@m)) goto L_NotOnline; message strcharinfo(0), "Spouse : Your spouse is... somewhere."; end; diff --git a/world/map/npc/magic/level2-barrier.txt b/world/map/npc/magic/level2-barrier.txt index 3f78677b..9afd4f38 100644 --- a/world/map/npc/magic/level2-barrier.txt +++ b/world/map/npc/magic/level2-barrier.txt @@ -8,7 +8,8 @@ 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))) set @target_id, BL_ID; // fallback to self + if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id) == 1) + set @target_id, BL_ID; // fallback to self set @asorm_caster, BL_ID, @target_id; if (attachrid(@target_id) != 1) end; diff --git a/world/map/npc/magic/level2-detect-players.txt b/world/map/npc/magic/level2-detect-players.txt index 9867b700..7335770c 100644 --- a/world/map/npc/magic/level2-detect-players.txt +++ b/world/map/npc/magic/level2-detect-players.txt @@ -18,7 +18,8 @@ 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 invisible players + 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; diff --git a/world/map/npc/magic/level2-flying-backpack.txt b/world/map/npc/magic/level2-flying-backpack.txt index b87fba02..5e19468e 100644 --- a/world/map/npc/magic/level2-flying-backpack.txt +++ b/world/map/npc/magic/level2-flying-backpack.txt @@ -14,7 +14,8 @@ misceffect FX_MAGIC_GREEN, strcharinfo(0); callfunc "magic_exp"; set @target_id, getcharid(3, @args$); - if (@target_id < 1 || !(isloggedin(@target_id))) set @target_id, BL_ID; // fallback to self + 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 (BL_ID != @target_id) misceffect FX_MAGIC_GENERIC, @args$; if (BL_ID == @target_id) set @args$, strcharinfo(0); diff --git a/world/map/npc/magic/level2-happy-curse.txt b/world/map/npc/magic/level2-happy-curse.txt index 190c7d23..dbfea17a 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; + if(call("magic_checks")) end; if (Sp < 13) end; set .@level, getskilllv(.school); if (.@level < .level) end; @@ -8,7 +8,8 @@ if (.@level <= 3 && countitem("GingerBreadMan") >= 1) delitem "GingerBreadMan", 1; elif (.@level <= 3) end; set @target_id, getcharid(3, @args$); - if (@target_id < 1 || !(isloggedin(@target_id))) set @target_id, BL_ID; // fallback to self + if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id)) + set @target_id, BL_ID; // fallback to self set @_M_BLOCK, 1; // block casting, until the timer clears it addtimer 1000, "Magic Timer::OnClear"; // set the new debuff diff --git a/world/map/npc/magic/level2-hide.txt b/world/map/npc/magic/level2-hide.txt index 1895cff1..ff67e6a5 100644 --- a/world/map/npc/magic/level2-hide.txt +++ b/world/map/npc/magic/level2-hide.txt @@ -8,7 +8,8 @@ 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))) set @target_id, BL_ID; // fallback to self + if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id)) + set @target_id, BL_ID; // fallback to self set @_M_BLOCK, 1; // block casting, until the timer clears it addtimer 1000, "Magic Timer::OnClear"; // set the new debuff diff --git a/world/map/npc/magic/level2-lay-on-hands.txt b/world/map/npc/magic/level2-lay-on-hands.txt index 4e3a1e9c..60c2fc12 100644 --- a/world/map/npc/magic/level2-lay-on-hands.txt +++ b/world/map/npc/magic/level2-lay-on-hands.txt @@ -6,7 +6,7 @@ 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))) end; + if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id)) end; if (Hp <= get(MaxHp, @target_id) / 20) end; // hp needs to be > 1/20 * target hp callfunc "adjust_spellpower"; if (distance(BL_ID, @target_id) >= (((sqrt(@spellpower)*12)+@spellpower)/100)+2) end; diff --git a/world/map/npc/magic/level2-protect.txt b/world/map/npc/magic/level2-protect.txt index e66aab3a..a3096ad7 100644 --- a/world/map/npc/magic/level2-protect.txt +++ b/world/map/npc/magic/level2-protect.txt @@ -8,7 +8,8 @@ if (.@level <= 3 && countitem("HardSpike") >= 1) delitem "HardSpike", 1; elif (.@level <= 3) end; set @target_id, getcharid(3, @args$); - if (@target_id < 1 || !(isloggedin(@target_id))) set @target_id, BL_ID; // fallback to self + if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id)) + set @target_id, BL_ID; // fallback to self set @betsanc_caster, BL_ID, @target_id; if (attachrid(@target_id) != 1) end; diff --git a/world/map/npc/magic/level3-necromancy.txt b/world/map/npc/magic/level3-necromancy.txt index ef2d761f..57f5a6cc 100644 --- a/world/map/npc/magic/level3-necromancy.txt +++ b/world/map/npc/magic/level3-necromancy.txt @@ -7,7 +7,7 @@ if (getskilllv(.school) < .level) end; if (getskilllv(SKILL_MAGIC) < .level) end; set @target_id, getcharid(3, @args$); - if (@target_id < 1 || !(isloggedin(@target_id))) end; + 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"; -- cgit v1.2.3-70-g09d2