Erwan
- 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.
This commit is contained in:
@@ -1456,13 +1456,13 @@ AACloner::~AACloner()
|
||||
}
|
||||
|
||||
// More Land - allow more lands to be played on a turn
|
||||
AAMoreLandPlz::AAMoreLandPlz(int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost, WParsedInt * _additional,
|
||||
int _tap, int who) :
|
||||
ActivatedAbilityTP(_id, card, _target, _cost, _tap, who), additional(_additional)
|
||||
AMoreLandPlzUEOT::AMoreLandPlzUEOT(int _id, MTGCardInstance * card, Targetable * _target, WParsedInt * _additional, int who) :
|
||||
InstantAbilityTP(_id, card, _target, who), additional(_additional)
|
||||
{
|
||||
landsRestriction = NULL;
|
||||
}
|
||||
|
||||
int AAMoreLandPlz::resolve()
|
||||
int AMoreLandPlzUEOT::addToGame()
|
||||
{
|
||||
Targetable * _target = getTarget();
|
||||
Player * player;
|
||||
@@ -1476,25 +1476,38 @@ int AAMoreLandPlz::resolve()
|
||||
{
|
||||
player = (Player *) _target;
|
||||
}
|
||||
player->landsPlayerCanStillPlay += additional->getValue();
|
||||
landsRestriction = (MaxPerTurnRestriction *) (player->game->playRestrictions->getRestrictionById(PlayRestriction::LANDS_RULE_ID));
|
||||
if(landsRestriction && landsRestriction->maxPerTurn != MaxPerTurnRestriction::NO_MAX)
|
||||
landsRestriction->maxPerTurn += additional->getValue();
|
||||
return InstantAbility::addToGame();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AMoreLandPlzUEOT::destroy()
|
||||
{
|
||||
if (!landsRestriction)
|
||||
return 0;
|
||||
|
||||
if(landsRestriction && landsRestriction->maxPerTurn != MaxPerTurnRestriction::NO_MAX)
|
||||
landsRestriction->maxPerTurn -= additional->getValue();
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * AAMoreLandPlz::getMenuText()
|
||||
const char * AMoreLandPlzUEOT::getMenuText()
|
||||
{
|
||||
return "Additional Lands";
|
||||
}
|
||||
|
||||
AAMoreLandPlz * AAMoreLandPlz::clone() const
|
||||
AMoreLandPlzUEOT * AMoreLandPlzUEOT::clone() const
|
||||
{
|
||||
AAMoreLandPlz * a = NEW AAMoreLandPlz(*this);
|
||||
AMoreLandPlzUEOT * a = NEW AMoreLandPlzUEOT(*this);
|
||||
a->additional = NEW WParsedInt(*(a->additional));
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
|
||||
AAMoreLandPlz::~AAMoreLandPlz()
|
||||
AMoreLandPlzUEOT::~AMoreLandPlzUEOT()
|
||||
{
|
||||
SAFE_DELETE(additional);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user