From 6168360d0c5482935d404870115528ea99d6e3f7 Mon Sep 17 00:00:00 2001 From: gregchan550 Date: Fri, 22 Sep 2023 10:29:57 +1000 Subject: [PATCH] added demon and slime death cases in the sequence --- .../tasks/bosstask/DemonBossTask.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/DemonBossTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/DemonBossTask.java index 1e9b5a761..9008346cd 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/DemonBossTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/DemonBossTask.java @@ -144,8 +144,10 @@ public void update() { // detect death stage if (health <= 0 && !slimeFlag) { slimeFlag = true; - changeState(DemonState.DEATH); + changeState(DemonState.TRANSFORM_REVERSE); demon.getComponent(CombatStatsComponent.class).addHealth(500); + } else if (health <= 0 && slimeFlag) { + changeState(DemonState.TRANSFORM); } // detect half health @@ -178,7 +180,14 @@ public void update() { changeState(DemonState.IDLE); } } - case DEATH -> { + case TRANSFORM -> { + if (health <= 0) { + if (animation.isFinished()) { + changeState(DemonState.DEATH); + } + } + } + case TRANSFORM_REVERSE -> { if (animation.isFinished()) { changeState(DemonState.SLIME_MOVE); } @@ -195,6 +204,11 @@ public void update() { } } } + case DEATH -> { + if (animation.isFinished()) { + demon.dispose(); + } + } } }