v1.1.0: fixed various errors with mass sheep spawning
This commit is contained in:
parent
f2d17231ca
commit
e43a0b56da
|
@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
|
||||
|
@ -34,6 +35,8 @@ import com.watabou.noosa.audio.Sample;
|
|||
import com.watabou.utils.PathFinder;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class WoollyBomb extends Bomb {
|
||||
|
||||
{
|
||||
|
@ -45,8 +48,14 @@ public class WoollyBomb extends Bomb {
|
|||
super.explode(cell);
|
||||
|
||||
PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 4 );
|
||||
ArrayList<Integer> spawnPoints = new ArrayList<>();
|
||||
for (int i = 0; i < PathFinder.distance.length; i++) {
|
||||
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
|
||||
spawnPoints.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i : spawnPoints){
|
||||
if (Dungeon.level.insideMap(i)
|
||||
&& Actor.findChar(i) == null
|
||||
&& !(Dungeon.level.pit[i])) {
|
||||
|
@ -58,7 +67,6 @@ public class WoollyBomb extends Bomb {
|
|||
CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Sample.INSTANCE.play(Assets.Sounds.PUFF);
|
||||
Sample.INSTANCE.play(Assets.Sounds.SHEEP);
|
||||
|
|
|
@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
|
||||
|
@ -34,6 +35,8 @@ import com.watabou.noosa.audio.Sample;
|
|||
import com.watabou.utils.PathFinder;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class StoneOfFlock extends Runestone {
|
||||
|
||||
{
|
||||
|
@ -47,8 +50,14 @@ public class StoneOfFlock extends Runestone {
|
|||
protected void activate(int cell) {
|
||||
|
||||
PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 );
|
||||
ArrayList<Integer> spawnPoints = new ArrayList<>();
|
||||
for (int i = 0; i < PathFinder.distance.length; i++) {
|
||||
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
|
||||
spawnPoints.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i : spawnPoints){
|
||||
if (Dungeon.level.insideMap(i)
|
||||
&& Actor.findChar(i) == null
|
||||
&& !(Dungeon.level.pit[i])) {
|
||||
|
@ -60,7 +69,7 @@ public class StoneOfFlock extends Runestone {
|
|||
CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CellEmitter.get(cell).burst(Speck.factory(Speck.WOOL), 4);
|
||||
Sample.INSTANCE.play(Assets.Sounds.PUFF);
|
||||
Sample.INSTANCE.play(Assets.Sounds.SHEEP);
|
||||
|
|
|
@ -33,6 +33,8 @@ import com.watabou.noosa.audio.Sample;
|
|||
import com.watabou.utils.PathFinder;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class FlockTrap extends Trap {
|
||||
|
||||
{
|
||||
|
@ -44,9 +46,15 @@ public class FlockTrap extends Trap {
|
|||
@Override
|
||||
public void activate() {
|
||||
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
|
||||
ArrayList<Integer> spawnPoints = new ArrayList<>();
|
||||
for (int i = 0; i < PathFinder.distance.length; i++) {
|
||||
Trap t;
|
||||
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
|
||||
spawnPoints.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i : spawnPoints){
|
||||
Trap t;
|
||||
if (Dungeon.level.insideMap(i)
|
||||
&& Actor.findChar(i) == null
|
||||
&& !(Dungeon.level.pit[i])) {
|
||||
|
@ -67,6 +75,5 @@ public class FlockTrap extends Trap {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user