v1.3.0: fixed various errors caused by recent ascension adjustment

This commit is contained in:
Evan Debenham
2022-07-01 14:30:25 -04:00
parent 13507d4124
commit 8e713107c9
4 changed files with 19 additions and 11 deletions

View File

@@ -14,7 +14,7 @@ allprojects {
appName = 'Shattered Pixel Dungeon' appName = 'Shattered Pixel Dungeon'
appPackageName = 'com.shatteredpixel.shatteredpixeldungeon' appPackageName = 'com.shatteredpixel.shatteredpixeldungeon'
appVersionCode = 637 appVersionCode = 638
appVersionName = '1.3.0-BETA-3' appVersionName = '1.3.0-BETA-3'
appJavaCompatibility = JavaVersion.VERSION_1_8 appJavaCompatibility = JavaVersion.VERSION_1_8

View File

@@ -213,8 +213,8 @@ public class AscensionChallenge extends Buff {
if (!mob.reset()) { if (!mob.reset()) {
Dungeon.level.mobs.remove( mob ); Dungeon.level.mobs.remove( mob );
} }
Dungeon.level.spawnMob(12);
} }
Dungeon.level.spawnMob(12);
} }
} }

View File

@@ -86,6 +86,7 @@ import com.watabou.noosa.Group;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundlable; import com.watabou.utils.Bundlable;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
import com.watabou.utils.GameMath;
import com.watabou.utils.PathFinder; import com.watabou.utils.PathFinder;
import com.watabou.utils.Point; import com.watabou.utils.Point;
import com.watabou.utils.Random; import com.watabou.utils.Random;
@@ -650,11 +651,11 @@ public abstract class Level implements Bundlable {
public float respawnCooldown(){ public float respawnCooldown(){
if (Statistics.amuletObtained){ if (Statistics.amuletObtained){
if (Dungeon.depth == 1){ if (Dungeon.depth == 1){
//very fast spawns on floor 1! 2/4/6/8/10/12, etc. //very fast spawns on floor 1! 0/2/4/6/8/10/12, etc.
return (1+Dungeon.level.mobCount()) * (TIME_TO_RESPAWN / 25f); return (Dungeon.level.mobCount()) * (TIME_TO_RESPAWN / 25f);
} else { } else {
//respawn time is 5/10/15/20/25/25, etc. //respawn time is 5/5/10/15/20/25/25, etc.
return Math.round(Math.min((1+Dungeon.level.mobCount()) * (TIME_TO_RESPAWN / 10f), TIME_TO_RESPAWN / 2f)); return Math.round(GameMath.gate( TIME_TO_RESPAWN/10f, Dungeon.level.mobCount() * (TIME_TO_RESPAWN / 10f), TIME_TO_RESPAWN / 2f));
} }
} else if (Dungeon.level.feeling == Feeling.DARK){ } else if (Dungeon.level.feeling == Feeling.DARK){
return 2*TIME_TO_RESPAWN/3f; return 2*TIME_TO_RESPAWN/3f;
@@ -664,11 +665,16 @@ public abstract class Level implements Bundlable {
} }
public boolean spawnMob(int disLimit){ public boolean spawnMob(int disLimit){
PathFinder.buildDistanceMap(Dungeon.hero.pos, BArray.or(Dungeon.level.passable, Dungeon.level.avoid, null)); PathFinder.buildDistanceMap(Dungeon.hero.pos, BArray.or(passable, avoid, null));
Mob mob = Dungeon.level.createMob(); Mob mob = createMob();
mob.state = mob.WANDERING; mob.state = mob.WANDERING;
mob.pos = Dungeon.level.randomRespawnCell( mob ); int tries = 30;
do {
mob.pos = randomRespawnCell(mob);
tries--;
} while ((mob.pos == -1 || PathFinder.distance[mob.pos] < disLimit) && tries > 0);
if (Dungeon.hero.isAlive() && mob.pos != -1 && PathFinder.distance[mob.pos] >= disLimit) { if (Dungeon.hero.isAlive() && mob.pos != -1 && PathFinder.distance[mob.pos] >= disLimit) {
GameScene.add( mob ); GameScene.add( mob );
if (!mob.buffs(ChampionEnemy.class).isEmpty()){ if (!mob.buffs(ChampionEnemy.class).isEmpty()){

View File

@@ -938,8 +938,10 @@ public class GameScene extends PixelScene {
public static void add( Mob mob ) { public static void add( Mob mob ) {
Dungeon.level.mobs.add( mob ); Dungeon.level.mobs.add( mob );
scene.addMobSprite( mob ); if (scene != null) {
Actor.add( mob ); scene.addMobSprite(mob);
Actor.add(mob);
}
} }
public static void addSprite( Mob mob ) { public static void addSprite( Mob mob ) {