diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java index fb98cc4ea..2c5accada 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java @@ -70,7 +70,6 @@ public class Assets { public static final String BANNERS = "interfaces/banners.png"; public static final String BADGES = "interfaces/badges.png"; public static final String LOCKED = "interfaces/locked_badge.png"; - public static final String AMULET = "interfaces/amulet.png"; public static final String CHROME = "interfaces/chrome.png"; public static final String ICONS = "interfaces/icons.png"; @@ -215,6 +214,7 @@ public class Assets { public static final String HUNTRESS = "sprites/huntress.png"; public static final String AVATARS = "sprites/avatars.png"; public static final String PET = "sprites/pet.png"; + public static final String AMULET = "sprites/amulet.png"; public static final String RAT = "sprites/rat.png"; public static final String BRUTE = "sprites/brute.png"; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java index cc5409322..ee18d225e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; @@ -131,6 +132,12 @@ public enum Rankings { } else if (!Dungeon.quickslot.contains(item)) belongings.backpack.items.remove(item); } + + //remove all buffs (ones tied to equipment will be re-applied) + for(Buff b : Dungeon.hero.buffs()){ + Dungeon.hero.remove(b); + } + rec.gameData.put( HERO, Dungeon.hero ); //save stats diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java index 3d9d1c086..0cd3821bf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java @@ -249,7 +249,7 @@ public class Mimic extends Mob { @Override public boolean reset() { - state = WANDERING; + if (state != PASSIVE) state = WANDERING; return true; } 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 bbd38f039..39663c35b 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 @@ -579,7 +579,7 @@ public abstract class Mob extends Char { } public boolean surprisedBy( Char enemy ){ - return !enemySeen && enemy == Dungeon.hero; + return (!enemySeen || enemy.invisible > 0) && enemy == Dungeon.hero; } public void aggro( Char ch ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Pylon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Pylon.java index 226d9a93c..7491b2879 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Pylon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Pylon.java @@ -129,6 +129,11 @@ public class Pylon extends Mob { return p; } + @Override + public void notice() { + //do nothing + } + @Override public String description() { if (alignment == Alignment.NEUTRAL){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogFist.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogFist.java index 40f31938e..7ba9d5cc1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogFist.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogFist.java @@ -473,7 +473,7 @@ public abstract class YogFist extends Mob { } while (Dungeon.level.heroFOV[i] || Dungeon.level.solid[i] || Actor.findChar(i) != null - || Dungeon.findStep(this, Dungeon.level.exit, Dungeon.level.passable, fieldOfView, false) == -1); + || PathFinder.getStep(i, Dungeon.level.exit, Dungeon.level.passable) == -1); ScrollOfTeleportation.appear(this, i); state = WANDERING; GameScene.flash(0xFFFFFF); @@ -543,7 +543,7 @@ public abstract class YogFist extends Mob { } while (Dungeon.level.heroFOV[i] || Dungeon.level.solid[i] || Actor.findChar(i) != null - || Dungeon.findStep(this, Dungeon.level.exit, Dungeon.level.passable, fieldOfView, false) == -1); + || PathFinder.getStep(i, Dungeon.level.exit, Dungeon.level.passable) == -1); ScrollOfTeleportation.appear(this, i); state = WANDERING; GameScene.flash(0, false); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java index 3ba91a9b5..80e75cf87 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java @@ -36,6 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.audio.Sample; import com.watabou.utils.PathFinder; @@ -57,11 +58,10 @@ public class RogueArmor extends ClassArmor { public void onSelect( Integer target ) { if (target != null) { - PathFinder.buildDistanceMap(curUser.pos, Dungeon.level.passable, 8); + PathFinder.buildDistanceMap(curUser.pos, BArray.not(Dungeon.level.solid,null), 8); if ( PathFinder.distance[target] == Integer.MAX_VALUE || !Dungeon.level.heroFOV[target] || - !(Dungeon.level.passable[target] || Dungeon.level.avoid[target]) || Actor.findChar( target ) != null) { GLog.w( Messages.get(RogueArmor.class, "fov") ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java index 8174b3cb7..3b2041b77 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java @@ -57,7 +57,7 @@ public class AmuletScene extends PixelScene { add( text ); } - amulet = new Image( Assets.Interfaces.AMULET ); + amulet = new Image( Assets.Sprites.AMULET ); add( amulet ); RedButton btnExit = new RedButton( Messages.get(this, "exit") ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java index 88c4c6fda..3dc7b7aa4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java @@ -35,14 +35,14 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock; import com.shatteredpixel.shatteredpixeldungeon.ui.StyledButton; -import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage; -import com.shatteredpixel.shatteredpixeldungeon.windows.WndStartGame; import com.watabou.glwrap.Blending; import com.watabou.noosa.Camera; import com.watabou.noosa.Game; import com.watabou.noosa.Image; import com.watabou.utils.FileUtils; +import java.util.ArrayList; + public class WelcomeScene extends PixelScene { private static int LATEST_UPDATE = ShatteredPixelDungeon.v0_8_0; @@ -169,10 +169,21 @@ public class WelcomeScene extends PixelScene { if (previousVersion < LATEST_UPDATE){ try { Rankings.INSTANCE.load(); + for (Rankings.Record rec : Rankings.INSTANCE.records.toArray(new Rankings.Record[0])){ + try { + Rankings.INSTANCE.loadGameData(rec); + Rankings.INSTANCE.saveGameData(rec); + } catch (Exception e) { + //if we encounter a fatal per-record error, then clear that record + Rankings.INSTANCE.records.remove(rec); + ShatteredPixelDungeon.reportException(e); + } + } Rankings.INSTANCE.save(); } catch (Exception e) { //if we encounter a fatal error, then just clear the rankings FileUtils.deleteFile( Rankings.RANKINGS_FILE ); + ShatteredPixelDungeon.reportException(e); } }