- Initial implementation for the RemoveDeck:NonCommander hint.

This commit is contained in:
Agetian
2020-07-09 09:22:47 +03:00
parent 6567aa1b88
commit 448de9b4a2
8 changed files with 33 additions and 7 deletions

View File

@@ -1930,4 +1930,7 @@ public class ComputerUtilCard {
public static boolean isCardRemRandomDeck(final Card card) {
return card.getRules() != null && card.getRules().getAiHints().getRemRandomDecks();
}
public static boolean isCardRemNonCommanderDeck(final Card card) {
return card.getRules() != null && card.getRules().getAiHints().getRemNonCommanderDecks();
}
}

View File

@@ -9,15 +9,17 @@ public class CardAiHints {
private final boolean isRemovedFromAIDecks;
private final boolean isRemovedFromRandomDecks;
private final boolean isRemovedFromNonCommanderDecks;
private final DeckHints deckHints;
private final DeckHints deckNeeds;
private final DeckHints deckHas;
public CardAiHints(boolean remAi, boolean remRandom, DeckHints dh, DeckHints dn, DeckHints has) {
public CardAiHints(boolean remAi, boolean remRandom, boolean remUnlessCommander, DeckHints dh, DeckHints dn, DeckHints has) {
isRemovedFromAIDecks = remAi;
isRemovedFromRandomDecks = remRandom;
isRemovedFromNonCommanderDecks = remUnlessCommander;
deckHints = dh;
deckNeeds = dn;
deckHas = has;
@@ -42,8 +44,17 @@ public class CardAiHints {
}
/**
* @return the deckHints
* Gets the rem random decks.
*
* @return the rem random decks
*/
public boolean getRemNonCommanderDecks() {
return this.isRemovedFromNonCommanderDecks;
}
/**
* @return the deckHints
*/
public DeckHints getDeckHints() {
return deckHints;
}

View File

@@ -291,6 +291,7 @@ public final class CardRules implements ICardCharacteristics {
// fields to build CardAiHints
private boolean removedFromAIDecks = false;
private boolean removedFromRandomDecks = false;
private boolean removedFromNonCommanderDecks = false;
private DeckHints hints = null;
private DeckHints needs = null;
private DeckHints has = null;
@@ -310,6 +311,7 @@ public final class CardRules implements ICardCharacteristics {
this.removedFromAIDecks = false;
this.removedFromRandomDecks = false;
this.removedFromNonCommanderDecks = false;
this.needs = null;
this.hints = null;
this.has = null;
@@ -324,7 +326,7 @@ public final class CardRules implements ICardCharacteristics {
* @return the card
*/
public final CardRules getCard() {
CardAiHints cah = new CardAiHints(removedFromAIDecks, removedFromRandomDecks, hints, needs, has);
CardAiHints cah = new CardAiHints(removedFromAIDecks, removedFromRandomDecks, removedFromNonCommanderDecks, hints, needs, has);
faces[0].assignMissingFields();
if (null != faces[1]) faces[1].assignMissingFields();
final CardRules result = new CardRules(faces, altMode, cah);
@@ -377,6 +379,7 @@ public final class CardRules implements ICardCharacteristics {
if ( "RemoveDeck".equals(variable) ) {
this.removedFromAIDecks = "All".equalsIgnoreCase(value);
this.removedFromRandomDecks = "Random".equalsIgnoreCase(value);
this.removedFromNonCommanderDecks = "NonCommander".equalsIgnoreCase(value);
}
} else if ("AlternateMode".equals(key)) {
//System.out.println(faces[curFace].getName());
@@ -551,7 +554,7 @@ public final class CardRules implements ICardCharacteristics {
}
public static CardRules getUnsupportedCardNamed(String name) {
CardAiHints cah = new CardAiHints(true, true, null, null, null);
CardAiHints cah = new CardAiHints(true, true, true,null, null, null);
CardFace[] faces = { new CardFace(name), null};
faces[0].setColor(ColorSet.fromMask(0));
faces[0].setType(CardType.parse(""));

View File

@@ -290,10 +290,17 @@ public abstract class DeckGeneratorBase {
// remove cards that generated decks don't like
Predicate<CardRules> canPlay = forAi ? AI_CAN_PLAY : HUMAN_CAN_PLAY;
Predicate<CardRules> hasColor = new MatchColorIdentity(colors);
Predicate<CardRules> canUseInFormat = new Predicate<CardRules>() {
@Override
public boolean apply(CardRules c) {
return !c.getAiHints().getRemNonCommanderDecks() || format.hasCommander();
}
};
if (useArtifacts) {
hasColor = Predicates.or(hasColor, COLORLESS_CARDS);
}
return Iterables.filter(pool.getAllCards(),Predicates.compose(Predicates.and(canPlay, hasColor), PaperCard.FN_GET_RULES));
return Iterables.filter(pool.getAllCards(),Predicates.compose(Predicates.and(canPlay, hasColor, canUseInFormat), PaperCard.FN_GET_RULES));
}
protected static Map<String, Integer> countLands(ItemPool<PaperCard> outList) {

View File

@@ -2,4 +2,5 @@ Name:Arcane Signet
ManaCost:2
Types:Artifact
A:AB$ Mana | Cost$ T | Produced$ Combo ColorIdentity | SpellDescription$ Add one mana of any color in your commander's color identity.
AI:RemoveDeck:NonCommander
Oracle:{T}: Add one mana of any color in your commander's color identity.

View File

@@ -2,5 +2,6 @@ Name:Command Tower
ManaCost:no cost
Types:Land
A:AB$ Mana | Cost$ T | Produced$ Combo ColorIdentity | SpellDescription$ Add one mana of any color in your commander's color identity.
AI:RemoveDeck:NonCommander
SVar:Picture:http://www.wizards.com/global/images/magic/general/command_tower.jpg
Oracle:{T}: Add one mana of any color in your commander's color identity.

View File

@@ -4,7 +4,6 @@ Types:Land
A:AB$ Mana | Cost$ T | Produced$ C | SpellDescription$ Add {C}.
A:AB$ Mana | Cost$ 1 T | Produced$ Combo ColorIdentity | AddsCounters$ Card.IsCommander_P1P1_ManaAddsCounterNum | SpellDescription$ Add one mana of any color in your commander's color identity. If you spend this mana to cast your commander, it enters the battlefield with a number of additional +1/+1 counters on it equal to the number of times it's been cast from the command zone this game.
SVar:ManaAddsCounterNum:Count$CommanderCastFromCommandZone
AI:RemoveDeck:All
AI:RemoveDeck:Random
AI:RemoveDeck:NonCommander
SVar:Picture:http://www.wizards.com/global/images/magic/general/opal_palace.jpg
Oracle:{T}: Add {C}.\n{1}, {T}: Add one mana of any color in your commander's color identity. If you spend this mana to cast your commander, it enters the battlefield with a number of additional +1/+1 counters on it equal to the number of times it's been cast from the command zone this game.

View File

@@ -5,5 +5,6 @@ K:CARDNAME enters the battlefield tapped.
A:AB$ Mana | Cost$ T | Produced$ Combo ColorIdentity | TriggersWhenSpent$ TrigScry | SpellDescription$ Add one mana of any color in your commander's color identity. When that mana is spent to cast a creature spell that shares a creature type with your commander, scry 1.
SVar:TrigScry:Mode$ SpellCast | ValidCard$ Creature.sharesCreatureTypeWith Commander | ValidActivatingPlayer$ You | OneOff$ True | Execute$ DBScry | TriggerDescription$ When mana produced by CARDNAME is spent to cast a creature spell that shares a creature type with your commander, scry 1.
SVar:DBScry:DB$ Scry | ScryNum$ 1
AI:RemoveDeck:NonCommander
SVar:Picture:http://www.wizards.com/global/images/magic/general/command_tower.jpg
Oracle:Path of Ancestry enters the battlefield tapped.\n{T}: Add one mana of any color in your commander's color identity. When that mana is spent to cast a creature spell that shares a creature type with your commander, scry 1.