v0.3.4: rebalanced rockfall trap

This commit is contained in:
Evan Debenham 2016-02-06 22:13:03 -05:00 committed by Evan Debenham
parent e45a4470d1
commit b9692282a5

View File

@ -46,20 +46,30 @@ public class RockfallTrap extends Trap {
@Override
public void activate() {
if (Dungeon.visible[ pos ]){
CellEmitter.get( pos - Level.WIDTH ).start(Speck.factory(Speck.ROCK), 0.07f, 10);
boolean seen = false;
for (int i : Level.NEIGHBOURS9){
if (Level.solid[pos+i])
continue;
if (Dungeon.visible[ pos+i ]){
CellEmitter.get( pos + i - Level.WIDTH ).start(Speck.factory(Speck.ROCK), 0.07f, 10);
if (!seen) {
Camera.main.shake(3, 0.7f);
Sample.INSTANCE.play(Assets.SND_ROCKS);
seen = true;
}
}
Char ch = Actor.findChar( pos );
Char ch = Actor.findChar( pos+i );
if (ch != null){
int damage = Random.NormalIntRange(5+Dungeon.depth, 10+Dungeon.depth*3);
int damage = Random.NormalIntRange(Dungeon.depth, Dungeon.depth*2);
damage -= Random.IntRange( 0, ch.dr());
ch.damage( Math.max(damage, 0) , this);
Buff.prolong( ch, Paralysis.class, Paralysis.duration(ch)*2);
Buff.prolong( ch, Paralysis.class, Paralysis.duration(ch)/2);
if (!ch.isAlive() && ch == Dungeon.hero){
Dungeon.fail( getClass() );
@ -67,4 +77,6 @@ public class RockfallTrap extends Trap {
}
}
}
}
}