- added maxCast and maxPlay abilities, this deprecates the following abilities: nospells,nocreatures,onlyonespell,land
I usually don't like to deprecate abilities, but the existing ones, despite having easy to remember names, were really not flexible enough.
If you want to use these old keywords, instead use:
-- nospells => maxCast(*)0
-- onlyOneSpell => maxCast(*)1
--nocreatures => maxCast(creature)0
--land:1 => maxplay(land)+1
note maxPlay and maxCast. They follow similar rules, but maxPlay monitors the number of cards that are going on the Battlefield, while maxCast monitors the stack. In most cases, maxCast should be the one to use, but lands are a special case because they go directly to play.
I unfortunately cannot guarantee I didn't break anything, especially in the AI, but the test suite passes ,and I added a few additional tests yesterday and today, to feel more confident about the change.
next step is removing the creatures keywords that do the same kind of thing (cantcast, etc...) and replace them with maxCast
1. Fire Dragon(It has same problem as unchanged Honden Of Infinite Rage, using new code "type:" to fix it.)
auto=foreach(mountain|myBattlefield) damage:1 target(creature) oneshot
==>
auto=damage:type:mountain target(creature)
2. Burden of Greed
auto=foreach(artifact[tapped]|opponentBattlefield)damage:1
==>
auto=foreach(artifact[tapped]|opponentBattlefield) life:-1 opponent
- replaced variables canPutLandsIntoPlay and landsPlayerCanStillPlay with a PlayRestrictions class.
- Added seenThisTurn(TargetChooser * tc) in MTGGameZones, which allows to count how many cards matching a targetChooser have been in a given zone in the current turn. With minor work, this can probably be reused by the ability parser for some cards that need to count how many **** where played or put on the stack during a turn.
-- for example player->game->stack->seenThisTurn([put a TypeTargetChooser("creature") here]) would give you the number of creature spells cast by the player this turn.
- This is the first step of a refactor that aims at removing all the adhoc variables for "cant cast". I plan to get rid of the following variables in Player.h (and the associated code, which hopefully will become smaller):
int castedspellsthisturn;
bool onlyonecast;
int castcount;
bool nocreatureinstant;
bool nospellinstant;
bool onlyoneinstant;
bool castrestrictedcreature;
bool castrestrictedspell;
bool onlyoneboth;
bool bothrestrictedspell;
bool bothrestrictedcreature;
They will be replaced by the PlayRestrictions system, and hopefully I'll have time to update the parser to make this more generic as well.
My initial goal with this change was to move the limit of 1 land per turn outside of the code, and make it an external rule in Rules/mtg.txt. I have yet to do it.
New code for Paralyze uses "teach(...)":
[card]
name=Paralyze
target=creature
auto=tap
auto=doesnotuntap
auto=teach(creature) {4}:untap myUpkeepOnly
text=Enchant creature -- When Paralyze enters the battlefield, tap enchanted creature. -- Enchanted creature doesn't untap during its controller's untap step. -- At the beginning of the upkeep of enchanted creature's controller, that player may pay {4}. If he or she does, untap the creature.
mana={B}
type=Enchantment
subtype=Aura
[/card]
general tip on getting ai to use an ability on a card.
titan forge for exsample
[card]
name=Titan Forge
auto={3}{T}:counter(0/0,1,Charge)
auto={T}{C(0/0,-3,Charge)}:token(Golem,Artifact Creature Golem,9/9)
text={3},{T}: Put a charge counter on Titan Forge. -- {T}, Remove three charge counters from Titan Forge: Put a 9/9 colorless Golem artifact creature token onto the
battlefield.
mana={3}
type=Artifact
[/card]
with the counter ability above the counter cost ability, ai will rarely ever use the titan forge to make a token.
however if you change the order around, ai will see the token ability first...then if it can afford it then it will make a token.
Word of Seizing
Wipe Away
Take Possession
Sulfur Elemental
Sudden Shock
Sudden Death
Stonewood Invocation
Krosan Grip
Extirpate
Celestial Crusader
Kaijin of the Vanishing Touch