[Un-cards] DeckLimit keyword + Cardboard Carapace

This commit is contained in:
Adam Pantel
2021-03-06 15:58:01 -05:00
parent 0312e54590
commit acb21b2a28
10 changed files with 43 additions and 14 deletions

View File

@@ -569,4 +569,14 @@ public final class CardRules implements ICardCharacteristics {
public boolean hasKeyword(final String k) {
return Iterables.contains(mainPart.getKeywords(), k);
}
public Integer getKeywordMagnitude(final String k) {
for (final String inst : mainPart.getKeywords()) {
final String[] parts = inst.split(":");
if (parts[0].equals(k) && StringUtils.isNumeric(parts[1])) {
return Integer.valueOf(parts[1]);
}
}
return null;
}
}

View File

@@ -375,13 +375,7 @@ public enum DeckFormat {
public static Integer canHaveSpecificNumberInDeck(final IPaperCard card) {
// Ideally, this would be parsed during card parsing and set this value
if (card.getRules().hasKeyword("A deck can have up to seven cards named CARDNAME.")) {
return 7;
} else if (card.getRules().hasKeyword("Megalegendary")) {
return 1;
}
return null;
return card.getRules().getKeywordMagnitude("DeckLimit");
}
public static String getPlaneSectionConformanceProblem(final CardPool planes) {

View File

@@ -1846,7 +1846,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
s.append(" on it.");
}
sbLong.append(s).append("\r\n");
} else if (keyword.startsWith("Protection:")) {
} else if (keyword.startsWith("Protection:") || keyword.startsWith("DeckLimit")) {
final String[] k = keyword.split(":");
sbLong.append(k[2]).append("\r\n");
} else if (keyword.startsWith("Creatures can't attack unless their controller pays")) {
@@ -1966,8 +1966,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|| keyword.equals("Foretell") // for the ones without cost
|| keyword.equals("Hideaway") || keyword.equals("Ascend")
|| keyword.equals("Totem armor") || keyword.equals("Battle cry")
|| keyword.equals("Devoid") || keyword.equals("Riot")
|| keyword.equals("Megalegendary")){
|| keyword.equals("Devoid") || keyword.equals("Riot")){
sbLong.append(keyword).append(" (").append(inst.getReminderText()).append(")");
} else if (keyword.startsWith("Partner:")) {
final String[] k = keyword.split(":");
@@ -2483,6 +2482,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
sbBefore.append(" You may choose new targets for the copies.");
}
sbBefore.append(")\r\n");
} else if (keyword.startsWith("DeckLimit")) {
final String[] k = keyword.split(":");
sbBefore.append(k[2]).append("\r\n");
}
} catch (Exception e) {
String msg = "Card:abilityTextInstantSorcery: crash in Keyword parsing";

View File

@@ -92,7 +92,6 @@ public enum Keyword {
LIFELINK("Lifelink", SimpleKeyword.class, true, "Damage dealt by this creature also causes its controller to gain that much life."),
LIVING_WEAPON("Living weapon", SimpleKeyword.class, true, "When this Equipment enters the battlefield, create a 0/0 black Germ creature token, then attach this to it."),
MADNESS("Madness", KeywordWithCost.class, false, "If you discard this card, discard it into exile. When you do, cast it for %s or put it into your graveyard."),
MEGALEGENDARY("Megalegendary", SimpleKeyword.class, true, "Your deck can have only one copy of this card."),
MELEE("Melee", SimpleKeyword.class, false, "Whenever this creature attacks, it gets +1/+1 until end of turn for each opponent you attacked this combat."),
MENTOR("Mentor", SimpleKeyword.class, false, "Whenever this creature attacks, put a +1/+1 counter on target attacking creature with lesser power."),
MENACE("Menace", SimpleKeyword.class, true, "This creature can't be blocked except by two or more creatures."),

View File

@@ -0,0 +1,8 @@
Name:Cardboard Carapace
ManaCost:5 G
Types:Enchantment Aura
K:Enchant creature
A:SP$ Attach | Cost$ 5 G | ValidTgts$ Creature | AILogic$ Pump
S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ X | AddToughness$ X | Description$ For each other card named Cardboard Carapace you have with you outside the game, enchanted creature gets +1/+1.
SVar:X:Count$ValidSideboard Card.namedCardboard Carapace
Oracle:Enchant creature\nFor each other card named Cardboard Carapace you have with you outside the game, enchanted creature gets +1/+1.

View File

@@ -0,0 +1,6 @@
Name:Gleemox
ManaCost:0
Types:Artifact
K:DeckLimit:0:This card is banned.
A:AB$ Mana | Cost$ T | Produced$ Any | SpellDescription$ Add one mana of any color.
Oracle:{T}: Add one mana of any color.\nThis card is banned.

View File

@@ -0,0 +1,10 @@
Name:Once More with Feeling
ManaCost:W W W W
Types:Sorcery
K:DeckLimit:1:DCI ruling - A deck can have only one card named Once More with Feeling.
A:SP$ ChangeZoneAll | Cost$ W W W W | ChangeType$ Permanent | Origin$ Battlefield,Graveyard | Destination$ Exile | SubAbility$ DBShuffle | SpellDescription$ Exile all permanents and all cards from all graveyards. Each player shuffles their hand into their library, then draws seven cards. Each players life total becomes 10. Exile CARDNAME.
SVar:DBShuffle:DB$ ChangeZoneAll | ChangeType$ Card | Origin$ Hand | Destination$ Library | Shuffle$ True | Random$ True | UseAllOriginZones$ True | SubAbility$ DBDraw | StackDescription$ None
SVar:DBDraw:DB$ Draw | NumCards$ 7 | Defined$ Player | SubAbility$ SetAllLife | StackDescription$ None
SVar:SetAllLife:DB$ SetLife | Defined$ Player | LifeAmount$ 10 | SubAbility$ ExileSelf | StackDescription$ None
SVar:ExileSelf:DB$ ChangeZone | Origin$ Stack | Destination$ Exile | StackDescription$ None
Oracle:Exile all permanents and all cards from all graveyards. Each player shuffles their hand into their library, then draws seven cards. Each players life total becomes 10. Exile Once More with Feeling.\nDCI ruling — A deck can have only one card named Once More with Feeling.

View File

@@ -2,7 +2,7 @@ Name:Seven Dwarves
ManaCost:1 R
Types:Creature Dwarf
PT:2/2
K:A deck can have up to seven cards named CARDNAME.
K:DeckLimit:7:A deck can have up to seven cards named CARDNAME.
S:Mode$ Continuous | Affected$ Card.Self | AddPower$ X | AddToughness$ X | References$ X | Description$ CARDNAME gets +1/+1 for each other creature named Seven Dwarves you control.
SVar:X:Count$Valid Creature.namedSeven Dwarves+Other+YouCtrl
SVar:BuffedBy:Creature.namedSeven Dwarves

View File

@@ -2,7 +2,7 @@ Name:Vazal, the Compleat
ManaCost:3 G G G
Types:Legendary Artifact Creature Phyrexian
PT:7/7
K:Megalegendary
K:DeckLimit:1:Megalegendary (Your deck can have only one copy of this card.)
K:Vigilance
K:Trample
S:Mode$ Continuous | Affected$ Card.Self | EffectZone$ Battlefield | GainsAbilitiesOf$ Permanent.Other | Description$ CARDNAME has all activated abilities of each other permanent on the battlefield.

View File

@@ -245,4 +245,4 @@ Type=Reprint
238 S Zodiac Snake
239 S Zodiac Tiger
240 S Zuran Orb
26584 S Gleemox