mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
Merge pull request #6539 from kevlahnota/master2
prevent townPriceModifier NPE
This commit is contained in:
@@ -3,6 +3,7 @@ package forge.adventure.character;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import forge.Forge;
|
||||
import forge.adventure.data.ShopData;
|
||||
import forge.adventure.pointofintrest.PointOfInterestChanges;
|
||||
import forge.adventure.scene.RewardScene;
|
||||
import forge.adventure.stage.MapStage;
|
||||
import forge.adventure.util.Reward;
|
||||
@@ -16,24 +17,26 @@ public class ShopActor extends MapActor{
|
||||
private ShopData shopData;
|
||||
Array<Reward> rewardData;
|
||||
|
||||
public ShopActor(MapStage stage, int id, Array<Reward> rewardData, ShopData data)
|
||||
{
|
||||
public ShopActor(MapStage stage, int id, Array<Reward> rewardData, ShopData data) {
|
||||
super(id);
|
||||
this.stage = stage;
|
||||
this.shopData = data;
|
||||
this.rewardData = rewardData;
|
||||
}
|
||||
|
||||
public float getPriceModifier() { return ( stage.getChanges().getShopPriceModifier(objectId) * stage.getChanges().getTownPriceModifier() ); }
|
||||
public MapStage getMapStage()
|
||||
{
|
||||
public float getPriceModifier() {
|
||||
PointOfInterestChanges changes = stage.getChanges();
|
||||
float townPricemodifier = changes == null ? 1f : changes.getTownPriceModifier();
|
||||
float shopPriceModifier = changes == null ? 1f : changes.getShopPriceModifier(objectId);
|
||||
return shopPriceModifier * townPricemodifier;
|
||||
}
|
||||
|
||||
public MapStage getMapStage() {
|
||||
return stage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerCollide()
|
||||
{
|
||||
|
||||
public void onPlayerCollide() {
|
||||
stage.getPlayerSprite().stop();
|
||||
RewardScene.instance().loadRewards(rewardData, RewardScene.Type.Shop, this);
|
||||
Forge.switchScene(RewardScene.instance());
|
||||
@@ -61,8 +64,15 @@ public class ShopActor extends MapActor{
|
||||
return getRestockPrice() > 0;
|
||||
}
|
||||
|
||||
public ShopData getShopData() { return shopData; }
|
||||
|
||||
public void setRewardData(Array<Reward> data) { rewardData = data; }
|
||||
public Array<Reward> getRewardData() { return rewardData;}
|
||||
public ShopData getShopData() {
|
||||
return shopData;
|
||||
}
|
||||
|
||||
public void setRewardData(Array<Reward> data) {
|
||||
rewardData = data;
|
||||
}
|
||||
|
||||
public Array<Reward> getRewardData() {
|
||||
return rewardData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +92,7 @@ public class AdventureEventData implements Serializable {
|
||||
random = (eventSeed > 0 ? new Random(eventSeed) : new Random());
|
||||
return random;
|
||||
}
|
||||
|
||||
public AdventureEventData(Long seed, AdventureEventController.EventFormat selectedFormat) {
|
||||
setEventSeed(seed);
|
||||
eventStatus = AdventureEventController.EventStatus.Available;
|
||||
@@ -127,8 +128,7 @@ public class AdventureEventData implements Serializable {
|
||||
r2.itemRewards = new String[]{"Challenge Coin"};
|
||||
rewards[2] = r2;
|
||||
}
|
||||
}
|
||||
else if (format.equals(AdventureEventController.EventFormat.Jumpstart)) {
|
||||
} else if (format.equals(AdventureEventController.EventFormat.Jumpstart)) {
|
||||
int numPacksToPickFrom = 6;
|
||||
generateParticipants(7);
|
||||
|
||||
@@ -172,8 +172,7 @@ public class AdventureEventData implements Serializable {
|
||||
}
|
||||
if (themeAdded.isEmpty()) {
|
||||
done = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
chosenPacks.addAll(themeMap.get(themeAdded).subList(0, Math.min(themeMap.get(themeAdded).size(), packConfiguration.length - chosenPacks.size())));
|
||||
availableOptions.removeAll(themeMap.get(themeAdded));
|
||||
themeMap.remove(themeAdded);
|
||||
@@ -184,13 +183,20 @@ public class AdventureEventData implements Serializable {
|
||||
//2. Fill remaining slots with colors already picked whenever possible
|
||||
Map<String, List<Deck>> colorMap = new HashMap<>();
|
||||
for (Deck option : availableOptions) {
|
||||
if (option.getTags().contains("black")) colorMap.getOrDefault("black", new ArrayList<Deck>()).add(option);
|
||||
if (option.getTags().contains("blue")) colorMap.getOrDefault("blue", new ArrayList<Deck>()).add(option);
|
||||
if (option.getTags().contains("green")) colorMap.getOrDefault("green", new ArrayList<Deck>()).add(option);
|
||||
if (option.getTags().contains("red")) colorMap.getOrDefault("red", new ArrayList<Deck>()).add(option);
|
||||
if (option.getTags().contains("white")) colorMap.getOrDefault("white", new ArrayList<Deck>()).add(option);
|
||||
if (option.getTags().contains("multicolor")) colorMap.getOrDefault("multicolor", new ArrayList<Deck>()).add(option);
|
||||
if (option.getTags().contains("colorless")) colorMap.getOrDefault("colorless", new ArrayList<Deck>()).add(option);
|
||||
if (option.getTags().contains("black"))
|
||||
colorMap.getOrDefault("black", new ArrayList<Deck>()).add(option);
|
||||
if (option.getTags().contains("blue"))
|
||||
colorMap.getOrDefault("blue", new ArrayList<Deck>()).add(option);
|
||||
if (option.getTags().contains("green"))
|
||||
colorMap.getOrDefault("green", new ArrayList<Deck>()).add(option);
|
||||
if (option.getTags().contains("red"))
|
||||
colorMap.getOrDefault("red", new ArrayList<Deck>()).add(option);
|
||||
if (option.getTags().contains("white"))
|
||||
colorMap.getOrDefault("white", new ArrayList<Deck>()).add(option);
|
||||
if (option.getTags().contains("multicolor"))
|
||||
colorMap.getOrDefault("multicolor", new ArrayList<Deck>()).add(option);
|
||||
if (option.getTags().contains("colorless"))
|
||||
colorMap.getOrDefault("colorless", new ArrayList<Deck>()).add(option);
|
||||
}
|
||||
|
||||
done = false;
|
||||
@@ -222,8 +228,7 @@ public class AdventureEventData implements Serializable {
|
||||
if (packConfiguration.length > chosenPacks.size() && colorAdded.isEmpty() && !availableOptions.isEmpty()) {
|
||||
chosenPacks.add(Aggregates.removeRandom(availableOptions));
|
||||
colorAdded = "";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
done = colorAdded.isEmpty() || packConfiguration.length <= chosenPacks.size();
|
||||
colorAdded = "";
|
||||
}
|
||||
@@ -505,9 +510,7 @@ public class AdventureEventData implements Serializable {
|
||||
draftedDeck.setComment("Prize for placing 1st overall in draft event");
|
||||
rewards[3].cardRewards = new Deck[]{draftedDeck};
|
||||
|
||||
}
|
||||
|
||||
else if (format == AdventureEventController.EventFormat.Jumpstart) {
|
||||
} else if (format == AdventureEventController.EventFormat.Jumpstart) {
|
||||
|
||||
rewards[3] = new AdventureEventReward();
|
||||
rewards[3].minWins = 0;
|
||||
@@ -570,12 +573,13 @@ public class AdventureEventData implements Serializable {
|
||||
}
|
||||
|
||||
public String getDescription(PointOfInterestChanges changes) {
|
||||
float townPriceModifier = changes == null ? 1f : changes.getTownPriceModifier();
|
||||
if (format.equals(AdventureEventController.EventFormat.Draft)) {
|
||||
description = "Event Type: Booster Draft\n";
|
||||
description += "Block: " + getCardBlock() + "\n";
|
||||
description += "Boosters: " + String.join(", ", packConfiguration) + "\n";
|
||||
description += "Competition Style: " + participants.length + " players, matches played as best of " + eventRules.gamesPerMatch + ", " + (getPairingDescription()) + "\n\n";
|
||||
description += String.format("Entry Fee (incl. reputation)\nGold %d[][+Gold][BLACK]\nMana Shards %d[][+Shards][BLACK]\n", Math.round(eventRules.goldToEnter * changes.getTownPriceModifier()), Math.round(eventRules.shardsToEnter * changes.getTownPriceModifier()));
|
||||
description += String.format("Entry Fee (incl. reputation)\nGold %d[][+Gold][BLACK]\nMana Shards %d[][+Shards][BLACK]\n", Math.round(eventRules.goldToEnter * townPriceModifier), Math.round(eventRules.shardsToEnter * townPriceModifier));
|
||||
if (eventRules.acceptsBronzeChallengeCoin) {
|
||||
description += "Bronze Challenge Coin [][+BronzeChallengeCoin][BLACK]\n\n";
|
||||
} else if (eventRules.acceptsSilverChallengeCoin) {
|
||||
@@ -586,12 +590,11 @@ public class AdventureEventData implements Serializable {
|
||||
description += "\n";
|
||||
}
|
||||
description += String.format("Prizes\nChampion: Keep drafted deck\n2+ round wins: Challenge Coin \n1+ round wins: %s Booster, %s Booster\n0 round wins: %s Booster", rewardPacks[0].getComment(), rewardPacks[1].getComment(), rewardPacks[2].getComment());
|
||||
}
|
||||
else if (format.equals(AdventureEventController.EventFormat.Jumpstart)) {
|
||||
} else if (format.equals(AdventureEventController.EventFormat.Jumpstart)) {
|
||||
description = "Event Type: Jumpstart\n";
|
||||
description += "Block: " + getCardBlock() + "\n";
|
||||
description += "Competition Style: " + participants.length + " players, matches played as best of " + eventRules.gamesPerMatch + ", " + (getPairingDescription()) + "\n\n";
|
||||
description += String.format("Entry Fee (incl. reputation)\nGold %d[][+Gold][BLACK]\nMana Shards %d[][+Shards][BLACK]\n", Math.round(eventRules.goldToEnter * changes.getTownPriceModifier()), Math.round(eventRules.shardsToEnter * changes.getTownPriceModifier()));
|
||||
description += String.format("Entry Fee (incl. reputation)\nGold %d[][+Gold][BLACK]\nMana Shards %d[][+Shards][BLACK]\n", Math.round(eventRules.goldToEnter * townPriceModifier), Math.round(eventRules.shardsToEnter * townPriceModifier));
|
||||
if (eventRules.acceptsBronzeChallengeCoin) {
|
||||
description += "Bronze Challenge Coin [][+BronzeChallengeCoin][BLACK]\n\n";
|
||||
} else if (eventRules.acceptsSilverChallengeCoin) {
|
||||
@@ -683,10 +686,12 @@ public class AdventureEventData implements Serializable {
|
||||
public Deck getDeck() {
|
||||
return registeredDeck == null ? Current.player().getSelectedDeck() : registeredDeck;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Current.player().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getAvatar() {
|
||||
return new Image(Current.player().avatar());
|
||||
|
||||
@@ -350,8 +350,7 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
setColorIdentity(temp);
|
||||
else
|
||||
colorIdentity = ColorSet.ALL_COLORS;
|
||||
}
|
||||
else
|
||||
} else
|
||||
colorIdentity = ColorSet.ALL_COLORS;
|
||||
|
||||
gold = data.readInt("gold");
|
||||
@@ -598,6 +597,7 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
public TextureRegion avatar() {
|
||||
return HeroListData.instance().getAvatar(heroRace, isFemale, avatarIndex);
|
||||
}
|
||||
|
||||
public String raceName() {
|
||||
return HeroListData.instance().getRaces().get(Current.player().heroRace);
|
||||
}
|
||||
@@ -607,6 +607,7 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
return MapStage.getInstance();
|
||||
return WorldStage.getInstance();
|
||||
}
|
||||
|
||||
public void addStatusMessage(String iconName, String message, Integer itemCount, float x, float y) {
|
||||
String symbol = itemCount == null || itemCount < 0 ? "" : " +";
|
||||
String icon = iconName == null ? "" : "[+" + iconName + "]";
|
||||
@@ -620,6 +621,7 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
);
|
||||
getCurrentGameStage().addActor(actor);
|
||||
}
|
||||
|
||||
public void addCard(PaperCard card) {
|
||||
cards.add(card);
|
||||
newCards.add(card);
|
||||
@@ -903,7 +905,8 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
}
|
||||
|
||||
public int cardSellPrice(PaperCard card) {
|
||||
return (int) (CardUtil.getCardPrice(card) * difficultyData.sellFactor * (2.0f - currentLocationChanges.getTownPriceModifier()));
|
||||
float townPriceModifier = currentLocationChanges == null ? 1f : currentLocationChanges.getTownPriceModifier();
|
||||
return (int) (CardUtil.getCardPrice(card) * difficultyData.sellFactor * (2.0f - townPriceModifier));
|
||||
}
|
||||
|
||||
public void sellCard(PaperCard card, Integer result) {
|
||||
|
||||
@@ -57,22 +57,23 @@ public class EventScene extends MenuScene implements IAfterMatch {
|
||||
|
||||
private EventScene() {
|
||||
super(Forge.isLandscapeMode() ? "ui/event.json" : "ui/event_portrait.json");
|
||||
//todo: add translation
|
||||
// TODO: Add translation
|
||||
float townPriceModifier = changes == null ? 1f : changes.getTownPriceModifier();
|
||||
DialogData introDialog = new DialogData();
|
||||
introDialog.text = "Enter this event?";
|
||||
DialogData enterWithCoin = new DialogData();
|
||||
|
||||
DialogData enterWithShards = new DialogData();
|
||||
enterWithShards.name = String.format("Spend %d [+shards]", Math.round(currentEvent.eventRules.shardsToEnter* changes.getTownPriceModifier()));
|
||||
enterWithShards.name = String.format("Spend %d [+shards]", Math.round(currentEvent.eventRules.shardsToEnter * townPriceModifier));
|
||||
DialogData enterWithGold = new DialogData();
|
||||
enterWithGold.name = String.format("Spend %d [+gold]", Math.round(currentEvent.eventRules.goldToEnter * changes.getTownPriceModifier()));
|
||||
enterWithGold.name = String.format("Spend %d [+gold]", Math.round(currentEvent.eventRules.goldToEnter * townPriceModifier));
|
||||
|
||||
DialogData.ConditionData hasGold = new DialogData.ConditionData();
|
||||
hasGold.hasGold = Math.round(currentEvent.eventRules.goldToEnter * changes.getTownPriceModifier());
|
||||
hasGold.hasGold = Math.round(currentEvent.eventRules.goldToEnter * townPriceModifier);
|
||||
enterWithGold.condition = new DialogData.ConditionData[]{hasGold};
|
||||
|
||||
DialogData.ConditionData hasShards = new DialogData.ConditionData();
|
||||
hasShards.hasShards = Math.round(currentEvent.eventRules.shardsToEnter * changes.getTownPriceModifier());
|
||||
hasShards.hasShards = Math.round(currentEvent.eventRules.shardsToEnter * townPriceModifier);
|
||||
enterWithShards.condition = new DialogData.ConditionData[]{hasShards};
|
||||
|
||||
if (currentEvent.eventRules.acceptsChallengeCoin) {
|
||||
@@ -104,23 +105,21 @@ public class EventScene extends MenuScene implements IAfterMatch {
|
||||
giveCoin.removeItem = hasCoin.item;
|
||||
enterWithCoin.action = new DialogData.ActionData[]{giveCoin};
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
DialogData.ConditionData alwaysFalse = new DialogData.ConditionData();
|
||||
alwaysFalse.item = "NonexistentItem";
|
||||
enterWithCoin.condition = new DialogData.ConditionData[]{alwaysFalse};
|
||||
}
|
||||
|
||||
DialogData.ActionData spendGold = new DialogData.ActionData();
|
||||
spendGold.addGold=-Math.round(currentEvent.eventRules.goldToEnter * changes.getTownPriceModifier());
|
||||
spendGold.addGold = -Math.round(currentEvent.eventRules.goldToEnter * townPriceModifier);
|
||||
enterWithGold.action = new DialogData.ActionData[]{spendGold};
|
||||
|
||||
DialogData.ActionData spendShards = new DialogData.ActionData();
|
||||
spendShards.addShards =-Math.round(currentEvent.eventRules.shardsToEnter * changes.getTownPriceModifier());
|
||||
spendShards.addShards = -Math.round(currentEvent.eventRules.shardsToEnter * townPriceModifier);
|
||||
enterWithShards.action = new DialogData.ActionData[]{spendShards};
|
||||
|
||||
|
||||
|
||||
DialogData decline = new DialogData();
|
||||
//todo: add translation
|
||||
decline.name = "Do not enter event";
|
||||
@@ -194,8 +193,7 @@ public class EventScene extends MenuScene implements IAfterMatch {
|
||||
if (currentEvent.format == AdventureEventController.EventFormat.Draft && currentEvent.eventStatus == Ready) {
|
||||
DraftScene.instance().loadEvent(currentEvent);
|
||||
Forge.switchScene(DraftScene.instance());
|
||||
}
|
||||
else if (currentEvent.format == AdventureEventController.EventFormat.Jumpstart && currentEvent.eventStatus == Ready) {
|
||||
} else if (currentEvent.format == AdventureEventController.EventFormat.Jumpstart && currentEvent.eventStatus == Ready) {
|
||||
DeckEditScene.getInstance().loadEvent(currentEvent);
|
||||
Forge.switchScene(DeckEditScene.getInstance());
|
||||
}
|
||||
@@ -236,8 +234,7 @@ public class EventScene extends MenuScene implements IAfterMatch {
|
||||
loadMetaDraft();
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
scrollContainer = new Table(Controls.getSkin());
|
||||
scrollContainer.row();
|
||||
|
||||
@@ -356,8 +353,7 @@ public class EventScene extends MenuScene implements IAfterMatch {
|
||||
editDeck.setVisible(false);
|
||||
if (currentEvent.getDraft() != null) {
|
||||
advance.setText("Enter Draft");
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
advance.setText("Select Deck");
|
||||
}
|
||||
advance.setVisible(true);
|
||||
@@ -415,14 +411,12 @@ public class EventScene extends MenuScene implements IAfterMatch {
|
||||
headerTable.clear();
|
||||
if (!reverse && ++pageIndex >= eventPages.length) {
|
||||
pageIndex = 0;
|
||||
}
|
||||
else if (reverse && --pageIndex < 0) {
|
||||
} else if (reverse && --pageIndex < 0) {
|
||||
pageIndex = eventPages.length - 1;
|
||||
}
|
||||
if (pageIndex == 0) {
|
||||
headerTable.add("Event Standings").expand();
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
headerTable.add("Round " + (pageIndex) + " of " + (eventPages.length - 1));
|
||||
}
|
||||
|
||||
@@ -530,8 +524,7 @@ public class EventScene extends MenuScene implements IAfterMatch {
|
||||
match.p1.wins++;
|
||||
match.p2.losses++;
|
||||
match.winner = match.p1;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
match.p1.losses++;
|
||||
match.p2.wins++;
|
||||
match.winner = match.p2;
|
||||
@@ -542,8 +535,7 @@ public class EventScene extends MenuScene implements IAfterMatch {
|
||||
|
||||
if (humanMatch != null && humanMatch.round != currentEvent.currentRound)
|
||||
humanMatch = null;
|
||||
if (humanMatch != null)
|
||||
{
|
||||
if (humanMatch != null) {
|
||||
DuelScene duelScene = DuelScene.instance();
|
||||
EnemySprite enemy = humanMatch.p2.getSprite();
|
||||
currentEvent.nextOpponent = humanMatch.p2;
|
||||
@@ -551,9 +543,7 @@ public class EventScene extends MenuScene implements IAfterMatch {
|
||||
duelScene.initDuels(WorldStage.getInstance().getPlayerSprite(), enemy, false, currentEvent);
|
||||
Forge.switchScene(duelScene);
|
||||
}, Forge.takeScreenshot(), true, false, false, false, "", Current.player().avatar(), enemy.getAtlasPath(), Current.player().getName(), enemy.getName(), humanMatch.p1.getRecord(), humanMatch.p2.getRecord())));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
finishRound();
|
||||
}
|
||||
advance.setDisabled(false);
|
||||
@@ -577,8 +567,7 @@ public class EventScene extends MenuScene implements IAfterMatch {
|
||||
if (winner) {
|
||||
//AdventureQuestController.instance().updateQuestsWin(currentMob,enemies);
|
||||
//AdventureQuestController.instance().showQuestDialogs(MapStage.this);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
// AdventureQuestController.instance().updateQuestsLose(currentMob);
|
||||
// AdventureQuestController.instance().showQuestDialogs(MapStage.this);
|
||||
}
|
||||
@@ -589,8 +578,7 @@ public class EventScene extends MenuScene implements IAfterMatch {
|
||||
public void finishRound() {
|
||||
if (currentEvent.currentRound == currentEvent.rounds) {
|
||||
finishEvent();
|
||||
}
|
||||
else currentEvent.currentRound += 1;
|
||||
} else currentEvent.currentRound += 1;
|
||||
refresh();
|
||||
}
|
||||
|
||||
@@ -629,11 +617,9 @@ public class EventScene extends MenuScene implements IAfterMatch {
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
selectButton.clearListeners();
|
||||
deckOption.getTags().add("Selected");
|
||||
if (!selectedJumpstartPackIsLast(deckOption))
|
||||
{
|
||||
if (!selectedJumpstartPackIsLast(deckOption)) {
|
||||
loadMetaDraft();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
metaDraftTable.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,8 +101,8 @@ public class InnScene extends UIScene {
|
||||
}
|
||||
|
||||
private void refreshStatus(){
|
||||
|
||||
tempHealthCost = Math.round(Current.player().falseLifeCost() * changes.getTownPriceModifier());
|
||||
float townPriceModifier = changes == null ? 1f : changes.getTownPriceModifier();
|
||||
tempHealthCost = Math.round(Current.player().falseLifeCost() * townPriceModifier);
|
||||
boolean purchaseable = Current.player().getMaxLife() == Current.player().getLife() &&
|
||||
tempHealthCost <= Current.player().getGold();
|
||||
|
||||
|
||||
@@ -48,15 +48,16 @@ public class ShopScene extends ForgeScene {
|
||||
}
|
||||
|
||||
public void doAutosell() {
|
||||
boolean promptToConfirmSale = false; //Todo: config option
|
||||
boolean promptToConfirmSale = false; // TODO: config option
|
||||
if (promptToConfirmSale) {
|
||||
float townPriceModifier = changes == null ? 1f : changes.getTownPriceModifier();
|
||||
int profit = 0;
|
||||
int cards = 0;
|
||||
for (PaperCard cardToSell: Current.player().autoSellCards.toFlatList()) {
|
||||
cards++;
|
||||
profit += getCardPrice(cardToSell);
|
||||
}
|
||||
if (!confirmAutosell(profit, cards, changes.getTownPriceModifier())) {
|
||||
if (!confirmAutosell(profit, cards, townPriceModifier)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +68,7 @@ public class AdventureEventController implements Serializable {
|
||||
public AdventureEventController(AdventureEventController other) {
|
||||
if (object == null) {
|
||||
object = this;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
System.out.println("Could not initialize AdventureEventController. An instance already exists and cannot be merged.");
|
||||
}
|
||||
}
|
||||
@@ -78,8 +77,7 @@ public class AdventureEventController implements Serializable {
|
||||
object = null;
|
||||
}
|
||||
|
||||
public AdventureEventData createEvent(EventStyle style, String pointID, int eventOrigin, PointOfInterestChanges changes)
|
||||
{
|
||||
public AdventureEventData createEvent(EventStyle style, String pointID, int eventOrigin, PointOfInterestChanges changes) {
|
||||
if (nextEventDate.containsKey(pointID) && nextEventDate.get(pointID) >= LocalDate.now().toEpochDay()) {
|
||||
//No event currently available here
|
||||
return null;
|
||||
@@ -92,9 +90,7 @@ public class AdventureEventController implements Serializable {
|
||||
if (timeSeed > room) {
|
||||
//ensuring we don't ever hit an overflow
|
||||
eventSeed = Long.MIN_VALUE + timeSeed - room;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
eventSeed = timeSeed + placeSeed;
|
||||
}
|
||||
|
||||
@@ -104,8 +100,7 @@ public class AdventureEventController implements Serializable {
|
||||
|
||||
if (random.nextInt(10) <= 2) {
|
||||
e = new AdventureEventData(eventSeed, EventFormat.Jumpstart);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
e = new AdventureEventData(eventSeed, EventFormat.Draft);
|
||||
}
|
||||
|
||||
@@ -115,7 +110,7 @@ public class AdventureEventController implements Serializable {
|
||||
}
|
||||
e.sourceID = pointID;
|
||||
e.eventOrigin = eventOrigin;
|
||||
e.eventRules = new AdventureEventData.AdventureEventRules(e.format, changes.getTownPriceModifier());
|
||||
e.eventRules = new AdventureEventData.AdventureEventRules(e.format, changes == null ? 1f : changes.getTownPriceModifier());
|
||||
e.style = style;
|
||||
|
||||
switch (style) {
|
||||
@@ -147,8 +142,7 @@ public class AdventureEventController implements Serializable {
|
||||
//Get all candidates then remove at random until no more than count are included
|
||||
//This will prevent duplicate choices within a round of a Jumpstart draft
|
||||
List<Deck> packsAsDecks = new ArrayList<>();
|
||||
for(SealedTemplate template : StaticData.instance().getSpecialBoosters())
|
||||
{
|
||||
for (SealedTemplate template : StaticData.instance().getSpecialBoosters()) {
|
||||
if (!template.getEdition().contains(block.getLandSet().getCode()))
|
||||
continue;
|
||||
UnOpenedProduct toOpen = new UnOpenedProduct(template);
|
||||
@@ -195,8 +189,7 @@ public class AdventureEventController implements Serializable {
|
||||
}
|
||||
if (colors == 0 && !card.getRules().getType().isLand()) {
|
||||
colorless++;
|
||||
}
|
||||
else if (colors > 1) {
|
||||
} else if (colors > 1) {
|
||||
multi++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user