From aaa0bdc135492a44d3f55b5bf9d8c46257864616 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 11 Feb 2020 18:05:22 -0500 Subject: [PATCH] v0.8.0: adjusted demon spawners and bestiary now that halls has 4 floors --- .../shatteredpixeldungeon/Statistics.java | 10 ++++++++ .../actors/mobs/Bestiary.java | 7 +++++- .../actors/mobs/DemonSpawner.java | 25 ++++++++++++++++++- .../levels/HallsLevel.java | 3 --- .../rooms/special/DemonSpawnerRoom.java | 15 ----------- 5 files changed, 40 insertions(+), 20 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Statistics.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Statistics.java index b31412db9..996e9c7bf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Statistics.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Statistics.java @@ -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 ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bestiary.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bestiary.java index ed3a66991..fafa50660 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bestiary.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bestiary.java @@ -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, diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DemonSpawner.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DemonSpawner.java index 3b8869cd6..27162ff9d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DemonSpawner.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DemonSpawner.java @@ -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 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); } { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java index c6f51340f..ea0281178 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java @@ -70,9 +70,6 @@ public class HallsLevel extends RegularLevel { ArrayList rooms = super.initRooms(); rooms.add(new DemonSpawnerRoom()); - if (Dungeon.depth == 24){ - rooms.add(new DemonSpawnerRoom()); - } return rooms; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/DemonSpawnerRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/DemonSpawnerRoom.java index 3e0e6ee9b..21913c758 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/DemonSpawnerRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/DemonSpawnerRoom.java @@ -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