Merge branch 'master' into 'master'

Added puzzle PS_RNA5 (Possibility Storm - Ravnica Allegiance 05)

See merge request core-developers/forge!1441
This commit is contained in:
Michael Kamensky
2019-03-04 13:13:10 +00:00
2 changed files with 48 additions and 0 deletions

View File

@@ -74,6 +74,7 @@ public abstract class GameState {
private final Map<Card, Integer> cardToEnchantPlayerId = new HashMap<>();
private final Map<Card, Integer> markedDamage = new HashMap<>();
private final Map<Card, List<String>> cardToChosenClrs = new HashMap<>();
private final Map<Card, CardCollection> cardToChosenCards = new HashMap<>();
private final Map<Card, String> cardToChosenType = new HashMap<>();
private final Map<Card, List<String>> cardToRememberedId = new HashMap<>();
private final Map<Card, List<String>> cardToImprintedId = new HashMap<>();
@@ -211,6 +212,10 @@ public abstract class GameState {
// Remember the IDs of imprinted cards
cardsReferencedByID.add(i);
}
for (Card i : card.getChosenCards()) {
// Remember the IDs of chosen cards
cardsReferencedByID.add(i);
}
if (game.getCombat() != null && game.getCombat().isAttacking(card)) {
// Remember the IDs of attacked planeswalkers
GameEntity def = game.getCombat().getDefenderByAttacker(card);
@@ -312,6 +317,17 @@ public abstract class GameState {
newText.append("|NamedCard:").append(c.getNamedCard());
}
List<String> chosenCardIds = Lists.newArrayList();
for (Object obj : c.getChosenCards()) {
if (obj instanceof Card) {
int id = ((Card)obj).getId();
chosenCardIds.add(String.valueOf(id));
}
}
if (!chosenCardIds.isEmpty()) {
newText.append("|ChosenCards:").append(TextUtil.join(chosenCardIds, ","));
}
List<String> rememberedCardIds = Lists.newArrayList();
for (Object obj : c.getRemembered()) {
if (obj instanceof Card) {
@@ -552,6 +568,7 @@ public abstract class GameState {
cardToExiledWithId.clear();
markedDamage.clear();
cardToChosenClrs.clear();
cardToChosenCards.clear();
cardToChosenType.clear();
cardToScript.clear();
cardAttackMap.clear();
@@ -947,6 +964,12 @@ public abstract class GameState {
Card c = entry.getKey();
c.setNamedCard(entry.getValue());
}
// Chosen cards
for (Entry<Card, CardCollection> entry : cardToChosenCards.entrySet()) {
Card c = entry.getKey();
c.setChosenCards(entry.getValue());
}
}
private void handleCardAttachments() {
@@ -1143,6 +1166,13 @@ public abstract class GameState {
cardToChosenClrs.put(c, Arrays.asList(info.substring(info.indexOf(':') + 1).split(",")));
} else if (info.startsWith("ChosenType:")) {
cardToChosenType.put(c, info.substring(info.indexOf(':') + 1));
} else if (info.startsWith("ChosenCards:")) {
CardCollection chosen = new CardCollection();
String[] idlist = info.substring(info.indexOf(':') + 1).split(",");
for (String id : idlist) {
chosen.add(idToCard.get(Integer.parseInt(id)));
}
cardToChosenCards.put(c, chosen);
} else if (info.startsWith("NamedCard:")) {
cardToNamedCard.put(c, info.substring(info.indexOf(':') + 1));
} else if (info.startsWith("ExecuteScript:")) {

View File

@@ -0,0 +1,18 @@
[metadata]
Name:Possibility Storm - Ravnica Allegiance #05
URL:http://www.possibilitystorm.com/wp-content/uploads/2019/02/102.-RNA5.jpg
Goal:Win
Turns:1
Difficulty:Rare
Description:What the... you have no lands? Who did that? (You did that.) Start at the beginning of your first main phase as you choose targets for Fall of the Thran's second chapter ability. You just drew the final card in your library. Win this turn.
[state]
humanlife=17
ailife=16
turn=1
activeplayer=human
activephase=DRAW
activephaseadvance=MAIN1
humanhand=Enter the Unknown;Wildgrowth Walker;Depths of Desire;Merfolk Branchwalker;Song of Freyalise;Rallying Roar
humangraveyard=Plains;Hallowed Fountain;Forest;Swamp;Island;Temple Garden
humanbattlefield=Jace, Ingenious Mind-Mage|Counters:LOYALTY=3;Famished Paladin;Vona, Butcher of Magan;Tenth District Guard;Cacophodon;Path of Discovery;Fall of the Thran|Counters:LORE=1
aibattlefield=Temple Altisaur;Everdawn Champion;Baird, Steward of Argive;Imperial Ceratops|Id:1;Dauntless Bodyguard|ChosenCards:1