- 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:
wagic.the.homebrew@gmail.com
2011-02-12 16:31:07 +00:00
parent 2690a3f9a0
commit 60017a6652
20 changed files with 366 additions and 76 deletions

View File

@@ -108,8 +108,6 @@ void GameObserver::nextGamePhase()
if (currentGamePhase == Constants::MTG_PHASE_BEFORE_BEGIN)
{
cleanupPhase();
currentPlayer->canPutLandsIntoPlay = true;
currentPlayer->landsPlayerCanStillPlay = 1;
currentPlayer->castedspellsthisturn = 0;
currentPlayer->opponent()->castedspellsthisturn = 0;
currentPlayer->castcount = 0;
@@ -124,9 +122,8 @@ void GameObserver::nextGamePhase()
mLayers->actionLayer()->Update(0);
for (int i = 0; i < 2; i++)
{
delete (players[i]->game->garbage);
players[i]->game->garbage = NEW MTGGameZone();
players[i]->game->garbage->setOwner(players[i]);
//Cleanup of each player's gamezones
players[i]->game->beforeBeginPhase();
}
combatStep = BLOCKERS;
return nextGamePhase();
@@ -377,14 +374,6 @@ void GameObserver::gameStateBasedEffects()
//effects or menus actions
for (int i = 0; i < 2; i++)
{
if (players[i]->landsPlayerCanStillPlay <= 0)
{
players[i]->canPutLandsIntoPlay = false;
}
else
{
players[i]->canPutLandsIntoPlay = true;
}
if(players[i]->poisonCount > 0)
{
players[i]->isPoisoned = true;