v0.9.1: removed unusual delay behavior from flock traps

This commit is contained in:
Evan Debenham 2020-10-31 16:33:31 -04:00
parent c60a1bf237
commit f4177f8dad

View File

@ -43,42 +43,30 @@ public class FlockTrap extends Trap {
@Override
public void activate() {
//use an actor as we want to put this on a slight delay so all chars get a chance to act this turn first.
Actor.add(new Actor() {
{ actPriority = BUFF_PRIO; }
protected boolean act() {
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {
Trap t;
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
if (Dungeon.level.insideMap(i)
&& Actor.findChar(i) == null
&& !(Dungeon.level.pit[i])) {
Sheep sheep = new Sheep();
sheep.lifespan = Random.NormalIntRange( 4, 8 );
sheep.pos = i;
GameScene.add(sheep);
CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4);
//before the tile is pressed, directly trigger traps to avoid sfx spam
if ((t = Dungeon.level.traps.get(i)) != null && t.active){
t.disarm();
t.reveal();
t.activate();
}
Dungeon.level.occupyCell(sheep);
}
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {
Trap t;
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
if (Dungeon.level.insideMap(i)
&& Actor.findChar(i) == null
&& !(Dungeon.level.pit[i])) {
Sheep sheep = new Sheep();
sheep.lifespan = Random.NormalIntRange( 4, 8 );
sheep.pos = i;
GameScene.add(sheep);
CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4);
//before the tile is pressed, directly trigger traps to avoid sfx spam
if ((t = Dungeon.level.traps.get(i)) != null && t.active){
t.disarm();
t.reveal();
t.activate();
}
Dungeon.level.occupyCell(sheep);
Sample.INSTANCE.play(Assets.Sounds.PUFF);
Sample.INSTANCE.play(Assets.Sounds.SHEEP);
}
Sample.INSTANCE.play(Assets.Sounds.PUFF);
Sample.INSTANCE.play(Assets.Sounds.SHEEP);
Actor.remove(this);
return true;
}
});
}
}
}