Skip to content

Commit

Permalink
Merge pull request erasels#213 from modargo/main
Browse files Browse the repository at this point in the history
Monster Zoo/Wildfire zones: change how the rooms are placed to avoid reducing the total number of non-monster rooms on the map
  • Loading branch information
erasels authored Mar 15, 2024
2 parents 6b2ddac + d1f733b commit 43fbde1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@
import com.megacrit.cardcrawl.powers.StrengthPower;
import com.megacrit.cardcrawl.random.Random;
import com.megacrit.cardcrawl.rewards.RewardItem;
import com.megacrit.cardcrawl.rooms.AbstractRoom;
import com.megacrit.cardcrawl.rooms.MonsterRoom;
import spireMapOverhaul.abstracts.AbstractZone;
import spireMapOverhaul.util.Wiz;
import spireMapOverhaul.zoneInterfaces.CombatModifyingZone;
import spireMapOverhaul.zoneInterfaces.RenderableZone;
import spireMapOverhaul.zoneInterfaces.RewardModifyingZone;

import java.util.ArrayList;

public class MonsterZooZone extends AbstractZone implements RewardModifyingZone, CombatModifyingZone, RenderableZone {
public static final String ID = "MonsterZoo";

Expand All @@ -39,12 +42,18 @@ public Color getColor() {
}

@Override
public void replaceRooms(Random rng) {
//Replace all non monster rooms with monster rooms
for (MapRoomNode node : this.nodes) {
if(!(node.room instanceof MonsterRoom)) { //Replaces shop/rest/event with normal monster room
node.setRoom(new MonsterRoom());
}
public void distributeRooms(Random rng, ArrayList<AbstractRoom> roomList) {
// This fills the zone with monster rooms, with half taken from the room distribution list (which means they
// could be elite rooms instead of normal monster rooms, and that it uses up some of the expected distribution
// of those room types), and half simply set directly (which means they are always normal monster rooms and do
// not use up any of the expected distribution of those room types)
int half = nodes.size() / 2;
int i;
for (i = 0; i < half; ++i) {
nodes.get(i).setRoom(roomOrDefault(roomList, (room) -> room instanceof MonsterRoom, MonsterRoom::new));
}
for (; i < nodes.size(); ++i) {
nodes.get(i).setRoom(new MonsterRoom());
}
}

Expand Down
20 changes: 11 additions & 9 deletions src/main/java/spireMapOverhaul/zones/wildfire/Wildfire.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.map.MapRoomNode;
import com.megacrit.cardcrawl.random.Random;
import com.megacrit.cardcrawl.rooms.EventRoom;
import com.megacrit.cardcrawl.rooms.MonsterRoom;
import com.megacrit.cardcrawl.rooms.ShopRoom;
import com.megacrit.cardcrawl.rooms.*;
import spireMapOverhaul.abstracts.AbstractZone;
import spireMapOverhaul.util.Wiz;
import spireMapOverhaul.zoneInterfaces.CombatModifyingZone;
Expand Down Expand Up @@ -107,12 +105,16 @@ protected boolean canIncludeEarlyRows() {
}

@Override
public void replaceRooms(Random rng) {
//Replace all event and shop rooms with monster rooms
for (MapRoomNode node : this.nodes) {
if (node.room != null && (EventRoom.class.equals(node.room.getClass()) || ShopRoom.class.equals(node.room.getClass()))) {
node.setRoom(new MonsterRoom());
}
public void distributeRooms(Random rng, ArrayList<AbstractRoom> roomList) {
// This makes all rooms in the zone either monster rooms (which could be elites) or campfires.
// See the comment in Monster Zoo's distributeRooms method for a more detailed explanation of this approach.
int half = nodes.size() / 2;
int i;
for (i = 0; i < half; ++i) {
nodes.get(i).setRoom(roomOrDefault(roomList, (room) -> room instanceof MonsterRoom || room instanceof RestRoom, MonsterRoom::new));
}
for (; i < nodes.size(); ++i) {
nodes.get(i).setRoom(new MonsterRoom());
}
}

Expand Down

0 comments on commit 43fbde1

Please sign in to comment.