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);
|
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,10 +52,12 @@ public class PitfallTrap extends Trap {
|
||||||
|
|
||||||
Char ch = Actor.findChar( pos );
|
Char ch = Actor.findChar( pos );
|
||||||
|
|
||||||
if (ch == Dungeon.hero){
|
if (ch != null && !ch.flying) {
|
||||||
Chasm.heroFall( pos );
|
if (ch == Dungeon.hero) {
|
||||||
} else if (ch != null){
|
Chasm.heroFall(pos);
|
||||||
Chasm.mobFall((Mob)ch);
|
} else {
|
||||||
|
Chasm.mobFall((Mob) ch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,31 +50,33 @@ 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 instanceof Hero){
|
if (ch != null && !ch.flying) {
|
||||||
ScrollOfTeleportation.teleportHero( (Hero)ch);
|
if (ch instanceof Hero) {
|
||||||
} else if (ch != null){
|
ScrollOfTeleportation.teleportHero((Hero) ch);
|
||||||
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 {
|
} else {
|
||||||
|
int count = 10;
|
||||||
ch.pos = pos;
|
int pos;
|
||||||
if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING){
|
do {
|
||||||
((Mob) ch).state = ((Mob) ch).WANDERING;
|
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
|
@Override
|
||||||
public void activate() {
|
public void activate() {
|
||||||
CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
|
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);
|
Char ch = Actor.findChar(pos);
|
||||||
if (ch instanceof Hero){
|
if (ch != null && !ch.flying) {
|
||||||
ScrollOfTeleportation.teleportHero( (Hero)ch);
|
if (ch instanceof Hero) {
|
||||||
BArray.setFalse(Dungeon.level.visited);
|
ScrollOfTeleportation.teleportHero((Hero) ch);
|
||||||
BArray.setFalse(Dungeon.level.mapped);
|
BArray.setFalse(Dungeon.level.visited);
|
||||||
GameScene.updateFog();
|
BArray.setFalse(Dungeon.level.mapped);
|
||||||
Dungeon.observe();
|
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") );
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
int count = 10;
|
||||||
|
int pos;
|
||||||
|
do {
|
||||||
|
pos = Dungeon.level.randomRespawnCell();
|
||||||
|
if (count-- <= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (pos == -1);
|
||||||
|
|
||||||
ch.pos = pos;
|
if (pos == -1 || Dungeon.bossLevel()) {
|
||||||
if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING){
|
|
||||||
((Mob) ch).state = ((Mob) ch).WANDERING;
|
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 );
|
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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user