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

View File

@ -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);
}
}

View File

@ -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;
KindOfWeapon weapon = hero.belongings.weapon;

View File

@ -56,7 +56,7 @@ public class GrippingTrap extends Trap {
Char c = Actor.findChar( pos );
if (c != null) {
if (c != null && !c.flying) {
int damage = Math.max( 0, (2 + Dungeon.depth) - c.drRoll() );
Buff.affect( c, Bleeding.class ).set( damage );
Buff.prolong( c, Cripple.class, Cripple.DURATION);

View File

@ -38,7 +38,7 @@ public class OozeTrap extends Trap {
public void activate() {
Char ch = Actor.findChar( pos );
if (ch != null){
if (ch != null && !ch.flying){
Buff.affect(ch, Ooze.class).set( 20f );
Splash.at( pos, 0x000000, 5);
}

View File

@ -52,10 +52,12 @@ public class PitfallTrap extends Trap {
Char ch = Actor.findChar( pos );
if (ch == Dungeon.hero){
Chasm.heroFall( pos );
} else if (ch != null){
Chasm.mobFall((Mob)ch);
if (ch != null && !ch.flying) {
if (ch == Dungeon.hero) {
Chasm.heroFall(pos);
} else {
Chasm.mobFall((Mob) ch);
}
}
}

View File

@ -50,9 +50,10 @@ public class TeleportationTrap extends Trap {
Sample.INSTANCE.play( Assets.SND_TELEPORT );
Char ch = Actor.findChar( pos);
if (ch instanceof Hero){
ScrollOfTeleportation.teleportHero( (Hero)ch);
} else if (ch != null){
if (ch != null && !ch.flying) {
if (ch instanceof Hero) {
ScrollOfTeleportation.teleportHero((Hero) ch);
} else {
int count = 10;
int pos;
do {
@ -64,12 +65,12 @@ public class TeleportationTrap extends Trap {
if (pos == -1 || Dungeon.bossLevel()) {
GLog.w( Messages.get(ScrollOfTeleportation.class, "no_tele") );
GLog.w(Messages.get(ScrollOfTeleportation.class, "no_tele"));
} else {
ch.pos = pos;
if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING){
if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING) {
((Mob) ch).state = ((Mob) ch).WANDERING;
}
ch.sprite.place(ch.pos);
@ -77,6 +78,7 @@ public class TeleportationTrap extends Trap {
}
}
}
Heap heap = Dungeon.level.heaps.get(pos);

View File

@ -48,17 +48,18 @@ public class WarpingTrap extends Trap {
@Override
public void activate() {
CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
Sample.INSTANCE.play( Assets.SND_TELEPORT );
Sample.INSTANCE.play(Assets.SND_TELEPORT);
Char ch = Actor.findChar( pos);
if (ch instanceof Hero){
ScrollOfTeleportation.teleportHero( (Hero)ch);
Char ch = Actor.findChar(pos);
if (ch != null && !ch.flying) {
if (ch instanceof Hero) {
ScrollOfTeleportation.teleportHero((Hero) ch);
BArray.setFalse(Dungeon.level.visited);
BArray.setFalse(Dungeon.level.mapped);
GameScene.updateFog();
Dungeon.observe();
} else if (ch != null){
} else {
int count = 10;
int pos;
do {
@ -70,12 +71,12 @@ public class WarpingTrap extends Trap {
if (pos == -1 || Dungeon.bossLevel()) {
GLog.w( Messages.get(ScrollOfTeleportation.class, "no_tele") );
GLog.w(Messages.get(ScrollOfTeleportation.class, "no_tele"));
} else {
ch.pos = pos;
if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING){
if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING) {
((Mob) ch).state = ((Mob) ch).WANDERING;
}
ch.sprite.place(ch.pos);
@ -83,6 +84,7 @@ public class WarpingTrap extends Trap {
}
}
}
Heap heap = Dungeon.level.heaps.get(pos);

View File

@ -43,7 +43,7 @@ public class WeakeningTrap extends Trap{
}
Char ch = Actor.findChar( pos );
if (ch == Dungeon.hero){
if (ch != null && !ch.flying){
Buff.prolong( ch, Weakness.class, Weakness.DURATION*2f );
}
}