v1.3.0: DK and Yog can now spawn minions through sheep

This commit is contained in:
Evan Debenham
2022-07-05 13:06:56 -04:00
parent f734553d89
commit ad386aac5c
2 changed files with 29 additions and 4 deletions
@@ -34,6 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Doom; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Doom;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LifeLink; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LifeLink;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep;
import com.shatteredpixel.shatteredpixeldungeon.effects.Beam; import com.shatteredpixel.shatteredpixeldungeon.effects.Beam;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing; import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
@@ -638,6 +639,11 @@ public class DwarfKing extends Mob {
} }
} }
//kill sheep that are right on top of the spawner instead of failing to spawn
if (Actor.findChar(pos) instanceof Sheep){
Actor.findChar(pos).die(null);
}
if (Actor.findChar(pos) == null) { if (Actor.findChar(pos) == null) {
Mob m = Reflection.newInstance(summon); Mob m = Reflection.newInstance(summon);
m.pos = pos; m.pos = pos;
@@ -38,6 +38,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Sleep; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Sleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep;
import com.shatteredpixel.shatteredpixeldungeon.effects.Beam; import com.shatteredpixel.shatteredpixeldungeon.effects.Beam;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing; import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
@@ -300,6 +301,20 @@ public class YogDzewa extends Mob {
} }
} }
//if no other valid spawn spots exist, try to kill an adjacent sheep to spawn anyway
if (spawnPos == -1){
for (int i : PathFinder.NEIGHBOURS8){
if (Actor.findChar(pos+i) instanceof Sheep){
if (spawnPos == -1 || Dungeon.level.trueDistance(Dungeon.hero.pos, spawnPos) > Dungeon.level.trueDistance(Dungeon.hero.pos, pos+i)){
spawnPos = pos + i;
}
}
}
if (spawnPos != -1){
Actor.findChar(spawnPos).die(null);
}
}
if (spawnPos != -1) { if (spawnPos != -1) {
summon.pos = spawnPos; summon.pos = spawnPos;
GameScene.add( summon ); GameScene.add( summon );
@@ -403,16 +418,20 @@ public class YogDzewa extends Mob {
int targetPos = Dungeon.level.exit() + Dungeon.level.width(); int targetPos = Dungeon.level.exit() + Dungeon.level.width();
if (!Dungeon.isChallenged(Challenges.STRONGER_BOSSES) if (!Dungeon.isChallenged(Challenges.STRONGER_BOSSES)
&& Actor.findChar(targetPos) == null){ && (Actor.findChar(targetPos) == null || Actor.findChar(targetPos) instanceof Sheep)){
fist.pos = targetPos; fist.pos = targetPos;
} else if (Actor.findChar(targetPos-1) == null){ } else if (Actor.findChar(targetPos-1) == null || Actor.findChar(targetPos-1) instanceof Sheep){
fist.pos = targetPos-1; fist.pos = targetPos-1;
} else if (Actor.findChar(targetPos+1) == null){ } else if (Actor.findChar(targetPos+1) == null || Actor.findChar(targetPos+1) instanceof Sheep){
fist.pos = targetPos+1; fist.pos = targetPos+1;
} else if (Actor.findChar(targetPos) == null){ } else if (Actor.findChar(targetPos) == null || Actor.findChar(targetPos) instanceof Sheep){
fist.pos = targetPos; fist.pos = targetPos;
} }
if (Actor.findChar(fist.pos) instanceof Sheep){
Actor.findChar(fist.pos).die(null);
}
GameScene.add(fist, 4); GameScene.add(fist, 4);
Actor.addDelayed( new Pushing( fist, Dungeon.level.exit(), fist.pos ), -1 ); Actor.addDelayed( new Pushing( fist, Dungeon.level.exit(), fist.pos ), -1 );
} }