From e92b42d5fb04b24944dd274c397b6bd81bbe22e5 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 10 Feb 2021 19:50:27 -0500 Subject: [PATCH] v0.9.2: tweaked randomness on hostile champions and tuned it up slightly --- .../main/assets/messages/misc/misc.properties | 2 +- .../shatteredpixeldungeon/Dungeon.java | 5 +++++ .../actors/buffs/ChampionEnemy.java | 18 ++++-------------- .../shatteredpixeldungeon/levels/Level.java | 2 +- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/core/src/main/assets/messages/misc/misc.properties b/core/src/main/assets/messages/misc/misc.properties index b5191fffa..82c5c8a9c 100644 --- a/core/src/main/assets/messages/misc/misc.properties +++ b/core/src/main/assets/messages/misc/misc.properties @@ -84,6 +84,6 @@ challenges.darkness_desc=It is a dungeon after all!\n\n- Regular visible distanc challenges.no_scrolls=Forbidden runes challenges.no_scrolls_desc=A certain rune is harder to find. Unfortunately, it's always the most useful one.\n\n- Half of the dungeon's upgrades scrolls are removed challenges.champion_enemies=Hostile champions -challenges.champion_enemies_desc=You're not the only one who can level up!\n\n- Regular enemies have a 1/10 chance to spawn with a special champion buff.\n- Champions wake up if they spawn asleep\n- The hero knows when a champion spawns\n- Champions are immune to corruption\n\nThere are six types of champion enemy:\n_Blazing (orange):_ +25% melee damage, ignites on hit, immune to fire, spreads flames on death\n_Projecting (purple):_ +25% melee damage, can attack anything they see\n_Antimagic (green):_ -25% damage taken, immune to magical effects\n_Giant (blue):_ -75% damage taken, +1 melee range, cannot move into tunnels\n_Blessed (yellow):_ +200% accuracy, +200% evasion\n_Growing (red):_ +20% accuracy, evasion, damage, and effective HP. Increases by 1% every 3 turns. +challenges.champion_enemies_desc=You're not the only one who can level up!\n\n- Regular enemies have a 1/8 chance to spawn with a special champion buff.\n- Champions wake up if they spawn asleep\n- The hero knows when a champion spawns\n- Champions are immune to corruption\n\nThere are six types of champion enemy:\n_Blazing (orange):_ +25% melee damage, ignites on hit, immune to fire, spreads flames on death\n_Projecting (purple):_ +25% melee damage, can attack anything they see\n_Antimagic (green):_ -25% damage taken, immune to magical effects\n_Giant (blue):_ -75% damage taken, +1 melee range, cannot move into tunnels\n_Blessed (yellow):_ +200% accuracy, +200% evasion\n_Growing (red):_ +20% accuracy, evasion, damage, and effective HP. Increases by 1% every 3 turns. rankings$record.something=Killed by Something diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index 23866ddae..c07ede3ee 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -149,6 +149,7 @@ public class Dungeon { } public static int challenges; + public static int mobsToChampion; public static Hero hero; public static Level level; @@ -171,6 +172,7 @@ public class Dungeon { version = Game.versionCode; challenges = SPDSettings.challenges(); + mobsToChampion = -1; seed = DungeonSeed.randomSeed(); @@ -448,6 +450,7 @@ public class Dungeon { private static final String VERSION = "version"; private static final String SEED = "seed"; private static final String CHALLENGES = "challenges"; + private static final String MOBS_TO_CHAMPION = "mobs_to_champion"; private static final String HERO = "hero"; private static final String GOLD = "gold"; private static final String DEPTH = "depth"; @@ -467,6 +470,7 @@ public class Dungeon { bundle.put( VERSION, version ); bundle.put( SEED, seed ); bundle.put( CHALLENGES, challenges ); + bundle.put( MOBS_TO_CHAMPION, mobsToChampion ); bundle.put( HERO, hero ); bundle.put( GOLD, gold ); bundle.put( DEPTH, depth ); @@ -561,6 +565,7 @@ public class Dungeon { QuickSlotButton.reset(); Dungeon.challenges = bundle.getInt( CHALLENGES ); + Dungeon.mobsToChampion = bundle.getInt( MOBS_TO_CHAMPION ); Dungeon.level = null; Dungeon.depth = -1; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ChampionEnemy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ChampionEnemy.java index 194d48269..64305d188 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ChampionEnemy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ChampionEnemy.java @@ -34,8 +34,6 @@ import com.watabou.utils.Bundle; import com.watabou.utils.PathFinder; import com.watabou.utils.Random; -import java.util.HashSet; - public abstract class ChampionEnemy extends Buff { { @@ -94,20 +92,12 @@ public abstract class ChampionEnemy extends Buff { immunities.add(Corruption.class); } - public static void rollForChampion(Mob m, HashSet existing){ - int existingChamps = 0; - for (Mob e : existing){ - if (!e.buffs(ChampionEnemy.class).isEmpty()){ - existingChamps++; - } - } + public static void rollForChampion(Mob m){ + if (Dungeon.mobsToChampion <= 0) Dungeon.mobsToChampion = 8; - //cap of 2/2/3/3/4 champs for each region. Mainly to prevent terrible luck in the earlygame - if (existingChamps >= 2 + Dungeon.depth/10){ - return; - } + Dungeon.mobsToChampion--; - if (Random.Int(10) == 0){ + if (Dungeon.mobsToChampion <= 0){ switch (Random.Int(6)){ case 0: default: Buff.affect(m, Blazing.class); break; case 1: Buff.affect(m, Projecting.class); break; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index a19f031d8..6fc7f3658 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -462,7 +462,7 @@ public abstract class Level implements Bundlable { Mob m = Reflection.newInstance(mobsToSpawn.remove(0)); if (Dungeon.isChallenged(Challenges.CHAMPION_ENEMIES)){ - ChampionEnemy.rollForChampion(m, mobs); + ChampionEnemy.rollForChampion(m); } return m; }