diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java index c4c866e2d..e58646691 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java @@ -140,7 +140,7 @@ public class GamesInProgress { info.goldCollected = Statistics.goldCollected; info.maxDepth = Statistics.deepestFloor; - + slotStates.put( slot, info ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index 4d794a8b9..1cf8fc8e2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -101,8 +101,6 @@ public abstract class Char extends Actor { public CharSprite sprite; - public String name = "mob"; - public int HT; public int HP; @@ -137,6 +135,10 @@ public abstract class Char extends Actor { return false; } + public String name(){ + return Messages.get(this, "name"); + } + public boolean canInteract( Hero h ){ return Dungeon.level.adjacent( pos, h.pos ); } @@ -293,10 +295,10 @@ public abstract class Char extends Actor { } Dungeon.fail( getClass() ); - GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name)) ); + GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) ); } else if (this == Dungeon.hero) { - GLog.i( Messages.capitalize(Messages.get(Char.class, "defeat", enemy.name)) ); + GLog.i( Messages.capitalize(Messages.get(Char.class, "defeat", enemy.name())) ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java index f907bfe9b..51e4e2d39 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java @@ -301,7 +301,7 @@ public class Combo extends Buff implements ActionIndicator.Action { enemy.sprite.flash(); if (!enemy.isAlive()){ - GLog.i( Messages.capitalize(Messages.get(Char.class, "defeat", enemy.name)) ); + GLog.i( Messages.capitalize(Messages.get(Char.class, "defeat", enemy.name())) ); } Hero hero = (Hero)target; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index c80860e6b..b6b9c19f3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -181,11 +181,10 @@ public class Hero extends Char { //This list is maintained so that some logic checks can be skipped // for enemies we know we aren't seeing normally, resultign in better performance public ArrayList mindVisionEnemies = new ArrayList<>(); - + public Hero() { super(); - name = Messages.get(this, "name"); - + HP = HT = 20; STR = STARTING_STR; @@ -288,8 +287,9 @@ public class Hero extends Char { return subClass == null || subClass == HeroSubClass.NONE ? heroClass.title() : subClass.title(); } - public String givenName(){ - return name.equals(Messages.get(this, "name")) ? className() : name; + @Override + public String name(){ + return className(); } public void live() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java index 5f6e36502..2752ecb0c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java @@ -163,7 +163,7 @@ public class King extends Mob { beacon.upgrade(); } - yell( Messages.get(this, "defeated", Dungeon.hero.givenName()) ); + yell( Messages.get(this, "defeated", Dungeon.hero.name()) ); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index cb1efbe31..0c15ed638 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -71,7 +71,6 @@ import java.util.HashSet; public abstract class Mob extends Char { { - name = Messages.get(this, "name"); actPriority = MOB_PRIO; alignment = Alignment.ENEMY; @@ -700,7 +699,7 @@ public abstract class Mob extends Char { } public void yell( String str ) { - GLog.n( "%s: \"%s\" ", Messages.titleCase(name), str ); + GLog.n( "%s: \"%s\" ", Messages.titleCase(name()), str ); } //returns true when a mob sees the hero, and is currently targeting them. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewTengu.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewTengu.java index 698caf1ed..bc668cfe3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewTengu.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewTengu.java @@ -290,7 +290,7 @@ public class NewTengu extends Mob { BossHealthBar.assignBoss(this); if (HP <= HT/2) BossHealthBar.bleed(true); if (HP == HT) { - yell(Messages.get(this, "notice_gotcha", Dungeon.hero.givenName())); + yell(Messages.get(this, "notice_gotcha", Dungeon.hero.name())); for (Char ch : Actor.chars()){ if (ch instanceof DriedRose.GhostHero){ GLog.n("\n"); @@ -298,7 +298,7 @@ public class NewTengu extends Mob { } } } else { - yell(Messages.get(this, "notice_have", Dungeon.hero.givenName())); + yell(Messages.get(this, "notice_have", Dungeon.hero.name())); } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/OldTengu.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/OldTengu.java index 3769e0c24..40231d497 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/OldTengu.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/OldTengu.java @@ -248,7 +248,7 @@ public class OldTengu extends Mob { BossHealthBar.assignBoss(this); if (HP <= HT/2) BossHealthBar.bleed(true); if (HP == HT) { - yell(Messages.get(this, "notice_mine", Dungeon.hero.givenName())); + yell(Messages.get(this, "notice_mine", Dungeon.hero.name())); for (Char ch : Actor.chars()){ if (ch instanceof DriedRose.GhostHero){ GLog.n("\n"); @@ -256,7 +256,7 @@ public class OldTengu extends Mob { } } } else { - yell(Messages.get(this, "notice_face", Dungeon.hero.givenName())); + yell(Messages.get(this, "notice_face", Dungeon.hero.name())); } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java index 2c5ea1075..7f649132d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java @@ -339,7 +339,7 @@ public class Yog extends Mob { if (!enemy.isAlive() && enemy == Dungeon.hero) { Dungeon.fail( getClass() ); - GLog.n( Messages.get(Char.class, "kill", name) ); + GLog.n( Messages.get(Char.class, "kill", name()) ); } return true; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java index c4b137f77..1f709313c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java @@ -164,13 +164,13 @@ public class Ghost extends NPC { switch (Quest.type){ case 1: default: questBoss = new FetidRat(); - txt_quest = Messages.get(this, "rat_1", Dungeon.hero.givenName()); break; + txt_quest = Messages.get(this, "rat_1", Dungeon.hero.name()); break; case 2: questBoss = new GnollTrickster(); - txt_quest = Messages.get(this, "gnoll_1", Dungeon.hero.givenName()); break; + txt_quest = Messages.get(this, "gnoll_1", Dungeon.hero.name()); break; case 3: questBoss = new GreatCrab(); - txt_quest = Messages.get(this, "crab_1", Dungeon.hero.givenName()); break; + txt_quest = Messages.get(this, "crab_1", Dungeon.hero.name()); break; } questBoss.pos = Dungeon.level.randomRespawnCell(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java index 49950a3fb..e46666b29 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java @@ -58,7 +58,7 @@ public class Imp extends NPC { if (!Quest.given && Dungeon.level.heroFOV[pos]) { if (!seenBefore) { - yell( Messages.get(this, "hey", Dungeon.hero.givenName() ) ); + yell( Messages.get(this, "hey", Dungeon.hero.name() ) ); } seenBefore = true; } else { @@ -104,8 +104,8 @@ public class Imp extends NPC { }); } else { tell( Quest.alternative ? - Messages.get(this, "monks_2", Dungeon.hero.givenName()) - : Messages.get(this, "golems_2", Dungeon.hero.givenName()) ); + Messages.get(this, "monks_2", Dungeon.hero.name()) + : Messages.get(this, "golems_2", Dungeon.hero.name()) ); } } else { @@ -130,7 +130,7 @@ public class Imp extends NPC { public void flee() { - yell( Messages.get(this, "cya", Dungeon.hero.givenName()) ); + yell( Messages.get(this, "cya", Dungeon.hero.name()) ); destroy(); sprite.die(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java index f305960d9..f312d93a1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java @@ -41,7 +41,7 @@ public class ImpShopkeeper extends Shopkeeper { protected boolean act() { if (!seenBefore && Dungeon.level.heroFOV[pos]) { - yell( Messages.get(this, "greetings", Dungeon.hero.givenName() ) ); + yell( Messages.get(this, "greetings", Dungeon.hero.name() ) ); seenBefore = true; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java index fb18c6fbc..ab261e2be 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java @@ -113,13 +113,13 @@ public class Wandmaker extends NPC { String msg; switch(Quest.type){ case 1: default: - msg = Messages.get(this, "reminder_dust", Dungeon.hero.givenName()); + msg = Messages.get(this, "reminder_dust", Dungeon.hero.name()); break; case 2: - msg = Messages.get(this, "reminder_ember", Dungeon.hero.givenName()); + msg = Messages.get(this, "reminder_ember", Dungeon.hero.name()); break; case 3: - msg = Messages.get(this, "reminder_berry", Dungeon.hero.givenName()); + msg = Messages.get(this, "reminder_berry", Dungeon.hero.name()); break; } Game.runOnRenderThread(new Callback() { @@ -142,7 +142,7 @@ public class Wandmaker extends NPC { msg1 += Messages.get(this, "intro_rogue"); break; case MAGE: - msg1 += Messages.get(this, "intro_mage", Dungeon.hero.givenName()); + msg1 += Messages.get(this, "intro_mage", Dungeon.hero.name()); break; case HUNTRESS: msg1 += Messages.get(this, "intro_huntress"); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java index a1235223b..94a276a36 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java @@ -157,7 +157,7 @@ public class DriedRose extends Artifact { hero.sprite.operate(hero.pos); if (!firstSummon) { - ghost.yell( Messages.get(GhostHero.class, "hello", Dungeon.hero.givenName()) ); + ghost.yell( Messages.get(GhostHero.class, "hello", Dungeon.hero.name()) ); Sample.INSTANCE.play( Assets.SND_GHOST ); firstSummon = true; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTerror.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTerror.java index 22d239053..f9594cf92 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTerror.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTerror.java @@ -65,7 +65,7 @@ public class ScrollOfTerror extends Scroll { GLog.i( Messages.get(this, "none") ); break; case 1: - GLog.i( Messages.get(this, "one", affected.name) ); + GLog.i( Messages.get(this, "one", affected.name()) ); break; default: GLog.i( Messages.get(this, "many") ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java index 343e4fe4b..3025d0a8d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java @@ -186,11 +186,14 @@ public class WandOfWarding extends Wand { viewDistance = 3; state = WANDERING; - - name = Messages.get(this, "name_" + tier ); } - public void upgrade( int wandLevel ){ + @Override + public String name() { + return Messages.get(this, "name_" + tier ); + } + + public void upgrade(int wandLevel ){ if (this.wandLevel < wandLevel){ this.wandLevel = wandLevel; } @@ -216,7 +219,6 @@ public class WandOfWarding extends Wand { if (tier < 6){ tier++; viewDistance++; - name = Messages.get(this, "name_" + tier ); updateSpriteState(); GameScene.updateFog(pos, viewDistance+1); } @@ -414,7 +416,6 @@ public class WandOfWarding extends Wand { super.restoreFromBundle(bundle); tier = bundle.getInt(TIER); viewDistance = 2 + tier; - name = Messages.get(this, "name_" + tier ); wandLevel = bundle.getInt(WAND_LEVEL); totalZaps = bundle.getInt(TOTAL_ZAPS); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 76f99675d..c3dd7aa58 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -1027,7 +1027,7 @@ public class GameScene extends PixelScene { Mob mob = (Mob) Actor.findChar(cell); if (mob != null) { objects.add(mob); - names.add(Messages.titleCase( mob.name )); + names.add(Messages.titleCase( mob.name() )); } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java index 8cc679c31..4ae23556c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java @@ -56,7 +56,7 @@ public class WndBlacksmith extends Window { IconTitle titlebar = new IconTitle(); titlebar.icon( troll.sprite() ); - titlebar.label( Messages.titleCase( troll.name ) ); + titlebar.label( Messages.titleCase( troll.name() ) ); titlebar.setRect( 0, 0, WIDTH, 0 ); add( titlebar ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java index 23d1ca024..b2156e837 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java @@ -102,10 +102,10 @@ public class WndHero extends WndTabbed { IconTitle title = new IconTitle(); title.icon( HeroSprite.avatar(hero.heroClass, hero.tier()) ); - if (hero.givenName().equals(hero.className())) + if (hero.name().equals(hero.className())) title.label( Messages.get(this, "title", hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ) ); else - title.label((hero.givenName() + "\n" + Messages.get(this, "title", hero.lvl, hero.className())).toUpperCase(Locale.ENGLISH)); + title.label((hero.name() + "\n" + Messages.get(this, "title", hero.lvl, hero.className())).toUpperCase(Locale.ENGLISH)); title.color(Window.SHPX_COLOR); title.setRect( 0, 0, WIDTH, 0 ); add(title); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java index de6a1f883..d484a7536 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java @@ -49,7 +49,7 @@ public class WndInfoMob extends WndTitledMessage { public MobTitle( Mob mob ) { - name = PixelScene.renderTextBlock( Messages.titleCase( mob.name ), 9 ); + name = PixelScene.renderTextBlock( Messages.titleCase( mob.name() ), 9 ); name.hardlight( TITLE_COLOR ); add( name ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndQuest.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndQuest.java index 5e377319f..3b758203f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndQuest.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndQuest.java @@ -27,6 +27,6 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; public class WndQuest extends WndTitledMessage { public WndQuest( NPC questgiver, String text ) { - super( questgiver.sprite(), Messages.titleCase( questgiver.name ), text ); + super( questgiver.sprite(), Messages.titleCase( questgiver.name() ), text ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndWandmaker.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndWandmaker.java index 30237b3bf..98b66a2f7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndWandmaker.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndWandmaker.java @@ -100,7 +100,7 @@ public class WndWandmaker extends Window { Dungeon.level.drop( reward, wandmaker.pos ).sprite.drop(); } - wandmaker.yell( Messages.get(this, "farewell", Dungeon.hero.givenName()) ); + wandmaker.yell( Messages.get(this, "farewell", Dungeon.hero.name()) ); wandmaker.destroy(); wandmaker.sprite.die();