v0.7.1a: traps now check if chars on them are flying when appropriate
This commit is contained in:
parent
51be374f75
commit
5b6bacc627
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,31 +50,33 @@ 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){
|
||||
int count = 10;
|
||||
int pos;
|
||||
do {
|
||||
pos = Dungeon.level.randomRespawnCell();
|
||||
if (count-- <= 0) {
|
||||
break;
|
||||
}
|
||||
} while (pos == -1);
|
||||
|
||||
if (pos == -1 || Dungeon.bossLevel()) {
|
||||
|
||||
GLog.w( Messages.get(ScrollOfTeleportation.class, "no_tele") );
|
||||
|
||||
if (ch != null && !ch.flying) {
|
||||
if (ch instanceof Hero) {
|
||||
ScrollOfTeleportation.teleportHero((Hero) ch);
|
||||
} else {
|
||||
|
||||
ch.pos = pos;
|
||||
if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING){
|
||||
((Mob) ch).state = ((Mob) ch).WANDERING;
|
||||
int count = 10;
|
||||
int pos;
|
||||
do {
|
||||
pos = Dungeon.level.randomRespawnCell();
|
||||
if (count-- <= 0) {
|
||||
break;
|
||||
}
|
||||
} while (pos == -1);
|
||||
|
||||
if (pos == -1 || Dungeon.bossLevel()) {
|
||||
|
||||
GLog.w(Messages.get(ScrollOfTeleportation.class, "no_tele"));
|
||||
|
||||
} else {
|
||||
|
||||
ch.pos = pos;
|
||||
if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING) {
|
||||
((Mob) ch).state = ((Mob) ch).WANDERING;
|
||||
}
|
||||
ch.sprite.place(ch.pos);
|
||||
ch.sprite.visible = Dungeon.level.heroFOV[pos];
|
||||
|
||||
}
|
||||
ch.sprite.place(ch.pos);
|
||||
ch.sprite.visible = Dungeon.level.heroFOV[pos];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,39 +48,41 @@ 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);
|
||||
BArray.setFalse(Dungeon.level.visited);
|
||||
BArray.setFalse(Dungeon.level.mapped);
|
||||
GameScene.updateFog();
|
||||
Dungeon.observe();
|
||||
|
||||
} else if (ch != null){
|
||||
int count = 10;
|
||||
int pos;
|
||||
do {
|
||||
pos = Dungeon.level.randomRespawnCell();
|
||||
if (count-- <= 0) {
|
||||
break;
|
||||
}
|
||||
} while (pos == -1);
|
||||
|
||||
if (pos == -1 || Dungeon.bossLevel()) {
|
||||
|
||||
GLog.w( Messages.get(ScrollOfTeleportation.class, "no_tele") );
|
||||
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 {
|
||||
int count = 10;
|
||||
int pos;
|
||||
do {
|
||||
pos = Dungeon.level.randomRespawnCell();
|
||||
if (count-- <= 0) {
|
||||
break;
|
||||
}
|
||||
} while (pos == -1);
|
||||
|
||||
ch.pos = pos;
|
||||
if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING){
|
||||
((Mob) ch).state = ((Mob) ch).WANDERING;
|
||||
if (pos == -1 || Dungeon.bossLevel()) {
|
||||
|
||||
GLog.w(Messages.get(ScrollOfTeleportation.class, "no_tele"));
|
||||
|
||||
} else {
|
||||
|
||||
ch.pos = pos;
|
||||
if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING) {
|
||||
((Mob) ch).state = ((Mob) ch).WANDERING;
|
||||
}
|
||||
ch.sprite.place(ch.pos);
|
||||
ch.sprite.visible = Dungeon.level.heroFOV[pos];
|
||||
|
||||
}
|
||||
ch.sprite.place(ch.pos);
|
||||
ch.sprite.visible = Dungeon.level.heroFOV[pos];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user