diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index 3cac043d6..c95f682b4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -574,9 +574,7 @@ public abstract class Char extends Actor { sprite.visible = Dungeon.level.heroFOV[pos]; } - if (!flying) { - Dungeon.level.press( pos, this ); - } + Dungeon.level.occupyCell(this ); } public int distance( Char other ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java index 9ac1610ee..771dd998e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java @@ -253,7 +253,7 @@ public class Combo extends Buff implements ActionIndicator.Action { Actor.addDelayed( new Pushing( enemy, enemy.pos, newPos ), -1 ); enemy.pos = newPos; - Dungeon.level.press( newPos, enemy ); + Dungeon.level.occupyCell(enemy ); } break; 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 a4884e808..d0e271038 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,7 +50,7 @@ public class Levitation extends FlavourBuff { @Override public void detach() { target.flying = false; - Dungeon.level.press( target.pos, target ); + Dungeon.level.occupyCell(target ); super.detach(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java index 8953c0e49..e723579a1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java @@ -273,7 +273,7 @@ public class Preparation extends Buff implements ActionIndicator.Action { } Dungeon.hero.pos = attackPos; - Dungeon.level.press(Dungeon.hero.pos, Dungeon.hero); + Dungeon.level.occupyCell(Dungeon.hero); //prevents the hero from being interrupted by seeing new enemies Dungeon.observe(); Dungeon.hero.checkVisibleMobs(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java index f053eddd4..498aa2e17 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java @@ -96,7 +96,7 @@ public class Guard extends Mob { Actor.addDelayed(new Pushing(enemy, enemy.pos, newPosFinal, new Callback(){ public void call() { enemy.pos = newPosFinal; - Dungeon.level.press(newPosFinal, enemy, true); + Dungeon.level.occupyCell(enemy); Cripple.prolong(enemy, Cripple.class, 4f); if (enemy == Dungeon.hero) { Dungeon.hero.interrupt(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java index d08b36e00..5ee4e5cbf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java @@ -131,7 +131,7 @@ public class Mimic extends Mob { Actor.addDelayed( new Pushing( ch, ch.pos, newPos ), -1 ); ch.pos = newPos; - Dungeon.level.press( newPos, ch ); + Dungeon.level.occupyCell(ch ); } else { return null; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/Swap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/Swap.java index 83c1a7dc0..a739e695b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/Swap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/Swap.java @@ -75,14 +75,8 @@ public class Swap extends Actor { ch1.pos = ch2.pos; ch2.pos = pos; - if (!ch1.flying) { - Dungeon.level.press( ch1.pos, ch1 ); - - } - if (!ch2.flying) { - Dungeon.level.press( ch2.pos, ch2 ); - - } + Dungeon.level.occupyCell(ch1 ); + Dungeon.level.occupyCell(ch2 ); if (ch1 == Dungeon.hero || ch2 == Dungeon.hero) { Dungeon.observe(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java index fa3683371..fc8422dd3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java @@ -80,7 +80,7 @@ public class RogueArmor extends ClassArmor { ScrollOfTeleportation.appear( curUser, target ); CellEmitter.get( target ).burst( Speck.factory( Speck.WOOL ), 10 ); Sample.INSTANCE.play( Assets.SND_PUFF ); - Dungeon.level.press( target, curUser ); + Dungeon.level.occupyCell(curUser ); Dungeon.observe(); GameScene.updateFog(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/WarriorArmor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/WarriorArmor.java index 8f1ffa78b..42638ae21 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/WarriorArmor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/WarriorArmor.java @@ -73,7 +73,7 @@ public class WarriorArmor extends ClassArmor { @Override public void call() { curUser.move(dest); - Dungeon.level.press(dest, curUser, true); + Dungeon.level.occupyCell(curUser); Dungeon.observe(); GameScene.updateFog(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java index 2a58ac5ad..15bc7e8d9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java @@ -166,7 +166,7 @@ public class EtherealChains extends Artifact { public void call() { Actor.add(new Pushing(enemy, enemy.pos, pulledPos, new Callback() { public void call() { - Dungeon.level.press(pulledPos, enemy, true); + Dungeon.level.occupyCell(enemy); } })); enemy.pos = pulledPos; @@ -215,7 +215,7 @@ public class EtherealChains extends Artifact { public void call() { Actor.add(new Pushing(hero, hero.pos, newHeroPos, new Callback() { public void call() { - Dungeon.level.press(newHeroPos, hero); + Dungeon.level.occupyCell(hero); } })); hero.spendAndNext(1f); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java index 4452a45cd..71e59be5e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java @@ -172,7 +172,7 @@ public class LloydsBeacon extends Artifact { } } } - Dungeon.level.press( returnPos, hero ); + Dungeon.level.occupyCell(hero ); Dungeon.observe(); GameScene.updateFog(); } else { 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 daa50f7e5..030c35142 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 @@ -319,7 +319,7 @@ public class TimekeepersHourglass extends Artifact { private void triggerPresses(){ for (int cell : presses) - Dungeon.level.press(cell, null, true); + Dungeon.level.pressCell(cell); presses = new ArrayList<>(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/WoollyBomb.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/WoollyBomb.java index f5284d2eb..ef7c8a7a2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/WoollyBomb.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/WoollyBomb.java @@ -53,7 +53,7 @@ public class WoollyBomb extends Bomb { Sheep sheep = new Sheep(); sheep.lifespan = Random.NormalIntRange( 8, 16 ); sheep.pos = i; - Dungeon.level.press(sheep.pos, sheep); + Dungeon.level.occupyCell(sheep); GameScene.add(sheep); CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java index 69630ee82..87209fba8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java @@ -320,7 +320,7 @@ public class Potion extends Item { } else { - Dungeon.level.press( cell, null, true ); + Dungeon.level.pressCell( cell ); shatter( cell ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java index 091d3863c..77d6b542c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java @@ -101,7 +101,7 @@ public class ScrollOfTeleportation extends Scroll { } appear( hero, pos ); - if (!hero.flying) Dungeon.level.press( pos, hero ); + Dungeon.level.occupyCell(hero ); Dungeon.observe(); GameScene.updateFog(); @@ -127,7 +127,7 @@ public class ScrollOfTeleportation extends Scroll { GLog.i( Messages.get(ScrollOfTeleportation.class, "tele") ); appear( hero, pos ); - if (!hero.flying) Dungeon.level.press( pos, hero ); + Dungeon.level.occupyCell(hero ); Dungeon.observe(); GameScene.updateFog(); @@ -192,7 +192,7 @@ public class ScrollOfTeleportation extends Scroll { } GLog.i( Messages.get(ScrollOfTeleportation.class, "tele") ); appear( hero, pos ); - if (!hero.flying) Dungeon.level.press( pos, hero ); + Dungeon.level.occupyCell(hero ); if (secretDoor && level.map[doorPos] == Terrain.SECRET_DOOR){ Sample.INSTANCE.play( Assets.SND_SECRET ); int oldValue = Dungeon.level.map[doorPos]; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java index 21e02e117..f6fd8051d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java @@ -133,7 +133,7 @@ public class BeaconOfReturning extends Spell { } } } - Dungeon.level.press( returnPos, hero ); + Dungeon.level.occupyCell(hero ); Dungeon.observe(); GameScene.updateFog(); } else { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfFlock.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfFlock.java index 169d3b8de..ca34e6fa2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfFlock.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfFlock.java @@ -52,7 +52,7 @@ public class StoneOfFlock extends Runestone { sheep.lifespan = Random.IntRange(5, 8); sheep.pos = cell + i; GameScene.add(sheep); - Dungeon.level.press(sheep.pos, sheep); + Dungeon.level.occupyCell(sheep); CellEmitter.get(sheep.pos).burst(Speck.factory(Speck.WOOL), 4); } 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 8af82719b..281d733a3 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 @@ -70,7 +70,7 @@ public class WandOfBlastWave extends DamageWand { //presses all tiles in the AOE first for (int i : PathFinder.NEIGHBOURS9){ - Dungeon.level.press(bolt.collisionPos+i, Actor.findChar(bolt.collisionPos+i), true); + Dungeon.level.pressCell( bolt.collisionPos+i ); } //throws other chars around the center. @@ -138,7 +138,7 @@ public class WandOfBlastWave extends DamageWand { ch.damage(Random.NormalIntRange((finalDist + 1) / 2, finalDist), this); Paralysis.prolong(ch, Paralysis.class, Random.NormalIntRange((finalDist + 1) / 2, finalDist)); } - Dungeon.level.press(ch.pos, ch, true); + Dungeon.level.occupyCell(ch); if (ch == Dungeon.hero){ //FIXME currently no logic here if the throw effect kills the hero Dungeon.observe(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorrosion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorrosion.java index 08db51b7b..7357ed2d2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorrosion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorrosion.java @@ -65,7 +65,7 @@ public class WandOfCorrosion extends Wand { } if (Actor.findChar(bolt.collisionPos) == null){ - Dungeon.level.press(bolt.collisionPos, null, true); + Dungeon.level.pressCell(bolt.collisionPos); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java index 1de07d6d8..3e8f06616 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java @@ -178,7 +178,7 @@ public class WandOfCorruption extends Wand { processSoulMark(ch, chargesPerCast()); } else { - Dungeon.level.press(bolt.collisionPos, null, true); + Dungeon.level.pressCell(bolt.collisionPos); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java index 259f69e24..1e28ca81f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java @@ -87,7 +87,7 @@ public class WandOfFrost extends DamageWand { Buff.prolong(ch, Chill.class, 2+level()); } } else { - Dungeon.level.press(bolt.collisionPos, null, true); + Dungeon.level.pressCell(bolt.collisionPos); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLivingEarth.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLivingEarth.java index 59f1539ee..2f20f74bf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLivingEarth.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLivingEarth.java @@ -127,7 +127,7 @@ public class WandOfLivingEarth extends DamageWand { } else { guardian.pos = closest; GameScene.add(guardian, 1); - Dungeon.level.press(guardian.pos, guardian); + Dungeon.level.occupyCell(guardian); } if (ch.alignment == Char.Alignment.ENEMY || ch.buff(Amok.class) != null) { @@ -137,7 +137,7 @@ public class WandOfLivingEarth extends DamageWand { } else { guardian.pos = bolt.collisionPos; GameScene.add(guardian, 1); - Dungeon.level.press(guardian.pos, guardian); + Dungeon.level.occupyCell(guardian); } guardian.sprite.centerEmitter().burst(MagicMissile.EarthParticle.ATTRACT, 8 + level()/2); @@ -164,7 +164,7 @@ public class WandOfLivingEarth extends DamageWand { } } else { - Dungeon.level.press(bolt.collisionPos, null, true); + Dungeon.level.pressCell(bolt.collisionPos); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java index 6655cdd7b..5c4f4948f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java @@ -57,7 +57,7 @@ public class WandOfMagicMissile extends DamageWand { ch.sprite.burst(0xFFFFFFFF, level() / 2 + 2); } else { - Dungeon.level.press(bolt.collisionPos, null, true); + Dungeon.level.pressCell(bolt.collisionPos); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java index 45015dc5a..45a123285 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java @@ -94,7 +94,7 @@ public class WandOfWarding extends Wand { ward.pos = bolt.collisionPos; ward.wandLevel = level(); GameScene.add(ward, 1f); - Dungeon.level.press(ward.pos, ward); + Dungeon.level.occupyCell(ward); ward.sprite.emitter().burst(MagicMissile.WardParticle.UP, ward.tier); } else { GLog.w( Messages.get(this, "bad_location")); 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 a42916187..498304158 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 @@ -47,13 +47,13 @@ public class ForceCube extends MissileWeapon { @Override protected void onThrow(int cell) { - Dungeon.level.press(cell, null, true); + Dungeon.level.pressCell(cell); ArrayList targets = new ArrayList<>(); if (Actor.findChar(cell) != null) targets.add(Actor.findChar(cell)); for (int i : PathFinder.NEIGHBOURS8){ - Dungeon.level.press(cell + i, null, true); + Dungeon.level.pressCell(cell); if (Actor.findChar(cell + i) != null) targets.add(Actor.findChar(cell + i)); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/DisplacingDart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/DisplacingDart.java index 350e0bd96..bdc2a50df 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/DisplacingDart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/DisplacingDart.java @@ -77,7 +77,7 @@ public class DisplacingDart extends TippedDart { if (chosenDist != -1){ int pos = positions.get(chosenDist).get(Random.index(positions.get(chosenDist))); ScrollOfTeleportation.appear( defender, pos ); - Dungeon.level.press( pos, defender ); + Dungeon.level.occupyCell(defender ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java index 20071cf6a..b8689d5e2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java @@ -211,11 +211,11 @@ public class CavesBossLevel extends Level { } @Override - public void press( int cell, Char hero ) { + public void occupyCell( Char ch ) { - super.press( cell, hero ); + super.occupyCell( ch ); - if (!enteredArena && outsideEntraceRoom( cell ) && hero == Dungeon.hero) { + if (!enteredArena && outsideEntraceRoom( ch.pos ) && ch == Dungeon.hero) { enteredArena = true; seal(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java index 6b37c0c73..2436cdd78 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java @@ -182,11 +182,11 @@ public class CityBossLevel extends Level { } @Override - public void press( int cell, Char hero ) { + public void occupyCell( Char ch ) { - super.press( cell, hero ); + super.occupyCell( ch ); - if (!enteredArena && outsideEntraceRoom( cell ) && hero == Dungeon.hero) { + if (!enteredArena && outsideEntraceRoom( ch.pos ) && ch == Dungeon.hero) { enteredArena = true; seal(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java index bd844a802..75cb42a33 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java @@ -172,11 +172,11 @@ public class HallsBossLevel extends Level { } @Override - public void press( int cell, Char hero ) { + public void occupyCell( Char ch ) { - super.press( cell, hero ); + super.occupyCell( ch ); - if (!enteredArena && hero == Dungeon.hero && cell != entrance) { + if (!enteredArena && ch == Dungeon.hero && ch.pos != entrance) { enteredArena = true; seal(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 52cd1e5ea..5a0087fae 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -43,6 +43,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bestiary; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlowParticle; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.WindParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; @@ -712,7 +713,7 @@ public abstract class Level implements Bundlable { } if (Dungeon.level != null) { - press( cell, null, true ); + pressCell( cell ); } return heap; @@ -785,25 +786,32 @@ public abstract class Level implements Bundlable { return result; } - //characters which are not the hero 'soft' press cells by default - public void press( int cell, Char ch){ - press( cell, ch, ch == Dungeon.hero); + public void occupyCell( Char ch ){ + if (!ch.flying){ + + if (pit[ch.pos]){ + if (ch == Dungeon.hero) { + Chasm.heroFall(ch.pos); + } else if (ch instanceof Mob) { + Chasm.mobFall( (Mob)ch ); + } + return; + } + + //characters which are not the hero or a sheep 'soft' press cells + pressCell( ch.pos, ch instanceof Hero || ch instanceof Sheep); + } + } + + //public method for forcing the hard press of a cell. e.g. when an item lands on it + public void pressCell( int cell ){ + pressCell( cell, true ); } //a 'soft' press ignores hidden traps //a 'hard' press triggers all things - //generally a 'hard' press should be forced is something is moving forcefully (e.g. thrown) - public void press( int cell, Char ch, boolean hard ) { + private void pressCell( int cell, boolean hard ) { - if (ch != null && pit[cell] && !ch.flying) { - if (ch == Dungeon.hero) { - Chasm.heroFall(cell); - } else if (ch instanceof Mob) { - Chasm.mobFall( (Mob)ch ); - } - return; - } - Trap trap = null; switch (map[cell]) { @@ -821,7 +829,7 @@ public abstract class Level implements Bundlable { case Terrain.HIGH_GRASS: case Terrain.FURROWED_GRASS: - HighGrass.trample( this, cell, ch ); + HighGrass.trample( this, cell); break; case Terrain.WELL: @@ -859,7 +867,7 @@ public abstract class Level implements Bundlable { } else { - if (ch == Dungeon.hero) { + if (Dungeon.hero.pos == cell) { Dungeon.hero.interrupt(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java index 5f99a8263..a725e4233 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java @@ -189,20 +189,20 @@ public class PrisonBossLevel extends Level { } @Override - public void press( int cell, Char ch ) { - - super.press(cell, ch); + public void occupyCell( Char ch ) { + + super.occupyCell( ch ); if (ch == Dungeon.hero){ //hero enters tengu's chamber if (state == State.START - && (new EmptyRoom().set(2, 25, 8, 32)).inside(cellToPoint(cell))){ + && (new EmptyRoom().set(2, 25, 8, 32)).inside(cellToPoint(ch.pos))){ progress(); } //hero finishes the maze else if (state == State.MAZE - && (new EmptyRoom().set(4, 0, 7, 4)).inside(cellToPoint(cell))){ + && (new EmptyRoom().set(4, 0, 7, 4)).inside(cellToPoint(ch.pos))){ progress(); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java index ac7c8f0c5..dba50101b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java @@ -107,7 +107,7 @@ public class Chasm { Camera.main.shake( 4, 1f ); - Dungeon.level.press( hero.pos, hero, true ); + Dungeon.level.occupyCell(hero ); Buff.prolong( hero, Cripple.class, Cripple.DURATION ); //The lower the hero's HP, the more bleed and the less upfront damage. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java index 73bbb95a3..82ea60b6e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java @@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.features; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; @@ -44,10 +45,12 @@ public class HighGrass { //yes this is a bit ugly, oh well. private static boolean freezeTrample = false; - public static void trample( Level level, int pos, Char ch ) { + public static void trample( Level level, int pos ) { if (freezeTrample) return; + Char ch = Actor.findChar(pos); + if (level.map[pos] == Terrain.FURROWED_GRASS){ if (ch instanceof Hero && ((Hero) ch).heroClass == HeroClass.HUNTRESS){ //Do nothing diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlockTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlockTrap.java index c2754bba4..633a416ca 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlockTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlockTrap.java @@ -67,7 +67,7 @@ public class FlockTrap extends Trap { t.reveal(); t.activate(); } - Dungeon.level.press(sheep.pos, sheep); + Dungeon.level.occupyCell(sheep); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SummoningTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SummoningTrap.java index d89d25bfe..ab532c131 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SummoningTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SummoningTrap.java @@ -91,7 +91,7 @@ public class SummoningTrap extends Trap { t.activate(); } ScrollOfTeleportation.appear(mob, mob.pos); - Dungeon.level.press(mob.pos, mob, true); + Dungeon.level.occupyCell(mob); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Swiftthistle.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Swiftthistle.java index acfc2cee2..cddd598fe 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Swiftthistle.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Swiftthistle.java @@ -116,7 +116,7 @@ public class Swiftthistle extends Plant { private void triggerPresses(){ for (int cell : presses) - Dungeon.level.press(cell, null, true); + Dungeon.level.pressCell(cell); presses = new ArrayList<>(); }