From 2306d0c271b52e7ef726b673164396de0084c923 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 27 Sep 2017 22:20:26 -0400 Subject: [PATCH] v0.6.2: several bugfixes and minor corrections --- .../shatteredpixeldungeon/Bones.java | 3 ++- .../actors/blobs/Alchemy.java | 12 ++++++++++++ .../actors/buffs/Preparation.java | 10 +++++----- .../actors/mobs/npcs/Imp.java | 4 ++-- .../items/scrolls/InventoryScroll.java | 2 +- .../shatteredpixeldungeon/levels/Level.java | 14 -------------- .../shatteredpixeldungeon/levels/Terrain.java | 2 +- 7 files changed, 23 insertions(+), 24 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java index 79697817c..51de52678 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java @@ -92,8 +92,9 @@ public class Bones { item = Dungeon.quickslot.randomNonePlaceholder(); break; } - if (item == null || item.bones) + if (item == null || !item.bones) { return pickItem(hero); + } } else { Iterator iterator = hero.belongings.backpack.iterator(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java index b056b1b25..80b45e4b2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java @@ -25,6 +25,8 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; +import com.watabou.utils.PathFinder; +import com.watabou.utils.Random; public class Alchemy extends Blob { @@ -42,6 +44,16 @@ public class Alchemy extends Blob { if (off[cell] > 0 && Dungeon.level.heroFOV[cell]){ Notes.add( Notes.Landmark.ALCHEMY ); } + + //for pre-0.6.2 saves + while (off[cell] > 0 && Dungeon.level.heaps.get(cell) != null){ + + int n; + do { + n = cell + PathFinder.NEIGHBOURS8[Random.Int( 8 )]; + } while (!Dungeon.level.passable[n]); + Dungeon.level.drop( Dungeon.level.heaps.get(cell).pickUp(), n ).sprite.drop( pos ); + } } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java index 798fb9875..31832dacd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java @@ -34,7 +34,6 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.ui.ActionIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; -import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.Image; import com.watabou.noosa.audio.Sample; @@ -57,7 +56,7 @@ public class Preparation extends Buff implements ActionIndicator.Action { LVL_2( 3, 0.2f, 0.0f, 1, 1), LVL_3( 6, 0.3f, 0.0f, 2, 3), LVL_4( 11, 0.4f, 0.4f, 2, 5), - LVL_5( 16, 0.6f, 0.6f, 1, 7); + LVL_5( 16, 0.6f, 0.6f, 3, 7); final int turnsReq; final float baseDmgBonus, missingHPBonus; @@ -72,7 +71,7 @@ public class Preparation extends Buff implements ActionIndicator.Action { public boolean canInstakill(Char defender){ return this == LVL_5 && !defender.properties().contains(Char.Property.MINIBOSS) - && !defender.properties().contains(Char.Property.MINIBOSS); + && !defender.properties().contains(Char.Property.BOSS); } public int damageRoll( Char attacker, Char defender){ @@ -242,13 +241,14 @@ public class Preparation extends Buff implements ActionIndicator.Action { if (Dungeon.hero.canAttack(enemy)){ if (Dungeon.hero.handle( cell )) { Dungeon.hero.next(); + return; } } AttackLevel lvl = AttackLevel.getLvl(turnsInvis); - boolean[] passable = new boolean[Dungeon.level.length()]; - PathFinder.buildDistanceMap(Dungeon.hero.pos, BArray.or(Dungeon.level.passable, Dungeon.level.avoid, passable), lvl.blinkDistance+1); + boolean[] passable = Dungeon.level.passable.clone(); + PathFinder.buildDistanceMap(Dungeon.hero.pos, passable, lvl.blinkDistance+1); if (PathFinder.distance[cell] == Integer.MAX_VALUE){ GLog.w(Messages.get(Preparation.class, "out_of_reach")); return; 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 0e94b79df..7300128b3 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 @@ -190,8 +190,8 @@ public class Imp extends NPC { level.heaps.get( npc.pos ) != null || level.findMob( npc.pos ) != null || //The imp doesn't move, so he cannot obstruct a passageway - !(Dungeon.level.passable[npc.pos + PathFinder.CIRCLE4[0]] && Dungeon.level.passable[npc.pos + PathFinder.CIRCLE4[2]]) || - !(Dungeon.level.passable[npc.pos + PathFinder.CIRCLE4[1]] && Dungeon.level.passable[npc.pos + PathFinder.CIRCLE4[3]])); + !(level.passable[npc.pos + PathFinder.CIRCLE4[0]] && level.passable[npc.pos + PathFinder.CIRCLE4[2]]) || + !(level.passable[npc.pos + PathFinder.CIRCLE4[1]] && level.passable[npc.pos + PathFinder.CIRCLE4[3]])); level.mobs.add( npc ); spawned = true; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java index 6fcd9dd6f..f95547bed 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java @@ -49,7 +49,7 @@ public abstract class InventoryScroll extends Scroll { } private void confirmCancelation() { - GameScene.show( new WndOptions( name(), Messages.get(this, "warning"), + GameScene.show( new WndOptions( Messages.titleCase(name()), Messages.get(this, "warning"), Messages.get(this, "yes"), Messages.get(this, "no") ) { @Override protected void onSelect( int index ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 16b9b5a21..cf2a5d802 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -48,12 +48,10 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Stylus; import com.shatteredpixel.shatteredpixeldungeon.items.Torch; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; -import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.AlchemistsToolkit; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass; import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder; import com.shatteredpixel.shatteredpixeldungeon.items.bags.SeedPouch; -import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; import com.shatteredpixel.shatteredpixeldungeon.items.food.Food; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength; @@ -658,18 +656,6 @@ public abstract class Level implements Bundlable { return heap; } - - if ((map[cell] == Terrain.ALCHEMY) && ( - !(item instanceof Plant.Seed || item instanceof Blandfruit) || - item instanceof BlandfruitBush.Seed || - (item instanceof Blandfruit && (((Blandfruit) item).potionAttrib != null || heaps.get(cell) != null))|| - Dungeon.hero.buff(AlchemistsToolkit.alchemy.class) != null && Dungeon.hero.buff(AlchemistsToolkit.alchemy.class).isCursed())) { - int n; - do { - n = cell + PathFinder.NEIGHBOURS8[Random.Int( 8 )]; - } while (map[n] != Terrain.EMPTY_SP); - cell = n; - } Heap heap = heaps.get( cell ); if (heap == null) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Terrain.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Terrain.java index 1c4287abb..370c7ed1f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Terrain.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Terrain.java @@ -99,7 +99,7 @@ public class Terrain { flags[STATUE] = SOLID; flags[STATUE_SP] = flags[STATUE]; flags[BOOKSHELF] = flags[BARRICADE]; - flags[ALCHEMY] = PASSABLE; + flags[ALCHEMY] = SOLID; };