Castcard, Rebound and other fixes

This commit is contained in:
Anthony Calosa
2015-10-27 19:44:22 +08:00
parent 56fc735b36
commit d2f3e2cd60
5 changed files with 175 additions and 107 deletions
+24 -9
View File
@@ -5244,12 +5244,15 @@ void ABlink::Update(float dt)
resolveBlink();
}
if ((blinkueot && currentPhase == MTG_PHASE_ENDOFTURN) || (blinkForSource && !source->isInPlay(game)) && (Blinked->blinked))
if ((blinkueot && currentPhase == MTG_PHASE_ENDOFTURN) || (blinkForSource && !source->isInPlay(game)))
{
if (Blinked == NULL)
MTGAbility::Update(dt);
MTGCardInstance * _target = Blinked;
returnCardIntoPlay(_target);
if(Blinked->blinked)
{
if (Blinked == NULL)
MTGAbility::Update(dt);
MTGCardInstance * _target = Blinked;
returnCardIntoPlay(_target);
}
}
MTGAbility::Update(dt);
}
@@ -5724,16 +5727,28 @@ void AACastCard::Update(float dt)
this->forceDestroy = 1;
return;
}
if(!toCheck->hasType(Subtypes::TYPE_INSTANT) && !(game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN || game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
/*if(!toCheck->hasType(Subtypes::TYPE_INSTANT) && !(game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN || game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
{
processed = true;
this->forceDestroy = 1;
return;
}*/
}
MTGCardInstance * toCheck = (MTGCardInstance*)target;
if(theNamedCard)
toCheck = theNamedCard;
if(toCheck && toCheck->spellTargetType.size())
{
TargetChooserFactory tcf(game);
TargetChooser * stc = tcf.createTargetChooser(toCheck->spellTargetType,toCheck);
if (!stc->validTargetsExist()||toCheck->isToken)
{
processed = true;
this->forceDestroy = 1;
return;
}
SAFE_DELETE(stc);
}
MTGCardInstance * toCheck = (MTGCardInstance*)target;
if(theNamedCard)
toCheck = theNamedCard;
if (Spell * checkSpell = dynamic_cast<Spell*>(target))
{
toCheck = checkSpell->source;
+15
View File
@@ -310,6 +310,21 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
return 0;
}
}
check = restriction[i].find("rebound");
if(check != string::npos)
{
int count = 0;
for(unsigned int k = 0; k < player->game->stack->cardsSeenThisTurn.size(); k++)
{
MTGCardInstance * stackCard = player->game->stack->cardsSeenThisTurn[k];
if(stackCard->next && stackCard->next == card && card->previousZone == card->controller()->game->hand)
count++;
if(stackCard == card && card->previousZone == card->controller()->game->hand)
count++;
}
if(!count)
return 0;
}
check = restriction[i].find("morbid");
if(check != string::npos)
{
+4
View File
@@ -739,6 +739,10 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
{
return NEW CardTargetChooser(observer, card->storedSourceCard, card, zones, nbzones);
}
else if (typeName.compare("abilitycontroller") == 0)
{
return NEW PlayerTargetChooser(observer, card, 1, card->storedSourceCard->controller());
}
else
{
tc = NEW TypeTargetChooser(observer, typeName.c_str(), zones, nbzones, card, maxtargets, other, targetMin);