v0.9.1: removed unusual delay behavior from flock traps
This commit is contained in:
parent
c60a1bf237
commit
f4177f8dad
|
@ -43,42 +43,30 @@ public class FlockTrap extends Trap {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void activate() {
|
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.
|
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
|
||||||
Actor.add(new Actor() {
|
for (int i = 0; i < PathFinder.distance.length; i++) {
|
||||||
|
Trap t;
|
||||||
{ actPriority = BUFF_PRIO; }
|
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
|
||||||
|
if (Dungeon.level.insideMap(i)
|
||||||
protected boolean act() {
|
&& Actor.findChar(i) == null
|
||||||
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
|
&& !(Dungeon.level.pit[i])) {
|
||||||
for (int i = 0; i < PathFinder.distance.length; i++) {
|
Sheep sheep = new Sheep();
|
||||||
Trap t;
|
sheep.lifespan = Random.NormalIntRange( 4, 8 );
|
||||||
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
|
sheep.pos = i;
|
||||||
if (Dungeon.level.insideMap(i)
|
GameScene.add(sheep);
|
||||||
&& Actor.findChar(i) == null
|
CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4);
|
||||||
&& !(Dungeon.level.pit[i])) {
|
//before the tile is pressed, directly trigger traps to avoid sfx spam
|
||||||
Sheep sheep = new Sheep();
|
if ((t = Dungeon.level.traps.get(i)) != null && t.active){
|
||||||
sheep.lifespan = Random.NormalIntRange( 4, 8 );
|
t.disarm();
|
||||||
sheep.pos = i;
|
t.reveal();
|
||||||
GameScene.add(sheep);
|
t.activate();
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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;
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user