v2.4.0: increased cases where trinket catalyst can be in special rooms

This increases the overall likelihood from ~33% to ~75%
This commit is contained in:
Evan Debenham
2024-04-12 14:41:09 -04:00
parent aa0d58bace
commit 6807a16dc7
7 changed files with 52 additions and 19 deletions
@@ -795,11 +795,11 @@ public abstract class Level implements Bundlable {
return null;
if (match == null){
//if we have a trinket catalyst, always return that
for (Item i : itemsToSpawn){
if (i instanceof TrinketCatalyst){
itemsToSpawn.remove(i);
return i;
//if we have a trinket catalyst, always return that first
for (Item item : itemsToSpawn){
if (item instanceof TrinketCatalyst){
itemsToSpawn.remove(item);
return item;
}
}
@@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.TrinketCatalyst;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
@@ -63,6 +64,15 @@ public class ArmoryRoom extends SpecialRoom {
} while (level.map[pos] != Terrain.EMPTY || level.heaps.get( pos ) != null);
level.drop( prize( level ), pos );
}
Item cata = level.findPrizeItem(TrinketCatalyst.class);
if (cata != null){
int pos;
do {
pos = level.pointToCell(random());
} while (level.map[pos] != Terrain.EMPTY || level.heaps.get( pos ) != null);
level.drop( cata, pos );
}
entrance.set( Door.Type.LOCKED );
level.addItemToSpawn( new IronKey( Dungeon.depth ) );
@@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.journal.AlchemyPage;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.TrinketCatalyst;
import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
@@ -123,9 +124,13 @@ public class LaboratoryRoom extends SpecialRoom {
private static Item prize( Level level ) {
Item prize = level.findPrizeItem( Potion.class );
if (prize == null)
prize = Generator.random( Random.oneOf( Generator.Category.POTION, Generator.Category.STONE ));
Item prize = level.findPrizeItem( TrinketCatalyst.class );
if (prize == null){
prize = level.findPrizeItem( Potion.class );
if (prize == null) {
prize = Generator.random(Random.oneOf(Generator.Category.POTION, Generator.Category.STONE));
}
}
return prize;
}
@@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.TrinketCatalyst;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
@@ -66,9 +67,13 @@ public class LibraryRoom extends SpecialRoom {
private static Item prize( Level level ) {
Item prize = level.findPrizeItem( Scroll.class );
if (prize == null)
prize = Generator.random( Generator.Category.SCROLL );
Item prize = level.findPrizeItem( TrinketCatalyst.class );
if (prize == null){
prize = level.findPrizeItem( Scroll.class );
if (prize == null) {
prize = Generator.random( Generator.Category.SCROLL );
}
}
return prize;
}
@@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.TrinketCatalyst;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
@@ -64,10 +65,14 @@ public class RunestoneRoom extends SpecialRoom {
}
private static Item prize( Level level ) {
Item prize = level.findPrizeItem( Runestone.class );
if (prize == null)
prize = Generator.random( Generator.Category.STONE );
Item prize = level.findPrizeItem( TrinketCatalyst.class );
if (prize == null){
prize = level.findPrizeItem( Runestone.class );
if (prize == null) {
prize = Generator.random( Generator.Category.STONE );
}
}
return prize;
}
@@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfPurity;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.TrinketCatalyst;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
@@ -72,7 +73,7 @@ public class ToxicGasRoom extends SpecialRoom {
}
//skeleton with 2x gold, somewhat far from entry
//then 2 chests with regular gold (no mimics here)
//then 2 chests with regular gold (no mimics, chance for trinket catalyst)
//we generate excess positions to ensure skull is far from entrance
ArrayList<Integer> goldPositions = new ArrayList<>();
for (int i = 0; i < 8; i++){
@@ -97,7 +98,9 @@ public class ToxicGasRoom extends SpecialRoom {
level.drop(mainGold, furthestPos).type = Heap.Type.SKELETON;
for (int i = 0; i < 2; i++){
level.drop(new Gold().random(), goldPositions.remove(0)).type = Heap.Type.CHEST;
Item item = level.findPrizeItem(TrinketCatalyst.class);
if (item == null) item = new Gold().random();
level.drop(item, goldPositions.remove(0)).type = Heap.Type.CHEST;
}
level.addItemToSpawn(new PotionOfPurity());
@@ -25,7 +25,9 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic;
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.TrinketCatalyst;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
@@ -44,14 +46,17 @@ public class TreasuryRoom extends SpecialRoom {
int n = Random.IntRange( 2, 3 );
for (int i=0; i < n; i++) {
Item item = level.findPrizeItem(TrinketCatalyst.class);
if (item == null) item = new Gold().random();
int pos;
do {
pos = level.pointToCell(random());
} while (level.map[pos] != Terrain.EMPTY || level.heaps.get( pos ) != null || level.findMob(pos) != null);
if (heapType == Heap.Type.CHEST && Dungeon.depth > 1 && Random.Int( 5 ) == 0){
level.mobs.add(Mimic.spawnAt(pos, new Gold().random()));
level.mobs.add(Mimic.spawnAt(pos, item));
} else {
level.drop( new Gold().random(), pos ).type = heapType;
level.drop( item, pos ).type = heapType;
}
}