v0.3.4: reworked rankings to store their cause instead of a result string
This commit is contained in:
parent
0e2fbc05fb
commit
ac967fad27
|
@ -126,8 +126,6 @@ public class Dungeon {
|
||||||
|
|
||||||
public static int depth;
|
public static int depth;
|
||||||
public static int gold;
|
public static int gold;
|
||||||
// Reason of death
|
|
||||||
public static String resultDescription;
|
|
||||||
|
|
||||||
public static HashSet<Integer> chapters;
|
public static HashSet<Integer> chapters;
|
||||||
|
|
||||||
|
@ -672,14 +670,13 @@ public class Dungeon {
|
||||||
Hero.preview( info, bundle.getBundle( HERO ) );
|
Hero.preview( info, bundle.getBundle( HERO ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void fail( String desc ) {
|
public static void fail( Class cause ) {
|
||||||
resultDescription = desc;
|
|
||||||
if (hero.belongings.getItem( Ankh.class ) == null) {
|
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();
|
hero.belongings.identify();
|
||||||
|
|
||||||
|
@ -687,8 +684,7 @@ public class Dungeon {
|
||||||
Badges.validateChampion();
|
Badges.validateChampion();
|
||||||
}
|
}
|
||||||
|
|
||||||
resultDescription = desc;
|
Rankings.INSTANCE.submit( true, cause );
|
||||||
Rankings.INSTANCE.submit( true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void observe() {
|
public static void observe() {
|
||||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||||
|
@ -49,13 +50,13 @@ public enum Rankings {
|
||||||
public int totalNumber;
|
public int totalNumber;
|
||||||
public int wonNumber;
|
public int wonNumber;
|
||||||
|
|
||||||
public void submit( boolean win ) {
|
public void submit( boolean win, Class cause ) {
|
||||||
|
|
||||||
load();
|
load();
|
||||||
|
|
||||||
Record rec = new Record();
|
Record rec = new Record();
|
||||||
|
|
||||||
rec.info = Dungeon.resultDescription;
|
rec.cause = cause;
|
||||||
rec.win = win;
|
rec.win = win;
|
||||||
rec.heroClass = Dungeon.hero.heroClass;
|
rec.heroClass = Dungeon.hero.heroClass;
|
||||||
rec.armorTier = Dungeon.hero.tier();
|
rec.armorTier = Dungeon.hero.tier();
|
||||||
|
@ -167,7 +168,11 @@ public enum Rankings {
|
||||||
|
|
||||||
public static class Record implements Bundlable {
|
public static class Record implements Bundlable {
|
||||||
|
|
||||||
|
//pre 0.3.4
|
||||||
|
public String info;
|
||||||
private static final String REASON = "reason";
|
private static final String REASON = "reason";
|
||||||
|
|
||||||
|
private static final String CAUSE = "cause";
|
||||||
private static final String WIN = "win";
|
private static final String WIN = "win";
|
||||||
private static final String SCORE = "score";
|
private static final String SCORE = "score";
|
||||||
private static final String TIER = "tier";
|
private static final String TIER = "tier";
|
||||||
|
@ -175,7 +180,7 @@ public enum Rankings {
|
||||||
private static final String DEPTH = "depth";
|
private static final String DEPTH = "depth";
|
||||||
private static final String GAME = "gameFile";
|
private static final String GAME = "gameFile";
|
||||||
|
|
||||||
public String info;
|
public Class cause;
|
||||||
public boolean win;
|
public boolean win;
|
||||||
|
|
||||||
public HeroClass heroClass;
|
public HeroClass heroClass;
|
||||||
|
@ -187,10 +192,28 @@ public enum Rankings {
|
||||||
|
|
||||||
public String gameFile;
|
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
|
@Override
|
||||||
public void restoreFromBundle( Bundle bundle ) {
|
public void restoreFromBundle( Bundle bundle ) {
|
||||||
|
|
||||||
|
//pre-0.3.4
|
||||||
info = bundle.getString( REASON );
|
info = bundle.getString( REASON );
|
||||||
|
|
||||||
|
cause = bundle.getClass( CAUSE );
|
||||||
win = bundle.getBoolean( WIN );
|
win = bundle.getBoolean( WIN );
|
||||||
score = bundle.getInt( SCORE );
|
score = bundle.getInt( SCORE );
|
||||||
|
|
||||||
|
@ -239,7 +262,9 @@ public enum Rankings {
|
||||||
@Override
|
@Override
|
||||||
public void storeInBundle( Bundle bundle ) {
|
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( WIN, win );
|
||||||
bundle.put( SCORE, score );
|
bundle.put( SCORE, score );
|
||||||
|
|
||||||
|
|
|
@ -153,14 +153,7 @@ public abstract class Char extends Actor {
|
||||||
if (!enemy.isAlive() && visibleFight) {
|
if (!enemy.isAlive() && visibleFight) {
|
||||||
if (enemy == Dungeon.hero) {
|
if (enemy == Dungeon.hero) {
|
||||||
|
|
||||||
if ( this instanceof Yog ) {
|
Dungeon.fail( getClass() );
|
||||||
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) );
|
GLog.n( Messages.get(Char.class, "kill", name) );
|
||||||
|
|
||||||
} else if (this == Dungeon.hero) {
|
} else if (this == Dungeon.hero) {
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class ToxicGas extends Blob implements Hero.Doom {
|
||||||
|
|
||||||
Badges.validateDeathFromGas();
|
Badges.validateDeathFromGas();
|
||||||
|
|
||||||
Dungeon.fail( ResultDescriptions.GAS );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "ondeath") );
|
GLog.n( Messages.get(this, "ondeath") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class Bleeding extends Buff {
|
||||||
|
|
||||||
public void set( int level ) {
|
public void set( int level ) {
|
||||||
this.level = level;
|
this.level = level;
|
||||||
};
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int icon() {
|
public int icon() {
|
||||||
|
@ -80,7 +80,7 @@ public class Bleeding extends Buff {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target == Dungeon.hero && !target.isAlive()) {
|
if (target == Dungeon.hero && !target.isAlive()) {
|
||||||
Dungeon.fail( ResultDescriptions.BLEEDING );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "ondeath") );
|
GLog.n( Messages.get(this, "ondeath") );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ public class Burning extends Buff implements Hero.Doom {
|
||||||
|
|
||||||
Badges.validateDeathFromFire();
|
Badges.validateDeathFromFire();
|
||||||
|
|
||||||
Dungeon.fail( ResultDescriptions.BURNING );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "ondeath") );
|
GLog.n( Messages.get(this, "ondeath") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class Hunger extends Buff implements Hero.Doom {
|
||||||
|
|
||||||
Badges.validateDeathFromHunger();
|
Badges.validateDeathFromHunger();
|
||||||
|
|
||||||
Dungeon.fail( ResultDescriptions.HUNGER );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "ondeath") );
|
GLog.n( Messages.get(this, "ondeath") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class Ooze extends Buff {
|
||||||
else if (Random.Int(2) == 0)
|
else if (Random.Int(2) == 0)
|
||||||
target.damage( 1, this );
|
target.damage( 1, this );
|
||||||
if (!target.isAlive() && target == Dungeon.hero) {
|
if (!target.isAlive() && target == Dungeon.hero) {
|
||||||
Dungeon.fail( ResultDescriptions.OOZE );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "ondeath") );
|
GLog.n( Messages.get(this, "ondeath") );
|
||||||
}
|
}
|
||||||
spend( TICK );
|
spend( TICK );
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class Poison extends Buff implements Hero.Doom {
|
||||||
|
|
||||||
public void set( float duration ) {
|
public void set( float duration ) {
|
||||||
this.left = duration;
|
this.left = duration;
|
||||||
};
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int icon() {
|
public int icon() {
|
||||||
|
@ -118,7 +118,7 @@ public class Poison extends Buff implements Hero.Doom {
|
||||||
public void onDeath() {
|
public void onDeath() {
|
||||||
Badges.validateDeathFromPoison();
|
Badges.validateDeathFromPoison();
|
||||||
|
|
||||||
Dungeon.fail( ResultDescriptions.POISON );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( "You died from poison..." );
|
GLog.n( "You died from poison..." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -770,7 +770,7 @@ public class Hero extends Char {
|
||||||
GameScene.show( new WndMessage( Messages.get(this, "leave") ) );
|
GameScene.show( new WndMessage( Messages.get(this, "leave") ) );
|
||||||
ready();
|
ready();
|
||||||
} else {
|
} else {
|
||||||
Dungeon.win( ResultDescriptions.WIN );
|
Dungeon.win( Amulet.class );
|
||||||
Dungeon.deleteGame( Dungeon.hero.heroClass, true );
|
Dungeon.deleteGame( Dungeon.hero.heroClass, true );
|
||||||
Game.switchScene( SurfaceScene.class );
|
Game.switchScene( SurfaceScene.class );
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class Eye extends Mob {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ch.isAlive() && ch == Dungeon.hero) {
|
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") );
|
GLog.n( Messages.get(this, "deathgaze_kill") );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class Shaman extends Mob implements Callback {
|
||||||
Camera.main.shake( 2, 0.3f );
|
Camera.main.shake( 2, 0.3f );
|
||||||
|
|
||||||
if (!enemy.isAlive()) {
|
if (!enemy.isAlive()) {
|
||||||
Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name ) ) );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "zap_kill") );
|
GLog.n( Messages.get(this, "zap_kill") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class Skeleton extends Mob {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (heroKilled) {
|
if (heroKilled) {
|
||||||
Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name ) ) );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "explo_kill") );
|
GLog.n( Messages.get(this, "explo_kill") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class Warlock extends Mob implements Callback {
|
||||||
enemy.damage( dmg, this );
|
enemy.damage( dmg, this );
|
||||||
|
|
||||||
if (!enemy.isAlive() && enemy == Dungeon.hero) {
|
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") );
|
GLog.n( Messages.get(this, "bolt_kill") );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -346,7 +346,7 @@ public class Yog extends Mob {
|
||||||
enemy.sprite.flash();
|
enemy.sprite.flash();
|
||||||
|
|
||||||
if (!enemy.isAlive() && enemy == Dungeon.hero) {
|
if (!enemy.isAlive() && enemy == Dungeon.hero) {
|
||||||
Dungeon.fail( Utils.format( ResultDescriptions.UNIQUE, name ) );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(Char.class, "kill", name) );
|
GLog.n( Messages.get(Char.class, "kill", name) );
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -149,7 +149,7 @@ public class Bomb extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ch == Dungeon.hero && !ch.isAlive())
|
if (ch == Dungeon.hero && !ch.isAlive())
|
||||||
Dungeon.fail( Messages.get(this, "ondeath") );
|
Dungeon.fail( getClass() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ public class Armor extends EquipableItem {
|
||||||
if (inscribe) {
|
if (inscribe) {
|
||||||
inscribe( Glyph.random() );
|
inscribe( Glyph.random() );
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
STR--;
|
STR--;
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@ public class Armor extends EquipableItem {
|
||||||
public boolean checkOwner( Char owner ) {
|
public boolean checkOwner( Char owner ) {
|
||||||
if (!owner.isAlive() && owner instanceof Hero) {
|
if (!owner.isAlive() && owner instanceof Hero) {
|
||||||
|
|
||||||
Dungeon.fail( Utils.format( ResultDescriptions.GLYPH, name() ) );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "killed", name()) );
|
GLog.n( Messages.get(this, "killed", name()) );
|
||||||
|
|
||||||
Badges.validateDeathFromGlyph();
|
Badges.validateDeathFromGlyph();
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class Viscosity extends Glyph {
|
||||||
|
|
||||||
public void prolong( int damage ) {
|
public void prolong( int damage ) {
|
||||||
this.damage += damage;
|
this.damage += damage;
|
||||||
};
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int icon() {
|
public int icon() {
|
||||||
|
@ -124,7 +124,7 @@ public class Viscosity extends Glyph {
|
||||||
if (target == Dungeon.hero && !target.isAlive()) {
|
if (target == Dungeon.hero && !target.isAlive()) {
|
||||||
|
|
||||||
Glyph glyph = new Viscosity();
|
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()) );
|
GLog.n( Messages.get(Glyph.class, "killed", glyph.name()) );
|
||||||
|
|
||||||
Badges.validateDeathFromGlyph();
|
Badges.validateDeathFromGlyph();
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class ChaliceOfBlood extends Artifact {
|
||||||
protected void onSelect(int index) {
|
protected void onSelect(int index) {
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
prick(Dungeon.hero);
|
prick(Dungeon.hero);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ public class ChaliceOfBlood extends Artifact {
|
||||||
hero.damage(damage, this);
|
hero.damage(damage, this);
|
||||||
|
|
||||||
if (!hero.isAlive()) {
|
if (!hero.isAlive()) {
|
||||||
Dungeon.fail(Utils.format( ResultDescriptions.ITEM, name ));
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "ondeath") );
|
GLog.n( Messages.get(this, "ondeath") );
|
||||||
} else {
|
} else {
|
||||||
upgrade();
|
upgrade();
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class ScrollOfPsionicBlast extends Scroll {
|
||||||
curUser.spendAndNext( TIME_TO_READ ); //no animation here, the flash interrupts it anyway.
|
curUser.spendAndNext( TIME_TO_READ ); //no animation here, the flash interrupts it anyway.
|
||||||
|
|
||||||
if (!curUser.isAlive()) {
|
if (!curUser.isAlive()) {
|
||||||
Dungeon.fail( Utils.format(ResultDescriptions.ITEM, name ));
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "ondeath") );
|
GLog.n( Messages.get(this, "ondeath") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,7 +250,7 @@ public class CursedWand {
|
||||||
target.sprite.emitter().burst(Speck.factory(Speck.HEALING), 3);
|
target.sprite.emitter().burst(Speck.factory(Speck.HEALING), 3);
|
||||||
Sample.INSTANCE.play(Assets.SND_CURSED);
|
Sample.INSTANCE.play(Assets.SND_CURSED);
|
||||||
if (!user.isAlive()) {
|
if (!user.isAlive()) {
|
||||||
Dungeon.fail(Utils.format(ResultDescriptions.ITEM, wand.name()));
|
Dungeon.fail( wand.getClass() );
|
||||||
GLog.n(Messages.get(CursedWand.class, "ondeath", wand.name()));
|
GLog.n(Messages.get(CursedWand.class, "ondeath", wand.name()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class WandOfBlastWave extends Wand {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!curUser.isAlive()) {
|
if (!curUser.isAlive()) {
|
||||||
Dungeon.fail( Utils.format(ResultDescriptions.ITEM, name) );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get( this, "ondeath") );
|
GLog.n( Messages.get( this, "ondeath") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class WandOfLightning extends Wand {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!curUser.isAlive()) {
|
if (!curUser.isAlive()) {
|
||||||
Dungeon.fail( Utils.format( ResultDescriptions.ITEM, name ) );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n(Messages.get(this, "ondeath"));
|
GLog.n(Messages.get(this, "ondeath"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,6 @@ public class WandOfTransfusion extends Wand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//this wand costs health too
|
//this wand costs health too
|
||||||
private void damageHero(){
|
private void damageHero(){
|
||||||
// 15% of max hp
|
// 15% of max hp
|
||||||
|
@ -181,7 +180,7 @@ public class WandOfTransfusion extends Wand {
|
||||||
curUser.damage(damage, this);
|
curUser.damage(damage, this);
|
||||||
|
|
||||||
if (!curUser.isAlive()){
|
if (!curUser.isAlive()){
|
||||||
Dungeon.fail( Utils.format(ResultDescriptions.ITEM, name) );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "ondeath") );
|
GLog.n( Messages.get(this, "ondeath") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class Chasm {
|
||||||
jumpConfirmed = true;
|
jumpConfirmed = true;
|
||||||
hero.resume();
|
hero.resume();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ public class Chasm {
|
||||||
public void onDeath() {
|
public void onDeath() {
|
||||||
Badges.validateDeathFromFalling();
|
Badges.validateDeathFromFalling();
|
||||||
|
|
||||||
Dungeon.fail( ResultDescriptions.FALL );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(Chasm.class, "ondeath") );
|
GLog.n( Messages.get(Chasm.class, "ondeath") );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class ChillingTrap extends Trap{
|
||||||
Chill.prolong(ch, Chill.class, 5f + Random.Int(Dungeon.depth));
|
Chill.prolong(ch, Chill.class, 5f + Random.Int(Dungeon.depth));
|
||||||
ch.damage(Random.NormalIntRange(1 , Dungeon.depth), this);
|
ch.damage(Random.NormalIntRange(1 , Dungeon.depth), this);
|
||||||
if (!ch.isAlive() && ch == Dungeon.hero){
|
if (!ch.isAlive() && ch == Dungeon.hero){
|
||||||
Dungeon.fail( Utils.format(ResultDescriptions.TRAP, name) );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "ondeath") );
|
GLog.n( Messages.get(this, "ondeath") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class DisintegrationTrap extends Trap {
|
||||||
if (ch == Dungeon.hero){
|
if (ch == Dungeon.hero){
|
||||||
Hero hero = (Hero)ch;
|
Hero hero = (Hero)ch;
|
||||||
if (!hero.isAlive()){
|
if (!hero.isAlive()){
|
||||||
Dungeon.fail(Utils.format(ResultDescriptions.TRAP, name));
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "ondeath") );
|
GLog.n( Messages.get(this, "ondeath") );
|
||||||
} else {
|
} else {
|
||||||
Item item = hero.belongings.randomUnequipped();
|
Item item = hero.belongings.randomUnequipped();
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class FrostTrap extends Trap {
|
||||||
ch.damage(Random.NormalIntRange(1 , Dungeon.depth), this);
|
ch.damage(Random.NormalIntRange(1 , Dungeon.depth), this);
|
||||||
Chill.prolong(ch, Frost.class, 10f + Random.Int(Dungeon.depth));
|
Chill.prolong(ch, Frost.class, 10f + Random.Int(Dungeon.depth));
|
||||||
if (!ch.isAlive() && ch == Dungeon.hero){
|
if (!ch.isAlive() && ch == Dungeon.hero){
|
||||||
Dungeon.fail( Utils.format(ResultDescriptions.TRAP, name) );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "ondeath") );
|
GLog.n( Messages.get(this, "ondeath") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class GrimTrap extends Trap {
|
||||||
}
|
}
|
||||||
Sample.INSTANCE.play(Assets.SND_CURSED);
|
Sample.INSTANCE.play(Assets.SND_CURSED);
|
||||||
if (!finalTarget.isAlive()) {
|
if (!finalTarget.isAlive()) {
|
||||||
Dungeon.fail(Utils.format(ResultDescriptions.TRAP, name));
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "ondeath") );
|
GLog.n( Messages.get(this, "ondeath") );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class LightningTrap extends Trap {
|
||||||
Camera.main.shake( 2, 0.3f );
|
Camera.main.shake( 2, 0.3f );
|
||||||
|
|
||||||
if (!ch.isAlive()) {
|
if (!ch.isAlive()) {
|
||||||
Dungeon.fail( Utils.format( ResultDescriptions.TRAP, name ) );
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "ondeath") );
|
GLog.n( Messages.get(this, "ondeath") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class RockfallTrap extends Trap {
|
||||||
Buff.prolong( ch, Paralysis.class, Paralysis.duration(ch)*2);
|
Buff.prolong( ch, Paralysis.class, Paralysis.duration(ch)*2);
|
||||||
|
|
||||||
if (!ch.isAlive() && ch == Dungeon.hero){
|
if (!ch.isAlive() && ch == Dungeon.hero){
|
||||||
Dungeon.fail(Utils.format(ResultDescriptions.TRAP, name));
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "ondeath") );
|
GLog.n( Messages.get(this, "ondeath") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class SpearTrap extends Trap {
|
||||||
damage -= Random.IntRange( 0, ch.dr());
|
damage -= Random.IntRange( 0, ch.dr());
|
||||||
ch.damage( Math.max(damage, 0) , this);
|
ch.damage( Math.max(damage, 0) , this);
|
||||||
if (!ch.isAlive() && ch == Dungeon.hero){
|
if (!ch.isAlive() && ch == Dungeon.hero){
|
||||||
Dungeon.fail(Utils.format(ResultDescriptions.TRAP, name));
|
Dungeon.fail( getClass() );
|
||||||
GLog.n( Messages.get(this, "ondeath") );
|
GLog.n( Messages.get(this, "ondeath") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.Amulet;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.watabou.noosa.Camera;
|
import com.watabou.noosa.Camera;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
|
@ -61,7 +62,7 @@ public class AmuletScene extends PixelScene {
|
||||||
RedButton btnExit = new RedButton( Messages.get(this, "exit") ) {
|
RedButton btnExit = new RedButton( Messages.get(this, "exit") ) {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
Dungeon.win( ResultDescriptions.WIN );
|
Dungeon.win( Amulet.class );
|
||||||
Dungeon.deleteGame( Dungeon.hero.heroClass, true );
|
Dungeon.deleteGame( Dungeon.hero.heroClass, true );
|
||||||
Game.switchScene( noText ? TitleScene.class : RankingsScene.class );
|
Game.switchScene( noText ? TitleScene.class : RankingsScene.class );
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ public class RankingsScene extends PixelScene {
|
||||||
position.text(" ");
|
position.text(" ");
|
||||||
position.measure();
|
position.measure();
|
||||||
|
|
||||||
desc.text( rec.info );
|
desc.text( rec.deathDesc() );
|
||||||
|
|
||||||
//desc.measure();
|
//desc.measure();
|
||||||
|
|
||||||
|
@ -277,8 +277,8 @@ public class RankingsScene extends PixelScene {
|
||||||
depth.x = steps.x + (steps.width - depth.width()) / 2;
|
depth.x = steps.x + (steps.width - depth.width()) / 2;
|
||||||
depth.y = steps.y + (steps.height - depth.height()) / 2 + 1;
|
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.maxWidth((int)(steps.x - desc.left()));
|
||||||
|
desc.setPos(shield.x + shield.width + GAP, shield.y + (shield.height - desc.height()) / 2 + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class WndResurrect extends Window {
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
hide();
|
hide();
|
||||||
|
|
||||||
Rankings.INSTANCE.submit( false );
|
Rankings.INSTANCE.submit( false, WndResurrect.causeOfDeath.getClass() );
|
||||||
Hero.reallyDie( WndResurrect.causeOfDeath );
|
Hero.reallyDie( WndResurrect.causeOfDeath );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user