Adding initial handling for Party

This commit is contained in:
friarsol
2020-09-05 23:09:23 -04:00
parent 6ee974893d
commit a81e15ca31
2 changed files with 69 additions and 0 deletions

View File

@@ -1192,6 +1192,66 @@ public class CardFactoryUtil {
return doXMath(cl.size(), m, c);
}
if (sq[0].contains("Party")) {
CardCollection adventurers = CardLists.getValidCards(cc.getGame().getCardsIn(ZoneType.Battlefield),
"Creature.Cleric,Creature.Rogue,Creature.Warrior,Creature.Wizard", cc, c, null);
CardCollection changelings = CardLists.getKeyword(cc.getGame().getCardsIn(ZoneType.Battlefield), Keyword.CHANGELING);
Set<String> partyTypes = new HashSet<>(Arrays.asList(new String[]{"Cleric", "Rogue", "Warrior", "Wizard"}));
int partySize = 0;
HashMap<String, Card> chosenParty = new HashMap<>();
List<Card> wildcard = Lists.newArrayList(changelings);
HashMap<Card, Set<String>> multityped = new HashMap<>();
// Figure out how to count each class separately.
for (Card card : adventurers) {
Set<String> creatureTypes = card.getType().getCreatureTypes();
creatureTypes.retainAll(partyTypes);
if (creatureTypes.size() == 4) {
wildcard.add(card);
if (wildcard.size() >= 4) {
break;
}
continue;
} else if (creatureTypes.size() == 1) {
String type = (String)(creatureTypes.toArray()[0]);
if (!chosenParty.containsKey(type)) {
chosenParty.put(type, card);
}
} else {
multityped.put(card, creatureTypes);
}
}
partySize = Math.min(chosenParty.size() + wildcard.size(), 4);
if (partySize < 4) {
partyTypes.removeAll(chosenParty.keySet());
// Here I'm left with just the party types that I haven't selected.
for(Card multi : multityped.keySet()) {
Set<String> types = multityped.get(multi);
types.retainAll(partyTypes);
for(String type : types) {
chosenParty.put(type, multi);
partySize++;
partyTypes.remove(type);
break;
}
}
}
partySize = Math.min(chosenParty.size() + wildcard.size(), 4);
return doXMath(partySize, m, c);
}
if (sq[0].contains("CardPower")) {
return doXMath(c.getNetPower(), m, c);
}

View File

@@ -0,0 +1,9 @@
Name:Acquisitions Expert
ManaCost:1 B
Types:Creature Human Rogue
PT:1/2
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ DBDiscard | TriggerDescription$ When CARDNAME enters the battlefield, target opponent reveals a number of cards from their hand equal to the number of creatures in your your party. You choose one of those cards. That player discards that card.
SVar:DBDiscard:DB$ Discard | ValidTgts$ Opponent | NumCards$ 1 | RevealNumber$ X | Mode$ RevealYouChoose | References$ X
SVar:X:Count$Party
DeckHas:Ability$Party
Oracle:When Acquisitions Expert enters the battlefield, target opponent reveals a number of cards from their hand equal to the number of creatures in your party. You choose one of those cards. That player discards that card. (Your party consists of up to one each of Cleric, Rogue, Warrior, and Wizard.)