From 7fa677d766c2b3a4f4c919c7ff612e414ee1ccff Mon Sep 17 00:00:00 2001 From: P0nk Date: Mon, 29 Aug 2022 22:46:46 +0200 Subject: [PATCH] Fix act for scripts that reset to initial state after some time --- scripts/reactor/2119004.js | 2 +- scripts/reactor/2119005.js | 2 +- scripts/reactor/2119006.js | 2 +- src/main/java/server/maps/Reactor.java | 7 +++++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/reactor/2119004.js b/scripts/reactor/2119004.js index 59a84fd405..44a6fb387e 100644 --- a/scripts/reactor/2119004.js +++ b/scripts/reactor/2119004.js @@ -19,6 +19,6 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -function hit() { +function act() { rm.weakenAreaBoss(6090001, "The light at the altar appeases the hatred of the Snow Witch. The force of the Witch has weakened."); } \ No newline at end of file diff --git a/scripts/reactor/2119005.js b/scripts/reactor/2119005.js index 59a84fd405..44a6fb387e 100644 --- a/scripts/reactor/2119005.js +++ b/scripts/reactor/2119005.js @@ -19,6 +19,6 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -function hit() { +function act() { rm.weakenAreaBoss(6090001, "The light at the altar appeases the hatred of the Snow Witch. The force of the Witch has weakened."); } \ No newline at end of file diff --git a/scripts/reactor/2119006.js b/scripts/reactor/2119006.js index 59a84fd405..44a6fb387e 100644 --- a/scripts/reactor/2119006.js +++ b/scripts/reactor/2119006.js @@ -19,6 +19,6 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -function hit() { +function act() { rm.weakenAreaBoss(6090001, "The light at the altar appeases the hatred of the Snow Witch. The force of the Witch has weakened."); } \ No newline at end of file diff --git a/src/main/java/server/maps/Reactor.java b/src/main/java/server/maps/Reactor.java index d3c73dbc53..2b07d72b4d 100644 --- a/src/main/java/server/maps/Reactor.java +++ b/src/main/java/server/maps/Reactor.java @@ -270,8 +270,11 @@ public class Reactor extends AbstractMapObject { continue; } } - state = stats.getNextState(state, b); - if (stats.getNextState(state, b) == -1) {//end of reactor + + this.state = stats.getNextState(state, b); + byte nextState = stats.getNextState(state, b); + boolean isInEndState = nextState < this.state; + if (isInEndState) {//end of reactor if (reactorType < 100) {//reactor broken if (delay > 0) { map.destroyReactor(getObjectId());