v0.7.1: made adjustments to cut down on SFX spam from some traps

This commit is contained in:
Evan Debenham 2018-12-15 16:11:16 -05:00 committed by Evan Debenham
parent bf5e12e9d3
commit a7f1174bb9
2 changed files with 16 additions and 2 deletions

View File

@ -51,6 +51,7 @@ public class FlockTrap extends Trap {
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
@ -58,9 +59,16 @@ public class FlockTrap extends Trap {
Sheep sheep = new Sheep();
sheep.lifespan = Random.NormalIntRange(3 + Dungeon.depth/4, 6 + Dungeon.depth/2 );
sheep.pos = i;
Dungeon.level.press(sheep.pos, sheep);
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.press(sheep.pos, sheep);
}
}
}

View File

@ -86,9 +86,15 @@ public class SummoningTrap extends Trap {
}
//important to process the visuals and pressing of cells last, so spawned mobs have a chance to occupy cells first
Trap t;
for (Mob mob : mobs){
//manually trigger traps first to avoid sfx spam
if ((t = Dungeon.level.traps.get(mob.pos)) != null && t.active){
t.disarm();
t.reveal();
t.activate();
}
ScrollOfTeleportation.appear(mob, mob.pos);
//so hidden traps are triggered as well
Dungeon.level.press(mob.pos, mob, true);
}