Added/fixed some primitives, improved Deck Editor to allow user to choose commanders from collection and add them to their decks. Implemented command color identity rule and single card instance limitation for Commander Format game mode.

This commit is contained in:
valfieri
2020-12-07 19:25:06 +01:00
parent ced2c85076
commit d6a1a8eda8
8 changed files with 322 additions and 93 deletions

View File

@@ -1302,6 +1302,18 @@ mana={3}{W}
type=Enchantment
[/card]
[card]
name=Angelic Field Marshal
abilities=flying
auto=aslongas(*[iscommander]|mybattlefield) 2/2 >0
auto=aslongas(*[iscommander]|mybattlefield) lord(creature|mybattlefield) vigilance >0
text=Flying -- Lieutenant — As long as you control your commander, Angelic Field Marshal gets +2/+2 and creatures you control have vigilance.
mana={2}{W}{W}
type=Creature
subtype=Angel
power=3
toughness=3
[/card]
[card]
name=Angelic Guardian
abilities=flying
auto=@combat(attacking) source(creature|myBattlefield):all(creature[attacking]|mybattlefield) indestructible ueot
@@ -7916,7 +7928,9 @@ type=Artifact
[/card]
[card]
name=Coax from the Blind Eternities
auto=may moveto(myhand) target(*[eldrazi]|myexile,mysideboard)
auto=choice name(Look Exile) moveto(myhand) target(*[eldrazi]|myexile)
auto=choice name(Look Sideboard) reveal:type:*:mysideboard revealzone(mysideboard) optionone name(Choose eldrazi) target(*[eldrazi]|reveal) moveto(myhand) optiononeend optiontwo name(put back) all(other *|reveal) moveto(ownersideboard) optiontwoend revealend
auto=choice name(Don't choose) donothing
text=You may choose an Eldrazi card you own from outside the game or in exile, reveal that card, and put it into your hand.
mana={2}{U}
type=Sorcery
@@ -8066,8 +8080,8 @@ toughness=2
[/card]
[card]
name=Collector Protector
auto={W}:moveTo(opponentbattlefield) target(*[-land]|mysideboard) && prevent:1 controller
auto={W}:moveTo(opponentbattlefield) target(*[-land]|mysideboard) && prevent:1
auto={W}:name(Give card and prevent 1 damage to you) prevent:1 controller && name(Look Sideboard) reveal:type:*:mysideboard revealzone(mysideboard) optionone name(Choose non-land card) target(*[-land]|reveal) moveto(opponentBattlefield) optiononeend optiontwo name(put back) all(other *|reveal) moveto(ownersideboard) optiontwoend revealend
auto={W}:name(Give card and prevent 1 damage to Collector Protector) prevent:1 && name(Look Sideboard) reveal:type:*:mysideboard revealzone(mysideboard) optionone name(Choose non-land card) target(*[-land]|reveal) moveto(opponentBattlefield) optiononeend optiontwo name(put back) all(other *|reveal) moveto(ownersideboard) optiontwoend revealend
text={W}, Give an opponent a nonland card you own from outside the game: Prevent the next 1 damage that would be dealt to you or Collector Protector this turn.
mana={3}{W}{W}
type=Creature
@@ -8209,8 +8223,8 @@ type=Instant
[/card]
[card]
name=Command Beacon
auto={T}:add{1}
auto={T}{S}:target(*[commander]|sideboard) moveto(myhand)
auto={T}:add{C}
auto={T}{S}:target(*[iscommander]|mycommandzone) moveto(myhand)
text={T}: Add {C} to your mana pool. -- {T}, Sacrifice Command Beacon: Put your commander into your hand from the command zone.
type=Land
[/card]
@@ -8242,6 +8256,13 @@ mana={4}{R}
type=Instant
[/card]
[card]
name=Commander's Insignia
auto=lord(creature|myBattlefield) pnumofcommandcast/pnumofcommandcast
text=Creatures you control get +1/+1 for each time you've cast your commander from the command zone this game.
mana={2}{W}{W}
type=Enchantment
[/card]
[card]
name=Commander's Plate
target=creature
auto={5}:equip
@@ -16191,6 +16212,14 @@ mana={1}{B}
type=Sorcery
[/card]
[card]
name=Forge of Heroes
auto={T}:add{C}
auto={T} restriction{type(creature[iscommander;fresh]|mybattlefield)~morethan~0}:name(Add 1/1 counter to Commander) target(creature[iscommander;fresh]|mybattlefield) counter(1/1)
auto={T} restriction{type(planeswalker[iscommander;fresh]|mybattlefield)~morethan~0}:name(Add loyalty counter to Commander) target(planeswalker[iscommander;fresh]|mybattlefield) counter(0/0,1,Loyalty)
text={T}: Add {C}. -- {T}: Choose target commander that entered the battlefield this turn. Put a +1/+1 counter on it if it's a creature and a loyalty counter on it if it's a planeswalker.
type=Land
[/card]
[card]
name=Forgotten Sentinel
auto=tap(noevent)
text=Forgotten Sentinel enters the battlefield tapped.
@@ -17148,6 +17177,15 @@ power=1
toughness=2
[/card]
[card]
name=Genesis Storm
aicode=activate target(<pnumofcommandcastplus1plusend>*[-land;-instant;-sorcery]|mylibrary) moveto(mybattlefield)
auto=if compare(pnumofcommandcast)~equalto~0 then name(Reveal from top) name(Reveal from top) Reveal:1 revealzone(mylibrary) revealuntil(*[-land;-instant;-sorcery]|mylibrary) optionone choice name(Get non-land permanent) target(*[-land;-instant;-sorcery]|reveal) moveto(mybattlefield) optiononeend optiontwo choice name(Put on Bottom) all(*|reveal) bottomoflibrary optiontwoend revealend
auto=if compare(pnumofcommandcast)~morethan~0 then name(Reveal from top) name(Reveal from top) Reveal:type:*:mylibrary revealzone(mylibrary) optionone choice name(Get non-land permanents) target(<pnumofcommandcastplus1plusend>*[-land;-instant;-sorcery]|reveal) moveto(mybattlefield) optiononeend optiontwo choice name(Put on Bottom) all(*|reveal) bottomoflibrary optiontwoend revealend
text=When you cast this spell, copy it for each time you've cast your commander from the command zone this game. -- Reveal cards from the top of your library until you reveal a nonland permanent card. You may put that card onto the battlefield. Then put all cards revealed this way that weren't put onto the battlefield on the bottom of your library in a random order.
mana={4}{G}{G}
type=Sorcery
[/card]
[card]
name=Genesis Ultimatum
auto=name(Look) reveal:5 optionone name(Put a permanent) target(<anyamount>*[-instant;-sorcery]|reveal) moveto(myBattlefield) optiononeend optiontwo all(*|reveal) moveto(myHand) optiontwoend revealend
auto=moveTo(myExile)
@@ -23075,6 +23113,13 @@ mana={2}{R}
type=Sorcery
[/card]
[card]
name=Jeweled Lotus
auto={T}{S} restriction{type(*[iscommander]|mycommandzone)~morethan~0}:ability$!name(Choose one) choice name(Add 3 white mana) add{W}{W}{W} _ choice name(Add 3 black mana) add{B}{B}{B} _ choice name(Add 3 green mana) add{G}{G}{G} _ choice name(Add 3 red mana) add{R}{R}{R} _ choice name(Add 3 blue mana) add{U}{U}{U}!$ controller
text={T}, Sacrifice Jeweled Lotus: Add three mana of any one color. Spend this mana only to cast your commander.
mana={0}
type=Artifact
[/card]
[card]
name=Jhoira's Familiar
abilities=flying
auto=lord(*[artifact;legendary;saga]|mystack|mycastingzone) altercost(colorless,-1)
@@ -25156,6 +25201,15 @@ power=1
toughness=2
[/card]
[card]
name=Leadership Vacuum
target=player
auto=ability$!name(Put back each commander) name(Put back each commander) all(*[iscommander]|mybattlefield) moveto(mycommandzone)!$ targetedplayer
auto=draw:1 controller
text=Target player returns each commander they control from the battlefield to the command zone. -- Draw a card.
mana={2}{U}
type=Instant
[/card]
[card]
name=Leafkin Avenger
auto={T}:foreach(creature[power>=4]|myBattlefield) add{G}
auto={7}{R}:target(creature,planeswalker) dynamicability<!powerstrike!>
@@ -25288,7 +25342,7 @@ type=Instant
name=Legion Angel
abilities=flying
aicode=activate target(Legion Angel|mySideboard) moveTo(myHand)
auto=may name(Search Sideaboar) reveal:type:*:mySideboard revealzone(mySideboard) optionone name(choose card) target(<1>Legion Angel|reveal) moveTo(myHand) and!(all(other *|reveal) moveto(ownerSideboard))! optiononeend optiontwo name(put back) target(<1>*|reveal) moveTo(ownerSideboard) and!(all(other *|reveal) moveto(ownerSideboard))! optiontwoend revealend
auto=may name(Search Sideaboard) reveal:type:*:mySideboard revealzone(mySideboard) optionone name(choose card) target(<1>Legion Angel|reveal) moveTo(myHand) and!(all(other *|reveal) moveto(ownerSideboard))! optiononeend optiontwo name(put back) target(<1>*|reveal) moveTo(ownerSideboard) and!(all(other *|reveal) moveto(ownerSideboard))! optiontwoend revealend
text=Flying -- When Legion Angel enters the battlefield, you may reveal a card you own named Legion Angel from outside the game and put it into your hand.
mana={2}{W}{W}
type=Creature
@@ -29793,7 +29847,7 @@ toughness=4
[/card]
[card]
name=Netherborn Altar
auto={T}:counter(0/0,1,Soul) && transforms((,newability[moveTo(myHand) target(commander|sideboard)] && life:-3 foreach(counter{0/0,1,Soul}) all(this) controller))
auto={T} restriction{type(*[iscommander]|mycommandzone)~morethan~0}:transforms((,newability[counter(0/0.1.Soul) all(this)],newability[moveTo(myHand) target(*[iscommander]|mycommandzone)],newability[thisforeach(counter{0/0.1.Soul}) life:-3 controller])) oneshot
text={T}, Put a soul counter on Netherborn Altar: Put your commander into your hand from the command zone. Then you lose 3 life for each soul counter on Netherborn Altar.
mana={1}{B}
type=Artifact
@@ -35737,7 +35791,7 @@ other={3}{U}{R} name(Development)
auto=ifnot paid(alternative) then choice name(Search sideboard) reveal:type:*:mysideboard revealzone(mysideboard) optionone name(choose 4 cards) target(<upto:4>*|reveal) moveto(mylibrary) and!(all(other *|reveal) moveto(ownersideboard))! optiononeend optiontwo name(put back) target(<1>*|reveal) moveto(ownersideboard) and!(all(other *|reveal) moveto(ownersideboard))! optiontwoend afterrevealed shuffle controller afterrevealedend revealend
auto=ifnot paid(alternative) then choice name(Search exile) moveto(mylibrary) target(<upto:4>*|myexile) && shuffle controller
auto=if paid(alternative) then ability$!name(Choose one) choice name(Create Elemental) create(Elemental:creature Elemental:3/1:red)*2 opponent _ choice name(Draw cards) draw:2 opponent!$ opponent
text=Choose up to four cards you own from outside the game and shuffle them into your library. -- // -- Put a 3/1 red Elemental creature token onto the battlefield unless any opponent has you draw a card. Repeat this process two more times.
text=Choose up to four cards you own from outside the game and shuffle them into your library. // Put a 3/1 red Elemental creature token onto the battlefield unless any opponent has you draw a card. Repeat this process two more times.
mana={G}{U}
type=Instant
[/card]

View File

@@ -1231,6 +1231,46 @@ type=Legendary Planeswalker
subtype=Jace
[/card]
[card]
name=Jeska, Thrice Reborn
abilities=canbecommander,partner
auto=counter(0/0,pnumofcommandcast,loyalty)
auto={C(0/0,0,Loyalty)}:name(+0: target creature deals triple damage) target(creature) transforms((,newability[@combatdamaged(player) from(this):damage:twicethatmuch opponent])) uynt
auto={C(0/0,-1,Loyalty)}:name(-1: Deals damage to 1 player and to each of up to 2 creatures or planeswalkers) damage:1 target(player) && ability$!name(Choose 2 targets) target(<upto:2>*[creature;planeswalker]|battlefield) damage:1!$ controller
auto={C(0/0,-1,Loyalty)}:name(-1: Deals damage to 2 players and to each of up to 1 creature or planeswalker) damage:1 opponent && damage:1 controller && ability$!name(Choose 1 target) target(<upto:1>*[creature;planeswalker]|battlefield) damage:1!$ controller
auto={C(0/0,-1,Loyalty)}:name(-1: Deals damage to each of up to 3 creatures or planeswalkers) ability$!name(Choose 3 targets) target(<upto:3>*[creature;planeswalker]|battlefield) damage:1!$ controller
auto={C(0/0,-2,Loyalty)}:name(-2: Deals 2 damages to 1 player and to each of up to 2 creatures or planeswalkers) damage:2 target(player) && ability$!name(Choose 2 targets) target(<upto:2>*[creature;planeswalker]|battlefield) damage:2!$ controller
auto={C(0/0,-2,Loyalty)}:name(-2: Deals 2 damages to 2 players and to each of up to 1 creature or planeswalker) damage:2 opponent && damage:2 controller && ability$!name(Choose 1 target) target(<upto:1>*[creature;planeswalker]|battlefield) damage:2!$ controller
auto={C(0/0,-2,Loyalty)}:name(-2: Deals 2 damages to each of up to 3 creatures or planeswalkers) ability$!name(Choose 3 targets) target(<upto:3>*[creature;planeswalker]|battlefield) damage:2!$ controller
auto={C(0/0,-3,Loyalty)}:name(-3: Deals 3 damages to 1 player and to each of up to 2 creatures or planeswalkers) damage:3 target(player) && ability$!name(Choose 2 targets) target(<upto:2>*[creature;planeswalker]|battlefield) damage:3!$ controller
auto={C(0/0,-3,Loyalty)}:name(-3: Deals 3 damages to 2 players and to each of up to 1 creature or planeswalker) damage:3 opponent && damage:3 controller && ability$!name(Choose 1 target) target(<upto:1>*[creature;planeswalker]|battlefield) damage:3!$ controller
auto={C(0/0,-3,Loyalty)}:name(-3: Deals 3 damages to each of up to 3 creatures or planeswalkers) ability$!name(Choose 3 targets) target(<upto:3>*[creature;planeswalker]|battlefield) damage:3!$ controller
auto={C(0/0,-4,Loyalty)}:name(-4: Deals 4 damages to 1 player and to each of up to 2 creatures or planeswalkers) damage:4 target(player) && ability$!name(Choose 2 targets) target(<upto:2>*[creature;planeswalker]|battlefield) damage:4!$ controller
auto={C(0/0,-4,Loyalty)}:name(-4: Deals 4 damages to 2 players and to each of up to 1 creature or planeswalker) damage:4 opponent && damage:4 controller && ability$!name(Choose 1 target) target(<upto:1>*[creature;planeswalker]|battlefield) damage:4!$ controller
auto={C(0/0,-4,Loyalty)}:name(-4: Deals 4 damages to each of up to 3 creatures or planeswalkers) ability$!name(Choose 3 targets) target(<upto:3>*[creature;planeswalker]|battlefield) damage:4!$ controller
auto={C(0/0,-5,Loyalty)}:name(-5: Deals 5 damages to 1 player and to each of up to 2 creatures or planeswalkers) damage:5 target(player) && ability$!name(Choose 2 targets) target(<upto:2>*[creature;planeswalker]|battlefield) damage:5!$ controller
auto={C(0/0,-5,Loyalty)}:name(-5: Deals 5 damages to 2 players and to each of up to 1 creature or planeswalker) damage:5 opponent && damage:5 controller && ability$!name(Choose 1 target) target(<upto:1>*[creature;planeswalker]|battlefield) damage:5!$ controller
auto={C(0/0,-5,Loyalty)}:name(-5: Deals 5 damages to each of up to 3 creatures or planeswalkers) ability$!name(Choose 3 targets) target(<upto:3>*[creature;planeswalker]|battlefield) damage:5!$ controller
auto={C(0/0,-6,Loyalty)}:name(-6: Deals 6 damages to 1 player and to each of up to 2 creatures or planeswalkers) damage:6 target(player) && ability$!name(Choose 2 targets) target(<upto:2>*[creature;planeswalker]|battlefield) damage:6!$ controller
auto={C(0/0,-6,Loyalty)}:name(-6: Deals 6 damages to 2 players and to each of up to 1 creature or planeswalker) damage:6 opponent && damage:6 controller && ability$!name(Choose 1 target) target(<upto:1>*[creature;planeswalker]|battlefield) damage:6!$ controller
auto={C(0/0,-6,Loyalty)}:name(-6: Deals 6 damages to each of up to 3 creatures or planeswalkers) ability$!name(Choose 3 targets) target(<upto:3>*[creature;planeswalker]|battlefield) damage:6!$ controller
auto={C(0/0,-7,Loyalty)}:name(-7: Deals 7 damages to 1 player and to each of up to 2 creatures or planeswalkers) damage:7 target(player) && ability$!name(Choose 2 targets) target(<upto:2>*[creature;planeswalker]|battlefield) damage:7!$ controller
auto={C(0/0,-7,Loyalty)}:name(-7: Deals 7 damages to 2 players and to each of up to 1 creature or planeswalker) damage:7 opponent && damage:7 controller && ability$!name(Choose 1 target) target(<upto:1>*[creature;planeswalker]|battlefield) damage:7!$ controller
auto={C(0/0,-7,Loyalty)}:name(-7: Deals 7 damages to each of up to 3 creatures or planeswalkers) ability$!name(Choose 3 targets) target(<upto:3>*[creature;planeswalker]|battlefield) damage:7!$ controller
auto={C(0/0,-8,Loyalty)}:name(-8: Deals 8 damages to 1 player and to each of up to 2 creatures or planeswalkers) damage:8 target(player) && ability$!name(Choose 2 targets) target(<upto:2>*[creature;planeswalker]|battlefield) damage:8!$ controller
auto={C(0/0,-8,Loyalty)}:name(-8: Deals 8 damages to 2 players and to each of up to 1 creature or planeswalker) damage:8 opponent && damage:8 controller && ability$!name(Choose 1 target) target(<upto:1>*[creature;planeswalker]|battlefield) damage:8!$ controller
auto={C(0/0,-8,Loyalty)}:name(-8: Deals 8 damages to each of up to 3 creatures or planeswalkers) ability$!name(Choose 3 targets) target(<upto:3>*[creature;planeswalker]|battlefield) damage:8!$ controller
auto={C(0/0,-9,Loyalty)}:name(-9: Deals 9 damages to 1 player and to each of up to 2 creatures or planeswalkers) damage:9 target(player) && ability$!name(Choose 2 targets) target(<upto:2>*[creature;planeswalker]|battlefield) damage:9!$ controller
auto={C(0/0,-9,Loyalty)}:name(-9: Deals 9 damages to 2 players and to each of up to 1 creature or planeswalker) damage:9 opponent && damage:9 controller && ability$!name(Choose 1 target) target(<upto:1>*[creature;planeswalker]|battlefield) damage:9!$ controller
auto={C(0/0,-9,Loyalty)}:name(-9: Deals 9 damages to each of up to 3 creatures or planeswalkers) ability$!name(Choose 3 targets) target(<upto:3>*[creature;planeswalker]|battlefield) damage:9!$ controller
auto={C(0/0,-10,Loyalty)}:name(-10: Deals 10 damages to 1 player and to each of up to 2 creatures or planeswalkers) damage:10 target(player) && ability$!name(Choose 2 targets) target(<upto:2>*[creature;planeswalker]|battlefield) damage:10!$ controller
auto={C(0/0,-10,Loyalty)}:name(-10: Deals 10 damages to 2 players and to each of up to 1 creature or planeswalker) damage:10 opponent && damage:10 controller && ability$!name(Choose 1 target) target(<upto:1>*[creature;planeswalker]|battlefield) damage:10!$ controller
auto={C(0/0,-10,Loyalty)}:name(-10: Deals 10 damages to each of up to 3 creatures or planeswalkers) ability$!name(Choose 3 targets) target(<upto:3>*[creature;planeswalker]|battlefield) damage:10!$ controller
text=Jeska, Thrice Reborn enters the battlefield with a loyalty counter on it for each time you've cast a commander from the command zone this game. -- 0: Choose target creature. Until your next turn, if that creature would deal combat damage to one of your opponents, it deals triple that damage to that player instead. -- -X: Jeska, Thrice Reborn deals X damage to each of up to three targets. -- Jeska, Thrice Reborn can be your commander. -- Partner
mana={2}{R}
type=Legendary Planeswalker
subtype=Jeska
[/card]
[card]
name=Jaya Ballard
auto=counter(0/0,5,Loyalty)
auto={C(0/0,1,Loyalty)}:name(+1: Add {R}{R}{R}) if type(*[instant;sorcery]|myhand)~morethan~0 then add{R}{R}{R}

View File

@@ -370,16 +370,6 @@ mana={3}
type=Artifact
[/card]
[card]
name=Angelic Field Marshal
abilities=flying
text=Flying -- Lieutenant — As long as you control your commander, Angelic Field Marshal gets +2/+2 and creatures you control have vigilance.
mana={2}{W}{W}
type=Creature
subtype=Angel
power=3
toughness=3
[/card]
[card]
name=Animal Magnetism
text=Reveal the top five cards of your library. An opponent chooses a creature card from among them. Put that card onto the battlefield and the rest into your graveyard.
mana={4}{G}
@@ -2480,12 +2470,6 @@ mana={5}{U}{U}
type=Instant
[/card]
[card]
name=Commander's Insignia
text=Creatures you control get +1/+1 for each time you've cast your commander from the command zone this game.
mana={2}{W}{W}
type=Enchantment
[/card]
[card]
name=Common Cause
text=Nonartifact creatures get +2/+2 as long as they all share a color.
mana={2}{W}
@@ -4610,11 +4594,6 @@ mana={5}
type=Artifact
[/card]
[card]
name=Forge of Heroes
text={T}: Add {C}. -- {T}: Choose target commander that entered the battlefield this turn. Put a +1/+1 counter on it if it's a creature and a loyalty counter on it if it's a planeswalker.
type=Land
[/card]
[card]
name=Forgotten Lore
text=Target opponent chooses a card in your graveyard. You may pay {G}. If you do, repeat this process except that opponent can't choose a card already chosen for Forgotten Lore. Then put the last chosen card into your hand.
mana={G}
@@ -4930,12 +4909,6 @@ mana={3}
type=Artifact
[/card]
[card]
name=Genesis Storm
text=When you cast this spell, copy it for each time you've cast your commander from the command zone this game. -- Reveal cards from the top of your library until you reveal a nonland permanent card. You may put that card onto the battlefield. Then put all cards revealed this way that weren't put onto the battlefield on the bottom of your library in a random order.
mana={4}{G}{G}
type=Sorcery
[/card]
[card]
name=Genetic Recombinator
text=Whenever you crank Genetic Recombinator, up to two target creatures each get +2/+2 until end of turn.
type=Artifact
@@ -7010,13 +6983,6 @@ power=1
toughness=3
[/card]
[card]
name=Jeska, Thrice Reborn
text=Jeska, Thrice Reborn enters the battlefield with a loyalty counter on it for each time you've cast a commander from the command zone this game. -- 0: Choose target creature. Until your next turn, if that creature would deal combat damage to one of your opponents, it deals triple that damage to that player instead. -- -X: Jeska, Thrice Reborn deals X damage to each of up to three targets. -- Jeska, Thrice Reborn can be your commander. -- Partner
mana={2}{R}
type=Legendary Planeswalker
subtype=Jeska
[/card]
[card]
name=Jeskai Infiltrator
text=Jeskai Infiltrator can't be blocked as long as you control no other creatures. -- When Jeskai Infiltrator deals combat damage to a player, exile it and the top card of your library in a face-down pile, shuffle that pile, then manifest those cards. (To manifest a card, put it onto the battlefield face down as a 2/2 creature. Turn it face up any time for its mana cost if it's a creature card.)
mana={2}{U}
@@ -7066,12 +7032,6 @@ mana={1}
type=Artifact
[/card]
[card]
name=Jeweled Lotus
text={T}, Sacrifice Jeweled Lotus: Add three mana of any one color. Spend this mana only to cast your commander.
mana={0}
type=Artifact
[/card]
[card]
name=Jhoira of the Ghitu
text={2}, Exile a nonland card from your hand: Put four time counters on the exiled card. If it doesn't have suspend, it gains suspend. (At the beginning of your upkeep, remove a time counter from that card. When the last is removed, cast it without paying its mana cost. If it's a creature, it has haste.)
mana={1}{U}{R}
@@ -7791,12 +7751,6 @@ power=3
toughness=3
[/card]
[card]
name=Leadership Vacuum
text=Target player returns each commander they control from the battlefield to the command zone. -- Draw a card.
mana={2}{U}
type=Instant
[/card]
[card]
name=Leech Bonder
text=Leech Bonder enters the battlefield with two -1/-1 counters on it. -- {U}, {Q}: Move a counter from target creature onto another target creature. ({Q} is the untap symbol.)
mana={2}{U}

View File

@@ -33,7 +33,8 @@ enum
SBMENU_CHOICE = 802,
SBMENU_ADD_NORMAL = 803,
SBMENU_ADD_SB = 804,
SBMENU_ADD_CANCEL = 805
SBMENU_ADD_CMD = 805,
SBMENU_ADD_CANCEL = 806
};
// enums for menu options
@@ -75,7 +76,7 @@ private:
DeckViewerStages mStage;
JMusic * bgMusic;
InteractiveButton *toggleDeckButton, *sbButton, *sellCardButton, *statsPrevButton, *filterButton, *toggleViewButton, *toggleUpButton, *toggleDownButton, *toggleLeftButton, *toggleRightButton;
InteractiveButton *toggleDeckButton, *sb_cmd_Button, *sellCardButton, *statsPrevButton, *filterButton, *toggleViewButton, *toggleUpButton, *toggleDownButton, *toggleLeftButton, *toggleRightButton;
WGuiFilters * filterMenu;
WSrcDeckViewer * source;
@@ -89,6 +90,7 @@ private:
DeckDataWrapper * myDeck;
DeckDataWrapper * myCollection;
DeckDataWrapper * mySideboard;
DeckDataWrapper * myCommandZone;
StatsWrapper * mStatsWrapper;
int hudAlpha;
@@ -112,6 +114,7 @@ private:
void setupView(AvailableView view, DeckDataWrapper *deck);
void toggleView();
void insertSideBoard();
void insertCommandZone();
public:
GameStateDeckViewer(GameApp* parent);
virtual ~GameStateDeckViewer();
@@ -119,11 +122,12 @@ public:
void updateFilters();
void rebuildFilters();
void toggleCollection();
void toggleSideBoard();
void toggleSB_CMD();
void Start();
virtual void End();
void addRemove(MTGCard * card);
void SBaddRemove(MTGCard * card);
void CMDaddRemove(MTGCard * card);
void choiceAddRemove(MTGCard * card);
virtual void Update(float dt);
void renderOnScreenBasicInfo();

View File

@@ -233,6 +233,7 @@ public:
int add(MTGCard * card);
int remove(MTGCard * card);
void replaceSB(vector<string> newSB = vector<string>());
void replaceCMD(vector<string> newCMD = vector<string>());
string getFilename();
int save();
int save(const string& destFileName, bool useExpandedDescriptions, const string& deckTitle, const string& deckDesc);

View File

@@ -38,6 +38,7 @@ GameStateDeckViewer::GameStateDeckViewer(GameApp* parent) :
myCollection = NULL;
myDeck = NULL;
mySideboard = NULL;
myCommandZone = NULL;
filterMenu = NULL;
source = NULL;
hudAlpha = 0;
@@ -49,7 +50,7 @@ GameStateDeckViewer::GameStateDeckViewer(GameApp* parent) :
statsPrevButton = NEW InteractiveButton(NULL, kPrevStatsButtonId, Fonts::MAIN_FONT, "Stats", SCREEN_WIDTH_F - 35, SCREEN_HEIGHT_F - 20, JGE_BTN_PREV);
toggleDeckButton = NEW InteractiveButton(NULL, kToggleDeckActionId, Fonts::MAIN_FONT, "View Deck", 10, SCREEN_HEIGHT_F - 20, JGE_BTN_PRI);
sellCardButton = NEW InteractiveButton(NULL, kSellCardActionId, Fonts::MAIN_FONT, "Sell Card", (SCREEN_WIDTH_F/ 2) - 125, SCREEN_HEIGHT_F - 20, JGE_BTN_SEC);
sbButton = NEW InteractiveButton(NULL, kSBActionId, Fonts::MAIN_FONT, "View SB", (SCREEN_WIDTH_F/ 2) - 35, SCREEN_HEIGHT_F - 20, JGE_BTN_SOUND);
sb_cmd_Button = NEW InteractiveButton(NULL, kSBActionId, Fonts::MAIN_FONT, "View SB/CMD", (SCREEN_WIDTH_F/ 2) - 35, SCREEN_HEIGHT_F - 20, JGE_BTN_SOUND);
filterButton = NEW InteractiveButton(NULL, kFilterButtonId, Fonts::MAIN_FONT, "Filter", (SCREEN_WIDTH_F - 116), SCREEN_HEIGHT_F - 20, JGE_BTN_CTRL);
//TODO: Check if that button is available:
toggleViewButton = NEW InteractiveButton(NULL, kSwitchViewButton, Fonts::MAIN_FONT, "Grid", (SCREEN_WIDTH_F/ 2) + 50, SCREEN_HEIGHT_F - 20, JGE_BTN_MAX);
@@ -64,7 +65,7 @@ GameStateDeckViewer::~GameStateDeckViewer()
SAFE_DELETE(bgMusic);
SAFE_DELETE(toggleDeckButton);
SAFE_DELETE(sellCardButton);
SAFE_DELETE(sbButton);
SAFE_DELETE(sb_cmd_Button);
SAFE_DELETE(statsPrevButton);
SAFE_DELETE(filterButton);
SAFE_DELETE(toggleViewButton);
@@ -84,6 +85,11 @@ GameStateDeckViewer::~GameStateDeckViewer()
SAFE_DELETE(mySideboard->parent);
SAFE_DELETE(mySideboard);
}
if (myCommandZone)
{
SAFE_DELETE(myCommandZone->parent);
SAFE_DELETE(myCommandZone);
}
if (myCollection)
{
SAFE_DELETE(myCollection->parent);
@@ -119,7 +125,7 @@ void GameStateDeckViewer::updateFilters()
void GameStateDeckViewer::toggleCollection()
{
if(mView->deck() == mySideboard)
if(mView->deck() == mySideboard || mView->deck() == myCommandZone)
return;
if (mView->deck() == myCollection)
@@ -136,7 +142,7 @@ void GameStateDeckViewer::toggleCollection()
updateFilters();
}
void GameStateDeckViewer::toggleSideBoard()
void GameStateDeckViewer::toggleSB_CMD()
{
if(mView->deck() == myDeck)
return;
@@ -144,10 +150,17 @@ void GameStateDeckViewer::toggleSideBoard()
if (mView->deck() == myCollection)
{
mView->SetDeck(mySideboard);
sb_cmd_Button->setText("View CMD");
}
else if (mView->deck() == mySideboard)
{
mView->SetDeck(myCommandZone);
sb_cmd_Button->setText("View Coll.");
}
else
{
mView->SetDeck(myCollection);
sb_cmd_Button->setText("View SB/CMD");
}
//source->swapSrc();
//updateFilters();
@@ -196,6 +209,7 @@ void GameStateDeckViewer::Start()
sbMenu = NULL;
myDeck = NULL;
mySideboard = NULL;
myCommandZone = NULL;
mStage = STAGE_WELCOME;
last_user_activity = NO_USER_ACTIVITY_HELP_DELAY + 1;
@@ -263,6 +277,11 @@ void GameStateDeckViewer::End()
SAFE_DELETE(mySideboard->parent);
SAFE_DELETE(mySideboard);
}
if (myCommandZone)
{
SAFE_DELETE(myCommandZone->parent);
SAFE_DELETE(myCommandZone);
}
SAFE_DELETE(pricelist);
SAFE_DELETE(playerdata);
SAFE_DELETE(filterMenu);
@@ -313,6 +332,28 @@ void GameStateDeckViewer::SBaddRemove(MTGCard * card)
mView->reloadIndexes();
}
void GameStateDeckViewer::CMDaddRemove(MTGCard * card)
{
if (!card) return;
if ((card->getRarity() == Constants::RARITY_T) || (card->getId() < 1)) return;
if (mView->deck()->Remove(card, 1, (mView->deck() == myCommandZone)))
{
if (mView->deck() == myCollection)
{
myCommandZone->Add(card);
myCommandZone->Sort(WSrcCards::SORT_ALPHA);
}
else
{
myCollection->Add(card);
}
}
myCollection->validate();
myCommandZone->validate();
mStatsWrapper->needUpdate = true;
mView->reloadIndexes();
}
void GameStateDeckViewer::choiceAddRemove(MTGCard * card)
{
if (!card) return;
@@ -327,6 +368,8 @@ void GameStateDeckViewer::choiceAddRemove(MTGCard * card)
sbMenu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), SBMENU_CHOICE, this, Fonts::MAIN_FONT, menuXOffset, menuYOffset, "Add/Remove Cards");
sbMenu->Add(SBMENU_ADD_NORMAL, "Add to Deck");
sbMenu->Add(SBMENU_ADD_SB, "Add to Sideboard");
if(card->data->hasType("Legendary") && (card->data->hasType("Creature") || card->data->basicAbilities[Constants::CANBECOMMANDER]))
sbMenu->Add(SBMENU_ADD_CMD, "Choose as Commander");
sbMenu->Add(SBMENU_ADD_CANCEL, "Cancel");
}
else
@@ -334,6 +377,8 @@ void GameStateDeckViewer::choiceAddRemove(MTGCard * card)
sbMenu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), SBMENU_CHOICE, this, Fonts::MAIN_FONT, menuXOffset, menuYOffset, "Add/Remove Cards");
sbMenu->Add(SBMENU_ADD_NORMAL, "Remove Card");
//sbMenu->Add(SBMENU_ADD_SB, "Add to Sideboard");
if(card->data->hasType("Legendary") && (card->data->hasType("Creature") || card->data->basicAbilities[Constants::CANBECOMMANDER]))
sbMenu->Add(SBMENU_ADD_CMD, "Choose as Commander");
sbMenu->Add(SBMENU_ADD_CANCEL, "Cancel");
}
}
@@ -360,6 +405,26 @@ void GameStateDeckViewer::insertSideBoard()
}
}
void GameStateDeckViewer::insertCommandZone()
{
if(myCommandZone->getCount())
{
vector<string> newCMD;
for (int i = 0; i < myCommandZone->Size(true); i++)
{
MTGCard * current = myCommandZone->getCard(i, true);
int howmanyinDeck = myCommandZone->count(current);
for (int i = 0; i < howmanyinDeck; i++)
{
stringstream cid;
cid << current->getMTGId();
newCMD.push_back(cid.str());
}
}
myDeck->parent->replaceCMD(newCMD);
}
}
void GameStateDeckViewer::saveDeck()
{
//update the corresponding meta data object
@@ -369,6 +434,8 @@ void GameStateDeckViewer::saveDeck()
mSwitching = true;
//insert sideboards to mydeck parents
insertSideBoard();
//insert commanders to mydeck parents
insertCommandZone();
//save deck
myDeck->save();
playerdata->save();
@@ -424,7 +491,7 @@ bool GameStateDeckViewer::userPressedButton()
{
return ((toggleDeckButton->ButtonPressed())
|| (sellCardButton->ButtonPressed())
|| (sbButton->ButtonPressed())
|| (sb_cmd_Button->ButtonPressed())
|| (statsPrevButton->ButtonPressed())
|| (filterButton->ButtonPressed())
|| (toggleViewButton->ButtonPressed())
@@ -439,7 +506,7 @@ void GameStateDeckViewer::setButtonState(bool state)
{
toggleDeckButton->setIsSelectionValid(state);
sellCardButton->setIsSelectionValid(state);
sbButton->setIsSelectionValid(state);
sb_cmd_Button->setIsSelectionValid(state);
statsPrevButton->setIsSelectionValid(state);
filterButton->setIsSelectionValid(state);
toggleViewButton->setIsSelectionValid(state);
@@ -451,12 +518,12 @@ void GameStateDeckViewer::setButtonState(bool state)
void GameStateDeckViewer::RenderButtons()
{
if(mView->deck() != mySideboard)
if(mView->deck() != mySideboard && mView->deck() != myCommandZone)
toggleDeckButton->Render();
sellCardButton->Render();
if(mView->deck() != myDeck)
sbButton->Render();
if(mView->deck() != mySideboard)
sb_cmd_Button->Render();
if(mView->deck() != mySideboard && mView->deck() != myCommandZone)
filterButton->Render();
statsPrevButton->Render();
toggleViewButton->Render();
@@ -564,7 +631,7 @@ void GameStateDeckViewer::Update(float dt)
if (last_user_activity > 0.2)
{
last_user_activity = 0;
toggleSideBoard();
toggleSB_CMD();
}
break;
case JGE_BTN_PRI:
@@ -618,9 +685,9 @@ void GameStateDeckViewer::Update(float dt)
break;
case JGE_BTN_MENU:
if(mView->deck() == mySideboard)
if(mView->deck() == mySideboard || mView->deck() == myCommandZone)
{
toggleSideBoard();
toggleSB_CMD();
}
else
{
@@ -629,7 +696,7 @@ void GameStateDeckViewer::Update(float dt)
}
break;
case JGE_BTN_CTRL:
if (mView->deck() == mySideboard)
if (mView->deck() == mySideboard || mView->deck() == myCommandZone)
break;//SB is for viewing add or remove only
else if(!mView->ButtonPressed(JGE_BTN_CTRL))
{
@@ -917,8 +984,8 @@ void GameStateDeckViewer::renderOnScreenMenu()
int nb_letters = 0;
int value = myDeck->getCount(WSrcDeck::UNFILTERED_COPIES);
int sb_value = mySideboard->getCount(WSrcDeck::UNFILTERED_COPIES);
sprintf(buffer, _("Your Deck: %i cards.\nSideboard: %i cards").c_str(), value, sb_value);
int cmd_value = myCommandZone->getCount(WSrcDeck::UNFILTERED_COPIES);
sprintf(buffer, _("Your Deck: %i cards.\nSideboard: %i cards.\nCommanders: %i cards").c_str(), value, sb_value,cmd_value);
font->DrawString(buffer, SCREEN_WIDTH - 200 + rightTransition, SCREEN_HEIGHT / 2 + 15);
for (int j = 0; j < Constants::NB_Colors; j++)
@@ -1552,8 +1619,14 @@ int GameStateDeckViewer::loadDeck(int deckid)
SAFE_DELETE(mySideboard->parent);
SAFE_DELETE(mySideboard);
}
//cmd
if (myCommandZone)
{
SAFE_DELETE(myCommandZone->parent);
SAFE_DELETE(myCommandZone);
}
//temp deck for sb?
MTGDeck * tempDeck = NEW MTGDeck(MTGCollection());
MTGDeck * sbtempDeck = NEW MTGDeck(MTGCollection());
if(myDeck->parent)
{//add cards from sdeboard lists
if(myDeck->parent->Sideboard.size())
@@ -1561,11 +1634,11 @@ int GameStateDeckViewer::loadDeck(int deckid)
for(unsigned int j = 0; j < myDeck->parent->Sideboard.size(); j++)
{
string cardID = myDeck->parent->Sideboard[j];
tempDeck->add(atoi(cardID.c_str()));
sbtempDeck->add(atoi(cardID.c_str()));
}
}
}
mySideboard = NEW DeckDataWrapper(tempDeck);
mySideboard = NEW DeckDataWrapper(sbtempDeck);
for (int i = 0; i < mySideboard->Size(true); i++)
{
MTGCard * current = mySideboard->getCard(i, true);
@@ -1593,9 +1666,51 @@ int GameStateDeckViewer::loadDeck(int deckid)
myCollection->validate();
}
//endsb
//temp deck for cmd?
MTGDeck * cmdtempDeck = NEW MTGDeck(MTGCollection());
if(myDeck->parent)
{//add cards from commanders lists
if(myDeck->parent->CommandZone.size())
{
for(unsigned int j = 0; j < myDeck->parent->CommandZone.size(); j++)
{
string cardID = myDeck->parent->CommandZone[j];
cmdtempDeck->add(atoi(cardID.c_str()));
}
}
}
myCommandZone = NEW DeckDataWrapper(cmdtempDeck);
for (int i = 0; i < myCommandZone->Size(true); i++)
{
MTGCard * current = myCommandZone->getCard(i, true);
int howmanyinDeck = myCommandZone->count(current);
for (int i = myCollection->count(current); i < howmanyinDeck; i++)
{
cPure = false;
if (cheatmode)
{ //Are we cheating?
playerdata->collection->add(current); //Yup, add it to collection permanently.
myCollection->Add(current);
}
else
{
myCommandZone->Remove(current,howmanyinDeck-i); //Nope. Remove it from sb.
break;
}
}
myCollection->Remove(current, myCommandZone->count(current));
}
if (!cPure)
{
myCommandZone->validate();
myCollection->validate();
}
//endcmd
myDeck->Sort(WSrcCards::SORT_ALPHA);
mySideboard->Sort(WSrcCards::SORT_ALPHA);
myCommandZone->Sort(WSrcCards::SORT_ALPHA);
SAFE_DELETE(filterMenu);
rebuildFilters();
mView->reloadIndexes();
@@ -1754,6 +1869,14 @@ void GameStateDeckViewer::ButtonPressed(int controllerId, int controlId)
sbMenu->Close();
break;
}
case SBMENU_ADD_CMD:
{
MTGCard * card = mView->getActiveCard();
if (card)
CMDaddRemove(card);
sbMenu->Close();
break;
}
case SBMENU_ADD_CANCEL:
sbMenu->Close();
break;

View File

@@ -1190,6 +1190,16 @@ void MTGDeck::replaceSB(vector<string> newSB)
return;
}
void MTGDeck::replaceCMD(vector<string> newCMD)
{
if(newCMD.size())
{
CommandZone.clear();
CommandZone = newCMD;
}
return;
}
int MTGDeck::remove(int cardid)
{
if (cards.find(cardid) == cards.end() || cards[cardid] == 0) return 0;
@@ -1270,6 +1280,17 @@ int MTGDeck::save(const string& destFileName, bool useExpandedDescriptions, cons
file << "#SB:" << checkID << "\n";
}
}
//save commanders
if(CommandZone.size())
{
sort(CommandZone.begin(), CommandZone.end());
for(unsigned int k = 0; k < CommandZone.size(); k++)
{
int checkID = atoi(CommandZone[k].c_str());
if(checkID)
file << "#CMD:" << checkID << "\n";
}
}
file.close();
JFileSystem::GetInstance()->Rename(tmp, destFileName);

View File

@@ -50,16 +50,64 @@ MTGPlayerCards::MTGPlayerCards(MTGDeck * deck)
void MTGPlayerCards::initDeck(MTGDeck * deck)
{
resetLibrary();
//commander zone init
if(deck->CommandZone.size())
{
for(unsigned int j = 0; j < deck->CommandZone.size(); j++)
{
string cardID = deck->CommandZone[j];
MTGCard * card = MTGCollection()->getCardById(atoi(cardID.c_str()));
if(card)
{
MTGCardInstance * newCard = NEW MTGCardInstance(card, this);
//commander zone
newCard->basicAbilities[Constants::ISCOMMANDER] = 1;
commandzone->addCard(newCard);
}
}
}
map<int, int>::iterator it;
for (it = deck->cards.begin(); it != deck->cards.end(); it++)
{
MTGCard * card = deck->getCardById(it->first);
if (card)
{
for (int i = 0; i < it->second; i++)
for (int j = 0; j < it->second; j++)
{
MTGCardInstance * newCard = NEW MTGCardInstance(card, this);
library->addCard(newCard);
if(!commandzone->cards.size()){ //If no commander in Deck there are no limitations for cards.
library->addCard(newCard);
} else {
if(newCard->hasType("Land") && newCard->hasType("Basic")){ //There are no limitations for basic lands cards.
library->addCard(newCard);
} else{
bool colorFound = false; // All the cards have to share at least one color with commander identity color.
for(unsigned int i = 0; i < commandzone->cards.size() && !colorFound; i++){
if((newCard->hasColor(Constants::MTG_COLOR_WHITE) && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_WHITE)) ||
(newCard->hasColor(Constants::MTG_COLOR_BLACK) && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_BLACK)) ||
(newCard->hasColor(Constants::MTG_COLOR_RED) && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_RED)) ||
(newCard->hasColor(Constants::MTG_COLOR_BLUE) && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_BLUE)) ||
(newCard->hasColor(Constants::MTG_COLOR_GREEN) && commandzone->cards[i]->hasColor(Constants::MTG_COLOR_GREEN))){
colorFound = true;
} else if((newCard->hasColor(Constants::MTG_COLOR_WHITE) && commandzone->cards[i]->magicText.find("{W}") != std::string::npos) ||
(newCard->hasColor(Constants::MTG_COLOR_BLACK) && commandzone->cards[i]->magicText.find("{B}") != std::string::npos)||
(newCard->hasColor(Constants::MTG_COLOR_RED) && commandzone->cards[i]->magicText.find("{R}") != std::string::npos) ||
(newCard->hasColor(Constants::MTG_COLOR_BLUE) && commandzone->cards[i]->magicText.find("{U}") != std::string::npos) ||
(newCard->hasColor(Constants::MTG_COLOR_GREEN) && commandzone->cards[i]->magicText.find("{G}") != std::string::npos)){
colorFound = true;
}
}
if(colorFound || newCard->hasColor(Constants::MTG_COLOR_ARTIFACT) || newCard->colors == Constants::MTG_UNCOLORED || newCard->hasColor(Constants::MTG_COLOR_LAND)){
bool onlyInstance = true; // In commander format only single cards are allowed if they are not basic lands.
for(unsigned int k = 0; k < library->cards.size() && onlyInstance; k++){
if(library->cards[k]->name == newCard->name)
onlyInstance = false;
}
if(onlyInstance)
library->addCard(newCard);
}
}
}
}
}
}
@@ -78,22 +126,6 @@ void MTGPlayerCards::initDeck(MTGDeck * deck)
}
}
}
//commander zone init
if(deck->CommandZone.size())
{
for(unsigned int j = 0; j < deck->CommandZone.size(); j++)
{
string cardID = deck->CommandZone[j];
MTGCard * card = MTGCollection()->getCardById(atoi(cardID.c_str()));
if(card)
{
MTGCardInstance * newCard = NEW MTGCardInstance(card, this);
//commander zone
newCard->basicAbilities[Constants::ISCOMMANDER] = 1;
commandzone->addCard(newCard);
}
}
}
}
MTGPlayerCards::~MTGPlayerCards()