From 15879eafc88fd4f393fb0dc958cd750f8b60dfdb Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 12 Dec 2019 16:07:37 -0500 Subject: [PATCH] v0.8.0: various fixes: - fixed spinners not saving some info they should - fixed rare crashes with ring of wealth and brutes - blast wave and force cube no longer trigger tengu's traps - fixed force cube not pressing on all cells in the AOE - Tengu's traps now fade instantly much less often --- .../actors/mobs/Mob.java | 4 ++-- .../actors/mobs/Spinner.java | 20 ++++++++++++++++++- .../items/wands/WandOfBlastWave.java | 7 +++++-- .../items/weapon/missiles/ForceCube.java | 3 ++- .../levels/NewPrisonBossLevel.java | 6 +++--- 5 files changed, 31 insertions(+), 9 deletions(-) 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 2dc08a897..9221731ec 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 @@ -638,10 +638,10 @@ public abstract class Mob extends Char { if (bonus != null && !bonus.isEmpty()) { for (Item b : bonus) Dungeon.level.drop(b, pos).sprite.drop(); if (RingOfWealth.latestDropWasRare){ - new Flare(8, 48).color(0xAA00FF, true).show(sprite, 3f); + if (sprite != null) new Flare(8, 48).color(0xAA00FF, true).show(sprite, 3f); RingOfWealth.latestDropWasRare = false; } else { - new Flare(8, 24).color(0xFFFFFF, true).show(sprite, 3f); + if (sprite != null) new Flare(8, 24).color(0xFFFFFF, true).show(sprite, 3f); } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java index cf2098f8d..f2de46b5c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java @@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.SpinnerSprite; +import com.watabou.utils.Bundle; import com.watabou.utils.PathFinder; import com.watabou.utils.Random; @@ -66,9 +67,26 @@ public class Spinner extends Mob { public int drRoll() { return Random.NormalIntRange(0, 6); } - + private int webCoolDown = 0; private int lastEnemyPos = -1; + + private static final String WEB_COOLDOWN = "web_cooldown"; + private static final String LAST_ENEMY_POS = "last_enemy_pos"; + + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + bundle.put(WEB_COOLDOWN, webCoolDown); + bundle.put(LAST_ENEMY_POS, lastEnemyPos); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + webCoolDown = bundle.getInt( WEB_COOLDOWN ); + lastEnemyPos = bundle.getInt( LAST_ENEMY_POS ); + } @Override protected boolean act() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java index c234789dd..039f60890 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java @@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Elastic; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; +import com.shatteredpixel.shatteredpixeldungeon.levels.traps.TenguDartTrap; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; @@ -66,9 +67,11 @@ public class WandOfBlastWave extends DamageWand { Sample.INSTANCE.play( Assets.SND_BLAST ); BlastWave.blast(bolt.collisionPos); - //presses all tiles in the AOE first + //presses all tiles in the AOE first, with the exception of tengu dart traps for (int i : PathFinder.NEIGHBOURS9){ - Dungeon.level.pressCell( bolt.collisionPos+i ); + if (!(Dungeon.level.traps.get(bolt.collisionPos+i) instanceof TenguDartTrap)) { + Dungeon.level.pressCell(bolt.collisionPos + i); + } } //throws other chars around the center. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/ForceCube.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/ForceCube.java index 667ca9945..2e2e165fc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/ForceCube.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/ForceCube.java @@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave; +import com.shatteredpixel.shatteredpixeldungeon.levels.traps.TenguDartTrap; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; @@ -58,7 +59,7 @@ public class ForceCube extends MissileWeapon { if (Actor.findChar(cell) != null) targets.add(Actor.findChar(cell)); for (int i : PathFinder.NEIGHBOURS8){ - Dungeon.level.pressCell(cell); + if (!(Dungeon.level.traps.get(cell+i) instanceof TenguDartTrap)) Dungeon.level.pressCell(cell+i); if (Actor.findChar(cell + i) != null) targets.add(Actor.findChar(cell + i)); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java index 713a1fda5..16487d9d1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java @@ -585,7 +585,7 @@ public class NewPrisonBossLevel extends Level { FadingTraps f = new FadingTraps(); f.setCoveringArea(mazeCells[i]); - f.fadeDelay = 1f; + f.fadeDelay = 2f; GameScene.add(f, false); customTiles.add(f); @@ -680,7 +680,7 @@ public class NewPrisonBossLevel extends Level { GameScene.updateMap(); FadingTraps t = new FadingTraps(); - t.fadeDelay = 1f; + t.fadeDelay = 2f; t.setCoveringArea(tenguCell); GameScene.add(t, false); customTiles.add(t); @@ -795,7 +795,7 @@ public class NewPrisonBossLevel extends Level { Actor.addDelayed(new Actor() { { - actPriority = HERO_PRIO-1; + actPriority = HERO_PRIO+1; } @Override