From b4d9fc0158bc17c61076c866b4752114625999af Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sun, 19 Jan 2020 23:30:22 -0300 Subject: Rewrite siege so it realizes a proper cleanup --- npc/functions/siege.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/npc/functions/siege.txt b/npc/functions/siege.txt index 1b34d02d3..10dd96a9d 100644 --- a/npc/functions/siege.txt +++ b/npc/functions/siege.txt @@ -356,25 +356,34 @@ function script do_siege { detachrid(); } - // No one is active, cancel the event (FIXME) + // No one is active, cancel the event if (!.@idle) { kamibroadcast(col(b("EVENT CANCELLED DUE TO PLAYER INACTIVITY"),1)); $@MK_AGGRO=$@MK_AGGRO/5; // Lower aggro bar to 20% + + // Cleanup and Garbage Collection + siege_revert(.@m$); + siege_revert(.@o$); + enablenpc("Mana Stone"); + setd("$@SIEGE_"+.@c$, 0); end; } // In past, we had a $@SIEGE_ to determine difficulty // This behavior is now deprecated, we use a global $SIEGE_DIFFICULTY // Which raises in 1 every victory and lowers in 1 every defeat (capped at 1) + // But this behavior can be overriden if (!getd("$@SIEGE_"+.@c$)) { .@difc=max(1, getd("$SIEGE_DIFFICULTY")); // And then, we reset $@SIEGE_ so it can be manipulated // And set .@difc to this value setd("$@SIEGE_"+.@c$, .@difc); - .@difc=getd("$@SIEGE_"+.@c$); } + // Set difficulty based on previous value + .@difc=getd("$@SIEGE_"+.@c$); + switch (.@t) { // Warmup case 70: -- cgit v1.2.3-70-g09d2