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

@ -38,6 +38,8 @@ public class Statistics {
public static int sneakAttacks; public static int sneakAttacks;
public static int thrownAssists; public static int thrownAssists;
public static int spawnersAlive;
public static float duration; public static float duration;
public static boolean qualifiedForNoKilling = false; public static boolean qualifiedForNoKilling = false;
@ -59,6 +61,8 @@ public class Statistics {
sneakAttacks = 0; sneakAttacks = 0;
thrownAssists = 0; thrownAssists = 0;
spawnersAlive = 0;
duration = 0; duration = 0;
qualifiedForNoKilling = false; qualifiedForNoKilling = false;
@ -79,6 +83,8 @@ public class Statistics {
private static final String SNEAKS = "sneakAttacks"; private static final String SNEAKS = "sneakAttacks";
private static final String THROWN = "thrownAssists"; private static final String THROWN = "thrownAssists";
private static final String SPAWNERS = "spawnersAlive";
private static final String DURATION = "duration"; private static final String DURATION = "duration";
private static final String AMULET = "amuletObtained"; private static final String AMULET = "amuletObtained";
@ -96,6 +102,8 @@ public class Statistics {
bundle.put( SNEAKS, sneakAttacks ); bundle.put( SNEAKS, sneakAttacks );
bundle.put( THROWN, thrownAssists ); bundle.put( THROWN, thrownAssists );
bundle.put( SPAWNERS, spawnersAlive );
bundle.put( DURATION, duration ); bundle.put( DURATION, duration );
bundle.put( AMULET, amuletObtained ); bundle.put( AMULET, amuletObtained );
@ -114,6 +122,8 @@ public class Statistics {
sneakAttacks = bundle.getInt( SNEAKS ); sneakAttacks = bundle.getInt( SNEAKS );
thrownAssists = bundle.getInt( THROWN ); thrownAssists = bundle.getInt( THROWN );
spawnersAlive = bundle.getInt( SPAWNERS );
duration = bundle.getFloat( DURATION ); duration = bundle.getFloat( DURATION );
amuletObtained = bundle.getBoolean( AMULET ); amuletObtained = bundle.getBoolean( AMULET );

View File

@ -154,7 +154,12 @@ public class Bestiary {
Golem.class, Golem.class, Golem.class)); Golem.class, Golem.class, Golem.class));
// Halls // 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 //1x succubus, 1x evil eye
return new ArrayList<>(Arrays.asList( return new ArrayList<>(Arrays.asList(
Succubus.class, Succubus.class,

View File

@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs; package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
@ -73,10 +74,17 @@ public class DemonSpawner extends Mob {
return true; return true;
} }
private float spawnCooldown = 60; private float spawnCooldown = 0;
private boolean spawnRecorded = false;
@Override @Override
protected boolean act() { protected boolean act() {
if (!spawnRecorded){
Statistics.spawnersAlive++;
spawnRecorded = true;
}
spawnCooldown--; spawnCooldown--;
if (spawnCooldown <= 0){ if (spawnCooldown <= 0){
ArrayList<Integer> candidates = new ArrayList<>(); ArrayList<Integer> candidates = new ArrayList<>();
@ -100,6 +108,10 @@ public class DemonSpawner extends Mob {
} }
spawnCooldown += 60; 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(); return super.act();
@ -116,18 +128,29 @@ public class DemonSpawner extends Mob {
super.damage(dmg, src); 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_COOLDOWN = "spawn_cooldown";
public static final String SPAWN_RECORDED = "spawn_recorded";
@Override @Override
public void storeInBundle(Bundle bundle) { public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle); super.storeInBundle(bundle);
bundle.put(SPAWN_COOLDOWN, spawnCooldown); bundle.put(SPAWN_COOLDOWN, spawnCooldown);
bundle.put(SPAWN_RECORDED, spawnRecorded);
} }
@Override @Override
public void restoreFromBundle(Bundle bundle) { public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle); super.restoreFromBundle(bundle);
spawnCooldown = bundle.getFloat(SPAWN_COOLDOWN); 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(); ArrayList<Room> rooms = super.initRooms();
rooms.add(new DemonSpawnerRoom()); rooms.add(new DemonSpawnerRoom());
if (Dungeon.depth == 24){
rooms.add(new DemonSpawnerRoom());
}
return rooms; return rooms;
} }

View File

@ -49,21 +49,6 @@ public class DemonSpawnerRoom extends SpecialRoom {
spawner.pos = cx + cy * level.width(); spawner.pos = cx + cy * level.width();
level.mobs.add( spawner ); 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 @Override