v2.4.0: fixed cases of runestones affecting terrain when they shouldn't

This commit is contained in:
Evan Debenham
2024-02-26 13:34:57 -05:00
parent a00355b712
commit bfb4602151
3 changed files with 5 additions and 11 deletions

View File

@@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.items.stones; package com.shatteredpixel.shatteredpixeldungeon.items.stones;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
@@ -33,16 +34,15 @@ public abstract class Runestone extends Item {
defaultAction = AC_THROW; defaultAction = AC_THROW;
} }
//runestones press the cell they're thrown to by default, but a couple stones override this
protected boolean pressesCell = true;
@Override @Override
protected void onThrow(int cell) { protected void onThrow(int cell) {
if (Dungeon.level.pit[cell] || !defaultAction().equals(AC_THROW)){ ///inventory stones are thrown like normal items, other stones don't trigger when thrown into pits
if (this instanceof InventoryStone ||
(Dungeon.level.pit[cell] && Actor.findChar(cell) == null)){
super.onThrow( cell ); super.onThrow( cell );
} else { } else {
if (pressesCell) Dungeon.level.pressCell( cell );
activate(cell); activate(cell);
if (Actor.findChar(cell) == null) Dungeon.level.pressCell( cell );
Invisibility.dispel(); Invisibility.dispel();
} }
} }

View File

@@ -41,9 +41,6 @@ public class StoneOfDisarming extends Runestone {
{ {
image = ItemSpriteSheet.STONE_DISARM; image = ItemSpriteSheet.STONE_DISARM;
//so traps do not activate before the effect
pressesCell = false;
} }
@Override @Override

View File

@@ -39,9 +39,6 @@ public class StoneOfFlock extends Runestone {
{ {
image = ItemSpriteSheet.STONE_FLOCK; image = ItemSpriteSheet.STONE_FLOCK;
//the sheep will press the cell instead
pressesCell = false;
} }
@Override @Override