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