v0.9.0b: fixed a crash in new talent UI when her is level 30

This commit is contained in:
Evan Debenham 2020-10-16 12:01:36 -04:00
parent b39287503e
commit 7c4f562e3a
2 changed files with 5 additions and 6 deletions

View File

@ -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<LinkedHashMap<Talent, Integer>> talents ){
while (talents.size() < TALENT_TIERS){
while (talents.size() < MAX_TALENT_TIERS){
talents.add(new LinkedHashMap<>());
}

View File

@ -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++){