From f71f26affd599fa87a4c03319a979c6786f978f3 Mon Sep 17 00:00:00 2001 From: "Hello=)" Date: Wed, 10 Apr 2024 15:41:30 +0300 Subject: Initial commit of Dungeon Master/Boss Event spells/actions toolkit by Hello=) Few things to keep in mind: 1) This commit lands DEBUG version of thing to give some ideas how it could happen. 2) This version is very "chatty" and spits a lot of debug messages to General chat. Next commits would remove most of non-essential spell messages. 3) This version allows ANYONE to invoke spells and should not be used on production! Next commits would address this, uplifting spell invocation requirements. 4) Cooldown times are too low, to facilitate testing. Should be fixed in next commits. Next commits would 5) Some effects need to be rewired, and few more spells could possibly be added. --- .../map/npc/magic/event-boss-powerup-manadrain.txt | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 world/map/npc/magic/event-boss-powerup-manadrain.txt (limited to 'world/map/npc/magic/event-boss-powerup-manadrain.txt') diff --git a/world/map/npc/magic/event-boss-powerup-manadrain.txt b/world/map/npc/magic/event-boss-powerup-manadrain.txt new file mode 100644 index 00000000..69dae18a --- /dev/null +++ b/world/map/npc/magic/event-boss-powerup-manadrain.txt @@ -0,0 +1,52 @@ +-|script|powerup-manadrain|32767 +{ + end; + +OnCast: + message strcharinfo(0), "[boss-manadrain] : -> OnCast"; + if(call("boss_powerup_checks")) end; + message strcharinfo(0), "[boss-manadrain] : after boss powerup check"; + if (getmapflag(getmap(), MF_TOWN)) goto L_Fail_town; + message strcharinfo(0), "[boss-manadrain] : after mapflags check"; + message strcharinfo(0), "[boss-manadrain] : HP="+get(Hp, BL_ID); +// TBD who can use this. + set @_M_BLOCK, 1; // block casting, until the timer clears it + addtimer 10000, "Magic Timer::OnClear"; // set the new debuff + sc_start SC_COOLDOWN, 10000, 0, BL_ID; + misceffect FX_BLUE_MAGIC_CAST, strcharinfo(0); + set @dist, 16; + foreach 0, getmap(), (POS_X - @dist), (POS_Y - @dist), (POS_X + @dist), (POS_Y + @dist), strnpcinfo(0) + "::OnHit"; + message strcharinfo(0), "[boss-manadrain] : after foreach"; + message strcharinfo(0), "[boss-manadrain] : HP="+get(Hp, BL_ID); + message strcharinfo(0), "[boss-manadrain] : <- OnCast"; + end; + +OnHit: + if (@target_id == BL_ID) end; // Do not drain caster + if ((get(Hp, @target_id)) < 1) end; // Do not touch dead + set @targetmp, get(Sp, @target_id); // Get MP of victim + if (@targetmp > 0) goto L_cont; + set @targetmp, 0; + end; // Do not drain dead! +L_cont: + set @hpgain, min((@targetmp * 2 ), 900); // Clamp in case of weird setups. + message strcharinfo(0, @target_id), "[boss-manadrain] : "+strcharinfo(0, BL_ID)+" drains all your mana!"; + misceffect FX_CHANNELLING_RAISE, strcharinfo(0, @target_id); + set Sp, 1, @target_id; // Drain victim + set Hp, (Hp + @hpgain), BL_ID; // Heal caster by computed amount + set @hpgain, 0; + set @targetmp, 0; + end; + +L_Fail_town: + message strcharinfo(0), "[boss-manadrain] : aura of this place doesn't lets you drain mana!"; + end; + +OnInit: + set .school, SKILL_MAGIC; + set .invocation$, chr(MAGIC_SYMBOL) + "mapmanadrain"; // used in npcs that refer to this spell + void call("magic_register", "OnCast"); + set .level, 0; + set .exp_gain, 0; + end; +} -- cgit v1.2.3-70-g09d2