From 05c3621615160af17f74c1a0ca9e0671f41c061e Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 4 Apr 2022 17:47:32 -0400 Subject: [PATCH] v1.2.2: fixed cases where heroic energy was being incorrectly renamed --- .../shatteredpixeldungeon/actors/hero/Talent.java | 6 ++---- .../actors/hero/abilities/Ratmogrify.java | 3 +++ .../shatteredpixeldungeon/ui/TalentsPane.java | 3 +++ .../shatteredpixeldungeon/windows/WndInfoArmorAbility.java | 3 +++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java index fbb657436..0bb223a35 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java @@ -195,7 +195,7 @@ public enum Talent { public int icon(){ if (this == HEROIC_ENERGY){ - if (Dungeon.hero != null && Dungeon.hero.armorAbility instanceof Ratmogrify){ + if (Ratmogrify.useRatroicEnergy){ return 127; } HeroClass cls = Dungeon.hero != null ? Dungeon.hero.heroClass : GamesInProgress.selectedClass; @@ -219,9 +219,7 @@ public enum Talent { } public String title(){ - if (this == HEROIC_ENERGY - && Dungeon.hero != null - && Dungeon.hero.armorAbility instanceof Ratmogrify){ + if (Ratmogrify.useRatroicEnergy){ return Messages.get(this, name() + ".rat_title"); } return Messages.get(this, name() + ".title"); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/Ratmogrify.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/Ratmogrify.java index 5ab3eac46..18111f968 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/Ratmogrify.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/Ratmogrify.java @@ -57,6 +57,9 @@ public class Ratmogrify extends ArmorAbility { baseChargeUse = 50f; } + //this is sort of hacky, but we need it to know when to use alternate name/icon for heroic energy + public static boolean useRatroicEnergy = false; + @Override public String targetingPrompt() { return Messages.get(this, "prompt"); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TalentsPane.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TalentsPane.java index bbec4c91c..eb967b9d7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TalentsPane.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TalentsPane.java @@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; @@ -52,6 +53,8 @@ public class TalentsPane extends ScrollPane { public TalentsPane( TalentButton.Mode mode, ArrayList> talents ) { super(new Component()); + Ratmogrify.useRatroicEnergy = Dungeon.hero != null && Dungeon.hero.armorAbility instanceof Ratmogrify; + int tiersAvailable = 1; if (mode == TalentButton.Mode.INFO){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoArmorAbility.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoArmorAbility.java index 518da2935..70b363064 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoArmorAbility.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoArmorAbility.java @@ -24,6 +24,8 @@ package com.shatteredpixel.shatteredpixeldungeon.windows; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Rat; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; @@ -43,6 +45,7 @@ public class WndInfoArmorAbility extends WndTitledMessage { ArrayList> talentList = new ArrayList<>(); Talent.initArmorTalents(ability, talentList); + Ratmogrify.useRatroicEnergy = ability instanceof Ratmogrify; TalentsPane.TalentTierPane talentPane = new TalentsPane.TalentTierPane(talentList.get(3), 4, TalentButton.Mode.INFO); talentPane.title.text( Messages.titleCase(Messages.get(WndHeroInfo.class, "talents"))); talentPane.setRect(0, height + 5, width, talentPane.height());