v0.7.5: refactored tile pressing/occupying behaviour
This commit is contained in:
parent
0077e36c17
commit
71b406c84d
|
@ -574,9 +574,7 @@ public abstract class Char extends Actor {
|
||||||
sprite.visible = Dungeon.level.heroFOV[pos];
|
sprite.visible = Dungeon.level.heroFOV[pos];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!flying) {
|
Dungeon.level.occupyCell(this );
|
||||||
Dungeon.level.press( pos, this );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int distance( Char other ) {
|
public int distance( Char other ) {
|
||||||
|
|
|
@ -253,7 +253,7 @@ public class Combo extends Buff implements ActionIndicator.Action {
|
||||||
Actor.addDelayed( new Pushing( enemy, enemy.pos, newPos ), -1 );
|
Actor.addDelayed( new Pushing( enemy, enemy.pos, newPos ), -1 );
|
||||||
|
|
||||||
enemy.pos = newPos;
|
enemy.pos = newPos;
|
||||||
Dungeon.level.press( newPos, enemy );
|
Dungeon.level.occupyCell(enemy );
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class Levitation extends FlavourBuff {
|
||||||
@Override
|
@Override
|
||||||
public void detach() {
|
public void detach() {
|
||||||
target.flying = false;
|
target.flying = false;
|
||||||
Dungeon.level.press( target.pos, target );
|
Dungeon.level.occupyCell(target );
|
||||||
super.detach();
|
super.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -273,7 +273,7 @@ public class Preparation extends Buff implements ActionIndicator.Action {
|
||||||
}
|
}
|
||||||
|
|
||||||
Dungeon.hero.pos = attackPos;
|
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
|
//prevents the hero from being interrupted by seeing new enemies
|
||||||
Dungeon.observe();
|
Dungeon.observe();
|
||||||
Dungeon.hero.checkVisibleMobs();
|
Dungeon.hero.checkVisibleMobs();
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class Guard extends Mob {
|
||||||
Actor.addDelayed(new Pushing(enemy, enemy.pos, newPosFinal, new Callback(){
|
Actor.addDelayed(new Pushing(enemy, enemy.pos, newPosFinal, new Callback(){
|
||||||
public void call() {
|
public void call() {
|
||||||
enemy.pos = newPosFinal;
|
enemy.pos = newPosFinal;
|
||||||
Dungeon.level.press(newPosFinal, enemy, true);
|
Dungeon.level.occupyCell(enemy);
|
||||||
Cripple.prolong(enemy, Cripple.class, 4f);
|
Cripple.prolong(enemy, Cripple.class, 4f);
|
||||||
if (enemy == Dungeon.hero) {
|
if (enemy == Dungeon.hero) {
|
||||||
Dungeon.hero.interrupt();
|
Dungeon.hero.interrupt();
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class Mimic extends Mob {
|
||||||
Actor.addDelayed( new Pushing( ch, ch.pos, newPos ), -1 );
|
Actor.addDelayed( new Pushing( ch, ch.pos, newPos ), -1 );
|
||||||
|
|
||||||
ch.pos = newPos;
|
ch.pos = newPos;
|
||||||
Dungeon.level.press( newPos, ch );
|
Dungeon.level.occupyCell(ch );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -75,14 +75,8 @@ public class Swap extends Actor {
|
||||||
ch1.pos = ch2.pos;
|
ch1.pos = ch2.pos;
|
||||||
ch2.pos = pos;
|
ch2.pos = pos;
|
||||||
|
|
||||||
if (!ch1.flying) {
|
Dungeon.level.occupyCell(ch1 );
|
||||||
Dungeon.level.press( ch1.pos, ch1 );
|
Dungeon.level.occupyCell(ch2 );
|
||||||
|
|
||||||
}
|
|
||||||
if (!ch2.flying) {
|
|
||||||
Dungeon.level.press( ch2.pos, ch2 );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ch1 == Dungeon.hero || ch2 == Dungeon.hero) {
|
if (ch1 == Dungeon.hero || ch2 == Dungeon.hero) {
|
||||||
Dungeon.observe();
|
Dungeon.observe();
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class RogueArmor extends ClassArmor {
|
||||||
ScrollOfTeleportation.appear( curUser, target );
|
ScrollOfTeleportation.appear( curUser, target );
|
||||||
CellEmitter.get( target ).burst( Speck.factory( Speck.WOOL ), 10 );
|
CellEmitter.get( target ).burst( Speck.factory( Speck.WOOL ), 10 );
|
||||||
Sample.INSTANCE.play( Assets.SND_PUFF );
|
Sample.INSTANCE.play( Assets.SND_PUFF );
|
||||||
Dungeon.level.press( target, curUser );
|
Dungeon.level.occupyCell(curUser );
|
||||||
Dungeon.observe();
|
Dungeon.observe();
|
||||||
GameScene.updateFog();
|
GameScene.updateFog();
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class WarriorArmor extends ClassArmor {
|
||||||
@Override
|
@Override
|
||||||
public void call() {
|
public void call() {
|
||||||
curUser.move(dest);
|
curUser.move(dest);
|
||||||
Dungeon.level.press(dest, curUser, true);
|
Dungeon.level.occupyCell(curUser);
|
||||||
Dungeon.observe();
|
Dungeon.observe();
|
||||||
GameScene.updateFog();
|
GameScene.updateFog();
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ public class EtherealChains extends Artifact {
|
||||||
public void call() {
|
public void call() {
|
||||||
Actor.add(new Pushing(enemy, enemy.pos, pulledPos, new Callback() {
|
Actor.add(new Pushing(enemy, enemy.pos, pulledPos, new Callback() {
|
||||||
public void call() {
|
public void call() {
|
||||||
Dungeon.level.press(pulledPos, enemy, true);
|
Dungeon.level.occupyCell(enemy);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
enemy.pos = pulledPos;
|
enemy.pos = pulledPos;
|
||||||
|
@ -215,7 +215,7 @@ public class EtherealChains extends Artifact {
|
||||||
public void call() {
|
public void call() {
|
||||||
Actor.add(new Pushing(hero, hero.pos, newHeroPos, new Callback() {
|
Actor.add(new Pushing(hero, hero.pos, newHeroPos, new Callback() {
|
||||||
public void call() {
|
public void call() {
|
||||||
Dungeon.level.press(newHeroPos, hero);
|
Dungeon.level.occupyCell(hero);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
hero.spendAndNext(1f);
|
hero.spendAndNext(1f);
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class LloydsBeacon extends Artifact {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Dungeon.level.press( returnPos, hero );
|
Dungeon.level.occupyCell(hero );
|
||||||
Dungeon.observe();
|
Dungeon.observe();
|
||||||
GameScene.updateFog();
|
GameScene.updateFog();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -319,7 +319,7 @@ public class TimekeepersHourglass extends Artifact {
|
||||||
|
|
||||||
private void triggerPresses(){
|
private void triggerPresses(){
|
||||||
for (int cell : presses)
|
for (int cell : presses)
|
||||||
Dungeon.level.press(cell, null, true);
|
Dungeon.level.pressCell(cell);
|
||||||
|
|
||||||
presses = new ArrayList<>();
|
presses = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class WoollyBomb extends Bomb {
|
||||||
Sheep sheep = new Sheep();
|
Sheep sheep = new Sheep();
|
||||||
sheep.lifespan = Random.NormalIntRange( 8, 16 );
|
sheep.lifespan = Random.NormalIntRange( 8, 16 );
|
||||||
sheep.pos = i;
|
sheep.pos = i;
|
||||||
Dungeon.level.press(sheep.pos, sheep);
|
Dungeon.level.occupyCell(sheep);
|
||||||
GameScene.add(sheep);
|
GameScene.add(sheep);
|
||||||
CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4);
|
CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4);
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,7 +320,7 @@ public class Potion extends Item {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Dungeon.level.press( cell, null, true );
|
Dungeon.level.pressCell( cell );
|
||||||
shatter( cell );
|
shatter( cell );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class ScrollOfTeleportation extends Scroll {
|
||||||
}
|
}
|
||||||
|
|
||||||
appear( hero, pos );
|
appear( hero, pos );
|
||||||
if (!hero.flying) Dungeon.level.press( pos, hero );
|
Dungeon.level.occupyCell(hero );
|
||||||
Dungeon.observe();
|
Dungeon.observe();
|
||||||
GameScene.updateFog();
|
GameScene.updateFog();
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ public class ScrollOfTeleportation extends Scroll {
|
||||||
GLog.i( Messages.get(ScrollOfTeleportation.class, "tele") );
|
GLog.i( Messages.get(ScrollOfTeleportation.class, "tele") );
|
||||||
|
|
||||||
appear( hero, pos );
|
appear( hero, pos );
|
||||||
if (!hero.flying) Dungeon.level.press( pos, hero );
|
Dungeon.level.occupyCell(hero );
|
||||||
Dungeon.observe();
|
Dungeon.observe();
|
||||||
GameScene.updateFog();
|
GameScene.updateFog();
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ public class ScrollOfTeleportation extends Scroll {
|
||||||
}
|
}
|
||||||
GLog.i( Messages.get(ScrollOfTeleportation.class, "tele") );
|
GLog.i( Messages.get(ScrollOfTeleportation.class, "tele") );
|
||||||
appear( hero, pos );
|
appear( hero, pos );
|
||||||
if (!hero.flying) Dungeon.level.press( pos, hero );
|
Dungeon.level.occupyCell(hero );
|
||||||
if (secretDoor && level.map[doorPos] == Terrain.SECRET_DOOR){
|
if (secretDoor && level.map[doorPos] == Terrain.SECRET_DOOR){
|
||||||
Sample.INSTANCE.play( Assets.SND_SECRET );
|
Sample.INSTANCE.play( Assets.SND_SECRET );
|
||||||
int oldValue = Dungeon.level.map[doorPos];
|
int oldValue = Dungeon.level.map[doorPos];
|
||||||
|
|
|
@ -133,7 +133,7 @@ public class BeaconOfReturning extends Spell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Dungeon.level.press( returnPos, hero );
|
Dungeon.level.occupyCell(hero );
|
||||||
Dungeon.observe();
|
Dungeon.observe();
|
||||||
GameScene.updateFog();
|
GameScene.updateFog();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class StoneOfFlock extends Runestone {
|
||||||
sheep.lifespan = Random.IntRange(5, 8);
|
sheep.lifespan = Random.IntRange(5, 8);
|
||||||
sheep.pos = cell + i;
|
sheep.pos = cell + i;
|
||||||
GameScene.add(sheep);
|
GameScene.add(sheep);
|
||||||
Dungeon.level.press(sheep.pos, sheep);
|
Dungeon.level.occupyCell(sheep);
|
||||||
|
|
||||||
CellEmitter.get(sheep.pos).burst(Speck.factory(Speck.WOOL), 4);
|
CellEmitter.get(sheep.pos).burst(Speck.factory(Speck.WOOL), 4);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class WandOfBlastWave extends DamageWand {
|
||||||
|
|
||||||
//presses all tiles in the AOE first
|
//presses all tiles in the AOE first
|
||||||
for (int i : PathFinder.NEIGHBOURS9){
|
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.
|
//throws other chars around the center.
|
||||||
|
@ -138,7 +138,7 @@ public class WandOfBlastWave extends DamageWand {
|
||||||
ch.damage(Random.NormalIntRange((finalDist + 1) / 2, finalDist), this);
|
ch.damage(Random.NormalIntRange((finalDist + 1) / 2, finalDist), this);
|
||||||
Paralysis.prolong(ch, Paralysis.class, Random.NormalIntRange((finalDist + 1) / 2, finalDist));
|
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){
|
if (ch == Dungeon.hero){
|
||||||
//FIXME currently no logic here if the throw effect kills the hero
|
//FIXME currently no logic here if the throw effect kills the hero
|
||||||
Dungeon.observe();
|
Dungeon.observe();
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class WandOfCorrosion extends Wand {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Actor.findChar(bolt.collisionPos) == null){
|
if (Actor.findChar(bolt.collisionPos) == null){
|
||||||
Dungeon.level.press(bolt.collisionPos, null, true);
|
Dungeon.level.pressCell(bolt.collisionPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@ public class WandOfCorruption extends Wand {
|
||||||
processSoulMark(ch, chargesPerCast());
|
processSoulMark(ch, chargesPerCast());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Dungeon.level.press(bolt.collisionPos, null, true);
|
Dungeon.level.pressCell(bolt.collisionPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class WandOfFrost extends DamageWand {
|
||||||
Buff.prolong(ch, Chill.class, 2+level());
|
Buff.prolong(ch, Chill.class, 2+level());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Dungeon.level.press(bolt.collisionPos, null, true);
|
Dungeon.level.pressCell(bolt.collisionPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class WandOfLivingEarth extends DamageWand {
|
||||||
} else {
|
} else {
|
||||||
guardian.pos = closest;
|
guardian.pos = closest;
|
||||||
GameScene.add(guardian, 1);
|
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) {
|
if (ch.alignment == Char.Alignment.ENEMY || ch.buff(Amok.class) != null) {
|
||||||
|
@ -137,7 +137,7 @@ public class WandOfLivingEarth extends DamageWand {
|
||||||
} else {
|
} else {
|
||||||
guardian.pos = bolt.collisionPos;
|
guardian.pos = bolt.collisionPos;
|
||||||
GameScene.add(guardian, 1);
|
GameScene.add(guardian, 1);
|
||||||
Dungeon.level.press(guardian.pos, guardian);
|
Dungeon.level.occupyCell(guardian);
|
||||||
}
|
}
|
||||||
|
|
||||||
guardian.sprite.centerEmitter().burst(MagicMissile.EarthParticle.ATTRACT, 8 + level()/2);
|
guardian.sprite.centerEmitter().burst(MagicMissile.EarthParticle.ATTRACT, 8 + level()/2);
|
||||||
|
@ -164,7 +164,7 @@ public class WandOfLivingEarth extends DamageWand {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Dungeon.level.press(bolt.collisionPos, null, true);
|
Dungeon.level.pressCell(bolt.collisionPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class WandOfMagicMissile extends DamageWand {
|
||||||
ch.sprite.burst(0xFFFFFFFF, level() / 2 + 2);
|
ch.sprite.burst(0xFFFFFFFF, level() / 2 + 2);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Dungeon.level.press(bolt.collisionPos, null, true);
|
Dungeon.level.pressCell(bolt.collisionPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class WandOfWarding extends Wand {
|
||||||
ward.pos = bolt.collisionPos;
|
ward.pos = bolt.collisionPos;
|
||||||
ward.wandLevel = level();
|
ward.wandLevel = level();
|
||||||
GameScene.add(ward, 1f);
|
GameScene.add(ward, 1f);
|
||||||
Dungeon.level.press(ward.pos, ward);
|
Dungeon.level.occupyCell(ward);
|
||||||
ward.sprite.emitter().burst(MagicMissile.WardParticle.UP, ward.tier);
|
ward.sprite.emitter().burst(MagicMissile.WardParticle.UP, ward.tier);
|
||||||
} else {
|
} else {
|
||||||
GLog.w( Messages.get(this, "bad_location"));
|
GLog.w( Messages.get(this, "bad_location"));
|
||||||
|
|
|
@ -47,13 +47,13 @@ public class ForceCube extends MissileWeapon {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onThrow(int cell) {
|
protected void onThrow(int cell) {
|
||||||
Dungeon.level.press(cell, null, true);
|
Dungeon.level.pressCell(cell);
|
||||||
|
|
||||||
ArrayList<Char> targets = new ArrayList<>();
|
ArrayList<Char> targets = new ArrayList<>();
|
||||||
if (Actor.findChar(cell) != null) targets.add(Actor.findChar(cell));
|
if (Actor.findChar(cell) != null) targets.add(Actor.findChar(cell));
|
||||||
|
|
||||||
for (int i : PathFinder.NEIGHBOURS8){
|
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));
|
if (Actor.findChar(cell + i) != null) targets.add(Actor.findChar(cell + i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class DisplacingDart extends TippedDart {
|
||||||
if (chosenDist != -1){
|
if (chosenDist != -1){
|
||||||
int pos = positions.get(chosenDist).get(Random.index(positions.get(chosenDist)));
|
int pos = positions.get(chosenDist).get(Random.index(positions.get(chosenDist)));
|
||||||
ScrollOfTeleportation.appear( defender, pos );
|
ScrollOfTeleportation.appear( defender, pos );
|
||||||
Dungeon.level.press( pos, defender );
|
Dungeon.level.occupyCell(defender );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,11 +211,11 @@ public class CavesBossLevel extends Level {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
enteredArena = true;
|
||||||
seal();
|
seal();
|
||||||
|
|
|
@ -182,11 +182,11 @@ public class CityBossLevel extends Level {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
enteredArena = true;
|
||||||
seal();
|
seal();
|
||||||
|
|
|
@ -172,11 +172,11 @@ public class HallsBossLevel extends Level {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
enteredArena = true;
|
||||||
seal();
|
seal();
|
||||||
|
|
|
@ -43,6 +43,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bestiary;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bestiary;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
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.FlowParticle;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.WindParticle;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.WindParticle;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||||
|
@ -712,7 +713,7 @@ public abstract class Level implements Bundlable {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Dungeon.level != null) {
|
if (Dungeon.level != null) {
|
||||||
press( cell, null, true );
|
pressCell( cell );
|
||||||
}
|
}
|
||||||
|
|
||||||
return heap;
|
return heap;
|
||||||
|
@ -785,25 +786,32 @@ public abstract class Level implements Bundlable {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//characters which are not the hero 'soft' press cells by default
|
public void occupyCell( Char ch ){
|
||||||
public void press( int cell, Char ch){
|
if (!ch.flying){
|
||||||
press( cell, ch, ch == Dungeon.hero);
|
|
||||||
|
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 'soft' press ignores hidden traps
|
||||||
//a 'hard' press triggers all things
|
//a 'hard' press triggers all things
|
||||||
//generally a 'hard' press should be forced is something is moving forcefully (e.g. thrown)
|
private void pressCell( int cell, boolean hard ) {
|
||||||
public void press( int cell, Char ch, 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;
|
Trap trap = null;
|
||||||
|
|
||||||
switch (map[cell]) {
|
switch (map[cell]) {
|
||||||
|
@ -821,7 +829,7 @@ public abstract class Level implements Bundlable {
|
||||||
|
|
||||||
case Terrain.HIGH_GRASS:
|
case Terrain.HIGH_GRASS:
|
||||||
case Terrain.FURROWED_GRASS:
|
case Terrain.FURROWED_GRASS:
|
||||||
HighGrass.trample( this, cell, ch );
|
HighGrass.trample( this, cell);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Terrain.WELL:
|
case Terrain.WELL:
|
||||||
|
@ -859,7 +867,7 @@ public abstract class Level implements Bundlable {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (ch == Dungeon.hero) {
|
if (Dungeon.hero.pos == cell) {
|
||||||
Dungeon.hero.interrupt();
|
Dungeon.hero.interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,20 +189,20 @@ public class PrisonBossLevel extends Level {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void press( int cell, Char ch ) {
|
public void occupyCell( Char ch ) {
|
||||||
|
|
||||||
super.press(cell, ch);
|
super.occupyCell( ch );
|
||||||
|
|
||||||
if (ch == Dungeon.hero){
|
if (ch == Dungeon.hero){
|
||||||
//hero enters tengu's chamber
|
//hero enters tengu's chamber
|
||||||
if (state == State.START
|
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();
|
progress();
|
||||||
}
|
}
|
||||||
|
|
||||||
//hero finishes the maze
|
//hero finishes the maze
|
||||||
else if (state == State.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();
|
progress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class Chasm {
|
||||||
|
|
||||||
Camera.main.shake( 4, 1f );
|
Camera.main.shake( 4, 1f );
|
||||||
|
|
||||||
Dungeon.level.press( hero.pos, hero, true );
|
Dungeon.level.occupyCell(hero );
|
||||||
Buff.prolong( hero, Cripple.class, Cripple.DURATION );
|
Buff.prolong( hero, Cripple.class, Cripple.DURATION );
|
||||||
|
|
||||||
//The lower the hero's HP, the more bleed and the less upfront damage.
|
//The lower the hero's HP, the more bleed and the less upfront damage.
|
||||||
|
|
|
@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.features;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
|
@ -44,10 +45,12 @@ public class HighGrass {
|
||||||
//yes this is a bit ugly, oh well.
|
//yes this is a bit ugly, oh well.
|
||||||
private static boolean freezeTrample = false;
|
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;
|
if (freezeTrample) return;
|
||||||
|
|
||||||
|
Char ch = Actor.findChar(pos);
|
||||||
|
|
||||||
if (level.map[pos] == Terrain.FURROWED_GRASS){
|
if (level.map[pos] == Terrain.FURROWED_GRASS){
|
||||||
if (ch instanceof Hero && ((Hero) ch).heroClass == HeroClass.HUNTRESS){
|
if (ch instanceof Hero && ((Hero) ch).heroClass == HeroClass.HUNTRESS){
|
||||||
//Do nothing
|
//Do nothing
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class FlockTrap extends Trap {
|
||||||
t.reveal();
|
t.reveal();
|
||||||
t.activate();
|
t.activate();
|
||||||
}
|
}
|
||||||
Dungeon.level.press(sheep.pos, sheep);
|
Dungeon.level.occupyCell(sheep);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class SummoningTrap extends Trap {
|
||||||
t.activate();
|
t.activate();
|
||||||
}
|
}
|
||||||
ScrollOfTeleportation.appear(mob, mob.pos);
|
ScrollOfTeleportation.appear(mob, mob.pos);
|
||||||
Dungeon.level.press(mob.pos, mob, true);
|
Dungeon.level.occupyCell(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ public class Swiftthistle extends Plant {
|
||||||
|
|
||||||
private void triggerPresses(){
|
private void triggerPresses(){
|
||||||
for (int cell : presses)
|
for (int cell : presses)
|
||||||
Dungeon.level.press(cell, null, true);
|
Dungeon.level.pressCell(cell);
|
||||||
|
|
||||||
presses = new ArrayList<>();
|
presses = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user