From aa263b6f0a4b3884eef57f64d2000f76f6e26398 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 26 Mar 2020 14:18:16 -0400 Subject: [PATCH] v0.8.0: fixed various bugs: - Ghouls rarely moving into chasms as they get up - Golem teleportation not being blocked by antimagic - piranhas playing no death animation if they die on land - ripper demons failing to move off their leap target in many cases - various freeze/crash bugs with Yog-Dzewa - player not be able to place items into their main bag if a sub bag is full - DM-300 rarely spawning ontop of the exit stairs - rare levelgen hanging bug when placing enemies - spawner warning playing on floor 26 - rare crash bug involving DM-300 - rare crash bug involving update notification - typo in bright fist's description --- .../actors/mobs/Ghoul.java | 2 +- .../actors/mobs/Golem.java | 8 +++-- .../actors/mobs/Piranha.java | 1 - .../actors/mobs/RipperDemon.java | 12 ++++--- .../actors/mobs/YogDzewa.java | 2 ++ .../actors/mobs/YogFist.java | 4 +-- .../shatteredpixeldungeon/items/Item.java | 6 ++-- .../levels/NewCavesBossLevel.java | 14 ++++---- .../levels/RegularLevel.java | 33 ++++++++++++------- .../scenes/GameScene.java | 2 +- .../sprites/DM300Sprite.java | 7 ++-- .../ui/UpdateNotification.java | 12 ++++--- .../messages/actors/actors.properties | 2 +- .../messages/items/items.properties | 2 +- 14 files changed, 63 insertions(+), 44 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Ghoul.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Ghoul.java index 6dcccdd0f..3bd0a71bb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Ghoul.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Ghoul.java @@ -277,7 +277,7 @@ public class Ghoul extends Mob { ArrayList candidates = new ArrayList<>(); for (int n : PathFinder.NEIGHBOURS8) { int cell = ghoul.pos + n; - if ((Dungeon.level.passable[cell] || Dungeon.level.avoid[cell]) && Actor.findChar( cell ) == null) { + if (Dungeon.level.passable[cell] && Actor.findChar( cell ) == null) { candidates.add( cell ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java index fd4912059..7ab0bd773 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java @@ -24,9 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Sleep; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; @@ -135,6 +133,10 @@ public class Golem extends Mob { } } + if (enemy.buff(MagicImmune.class) != null){ + bestPos = enemy.pos; + } + if (bestPos != enemy.pos){ ScrollOfTeleportation.appear(enemy, bestPos); if (enemy instanceof Hero){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java index d3becf99e..7e4e19e96 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java @@ -65,7 +65,6 @@ public class Piranha extends Mob { if (!Dungeon.level.water[pos]) { die( null ); - sprite.killAndErase(); return true; } else { return super.act(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RipperDemon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RipperDemon.java index eca0b861c..f26642d89 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RipperDemon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RipperDemon.java @@ -146,15 +146,19 @@ public class RipperDemon extends Mob { Sample.INSTANCE.play(Assets.SND_HIT); } //bounce to a random safe pos(if possible) - int bouncepos = leapPos; + int bouncepos = -1; for (int i : PathFinder.NEIGHBOURS8){ - if (Dungeon.level.trueDistance(pos, leapPos+i) < Dungeon.level.trueDistance(pos, bouncepos) + if ((bouncepos == -1 || Dungeon.level.trueDistance(pos, leapPos+i) < Dungeon.level.trueDistance(pos, bouncepos)) && Actor.findChar(leapPos+i) == null && Dungeon.level.passable[leapPos+i]){ bouncepos = leapPos+i; } } - pos = bouncepos; - Actor.addDelayed(new Pushing(RipperDemon.this, leapPos, bouncepos), -1); + if (bouncepos != -1) { + pos = bouncepos; + Actor.addDelayed(new Pushing(RipperDemon.this, leapPos, bouncepos), -1); + } else { + pos = leapPos; + } } else { pos = leapPos; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java index 57764fc47..d0f44bfb9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java @@ -239,6 +239,8 @@ public class YogDzewa extends Mob { if (findFist() != null){ summonCooldown += MIN_SUMMON_CD - phase; } + } else { + break; } } 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 d5fdaeae6..9bf400c1b 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 @@ -475,7 +475,7 @@ public abstract class YogFist extends Mob { super.damage(dmg, src); if (isAlive() && beforeHP > HT/2 && HP < HT/2){ HP = HT/2; - Buff.prolong( enemy, Blindness.class, 30f ); + Buff.prolong( Dungeon.hero, Blindness.class, 30f ); int i; do { i = Random.Int(Dungeon.level.length()); @@ -485,7 +485,7 @@ public abstract class YogFist extends Mob { GameScene.flash(0xFFFFFF); GLog.w( Messages.get( this, "teleport" )); } else if (!isAlive()){ - Buff.prolong( enemy, Blindness.class, 50f ); + Buff.prolong( Dungeon.hero, Blindness.class, 50f ); GameScene.flash(0xFFFFFF); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java index 49b9072f5..78c55565b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -178,7 +178,9 @@ public class Item implements Bundlable { for (Item item:items) { if (item instanceof Bag && ((Bag)item).grab( this )) { - return collect( (Bag)item ); + if (collect( (Bag)item )){ + return true; + } } } @@ -206,7 +208,7 @@ public class Item implements Bundlable { } else { - GLog.n( Messages.get(Item.class, "pack_full", name()) ); + GLog.n( Messages.get(Item.class, "pack_full", container.name()) ); return false; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewCavesBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewCavesBossLevel.java index b3826521b..029775ef6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewCavesBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewCavesBossLevel.java @@ -209,13 +209,6 @@ public class NewCavesBossLevel extends Level { public void seal() { super.seal(); - NewDM300 boss = new NewDM300(); - boss.state = boss.WANDERING; - do { - boss.pos = pointToCell(Random.element(mainArena.getPoints())); - } while (!openSpace[boss.pos] || map[boss.pos] == Terrain.EMPTY_SP); - GameScene.add( boss ); - set( entrance, Terrain.WALL ); GameScene.updateMap( entrance ); Dungeon.observe(); @@ -224,6 +217,13 @@ public class NewCavesBossLevel extends Level { Camera.main.shake( 3, 0.7f ); Sample.INSTANCE.play( Assets.SND_ROCKS ); + NewDM300 boss = new NewDM300(); + boss.state = boss.WANDERING; + do { + boss.pos = pointToCell(Random.element(mainArena.getPoints())); + } while (!openSpace[boss.pos] || map[boss.pos] == Terrain.EMPTY_SP); + GameScene.add( boss ); + for (int i : pylonPositions) { Pylon pylon = new Pylon(); pylon.pos = i; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java index 78ebaa394..ef9dab89e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java @@ -190,23 +190,32 @@ public abstract class RegularLevel extends Level { stdRoomIter = stdRooms.iterator(); } roomToSpawn = stdRoomIter.next(); - + + int tries = 30; do { mob.pos = pointToCell(roomToSpawn.random()); - } while (findMob(mob.pos) != null || !passable[mob.pos] || mob.pos == exit); - - mobsToSpawn--; - mobs.add(mob); - - if (mobsToSpawn > 0 && Random.Int(4) == 0){ - mob = createMob(); - - do { - mob.pos = pointToCell(roomToSpawn.random()); - } while (findMob(mob.pos) != null || !passable[mob.pos] || mob.pos == exit); + tries--; + } while (tries >= 0 && (findMob(mob.pos) != null || !passable[mob.pos] || mob.pos == exit)); + if (tries >= 0) { mobsToSpawn--; mobs.add(mob); + + //add a second mob to this room + if (mobsToSpawn > 0 && Random.Int(4) == 0){ + mob = createMob(); + + tries = 30; + do { + mob.pos = pointToCell(roomToSpawn.random()); + tries--; + } while (tries >= 0 && findMob(mob.pos) != null || !passable[mob.pos] || mob.pos == exit); + + if (tries >= 0) { + mobsToSpawn--; + mobs.add(mob); + } + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 9c493e717..f80e9196e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -444,7 +444,7 @@ public class GameScene extends PixelScene { } int spawnersAbove = Statistics.spawnersAlive; - if (spawnersAbove > 0) { + if (spawnersAbove > 0 && Dungeon.depth <= 25) { for (Mob m : Dungeon.level.mobs) { if (m instanceof DemonSpawner && ((DemonSpawner) m).spawnRecorded) { spawnersAbove--; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM300Sprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM300Sprite.java index cf2770976..9face8fdc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM300Sprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM300Sprite.java @@ -128,12 +128,11 @@ public class DM300Sprite extends MobSprite { public void update() { super.update(); - if (ch instanceof NewDM300){ - superchargeSparks.on = ((NewDM300) ch).isSupercharged(); - } - if (superchargeSparks != null){ superchargeSparks.visible = visible; + if (ch instanceof NewDM300){ + superchargeSparks.on = ((NewDM300) ch).isSupercharged(); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/UpdateNotification.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/UpdateNotification.java index a013a35e3..eae72af28 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/UpdateNotification.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/UpdateNotification.java @@ -31,8 +31,6 @@ import com.watabou.noosa.Game; public class UpdateNotification extends StyledButton { - private static AvailableUpdateData update; - public UpdateNotification(){ super( Chrome.Type.GREY_BUTTON_TR, Messages.get(UpdateNotification.class, "title") ); textColor( Window.SHPX_COLOR ); @@ -56,17 +54,21 @@ public class UpdateNotification extends StyledButton { @Override protected void onClick() { - update = Updates.updateData(); - ShatteredPixelDungeon.scene().addToFront( new WndUpdate() ); + if (Updates.updateAvailable()){ + ShatteredPixelDungeon.scene().addToFront( new WndUpdate( Updates.updateData() ) ); + } } public static class WndUpdate extends WndOptions { - public WndUpdate(){ + private AvailableUpdateData update; + + public WndUpdate( AvailableUpdateData update ){ super( update.versionName == null ? Messages.get(WndUpdate.class,"title") : Messages.get(WndUpdate.class,"versioned_title", update.versionName), update.desc == null ? Messages.get(WndUpdate.class,"desc") : update.desc, Messages.get(WndUpdate.class,"button")); + this.update = update; } @Override diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties index c2141ba0e..659fb33ca 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties @@ -773,7 +773,7 @@ actors.mobs.yogfist$rusted.name=rusted fist actors.mobs.yogfist$rusted.desc=This fist is formed out of living metal. It is a towering mass of shifting metal that has powerful melee attacks, and can cripple its targets at range. Because of its tremendous mass, the fist will take any damage dealt to it over time, instead of immediately.\n\nThe fist is inflexible however, and cannot move into tight passageways. Additionally, while it make take damage slowly, the deferred damage will continue to increase if the fist is hit multiple times. actors.mobs.yogfist$bright.name=bright fist actors.mobs.yogfist$bright.teleport=The fist teleports away in a flash of light that seriously blinds you! -actors.mobs.yogfist$bright.desc=This fist is formed out of pure light energy. It is capable of shooting powerful rays of searing light every turn! These beams will temporarily blind you in addition to dealing heavy damage. The fist is also capable of briefly engulphing the arena in blinding light in order to escape!\n\nThe fist has no special abilities which it can use in melee range however. +actors.mobs.yogfist$bright.desc=This fist is formed out of pure light energy. It is capable of shooting powerful rays of searing light every turn! These beams will temporarily blind you in addition to dealing heavy damage. The fist is also capable of briefly engulfing the arena in blinding light in order to escape!\n\nThe fist has no special abilities which it can use in melee range however. actors.mobs.yogfist$dark.name=dark fist actors.mobs.yogfist$dark.teleport=The fist teleports away in a blast of darkness that extinguishes your light source! actors.mobs.yogfist$dark.desc=This fist is formed out of pure dark energy. It is capable of shooting powerful blasts of dark magic every turn! These blasts will weaken your light source in addition to dealing heavy damage. The fist is also capable of briefly engulfing the arena in darkness in order to escape!\n\nThe fist has no special abilities which it can use in melee range however. 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 3c76ec14a..82caa5948 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 @@ -1649,7 +1649,7 @@ items.honeypot.desc=This large honeypot is only really lined with honey, instead items.honeypot$shatteredpot.name=shattered honeypot items.honeypot$shatteredpot.desc=The pot has been shattered, only the sticky honey that lines its walls is holding it together, and it is slowly coming apart.\n\nDespite its broken state, the bee still seems to want to protect the pot. -items.item.pack_full=Your pack is too full for the %s. +items.item.pack_full=Your %s is full. items.item.prompt=Choose direction of throw items.item.ac_drop=DROP items.item.ac_throw=THROW