This commit is contained in:
Anthony Calosa
2017-03-02 07:56:41 +08:00
parent 8ae3e1ea98
commit ba73da321b
6 changed files with 79 additions and 31 deletions

View File

@@ -8111,6 +8111,7 @@ MTGCardInstance * AACastCard::makeCard()
if(!cardData) return NULL;
card = NEW MTGCardInstance(cardData, source->controller()->game);
card->owner = source->controller();
card->lastController = source->controller();
source->controller()->game->temp->addCard(card);
return card;
}
@@ -8143,9 +8144,9 @@ int AACastCard::resolveSpell()
{
if(theNamedCard)
{
MTGCardInstance * copy = _target->controller()->game->putInZone(_target, _target->currentZone, _target->controller()->game->temp);
copy->changeController(source->controller(),true);
Spell * spell = NEW Spell(game, 0,copy,NULL,NULL, 1);
//MTGCardInstance * copy = source->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->temp);
//copy->changeController(source->controller(),true);
Spell * spell = NEW Spell(game, -1,theNamedCard,NULL,NULL, 1);
spell->resolve();
delete spell;
@@ -8166,6 +8167,61 @@ int AACastCard::resolveSpell()
}
}
//
if(theNamedCard)
{
//MTGCardInstance * copy = source->controller()->game->putInZone(_target, _target->currentZone, source->controller()->game->temp);
//copy->changeController(source->controller(),true);
Spell * spell = NULL;
MTGCardInstance * copy = source->controller()->game->putInZone(theNamedCard, theNamedCard->currentZone, source->controller()->game->stack);
if (game->targetChooser)
{
game->targetChooser->Owner = source->controller();
spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, NULL, 1, 0);
game->targetChooser = NULL;
}
else
{
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, NULL, 1, 0);
}
if (copy->has(Constants::STORM))
{
int storm = source->controller()->game->stack->seenThisTurn("*", Constants::CAST_ALL) + source->controller()->opponent()->game->stack->seenThisTurn("*", Constants::CAST_ALL);
for (int i = storm; i > 1; i--)
{
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, 0, 1, 1);
}
}
if (!copy->has(Constants::STORM))
{
copy->X = 0;
copy->castX = copy->X;
}
if(andAbility)
{
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = copy;
if(andAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
}
this->forceDestroy = true;
processed = true;
return 1;
}
//
Spell * spell = NULL;
MTGCardInstance * copy = NULL;
if ((normal || asNormalMadness)||(!_target->hasType(Subtypes::TYPE_INSTANT) && !_target->hasType(Subtypes::TYPE_SORCERY)))

View File

@@ -661,7 +661,6 @@ void GameObserver::gameStateBasedEffects()
for (int w = 0; w < zone->nb_cards; w++)
{
MTGCardInstance * card = zone->cards[w];
Player * zPlayer = zone->owner;
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
{
if (card->has(Constants::DEVOID))
@@ -685,10 +684,6 @@ void GameObserver::gameStateBasedEffects()
int onum = w+1;
card->zpos = abs(onum - zone->nb_cards)+1;
}
else if(card && (isInPlay(card)))
{//lastcontroller override
card->lastController = zPlayer;
}
}
@@ -717,6 +712,8 @@ void GameObserver::gameStateBasedEffects()
for (int j = zone->nb_cards - 1; j >= 0; j--)
{
MTGCardInstance * card = zone->cards[j];
//lastcontroller zone update
card->lastController = players[i];
card->entersBattlefield = 0;
card->LKIpower = card->power;
card->LKItoughness = card->toughness;
@@ -810,7 +807,7 @@ void GameObserver::gameStateBasedEffects()
if ((card->target||card->playerTarget) && !card->hasType(Subtypes::TYPE_EQUIPMENT))
{
if(card->target && !isInPlay(card->target))
players[i]->game->putInGraveyard(card);
players[i]->game->putInGraveyard(card);
/*if(card->target && isInPlay(card->target))
{//what exactly does this section do?
if(card->spellTargetType.find("creature") != string::npos && !card->target->hasType("creature"))
@@ -825,7 +822,7 @@ void GameObserver::gameStateBasedEffects()
players[i]->game->putInGraveyard(card);
}*/
if(card->target && isInPlay(card->target) && (card->target)->protectedAgainst(card) && !card->has(Constants::AURAWARD))//protection from quality except aura cards like flickering ward
players[i]->game->putInGraveyard(card);
players[i]->game->putInGraveyard(card);
}
card->enchanted = false;
if (card->target && isInPlay(card->target) && !card->hasType(Subtypes::TYPE_EQUIPMENT) && card->hasSubtype(Subtypes::TYPE_AURA))
@@ -943,7 +940,6 @@ void GameObserver::gameStateBasedEffects()
//checks if a player has a card which has the stated ability in play.
Player * p = players[i];
MTGGameZone * z = players[i]->game->inPlay;
int nbcards = z->nb_cards;
//------------------------------
if(z->hasAbility(Constants::NOMAXHAND)||p->opponent()->inPlay()->hasAbility(Constants::OPPNOMAXHAND))
p->nomaxhandsize = true;
@@ -954,7 +950,7 @@ void GameObserver::gameStateBasedEffects()
/////////////////////////////////////////////////
if (mCurrentGamePhase == MTG_PHASE_ENDOFTURN+1)
{
for (int j = 0; j < nbcards; ++j)
for (int j = z->nb_cards - 1; j >= 0; j--)
{
MTGCardInstance * c = z->cards[j];
@@ -977,31 +973,25 @@ void GameObserver::gameStateBasedEffects()
c->damageToCreature = false;
c->isAttacking = NULL;
}
for (int t = 0; t < nbcards; t++)
for (int jj = z->nb_cards - 1; jj >= 0; jj--)
{
MTGCardInstance * c = z->cards[t];
MTGCardInstance * c = z->cards[jj];
if(!c->isPhased)
if(c && !c->isPhased)
{
if (c->has(Constants::TREASON))
{
MTGCardInstance * beforeCard = c;
p->game->putInGraveyard(c);
p->game->putInZone(c, c->currentZone, c->owner->game->graveyard);
WEvent * e = NEW WEventCardSacrifice(beforeCard,c);
receiveEvent(e);
}
if (c->has(Constants::UNEARTH))
{
p->game->putInExile(c);
p->game->putInZone(c, c->currentZone, c->owner->game->exile);
}
}
if(nbcards > z->nb_cards)
{
t = 0;
nbcards = z->nb_cards;
}
}
MTGGameZone * f = p->game->graveyard;

View File

@@ -1142,9 +1142,6 @@ MTGGameZone * MTGGameZone::intToZone(GameObserver *g, int zoneId, MTGCardInstanc
else
p2 = target->controller();
//p2 should be either of this two...
if(p != p2 && p->opponent() != p2)
p2 = p;
MTGGameZone * result = intToZone(zoneId, p, p2);
if (result) return result;

View File

@@ -3201,7 +3201,8 @@ int MTGUnearthRule::receiveEvent(WEvent * event)
Player * p = game->players[i];
if (e->to == p->game->graveyard || e->to == p->game->hand || e->to == p->game->library)
{
p->game->putInExile(e->card);
//p->game->putInExile(e->card);
e->to->owner->game->putInExile(e->card);
return 1;
}
}

View File

@@ -431,7 +431,8 @@ void Rules::initGame(GameObserver *g, bool currentPlayerSet)
{
if (zone == p->game->inPlay)
{
MTGCardInstance * copy = p->game->putInZone(card, p->game->library, p->game->stack);
//MTGCardInstance * copy = p->game->putInZone(card, p->game->library, p->game->stack);
MTGCardInstance * copy = zone->owner->game->putInZone(card, p->game->library, p->game->stack);
Spell * spell = NEW Spell(g, copy);
spell->resolve();
delete spell;
@@ -442,7 +443,8 @@ void Rules::initGame(GameObserver *g, bool currentPlayerSet)
{
LOG ("RULES ERROR, CARD NOT FOUND IN LIBRARY\n");
}
p->game->putInZone(card, p->game->library, zone);
//p->game->putInZone(card, p->game->library, zone);
zone->owner->game->putInZone(card, p->game->library, zone);
}
}
else

View File

@@ -873,7 +873,8 @@ void TestSuiteGame::initGame()
{
if (zone == p->game->inPlay)
{
MTGCardInstance * copy = p->game->putInZone(card, p->game->library, p->game->stack);
//MTGCardInstance * copy = p->game->putInZone(card, p->game->library, p->game->stack);
MTGCardInstance * copy = zone->owner->game->putInZone(card, p->game->library, p->game->stack);
Spell * spell = NEW Spell(observer, copy);
spell->resolve();
if (!summoningSickness && (size_t)p->game->inPlay->nb_cards > k) p->game->inPlay->cards[k]->summoningSickness = 0;
@@ -885,7 +886,8 @@ void TestSuiteGame::initGame()
{
LOG ("TESTUITE ERROR, CARD NOT FOUND IN LIBRARY\n");
}
p->game->putInZone(card, p->game->library, zone);
//p->game->putInZone(card, p->game->library, zone);
zone->owner->game->putInZone(card, p->game->library, zone);
}
}
else