From 438ce6f0a9148ce76de659c65efda32bb6efe884 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 5 Nov 2019 14:17:04 -0500 Subject: [PATCH] v0.8.0: various bugfixes and behaviour tweaks: - fixed storm clouds spreading water faster than intended - fixed visual bugs with stealth and hourglass stasis effect - fixed an exploit where unstable spellbook scrolls could be cancelled - upgrading a stack of missile weapons now resets durability, just as upgrading a single one already did - fixed visual bugs when tengu traps would be created and immediately removed by some effects --- .../actors/blobs/StormCloud.java | 2 +- .../items/artifacts/TimekeepersHourglass.java | 6 +++ .../items/artifacts/UnstableSpellbook.java | 40 ++++++++++++++++++- .../items/weapon/missiles/MissileWeapon.java | 2 +- .../levels/NewPrisonBossLevel.java | 17 +++++--- 5 files changed, 57 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/StormCloud.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/StormCloud.java index 9faf0cfb1..16a96bb3f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/StormCloud.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/StormCloud.java @@ -40,7 +40,7 @@ public class StormCloud extends Blob { for (int i = area.left; i < area.right; i++){ for (int j = area.top; j < area.bottom; j++){ cell = i + j*Dungeon.level.width(); - if (off[cell] > 0) { + if (cur[cell] > 0) { int terr = Dungeon.level.map[cell]; if (terr == Terrain.EMPTY || terr == Terrain.GRASS || terr == Terrain.EMBERS || terr == Terrain.EMPTY_SP || diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java index 8e5517644..0d6a73fd1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java @@ -283,6 +283,12 @@ public class TimekeepersHourglass extends Artifact { activeBuff = null; Dungeon.observe(); } + + @Override + public void fx(boolean on) { + if (on) target.sprite.add( CharSprite.State.INVISIBLE ); + else if (target.invisible == 0) target.sprite.remove( CharSprite.State.INVISIBLE ); + } } public class timeFreeze extends ArtifactBuff { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java index a66aeb4a2..ac3d9d113 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java @@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle; @@ -121,15 +122,20 @@ public class UnstableSpellbook extends Artifact { scroll instanceof ScrollOfMagicMapping) && Random.Int(2) == 0) //don't roll teleportation scrolls on boss floors || (scroll instanceof ScrollOfTeleportation && Dungeon.bossLevel()) + //cannot roll transmutation || (scroll instanceof ScrollOfTransmutation)); scroll.anonymize(); curItem = scroll; curUser = hero; - - //if there are changes left and the scroll has been given to the book + + //if there are charges left and the scroll has been given to the book if (charge > 0 && !scrolls.contains(scroll.getClass())) { final Scroll fScroll = scroll; + + final ExploitHandler handler = Buff.affect(hero, ExploitHandler.class); + handler.scroll = scroll; + GameScene.show(new WndOptions( Messages.get(this, "prompt"), Messages.get(this, "read_empowered"), @@ -137,6 +143,7 @@ public class UnstableSpellbook extends Artifact { Messages.get(ExoticScroll.regToExo.get(scroll.getClass()), "name")){ @Override protected void onSelect(int index) { + handler.detach(); if (index == 1){ Scroll scroll = Reflection.newInstance(ExoticScroll.regToExo.get(fScroll.getClass())); charge--; @@ -162,6 +169,35 @@ public class UnstableSpellbook extends Artifact { } } + //forces the reading of a regular scroll if the player tried to exploit by quitting the game when the menu was up + public static class ExploitHandler extends Buff { + { actPriority = VFX_PRIO; } + + public Scroll scroll; + + @Override + public boolean act() { + curUser = Dungeon.hero; + curItem = scroll; + scroll.anonymize(); + scroll.doRead(); + detach(); + return true; + } + + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + bundle.put( "scroll", scroll ); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + scroll = (Scroll)bundle.get("scroll"); + } + } + @Override protected ArtifactBuff passiveBuff() { return new bookRecharge(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java index f07bd5b91..16b62024b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java @@ -99,6 +99,7 @@ abstract public class MissileWeapon extends Weapon { //FIXME some logic here assumes the items are in the player's inventory. Might need to adjust public Item upgrade() { if (!bundleRestoring) { + durability = MAX_DURABILITY; if (quantity > 1) { MissileWeapon upgraded = (MissileWeapon) split(1); upgraded.parent = null; @@ -112,7 +113,6 @@ abstract public class MissileWeapon extends Weapon { updateQuickslot(); return upgraded; } else { - durability = MAX_DURABILITY; super.upgrade(); Item similar = Dungeon.hero.belongings.getSimilar(this); 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 73e6c125d..4694dbba3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java @@ -27,6 +27,8 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Regrowth; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.StormCloud; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.NewTengu; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; @@ -570,7 +572,9 @@ public class NewPrisonBossLevel extends Level { for (int y = 1; y < maze[0].length-1; y++) { if (maze[x][y]){ int cell = mazeCells[i].left+x + width()*(mazeCells[i].top+y); - if (heaps.get(cell) == null){ + if (heaps.get(cell) == null + && Blob.volumeAt(cell, StormCloud.class) == 0 + && Blob.volumeAt(cell, Regrowth.class) <= 9){ Level.set( cell, Terrain.SECRET_TRAP ); setTrap(new TenguDartTrap().hide(), cell); CellEmitter.get(cell).burst(Speck.factory(Speck.LIGHT), 2); @@ -664,11 +668,12 @@ public class NewPrisonBossLevel extends Level { int x = i % 7; int y = i / 7; int cell = x+tenguCell.left+1 + (y+tenguCell.top+1)*width(); - Level.set(cell, Terrain.SECRET_TRAP); - setTrap(new TenguDartTrap().hide(), cell); - CellEmitter.get(cell).burst(Speck.factory(Speck.LIGHT), 2); - } else { - + if (Blob.volumeAt(cell, StormCloud.class) == 0 + && Blob.volumeAt(cell, Regrowth.class) <= 9) { + Level.set(cell, Terrain.SECRET_TRAP); + setTrap(new TenguDartTrap().hide(), cell); + CellEmitter.get(cell).burst(Speck.factory(Speck.LIGHT), 2); + } } }