v1.4.0: fixed Yog potentially spawning on an existing char
This commit is contained in:
+19
@@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.YogDzewa;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.YogDzewa;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||||
@@ -240,6 +241,24 @@ public class HallsBossLevel extends Level {
|
|||||||
|
|
||||||
YogDzewa boss = new YogDzewa();
|
YogDzewa boss = new YogDzewa();
|
||||||
boss.pos = exit() + width*3;
|
boss.pos = exit() + width*3;
|
||||||
|
|
||||||
|
//push any char that is already here away
|
||||||
|
if (Actor.findChar(boss.pos) != null){
|
||||||
|
ArrayList<Integer> candidates = new ArrayList<>();
|
||||||
|
for (int i : PathFinder.NEIGHBOURS8){
|
||||||
|
if (Actor.findChar(boss.pos + i) == null){
|
||||||
|
candidates.add(boss.pos + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Char ch = Actor.findChar(boss.pos);
|
||||||
|
if (!candidates.isEmpty()){
|
||||||
|
ch.pos = Random.element(candidates);
|
||||||
|
} else {
|
||||||
|
ch.pos = boss.pos+2*width;
|
||||||
|
}
|
||||||
|
Actor.add(new Pushing(ch, boss.pos, ch.pos));
|
||||||
|
}
|
||||||
|
|
||||||
GameScene.add( boss );
|
GameScene.add( boss );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user