v0.8.0: adjusted demon spawners and bestiary now that halls has 4 floors

This commit is contained in:
Evan Debenham 2020-02-11 18:05:22 -05:00
parent c062edbdb6
commit aaa0bdc135
5 changed files with 40 additions and 20 deletions

View File

@ -37,6 +37,8 @@ public class Statistics {
public static int upgradesUsed;
public static int sneakAttacks;
public static int thrownAssists;
public static int spawnersAlive;
public static float duration;
@ -58,6 +60,8 @@ public class Statistics {
upgradesUsed = 0;
sneakAttacks = 0;
thrownAssists = 0;
spawnersAlive = 0;
duration = 0;
@ -78,6 +82,8 @@ public class Statistics {
private static final String UPGRADES = "upgradesUsed";
private static final String SNEAKS = "sneakAttacks";
private static final String THROWN = "thrownAssists";
private static final String SPAWNERS = "spawnersAlive";
private static final String DURATION = "duration";
@ -95,6 +101,8 @@ public class Statistics {
bundle.put( UPGRADES, upgradesUsed );
bundle.put( SNEAKS, sneakAttacks );
bundle.put( THROWN, thrownAssists );
bundle.put( SPAWNERS, spawnersAlive );
bundle.put( DURATION, duration );
@ -113,6 +121,8 @@ public class Statistics {
upgradesUsed = bundle.getInt( UPGRADES );
sneakAttacks = bundle.getInt( SNEAKS );
thrownAssists = bundle.getInt( THROWN );
spawnersAlive = bundle.getInt( SPAWNERS );
duration = bundle.getFloat( DURATION );

View File

@ -154,7 +154,12 @@ public class Bestiary {
Golem.class, Golem.class, Golem.class));
// Halls
case 21: case 22:
case 21:
//2x succubus, 1x evil eye
return new ArrayList<>(Arrays.asList(
Succubus.class, Succubus.class,
Eye.class));
case 22:
//1x succubus, 1x evil eye
return new ArrayList<>(Arrays.asList(
Succubus.class,

View File

@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
@ -73,10 +74,17 @@ public class DemonSpawner extends Mob {
return true;
}
private float spawnCooldown = 60;
private float spawnCooldown = 0;
private boolean spawnRecorded = false;
@Override
protected boolean act() {
if (!spawnRecorded){
Statistics.spawnersAlive++;
spawnRecorded = true;
}
spawnCooldown--;
if (spawnCooldown <= 0){
ArrayList<Integer> candidates = new ArrayList<>();
@ -100,6 +108,10 @@ public class DemonSpawner extends Mob {
}
spawnCooldown += 60;
if (Dungeon.depth > 21){
//60/53.33/46.67/40 turns to spawn on floor 21/22/23/24
spawnCooldown -= Math.max(40, (Dungeon.depth-21)*6.67);
}
}
}
return super.act();
@ -116,18 +128,29 @@ public class DemonSpawner extends Mob {
super.damage(dmg, src);
}
@Override
public void die(Object cause) {
if (spawnRecorded){
Statistics.spawnersAlive--;
}
super.die(cause);
}
public static final String SPAWN_COOLDOWN = "spawn_cooldown";
public static final String SPAWN_RECORDED = "spawn_recorded";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(SPAWN_COOLDOWN, spawnCooldown);
bundle.put(SPAWN_RECORDED, spawnRecorded);
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
spawnCooldown = bundle.getFloat(SPAWN_COOLDOWN);
spawnRecorded = bundle.getBoolean(SPAWN_RECORDED);
}
{

View File

@ -70,9 +70,6 @@ public class HallsLevel extends RegularLevel {
ArrayList<Room> rooms = super.initRooms();
rooms.add(new DemonSpawnerRoom());
if (Dungeon.depth == 24){
rooms.add(new DemonSpawnerRoom());
}
return rooms;
}

View File

@ -49,21 +49,6 @@ public class DemonSpawnerRoom extends SpecialRoom {
spawner.pos = cx + cy * level.width();
level.mobs.add( spawner );
//2/3 chance for 1, 1/3 chance for 2
int rippers = Random.chances( new float[]{0, 2, 1});
for (int i = 0; i < rippers; i++){
int pos;
do {
pos = level.pointToCell(random(1));
} while (level.solid[pos] || level.findMob(pos) != null);
RipperDemon ripper = new RipperDemon();
ripper.pos = pos;
ripper.state = ripper.HUNTING;
level.mobs.add( ripper );
}
}
@Override