From e49eb27a12bb16d753d35f8ebd1b11f98bdb5efd Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 18 May 2020 21:01:43 -0400 Subject: [PATCH] v0.8.1: Various small fixes and improvements: - fixed levitation applying occupyCell effects before it actually ended - fixed ascend/descend working while rooted - fixed FOV not updating sometimes when hero is interrupted from resting - fixed rare errors with tengu's bombs not being visually destroyed - fixed gold wall vfx rarely showing on city walls in DM-300's arena - fixed items/characters being able to be inside of a wall in DM-300's arena - fixed an error where Tengu's fading traps could visually layer - fixed a bug where the Tengu fight could freeze due to new trap logic - fixed tengu being able to place traps right beneath characters - fixed fading traps disappearing immediately on load - fixed scroll of remove curse not being usable while degraded --- .../actors/buffs/Levitation.java | 2 +- .../actors/hero/Hero.java | 18 ++++++-- .../actors/mobs/NewTengu.java | 9 ++++ .../items/scrolls/ScrollOfRemoveCurse.java | 5 ++- .../levels/NewCavesBossLevel.java | 42 +++++++++++++------ .../levels/NewPrisonBossLevel.java | 21 ++++++++-- 6 files changed, 76 insertions(+), 21 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Levitation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Levitation.java index 7f6d70b0e..afc8bbd93 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Levitation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Levitation.java @@ -50,8 +50,8 @@ public class Levitation extends FlavourBuff { @Override public void detach() { target.flying = false; - Dungeon.level.occupyCell(target ); super.detach(); + Dungeon.level.occupyCell(target ); } @Override 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 0e660328f..9628903ca 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 @@ -860,9 +860,13 @@ public class Hero extends Char { private boolean actDescend( HeroAction.Descend action ) { int stairs = action.dst; + if (rooted) { + Camera.main.shake(1, 1f); + ready(); + return false; //there can be multiple exit tiles, so descend on any of them //TODO this is slightly brittle, it assumes there are no disjointed sets of exit tiles - if ((Dungeon.level.map[pos] == Terrain.EXIT || Dungeon.level.map[pos] == Terrain.UNLOCKED_EXIT)) { + } else if ((Dungeon.level.map[pos] == Terrain.EXIT || Dungeon.level.map[pos] == Terrain.UNLOCKED_EXIT)) { curAction = null; @@ -889,9 +893,14 @@ public class Hero extends Char { private boolean actAscend( HeroAction.Ascend action ) { int stairs = action.dst; + + if (rooted){ + Camera.main.shake( 1, 1f ); + ready(); + return false; //there can be multiple entrance tiles, so descend on any of them //TODO this is slightly brittle, it assumes there are no disjointed sets of entrance tiles - if (Dungeon.level.map[pos] == Terrain.ENTRANCE) { + } else if (Dungeon.level.map[pos] == Terrain.ENTRANCE) { if (Dungeon.depth == 1) { @@ -1108,7 +1117,10 @@ public class Hero extends Char { if (newMob) { interrupt(); - resting = false; + if (resting){ + Dungeon.observe(); + resting = false; + } } visibleEnemies = visible; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewTengu.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewTengu.java index 726296c84..ae02ac454 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewTengu.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewTengu.java @@ -639,6 +639,15 @@ public class NewTengu extends Mob { Dungeon.fail(NewTengu.class); } } + + Heap h = Dungeon.level.heaps.get(cell); + if (h != null){ + for (Item it : h.items.toArray(new Item[0])){ + if (it instanceof BombItem){ + h.remove(it); + } + } + } exploded = true; CellEmitter.center(cell).burst(BlastParticle.FACTORY, 2); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java index 9e3120fce..5a6faf222 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.scrolls; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Degrade; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; @@ -112,7 +113,9 @@ public class ScrollOfRemoveCurse extends InventoryScroll { } public static boolean uncursable( Item item ){ - if ((item instanceof EquipableItem || item instanceof Wand) && (!item.isIdentified() || item.cursed)){ + if (item.isEquipped(Dungeon.hero) && Dungeon.hero.buff(Degrade.class) != null) { + return true; + } if ((item instanceof EquipableItem || item instanceof Wand) && (!item.isIdentified() || item.cursed)){ return true; } else if (item instanceof Weapon){ return ((Weapon)item).hasCurseEnchant(); 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 33c423a58..7f94e51f6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewCavesBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewCavesBossLevel.java @@ -92,16 +92,6 @@ public class NewCavesBossLevel extends Level { setSize(WIDTH, HEIGHT); - //Painter.fill(this, 0, 0, width(), height(), Terrain.EMBERS); - - //setup exit area above main boss arena - Painter.fill(this, 0, 3, width(), 4, Terrain.CHASM); - Painter.fill(this, 6, 7, 21, 1, Terrain.CHASM); - Painter.fill(this, 10, 8, 13, 1, Terrain.CHASM); - Painter.fill(this, 12, 9, 9, 1, Terrain.CHASM); - Painter.fill(this, 13, 10, 7, 1, Terrain.CHASM); - Painter.fill(this, 14, 3, 5, 10, Terrain.EMPTY); - //fill in special floor, statues, and exits Painter.fill(this, 15, 2, 3, 3, Terrain.EMPTY_SP); Painter.fill(this, 15, 5, 3, 1, Terrain.STATUE); @@ -132,6 +122,16 @@ public class NewCavesBossLevel extends Level { buildEntrance(); buildCorners(); + new CavesPainter().paint(this, null); + + //setup exit area above main boss arena + Painter.fill(this, 0, 3, width(), 4, Terrain.CHASM); + Painter.fill(this, 6, 7, 21, 1, Terrain.CHASM); + Painter.fill(this, 10, 8, 13, 1, Terrain.CHASM); + Painter.fill(this, 12, 9, 9, 1, Terrain.CHASM); + Painter.fill(this, 13, 10, 7, 1, Terrain.CHASM); + Painter.fill(this, 14, 3, 5, 10, Terrain.EMPTY); + CustomTilemap customVisuals = new CityEntrance(); customVisuals.setRect(0, 0, width(), 11); customTiles.add(customVisuals); @@ -144,8 +144,6 @@ public class NewCavesBossLevel extends Level { customVisuals.setRect(0, 12, width(), 27); customTiles.add(customVisuals); - new CavesPainter().paint(this, null); - return true; } @@ -248,6 +246,26 @@ public class NewCavesBossLevel extends Level { super.seal(); set( entrance, Terrain.WALL ); + + Heap heap = Dungeon.level.heaps.get( entrance ); + if (heap != null) { + int n; + do { + n = entrance + PathFinder.NEIGHBOURS8[Random.Int( 8 )]; + } while (!Dungeon.level.passable[n]); + Dungeon.level.drop( heap.pickUp(), n ).sprite.drop( entrance ); + } + + Char ch = Actor.findChar( entrance ); + if (ch != null) { + int n; + do { + n = entrance + PathFinder.NEIGHBOURS8[Random.Int( 8 )]; + } while (!Dungeon.level.passable[n]); + ch.pos = n; + ch.sprite.place(n); + } + GameScene.updateMap( entrance ); Dungeon.observe(); 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 59875e2fd..9035b5fbf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java @@ -545,6 +545,12 @@ public class NewPrisonBossLevel extends Level { } public void placeTrapsInTenguCell(float fill){ + + for (CustomTilemap vis : customTiles){ + if (vis instanceof FadingTraps){ + ((FadingTraps) vis).remove(); + } + } Point tenguPoint = cellToPoint(tengu.pos); Point heroPoint = cellToPoint(Dungeon.hero.pos); @@ -561,8 +567,8 @@ public class NewPrisonBossLevel extends Level { PathFinder.buildDistanceMap(tenguPos, BArray.not(trapsPatch, null)); //note that the effective range of fill is 40%-90% - //so distance to tengu starts at 3-4 tiles and scales up to 7-8 as fill increases - } while (PathFinder.distance[heroPos] > Math.ceil(1 + 7*fill) + //so distance to tengu starts at 3-6 tiles and scales up to 7-8 as fill increases + } while (PathFinder.distance[heroPos] > Math.ceil(4 + 4*fill) || PathFinder.distance[heroPos] < Math.ceil(7*fill)); PathFinder.setMapSize(width(), height()); @@ -574,7 +580,7 @@ public class NewPrisonBossLevel extends Level { int cell = x+tenguCell.left+1 + (y+tenguCell.top+1)*width(); if (Blob.volumeAt(cell, StormCloud.class) == 0 && Blob.volumeAt(cell, Regrowth.class) <= 9 - && Actor.findChar(cell) != tengu) { + && Actor.findChar(cell) == null) { Level.set(cell, Terrain.SECRET_TRAP); setTrap(new TenguDartTrap().hide(), cell); CellEmitter.get(cell).burst(Speck.factory(Speck.LIGHT), 2); @@ -636,7 +642,7 @@ public class NewPrisonBossLevel extends Level { private float fadeDuration = 1f; private float initialAlpha = .4f; - private float fadeDelay = 0f; + private float fadeDelay = 1f; public void setCoveringArea(Rect area){ tileX = area.left; @@ -723,6 +729,13 @@ public class NewPrisonBossLevel extends Level { } }, fadeDelay); } + + private void remove(){ + if (vis != null){ + vis.killAndErase(); + } + Dungeon.level.customTiles.remove(this); + } }