diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/src/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index a707e5abc..a5e8ab11c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -126,8 +126,6 @@ public class Dungeon { public static int depth; public static int gold; - // Reason of death - public static String resultDescription; public static HashSet chapters; @@ -672,14 +670,13 @@ public class Dungeon { Hero.preview( info, bundle.getBundle( HERO ) ); } - public static void fail( String desc ) { - resultDescription = desc; + public static void fail( Class cause ) { if (hero.belongings.getItem( Ankh.class ) == null) { - Rankings.INSTANCE.submit( false ); + Rankings.INSTANCE.submit( false, cause ); } } - public static void win( String desc ) { + public static void win( Class cause ) { hero.belongings.identify(); @@ -687,8 +684,7 @@ public class Dungeon { Badges.validateChampion(); } - resultDescription = desc; - Rankings.INSTANCE.submit( true ); + Rankings.INSTANCE.submit( true, cause ); } public static void observe() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java b/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java index 0a1aecd0a..b536a3a6c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java @@ -28,6 +28,7 @@ import java.util.Collections; import java.util.Comparator; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.watabou.noosa.Game; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; @@ -49,13 +50,13 @@ public enum Rankings { public int totalNumber; public int wonNumber; - public void submit( boolean win ) { + public void submit( boolean win, Class cause ) { load(); Record rec = new Record(); - rec.info = Dungeon.resultDescription; + rec.cause = cause; rec.win = win; rec.heroClass = Dungeon.hero.heroClass; rec.armorTier = Dungeon.hero.tier(); @@ -166,16 +167,20 @@ public enum Rankings { } public static class Record implements Bundlable { - + + //pre 0.3.4 + public String info; private static final String REASON = "reason"; + + private static final String CAUSE = "cause"; private static final String WIN = "win"; private static final String SCORE = "score"; private static final String TIER = "tier"; private static final String LEVEL = "level"; private static final String DEPTH = "depth"; private static final String GAME = "gameFile"; - - public String info; + + public Class cause; public boolean win; public HeroClass heroClass; @@ -187,10 +192,28 @@ public enum Rankings { public String gameFile; + public String deathDesc(){ + if (cause == null && (info == null || info.equals(""))) + return "Killed by Something"; + else if (cause == null){ + return info; //pre 0.3.4 saves + } else { + String result = Messages.get(cause, "rankings_desc", (Messages.get(cause, "name"))); + if (result.contains("!!!NO TEXT FOUND!!!")){ + return "Killed By Something"; + } else { + return result; + } + } + } + @Override public void restoreFromBundle( Bundle bundle ) { - + + //pre-0.3.4 info = bundle.getString( REASON ); + + cause = bundle.getClass( CAUSE ); win = bundle.getBoolean( WIN ); score = bundle.getInt( SCORE ); @@ -239,7 +262,9 @@ public enum Rankings { @Override public void storeInBundle( Bundle bundle ) { - bundle.put( REASON, info ); + if (info != null && !info.equals("")) bundle.put( REASON, info ); + else bundle.put( CAUSE, cause ); + bundle.put( WIN, win ); bundle.put( SCORE, score ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ResultDescriptions.java b/src/com/shatteredpixel/shatteredpixeldungeon/ResultDescriptions.java index f417ab2ca..da13d58c0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ResultDescriptions.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ResultDescriptions.java @@ -42,6 +42,6 @@ public class ResultDescriptions { public static final String BLEEDING = "Bled to Death"; public static final String OOZE = "Melted Away"; public static final String FALL = "Died on Impact"; - + public static final String WIN = "Obtained the Amulet of Yendor"; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index 4f86c3ba2..d47810698 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -153,15 +153,8 @@ public abstract class Char extends Actor { if (!enemy.isAlive() && visibleFight) { if (enemy == Dungeon.hero) { - if ( this instanceof Yog ) { - Dungeon.fail( Utils.format( ResultDescriptions.NAMED, name) ); - } else if (properties().contains(Property.MINIBOSS) || properties().contains(Property.BOSS)) { - Dungeon.fail( Utils.format( ResultDescriptions.UNIQUE, name) ); - } else { - Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name )) ); - } - - GLog.n( Messages.get(Char.class, "kill", name) ); + Dungeon.fail( getClass() ); + GLog.n( Messages.get(Char.class, "kill", name) ); } else if (this == Dungeon.hero) { GLog.i( Messages.get(Char.class, "defeat", enemy.name) ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ToxicGas.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ToxicGas.java index cdc285d0e..b32bef28f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ToxicGas.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ToxicGas.java @@ -72,7 +72,7 @@ public class ToxicGas extends Blob implements Hero.Doom { Badges.validateDeathFromGas(); - Dungeon.fail( ResultDescriptions.GAS ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "ondeath") ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bleeding.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bleeding.java index be53e4d77..421c43ebe 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bleeding.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bleeding.java @@ -55,7 +55,7 @@ public class Bleeding extends Buff { public void set( int level ) { this.level = level; - }; + } @Override public int icon() { @@ -80,7 +80,7 @@ public class Bleeding extends Buff { } if (target == Dungeon.hero && !target.isAlive()) { - Dungeon.fail( ResultDescriptions.BLEEDING ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "ondeath") ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java index 254fd1b29..1b45ed684 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java @@ -170,7 +170,7 @@ public class Burning extends Buff implements Hero.Doom { Badges.validateDeathFromFire(); - Dungeon.fail( ResultDescriptions.BURNING ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "ondeath") ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java index 38850b7ce..581fe7d65 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java @@ -188,7 +188,7 @@ public class Hunger extends Buff implements Hero.Doom { Badges.validateDeathFromHunger(); - Dungeon.fail( ResultDescriptions.HUNGER ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "ondeath") ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Ooze.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Ooze.java index 57f5d5fca..50dccfefd 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Ooze.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Ooze.java @@ -62,7 +62,7 @@ public class Ooze extends Buff { else if (Random.Int(2) == 0) target.damage( 1, this ); if (!target.isAlive() && target == Dungeon.hero) { - Dungeon.fail( ResultDescriptions.OOZE ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "ondeath") ); } spend( TICK ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Poison.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Poison.java index 19943e361..7c2270055 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Poison.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Poison.java @@ -58,7 +58,7 @@ public class Poison extends Buff implements Hero.Doom { public void set( float duration ) { this.left = duration; - }; + } @Override public int icon() { @@ -118,7 +118,7 @@ public class Poison extends Buff implements Hero.Doom { public void onDeath() { Badges.validateDeathFromPoison(); - Dungeon.fail( ResultDescriptions.POISON ); + Dungeon.fail( getClass() ); GLog.n( "You died from poison..." ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 12f16f4cd..1157849c9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -770,7 +770,7 @@ public class Hero extends Char { GameScene.show( new WndMessage( Messages.get(this, "leave") ) ); ready(); } else { - Dungeon.win( ResultDescriptions.WIN ); + Dungeon.win( Amulet.class ); Dungeon.deleteGame( Dungeon.hero.heroClass, true ); Game.switchScene( SurfaceScene.class ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java index 37284bd77..026e7fe6b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java @@ -128,7 +128,7 @@ public class Eye extends Mob { } if (!ch.isAlive() && ch == Dungeon.hero) { - Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name ) ) ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "deathgaze_kill") ); } } else { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java index 1e1f54937..398cbf7cf 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java @@ -107,7 +107,7 @@ public class Shaman extends Mob implements Callback { Camera.main.shake( 2, 0.3f ); if (!enemy.isAlive()) { - Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name ) ) ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "zap_kill") ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java index 080168f81..d53b95790 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java @@ -83,7 +83,7 @@ public class Skeleton extends Mob { } if (heroKilled) { - Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name ) ) ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "explo_kill") ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java index e405de530..1a2568f6c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java @@ -111,7 +111,7 @@ public class Warlock extends Mob implements Callback { enemy.damage( dmg, this ); if (!enemy.isAlive() && enemy == Dungeon.hero) { - Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name ) ) ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "bolt_kill") ); } } else { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java index b248cd682..e0cdc2cb6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java @@ -346,7 +346,7 @@ public class Yog extends Mob { enemy.sprite.flash(); if (!enemy.isAlive() && enemy == Dungeon.hero) { - Dungeon.fail( Utils.format( ResultDescriptions.UNIQUE, name ) ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(Char.class, "kill", name) ); } return true; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java index c2fe16b72..1ce1d6b0b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java @@ -149,7 +149,7 @@ public class Bomb extends Item { } if (ch == Dungeon.hero && !ch.isAlive()) - Dungeon.fail( Messages.get(this, "ondeath") ); + Dungeon.fail( getClass() ); } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index 1a02f247b..db14b4df1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -152,7 +152,7 @@ public class Armor extends EquipableItem { if (inscribe) { inscribe( Glyph.random() ); } - }; + } STR--; @@ -339,7 +339,7 @@ public class Armor extends EquipableItem { public boolean checkOwner( Char owner ) { if (!owner.isAlive() && owner instanceof Hero) { - Dungeon.fail( Utils.format( ResultDescriptions.GLYPH, name() ) ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "killed", name()) ); Badges.validateDeathFromGlyph(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Viscosity.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Viscosity.java index 3d2c47bb2..585bf40b7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Viscosity.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Viscosity.java @@ -104,7 +104,7 @@ public class Viscosity extends Glyph { public void prolong( int damage ) { this.damage += damage; - }; + } @Override public int icon() { @@ -124,7 +124,7 @@ public class Viscosity extends Glyph { if (target == Dungeon.hero && !target.isAlive()) { Glyph glyph = new Viscosity(); - Dungeon.fail( Utils.format( ResultDescriptions.GLYPH, glyph.name() ) ); + Dungeon.fail( glyph.getClass() ); GLog.n( Messages.get(Glyph.class, "killed", glyph.name()) ); Badges.validateDeathFromGlyph(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java index bbd4efb3e..772b09b18 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java @@ -74,7 +74,7 @@ public class ChaliceOfBlood extends Artifact { protected void onSelect(int index) { if (index == 0) prick(Dungeon.hero); - }; + } } ); @@ -108,7 +108,7 @@ public class ChaliceOfBlood extends Artifact { hero.damage(damage, this); if (!hero.isAlive()) { - Dungeon.fail(Utils.format( ResultDescriptions.ITEM, name )); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "ondeath") ); } else { upgrade(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java index 222ed1f8e..eba08b264 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java @@ -68,7 +68,7 @@ public class ScrollOfPsionicBlast extends Scroll { curUser.spendAndNext( TIME_TO_READ ); //no animation here, the flash interrupts it anyway. if (!curUser.isAlive()) { - Dungeon.fail( Utils.format(ResultDescriptions.ITEM, name )); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "ondeath") ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java index 6a304fbe4..5dddd7dae 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java @@ -250,7 +250,7 @@ public class CursedWand { target.sprite.emitter().burst(Speck.factory(Speck.HEALING), 3); Sample.INSTANCE.play(Assets.SND_CURSED); if (!user.isAlive()) { - Dungeon.fail(Utils.format(ResultDescriptions.ITEM, wand.name())); + Dungeon.fail( wand.getClass() ); GLog.n(Messages.get(CursedWand.class, "ondeath", wand.name())); } break; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java index 8ba6fc71f..ce0b1b7ac 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java @@ -100,7 +100,7 @@ public class WandOfBlastWave extends Wand { } if (!curUser.isAlive()) { - Dungeon.fail( Utils.format(ResultDescriptions.ITEM, name) ); + Dungeon.fail( getClass() ); GLog.n( Messages.get( this, "ondeath") ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java index a98c9b9c6..ae30b3201 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java @@ -73,7 +73,7 @@ public class WandOfLightning extends Wand { } if (!curUser.isAlive()) { - Dungeon.fail( Utils.format( ResultDescriptions.ITEM, name ) ); + Dungeon.fail( getClass() ); GLog.n(Messages.get(this, "ondeath")); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java index 81a9be1ef..c892cae8f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java @@ -173,7 +173,6 @@ public class WandOfTransfusion extends Wand { } } - //this wand costs health too private void damageHero(){ // 15% of max hp @@ -181,7 +180,7 @@ public class WandOfTransfusion extends Wand { curUser.damage(damage, this); if (!curUser.isAlive()){ - Dungeon.fail( Utils.format(ResultDescriptions.ITEM, name) ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "ondeath") ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java index c2f8ae1bb..c093e5459 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java @@ -59,7 +59,7 @@ public class Chasm { jumpConfirmed = true; hero.resume(); } - }; + } } ); } @@ -104,7 +104,7 @@ public class Chasm { public void onDeath() { Badges.validateDeathFromFalling(); - Dungeon.fail( ResultDescriptions.FALL ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(Chasm.class, "ondeath") ); } } ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java index a3fb76a4a..359d0d6ee 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java @@ -57,7 +57,7 @@ public class ChillingTrap extends Trap{ Chill.prolong(ch, Chill.class, 5f + Random.Int(Dungeon.depth)); ch.damage(Random.NormalIntRange(1 , Dungeon.depth), this); if (!ch.isAlive() && ch == Dungeon.hero){ - Dungeon.fail( Utils.format(ResultDescriptions.TRAP, name) ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "ondeath") ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisintegrationTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisintegrationTrap.java index 4c4ef6049..1ce3e3531 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisintegrationTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisintegrationTrap.java @@ -66,7 +66,7 @@ public class DisintegrationTrap extends Trap { if (ch == Dungeon.hero){ Hero hero = (Hero)ch; if (!hero.isAlive()){ - Dungeon.fail(Utils.format(ResultDescriptions.TRAP, name)); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "ondeath") ); } else { Item item = hero.belongings.randomUnequipped(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FrostTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FrostTrap.java index a2cf2a879..6bbc7abde 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FrostTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FrostTrap.java @@ -59,7 +59,7 @@ public class FrostTrap extends Trap { ch.damage(Random.NormalIntRange(1 , Dungeon.depth), this); Chill.prolong(ch, Frost.class, 10f + Random.Int(Dungeon.depth)); if (!ch.isAlive() && ch == Dungeon.hero){ - Dungeon.fail( Utils.format(ResultDescriptions.TRAP, name) ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "ondeath") ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GrimTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GrimTrap.java index 008140530..a27c28916 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GrimTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GrimTrap.java @@ -81,7 +81,7 @@ public class GrimTrap extends Trap { } Sample.INSTANCE.play(Assets.SND_CURSED); if (!finalTarget.isAlive()) { - Dungeon.fail(Utils.format(ResultDescriptions.TRAP, name)); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "ondeath") ); } } else { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/LightningTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/LightningTrap.java index 68a22365b..8c628cf9c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/LightningTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/LightningTrap.java @@ -61,7 +61,7 @@ public class LightningTrap extends Trap { Camera.main.shake( 2, 0.3f ); if (!ch.isAlive()) { - Dungeon.fail( Utils.format( ResultDescriptions.TRAP, name ) ); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "ondeath") ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/RockfallTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/RockfallTrap.java index ad2521f2b..cc9bf9c0d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/RockfallTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/RockfallTrap.java @@ -64,7 +64,7 @@ public class RockfallTrap extends Trap { Buff.prolong( ch, Paralysis.class, Paralysis.duration(ch)*2); if (!ch.isAlive() && ch == Dungeon.hero){ - Dungeon.fail(Utils.format(ResultDescriptions.TRAP, name)); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "ondeath") ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SpearTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SpearTrap.java index eb29963c4..a26895f9a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SpearTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SpearTrap.java @@ -66,7 +66,7 @@ public class SpearTrap extends Trap { damage -= Random.IntRange( 0, ch.dr()); ch.damage( Math.max(damage, 0) , this); if (!ch.isAlive() && ch == Dungeon.hero){ - Dungeon.fail(Utils.format(ResultDescriptions.TRAP, name)); + Dungeon.fail( getClass() ); GLog.n( Messages.get(this, "ondeath") ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java index 3f3669f29..2d3c167f7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java @@ -20,6 +20,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.scenes; +import com.shatteredpixel.shatteredpixeldungeon.items.Amulet; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.watabou.noosa.Camera; import com.watabou.noosa.Game; @@ -61,7 +62,7 @@ public class AmuletScene extends PixelScene { RedButton btnExit = new RedButton( Messages.get(this, "exit") ) { @Override protected void onClick() { - Dungeon.win( ResultDescriptions.WIN ); + Dungeon.win( Amulet.class ); Dungeon.deleteGame( Dungeon.hero.heroClass, true ); Game.switchScene( noText ? TitleScene.class : RankingsScene.class ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java index cee9d5630..97bedf7bb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java @@ -185,7 +185,7 @@ public class RankingsScene extends PixelScene { position.text(" "); position.measure(); - desc.text( rec.info ); + desc.text( rec.deathDesc() ); //desc.measure(); @@ -277,8 +277,8 @@ public class RankingsScene extends PixelScene { depth.x = steps.x + (steps.width - depth.width()) / 2; depth.y = steps.y + (steps.height - depth.height()) / 2 + 1; - desc.setPos(shield.x + shield.width + GAP, shield.y + (shield.height - desc.height()) / 2 + 1); desc.maxWidth((int)(steps.x - desc.left())); + desc.setPos(shield.x + shield.width + GAP, shield.y + (shield.height - desc.height()) / 2 + 1); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java index c7141a828..a2d06f36d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java @@ -79,7 +79,7 @@ public class WndResurrect extends Window { protected void onClick() { hide(); - Rankings.INSTANCE.submit( false ); + Rankings.INSTANCE.submit( false, WndResurrect.causeOfDeath.getClass() ); Hero.reallyDie( WndResurrect.causeOfDeath ); } };