Skip to content

Commit

Permalink
v1.3.0: DK and Yog can now spawn minions through sheep
Browse files Browse the repository at this point in the history
  • Loading branch information
00-Evan committed Jul 5, 2022
1 parent f734553 commit ad386aa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Doom;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LifeLink;
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.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
Expand Down Expand Up @@ -638,6 +639,11 @@ public boolean act() {
}
}

//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) {
Mob m = Reflection.newInstance(summon);
m.pos = pos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Sleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
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.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
Expand Down Expand Up @@ -300,6 +301,20 @@ protected boolean act() {
}
}

//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) {
summon.pos = spawnPos;
GameScene.add( summon );
Expand Down Expand Up @@ -403,16 +418,20 @@ public void addFist(YogFist fist){
int targetPos = Dungeon.level.exit() + Dungeon.level.width();

if (!Dungeon.isChallenged(Challenges.STRONGER_BOSSES)
&& Actor.findChar(targetPos) == null){
&& (Actor.findChar(targetPos) == null || Actor.findChar(targetPos) instanceof Sheep)){
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;
} else if (Actor.findChar(targetPos+1) == null){
} else if (Actor.findChar(targetPos+1) == null || Actor.findChar(targetPos+1) instanceof Sheep){
fist.pos = targetPos+1;
} else if (Actor.findChar(targetPos) == null){
} else if (Actor.findChar(targetPos) == null || Actor.findChar(targetPos) instanceof Sheep){
fist.pos = targetPos;
}

if (Actor.findChar(fist.pos) instanceof Sheep){
Actor.findChar(fist.pos).die(null);
}

GameScene.add(fist, 4);
Actor.addDelayed( new Pushing( fist, Dungeon.level.exit(), fist.pos ), -1 );
}
Expand Down

0 comments on commit ad386aa

Please sign in to comment.