From 7c4f562e3a6acc3cdebe569f0dee5704ab2f8aa7 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 16 Oct 2020 12:01:36 -0400 Subject: [PATCH] v0.9.0b: fixed a crash in new talent UI when her is level 30 --- .../shatteredpixeldungeon/actors/hero/Talent.java | 4 ++-- .../shatteredpixeldungeon/ui/TalentsPane.java | 7 +++---- 2 files changed, 5 insertions(+), 6 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 807332052..c71893a8e 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 @@ -202,14 +202,14 @@ public enum Talent { public static class SuckerPunchTracker extends Buff{}; public static class FollowupStrikeTracker extends Buff{}; - private static final int TALENT_TIERS = 1; + public static final int MAX_TALENT_TIERS = 1; public static void initClassTalents( Hero hero ){ initClassTalents( hero.heroClass, hero.talents ); } public static void initClassTalents( HeroClass cls, ArrayList> talents ){ - while (talents.size() < TALENT_TIERS){ + while (talents.size() < MAX_TALENT_TIERS){ talents.add(new LinkedHashMap<>()); } 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 be452ba9c..1f3253406 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TalentsPane.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TalentsPane.java @@ -52,13 +52,12 @@ public class TalentsPane extends ScrollPane { int tiersAvailable = 1; if (!canUpgrade){ - tiersAvailable = 4; + tiersAvailable = Talent.MAX_TALENT_TIERS; } else { - while (Dungeon.hero.lvl+1 >= Talent.tierLevelThresholds[tiersAvailable+1]){ + while (tiersAvailable < Talent.MAX_TALENT_TIERS + && Dungeon.hero.lvl+1 >= Talent.tierLevelThresholds[tiersAvailable+1]){ tiersAvailable++; } - //TODO lighten limit as future tiers are added - tiersAvailable = Math.min(tiersAvailable, 2); } for (int i = 0; i < Math.min(tiersAvailable, talents.size()); i++){