v1.3.0: ascension challenge now better controls enemy numbers and aggro

This commit is contained in:
Evan Debenham
2022-06-26 20:31:09 -04:00
parent 9edadefe8d
commit 871176abfe
3 changed files with 25 additions and 12 deletions

View File

@@ -415,12 +415,17 @@ public class Dungeon {
PathFinder.setMapSize(level.width(), level.height());
Dungeon.level = level;
hero.pos = pos;
Mob.restoreAllies( level, pos );
if (hero.buff(AscensionChallenge.class) != null){
hero.buff(AscensionChallenge.class).onLevelSwitch();
}
Actor.init();
level.addRespawner();
hero.pos = pos;
for(Mob m : level.mobs){
if (m.pos == hero.pos){
@@ -439,10 +444,6 @@ public class Dungeon {
hero.curAction = hero.lastAction = null;
if (hero.buff(AscensionChallenge.class) != null){
hero.buff(AscensionChallenge.class).onLevelSwitch();
}
observe();
try {
saveAll();

View File

@@ -89,12 +89,14 @@ public class AscensionChallenge extends Buff {
return 1;
}
//mobs get constantly beckoned to the hero at 2.5+ stacks
//distant mobs get constantly beckoned to the hero at 2.5+ stacks
public static void beckonEnemies(){
if (Dungeon.hero.buff(AscensionChallenge.class) != null
&& Dungeon.hero.buff(AscensionChallenge.class).stacks >= 2.5f){
for (Mob m : Dungeon.level.mobs){
if (m.alignment == Char.Alignment.ENEMY) m.beckon(Dungeon.hero.pos);
if (m.alignment == Char.Alignment.ENEMY && m.distance(Dungeon.hero) > 8) {
m.beckon(Dungeon.hero.pos);
}
}
}
}
@@ -204,6 +206,16 @@ public class AscensionChallenge extends Buff {
} else if (stacks >= 2.5f){
toSay = Messages.get(this, "beckon");
}
//clears any existing mobs from the level and adds one initial one
//this helps balance difficulty between levels with lots of mobs left, and ones with few
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (!mob.reset()) {
Dungeon.level.mobs.remove( mob );
}
Dungeon.level.spawnMob(12);
}
}
}
}

View File

@@ -650,11 +650,11 @@ public abstract class Level implements Bundlable {
public float respawnCooldown(){
if (Statistics.amuletObtained){
if (Dungeon.depth == 1){
//very fast spawns on floor 1! 0/2/4/6/8/10, etc.
return Dungeon.level.mobCount() * (TIME_TO_RESPAWN / 25f);
//very fast spawns on floor 1! 2/4/6/8/10/12, etc.
return (1+Dungeon.level.mobCount()) * (TIME_TO_RESPAWN / 25f);
} else {
//respawn time is 0/6/13/19/25/25, etc.
return Math.round(Math.min(Dungeon.level.mobCount() * (TIME_TO_RESPAWN / 8f), TIME_TO_RESPAWN / 2f));
//respawn time is 5/10/15/20/25/25, etc.
return Math.round(Math.min((1+Dungeon.level.mobCount()) * (TIME_TO_RESPAWN / 10f), TIME_TO_RESPAWN / 2f));
}
} else if (Dungeon.level.feeling == Feeling.DARK){
return 2*TIME_TO_RESPAWN/3f;