From 4dc9da6c2b23d145583ef528260cc7023a60bdfa Mon Sep 17 00:00:00 2001 From: syeyoung Date: Wed, 27 Jan 2021 19:01:40 +0900 Subject: BONZO --- .../bossfight/BossfightProcessorBonzo.java | 62 ++++++++++++++++++++++ .../bossfight/BossfightProcessorLivid.java | 2 +- .../bossfight/GeneralBossfightProcessor.java | 12 +---- .../roomprocessor/bossfight/HealthData.java | 1 + 4 files changed, 65 insertions(+), 12 deletions(-) create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java (limited to 'src/main/java/kr/syeyoung/dungeonsguide/roomprocessor') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java new file mode 100644 index 00000000..56957135 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java @@ -0,0 +1,62 @@ +package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; + +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.client.entity.EntityOtherPlayerMP; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraftforge.event.entity.living.LivingEvent; + +import java.util.ArrayList; +import java.util.List; + +public class BossfightProcessorBonzo extends GeneralBossfightProcessor { + public BossfightProcessorBonzo() { + addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("start") + .signatureMsg("§r§c[BOSS] Bonzo§r§f: Gratz for making it this far, but I’m basically unbeatable.§r") + .nextPhase("fight-1").build() + ); + addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("fight-1") + .signatureMsg("§r§c[BOSS] Bonzo§r§f: I can summon lots of undead! Check this out.§r") + .nextPhase("first-defeat").build() + ); + addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("first-defeat") + .signatureMsg("§r§c[BOSS] Bonzo§r§f: Oh I'm dead!§r").signatureMsg("§r§c[BOSS] Bonzo§r§f: Hoho, looks like you killed me!§r") + .nextPhase("fight-2").build() + ); + addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("fight-2") + .signatureMsg("§r§c[BOSS] Bonzo§r§f: Sike§r").signatureMsg("§r§c[BOSS] Bonzo§r§f: I can revive myself and become much stronger!§r") + .nextPhase("final-defeat").build() + ); + addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("final-defeat") + .signatureMsg("§r§c[BOSS] Bonzo§r§f: Alright, maybe I'm just weak after all..§r").build() + ); + } + + + @Override + public List getHealths() { + List healths = new ArrayList(); + long health = 0; + if (bonzoStand != null) { + String name = TextUtils.stripColor(bonzoStand.getName()); + String healthPart = name.split(" ")[2]; + health = TextUtils.reverseFormat(healthPart.substring(0, healthPart.length() - 1)); + System.out.println(healthPart.substring(0, healthPart.length() - 1) + " / "+ health); + } + healths.add(new HealthData("Bonzo", (int) health,250000 , this.getCurrentPhase().startsWith("fight-"))); + return healths; + } + + private EntityArmorStand bonzoStand; + @Override + public void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent) { + if (updateEvent.entityLiving.getName().startsWith("§c§lBonzo§r ") && updateEvent.entityLiving instanceof EntityArmorStand) { + System.out.println(updateEvent.entityLiving.getName()); + bonzoStand = (EntityArmorStand) updateEvent.entityLiving; + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java index 78dfd060..fa18262d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java @@ -33,6 +33,6 @@ public class BossfightProcessorLivid extends GeneralBossfightProcessor { @Override public List getHealths() { ArrayList healthData = new ArrayList(); - return super.getHealths(); + return healthData; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java index 2b1ce71c..f7fa009b 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java @@ -10,13 +10,10 @@ import net.minecraftforge.event.entity.living.LivingEvent; import java.util.*; -public class GeneralBossfightProcessor implements BossfightProcessor { +public abstract class GeneralBossfightProcessor implements BossfightProcessor { private Map phases = new HashMap(); private PhaseData currentPhase = null; - @Getter - @Setter - private int bossMaxHealth = 100; @Getter @Setter private String name; @@ -44,13 +41,6 @@ public class GeneralBossfightProcessor implements BossfightProcessor { return phases; } - @Override - public List getHealths() { - ArrayList arr = new ArrayList(); - arr.add(new HealthData(name, (int) (bossMaxHealth * BossStatus.healthScale), bossMaxHealth)); - return arr; - } - @Override public String getCurrentPhase() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/HealthData.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/HealthData.java index 66a727dd..9a9ed82b 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/HealthData.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/HealthData.java @@ -11,4 +11,5 @@ public class HealthData { private String name; private int health; private int maxHealth; + private boolean attackable; } -- cgit