v0.7.1a: traps now check if chars on them are flying when appropriate

This commit is contained in:
Evan Debenham
2018-12-20 21:19:29 -05:00
parent 51be374f75
commit 5b6bacc627
8 changed files with 66 additions and 60 deletions
@@ -65,7 +65,7 @@ public class CursingTrap extends Trap {
} }
} }
if (Dungeon.hero.pos == pos){ if (Dungeon.hero.pos == pos && !Dungeon.hero.flying){
curse(Dungeon.hero); curse(Dungeon.hero);
} }
} }
@@ -61,7 +61,7 @@ public class DisarmingTrap extends Trap{
} }
} }
if (Dungeon.hero.pos == pos){ if (Dungeon.hero.pos == pos && !Dungeon.hero.flying){
Hero hero = Dungeon.hero; Hero hero = Dungeon.hero;
KindOfWeapon weapon = hero.belongings.weapon; KindOfWeapon weapon = hero.belongings.weapon;
@@ -56,7 +56,7 @@ public class GrippingTrap extends Trap {
Char c = Actor.findChar( pos ); Char c = Actor.findChar( pos );
if (c != null) { if (c != null && !c.flying) {
int damage = Math.max( 0, (2 + Dungeon.depth) - c.drRoll() ); int damage = Math.max( 0, (2 + Dungeon.depth) - c.drRoll() );
Buff.affect( c, Bleeding.class ).set( damage ); Buff.affect( c, Bleeding.class ).set( damage );
Buff.prolong( c, Cripple.class, Cripple.DURATION); Buff.prolong( c, Cripple.class, Cripple.DURATION);
@@ -38,7 +38,7 @@ public class OozeTrap extends Trap {
public void activate() { public void activate() {
Char ch = Actor.findChar( pos ); Char ch = Actor.findChar( pos );
if (ch != null){ if (ch != null && !ch.flying){
Buff.affect(ch, Ooze.class).set( 20f ); Buff.affect(ch, Ooze.class).set( 20f );
Splash.at( pos, 0x000000, 5); Splash.at( pos, 0x000000, 5);
} }
@@ -52,12 +52,14 @@ public class PitfallTrap extends Trap {
Char ch = Actor.findChar( pos ); Char ch = Actor.findChar( pos );
if (ch != null && !ch.flying) {
if (ch == Dungeon.hero) { if (ch == Dungeon.hero) {
Chasm.heroFall(pos); Chasm.heroFall(pos);
} else if (ch != null){ } else {
Chasm.mobFall((Mob) ch); Chasm.mobFall((Mob) ch);
} }
} }
}
//TODO these used to become chasms when disarmed, but the functionality was problematic //TODO these used to become chasms when disarmed, but the functionality was problematic
//because it could block routes, perhaps some way to make this work elegantly? //because it could block routes, perhaps some way to make this work elegantly?
@@ -50,9 +50,10 @@ public class TeleportationTrap extends Trap {
Sample.INSTANCE.play( Assets.SND_TELEPORT ); Sample.INSTANCE.play( Assets.SND_TELEPORT );
Char ch = Actor.findChar( pos); Char ch = Actor.findChar( pos);
if (ch != null && !ch.flying) {
if (ch instanceof Hero) { if (ch instanceof Hero) {
ScrollOfTeleportation.teleportHero((Hero) ch); ScrollOfTeleportation.teleportHero((Hero) ch);
} else if (ch != null){ } else {
int count = 10; int count = 10;
int pos; int pos;
do { do {
@@ -77,6 +78,7 @@ public class TeleportationTrap extends Trap {
} }
} }
}
Heap heap = Dungeon.level.heaps.get(pos); Heap heap = Dungeon.level.heaps.get(pos);
@@ -51,6 +51,7 @@ public class WarpingTrap extends Trap {
Sample.INSTANCE.play(Assets.SND_TELEPORT); Sample.INSTANCE.play(Assets.SND_TELEPORT);
Char ch = Actor.findChar(pos); Char ch = Actor.findChar(pos);
if (ch != null && !ch.flying) {
if (ch instanceof Hero) { if (ch instanceof Hero) {
ScrollOfTeleportation.teleportHero((Hero) ch); ScrollOfTeleportation.teleportHero((Hero) ch);
BArray.setFalse(Dungeon.level.visited); BArray.setFalse(Dungeon.level.visited);
@@ -58,7 +59,7 @@ public class WarpingTrap extends Trap {
GameScene.updateFog(); GameScene.updateFog();
Dungeon.observe(); Dungeon.observe();
} else if (ch != null){ } else {
int count = 10; int count = 10;
int pos; int pos;
do { do {
@@ -83,6 +84,7 @@ public class WarpingTrap extends Trap {
} }
} }
}
Heap heap = Dungeon.level.heaps.get(pos); Heap heap = Dungeon.level.heaps.get(pos);
@@ -43,7 +43,7 @@ public class WeakeningTrap extends Trap{
} }
Char ch = Actor.findChar( pos ); Char ch = Actor.findChar( pos );
if (ch == Dungeon.hero){ if (ch != null && !ch.flying){
Buff.prolong( ch, Weakness.class, Weakness.DURATION*2f ); Buff.prolong( ch, Weakness.class, Weakness.DURATION*2f );
} }
} }