From f0c02d13fdc632fa9380cb954b015229c849db47 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 20 May 2019 19:53:57 -0400 Subject: [PATCH] v0.7.3: fixes/adjustments: - crash errors involving wild magic - reclaim trap exploits - crashes involving window preserving - some typos --- .../shatteredpixeldungeon/actors/hero/Hero.java | 16 ++++++++++++++++ .../items/spells/ReclaimTrap.java | 15 +++++++++------ .../items/spells/WildEnergy.java | 2 +- .../shatteredpixeldungeon/scenes/PixelScene.java | 2 +- .../messages/items/items.properties | 6 +++--- 5 files changed, 30 insertions(+), 11 deletions(-) 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 5f5fbc215..3f2b9d0c9 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 @@ -102,12 +102,14 @@ import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm; +import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot; import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle; import com.shatteredpixel.shatteredpixeldungeon.scenes.AlchemyScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene; +import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.SurfaceScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite; @@ -1070,6 +1072,8 @@ public class Hero extends Char { return visibleEnemies.get(index % visibleEnemies.size()); } + private boolean walkingToVisibleTrapInFog = false; + private boolean getCloser( final int target ) { if (target == pos) @@ -1099,6 +1103,11 @@ public class Hero extends Char { if (Dungeon.level.passable[target] || Dungeon.level.avoid[target]) { step = target; } + if (walkingToVisibleTrapInFog + && Dungeon.level.traps.get(target) != null + && Dungeon.level.traps.get(target).visible){ + return false; + } } } else { @@ -1222,6 +1231,13 @@ public class Hero extends Char { } else { + if (!Dungeon.level.visited[cell] && !Dungeon.level.mapped[cell] + && Dungeon.level.traps.get(cell) != null && Dungeon.level.traps.get(cell).visible) { + walkingToVisibleTrapInFog = true; + } else { + walkingToVisibleTrapInFog = false; + } + curAction = new HeroAction.Move( cell ); lastAction = null; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java index 8f476e638..beb27c946 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java @@ -86,12 +86,15 @@ public class ReclaimTrap extends TargetedSpell { } @Override - public Item split(int amount) { - Item split = super.split(amount); - if (split != null){ - ((ReclaimTrap)split).storedTrap = null; - } - return split; + protected void onThrow(int cell) { + storedTrap = null; + super.onThrow(cell); + } + + @Override + public void doDrop(Hero hero) { + storedTrap = null; + super.doDrop(hero); } private static final ItemSprite.Glowing[] COLORS = new ItemSprite.Glowing[]{ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java index b6179a778..3406b261d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java @@ -47,7 +47,7 @@ public class WildEnergy extends TargetedSpell { @Override protected void affectTarget(Ballistica bolt, final Hero hero) { - CursedWand.cursedZap(null, hero, bolt, new Callback() { + CursedWand.cursedZap(this, hero, bolt, new Callback() { @Override public void call() { ScrollOfRecharging.charge(hero); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java index 20b0bdcf0..a76617a61 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java @@ -141,7 +141,7 @@ public class PixelScene extends Scene { public void saveWindows(){ savedWindows.clear(); savedClass = getClass(); - for (Gizmo g : members){ + for (Gizmo g : members.toArray(new Gizmo[0])){ if (g instanceof Window){ savedWindows.add((Class) g.getClass()); } diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index 0ff49f7dd..241693568 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -1176,7 +1176,7 @@ items.weapon.enchantments.kinetic$conserveddamage.name=Conserved Damage items.weapon.enchantments.kinetic$conserveddamage.desc=Your weapon has stored the excess force from a previous killing blow, and will apply it as bonus damage to your next attack. The energy will slowly fade over time, however.\n\nConserved Damage: %d. items.weapon.enchantments.corrupting.name=corrupting %s -items.weapon.enchantments.corrupting.desc=This powerful enchantment posses the ability to turn enemies to your will. When an enemy is killed with this weapon, there is a chance they will become corrupted instead of dieing. +items.weapon.enchantments.corrupting.desc=This powerful enchantment possesses the ability to turn enemies to your will. When an enemy is killed with this weapon, there is a chance they will become corrupted instead of dieing. items.weapon.enchantments.elastic.name=elastic %s items.weapon.enchantments.elastic.desc=Elastic weapons have a chance to send enemies flying back short distances. @@ -1354,7 +1354,7 @@ items.weapon.missiles.darts.dart.tip_all=tip %d darts with %d seeds items.weapon.missiles.darts.dart.tip_two=tip 2 darts with 1 seed items.weapon.missiles.darts.dart.tip_one=tip 1 dart with 1 seed items.weapon.missiles.darts.dart.tip_cancel=cancel -items.weapon.missiles.darts.dart.desc=These simple shafts of spike-tipped wood are weighted to fly true and sting their prey with a flick of the wrist. They can tipped with seeds to gain bonus effects when thrown. +items.weapon.missiles.darts.dart.desc=These simple shafts of spike-tipped wood are weighted to fly true and sting their prey with a flick of the wrist. They can be tipped with seeds to gain bonus effects when thrown. items.weapon.missiles.darts.dart.unlimited_uses=However, due to their simple construction darts will effectively last forever. items.weapon.missiles.darts.displacingdart.name=displacing dart @@ -1430,7 +1430,7 @@ items.weapon.missiles.shuriken.name=shuriken items.weapon.missiles.shuriken.desc=Star-shaped pieces of metal with razor-sharp blades. They are lightweight and easy to use on the move. A single shuriken can be thrown instantly after moving. items.weapon.missiles.throwingclub.name=throwing club -items.weapon.missiles.throwingclub.desc=A fairly simply thrown weapon, essentially a large rock fastened to a stick. While they are a bit lacking in damage, their solid stone head means they are quite durable, and won't stick to enemies. +items.weapon.missiles.throwingclub.desc=A fairly simple thrown weapon, essentially a large rock fastened to a stick. While they are a bit lacking in damage, their solid stone head means they are quite durable, and won't stick to enemies. items.weapon.missiles.throwinghammer.name=throwing hammer items.weapon.missiles.throwinghammer.desc=These hefty hammers are designed to be thrown at an enemy. While they are a bit lacking in damage, their smooth all-metal construction means they are quite durable, and won't stick to enemies.