Transform Trigger, Turnlimit for TrCardAddedtoZone
Cleaned primitives, and fix SOI cards (remove workarounds) todo(recheck BFZ and OGW)
This commit is contained in:
@@ -1653,6 +1653,11 @@ AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, M
|
||||
if (target)
|
||||
{
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
if(_target->isFlipped && _target->hasType(Subtypes::TYPE_PLANESWALKER))//is flipping pw
|
||||
{
|
||||
this->forceDestroy = 1;
|
||||
return 0;
|
||||
}
|
||||
AbilityFactory af(game);
|
||||
if(counterstring.size())
|
||||
{
|
||||
@@ -3223,7 +3228,7 @@ int AAFlip::resolve()
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
if (_target)
|
||||
{
|
||||
if((_target->isACopier||_target->isToken) && !isflipcard && !forcedcopy)
|
||||
if((_target->isACopier||_target->isToken||_target->has(Constants::CANTTRANSFORM)) && !isflipcard && !forcedcopy)
|
||||
{
|
||||
game->removeObserver(this);
|
||||
return 0;
|
||||
@@ -3240,6 +3245,9 @@ int AAFlip::resolve()
|
||||
MTGCard * fcard = MTGCollection()->getCardByName(flipStats);
|
||||
if(!fcard) return 0;
|
||||
MTGCardInstance * myFlip = NEW MTGCardInstance(fcard, _target->controller()->game);
|
||||
MTGCardInstance * myParent = NULL;
|
||||
if(_target->target)
|
||||
myParent = _target->target;
|
||||
_target->name = myFlip->name;
|
||||
_target->setName(myFlip->name);
|
||||
if(!isflipcard)//transform card
|
||||
@@ -3252,12 +3260,7 @@ int AAFlip::resolve()
|
||||
_target->types = myFlip->types;
|
||||
_target->text = myFlip->text;
|
||||
_target->formattedText = myFlip->formattedText;
|
||||
//_target->basicAbilities = myFlip->basicAbilities;
|
||||
for(int k = 0; k < Constants::NB_BASIC_ABILITIES; k++)
|
||||
{
|
||||
if(myFlip->model->data->basicAbilities[k])
|
||||
_target->basicAbilities[k] = myFlip->model->data->basicAbilities[k];
|
||||
}
|
||||
_target->basicAbilities = myFlip->model->data->basicAbilities;
|
||||
_target->modbasicAbilities = myFlip->modbasicAbilities;
|
||||
cdaDamage = _target->damageCount;
|
||||
_target->copiedID = myFlip->getMTGId();//for copier
|
||||
@@ -3333,6 +3336,11 @@ int AAFlip::resolve()
|
||||
{//pbonus & tbonus are already computed except damage taken...
|
||||
_target->life -= cdaDamage;
|
||||
}
|
||||
if(_target->hasSubtype(Subtypes::TYPE_EQUIPMENT))
|
||||
{
|
||||
if(myParent)
|
||||
_target->target = myParent;
|
||||
}
|
||||
SAFE_DELETE(myFlip);
|
||||
_target->mPropertiesChangedSinceLastUpdate = true;
|
||||
if(!isflipcard)
|
||||
|
||||
@@ -499,7 +499,7 @@ void CardGui::Render()
|
||||
renderer->RenderQuad(fakemask.get(), actX, (actY-yy), actT, (26 * (actZ*zz) + 1) / 16, 38 * (actZ*zz) / 16);
|
||||
}
|
||||
}
|
||||
if(tc && tc->source && tc->source->view && tc->source->view->actY >= 1.3 && card == tc->source)//paint the source green while infocus.
|
||||
if(tc && tc->source && tc->source->view && tc->source->view->actZ >= 1.3 && card == tc->source)//paint the source green while infocus.
|
||||
{
|
||||
if(fakemask)
|
||||
{
|
||||
|
||||
@@ -1184,56 +1184,56 @@ void GameObserver::Affinity()
|
||||
//kicker is an addon to normal cost, suspend is not casting. add cost as needed EXACTLY as seen below.
|
||||
card->getManaCost()->resetCosts();
|
||||
ManaCost *newCost = NEW ManaCost();
|
||||
newCost->copy(card->computeNewCost(card, card->getManaCost(), card->model->data->getManaCost()));
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost(), card->model->data->getManaCost()));
|
||||
|
||||
card->getManaCost()->copy(newCost);
|
||||
card->getManaCost()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
if (card->getManaCost()->getAlternative())
|
||||
{
|
||||
card->getManaCost()->getAlternative()->resetCosts();
|
||||
ManaCost * newCost = NEW ManaCost();
|
||||
newCost->copy(card->computeNewCost(card, card->getManaCost()->getAlternative(), card->model->data->getManaCost()->getAlternative()));
|
||||
card->getManaCost()->getAlternative()->copy(newCost);
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getAlternative(), card->model->data->getManaCost()->getAlternative()));
|
||||
card->getManaCost()->getAlternative()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getBestow())
|
||||
{
|
||||
card->getManaCost()->getBestow()->resetCosts();
|
||||
ManaCost * newCost = NEW ManaCost();
|
||||
newCost->copy(card->computeNewCost(card, card->getManaCost()->getBestow(), card->model->data->getManaCost()->getBestow()));
|
||||
card->getManaCost()->getBestow()->copy(newCost);
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getBestow(), card->model->data->getManaCost()->getBestow()));
|
||||
card->getManaCost()->getBestow()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getRetrace())
|
||||
{
|
||||
card->getManaCost()->getRetrace()->resetCosts();
|
||||
ManaCost * newCost = NEW ManaCost();
|
||||
newCost->copy(card->computeNewCost(card, card->getManaCost()->getRetrace(), card->model->data->getManaCost()->getRetrace()));
|
||||
card->getManaCost()->getRetrace()->copy(newCost);
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getRetrace(), card->model->data->getManaCost()->getRetrace()));
|
||||
card->getManaCost()->getRetrace()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getBuyback())
|
||||
{
|
||||
card->getManaCost()->getBuyback()->resetCosts();
|
||||
ManaCost * newCost = NEW ManaCost();
|
||||
newCost->copy(card->computeNewCost(card, card->getManaCost()->getBuyback(), card->model->data->getManaCost()->getBuyback()));
|
||||
card->getManaCost()->getBuyback()->copy(newCost);
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getBuyback(), card->model->data->getManaCost()->getBuyback()));
|
||||
card->getManaCost()->getBuyback()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getFlashback())
|
||||
{
|
||||
card->getManaCost()->getFlashback()->resetCosts();
|
||||
ManaCost * newCost = NEW ManaCost();
|
||||
newCost->copy(card->computeNewCost(card, card->getManaCost()->getFlashback(), card->model->data->getManaCost()->getFlashback()));
|
||||
card->getManaCost()->getFlashback()->copy(newCost);
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getFlashback(), card->model->data->getManaCost()->getFlashback()));
|
||||
card->getManaCost()->getFlashback()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getMorph())
|
||||
{
|
||||
card->getManaCost()->getMorph()->resetCosts();
|
||||
ManaCost * newCost = NEW ManaCost();
|
||||
newCost->copy(card->computeNewCost(card, card->getManaCost()->getMorph(), card->model->data->getManaCost()->getMorph()));
|
||||
card->getManaCost()->getMorph()->copy(newCost);
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getMorph(), card->model->data->getManaCost()->getMorph()));
|
||||
card->getManaCost()->getMorph()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
|
||||
|
||||
@@ -371,6 +371,24 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
|
||||
return 0;
|
||||
}
|
||||
|
||||
check = restriction[i].find("notdelirum");
|
||||
if (check != string::npos)
|
||||
{
|
||||
Player * checkCurrent = card->controller();
|
||||
MTGGameZone * grave = checkCurrent->game->graveyard;
|
||||
|
||||
int checkTypesAmount = 0;
|
||||
if(grave->hasType("creature")) checkTypesAmount++;
|
||||
if (grave->hasType("enchantment")) checkTypesAmount++;
|
||||
if (grave->hasType("sorcery")) checkTypesAmount++;
|
||||
if (grave->hasType("instant")) checkTypesAmount++;
|
||||
if (grave->hasType("land")) checkTypesAmount++;
|
||||
if (grave->hasType("artifact")) checkTypesAmount++;
|
||||
if (grave->hasType("planeswalker")) checkTypesAmount++;
|
||||
if (checkTypesAmount > 3)
|
||||
return 0;
|
||||
}
|
||||
|
||||
check = restriction[i].find("miracle");
|
||||
if(check != string::npos)
|
||||
{
|
||||
@@ -824,7 +842,7 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
|
||||
fromTc->targetter = NULL; //avoid protection from
|
||||
}
|
||||
TriggeredAbility * mover = NEW TrCardAddedToZone(observer, id, card, (TargetZoneChooser *) toTc,
|
||||
toTcCard, (TargetZoneChooser *) fromTc, fromTcCard, once, sourceUntapped, isSuspended);
|
||||
toTcCard, (TargetZoneChooser *) fromTc, fromTcCard, once, sourceUntapped, isSuspended, limitOnceATurn);
|
||||
if(neverRemove)
|
||||
{
|
||||
mover->forcedAlive = 1;
|
||||
@@ -845,6 +863,10 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
|
||||
if (TargetChooser *tc = parseSimpleTC(s,"tappedformana", card))
|
||||
return NEW TrCardTappedformana(observer, id, card, tc, true,once);
|
||||
|
||||
//Card Transforms
|
||||
if (TargetChooser *tc = parseSimpleTC(s,"transformed", card))
|
||||
return NEW TrCardTransformed(observer, id, card, tc,once);
|
||||
|
||||
//CombatTrigger
|
||||
//Card card attacked and is blocked
|
||||
found = s.find("combat(");
|
||||
|
||||
@@ -98,12 +98,7 @@ void MTGCardInstance::copy(MTGCardInstance * card)
|
||||
{
|
||||
MTGCard * source = card->model;
|
||||
CardPrimitive * data = source->data;
|
||||
|
||||
for(int k = 0; k < Constants::NB_BASIC_ABILITIES; k++)
|
||||
{
|
||||
if(card->model->data->basicAbilities[k])
|
||||
basicAbilities[k] = card->model->data->basicAbilities[k];
|
||||
}
|
||||
basicAbilities = card->model->data->basicAbilities;
|
||||
modbasicAbilities = card->modbasicAbilities;
|
||||
for (size_t i = 0; i < data->types.size(); i++)
|
||||
{
|
||||
@@ -149,6 +144,7 @@ void MTGCardInstance::copy(MTGCardInstance * card)
|
||||
backupTargets = this->backupTargets;
|
||||
storedCard = oldStored;
|
||||
miracle = false;
|
||||
mPropertiesChangedSinceLastUpdate = true;
|
||||
}
|
||||
|
||||
MTGCardInstance::~MTGCardInstance()
|
||||
|
||||
@@ -168,7 +168,8 @@ const char* Constants::MTGBasicAbilities[] = {
|
||||
"shackler",
|
||||
"flyersonly",
|
||||
"tempflashback",
|
||||
"legendruleremove"
|
||||
"legendruleremove",
|
||||
"canttransform"
|
||||
};
|
||||
|
||||
map<string,int> Constants::MTGBasicAbilitiesMap;
|
||||
|
||||
@@ -666,6 +666,30 @@ void ManaCost::copy(ManaCost * _manaCost)
|
||||
xColor = _manaCost->xColor;
|
||||
}
|
||||
|
||||
void ManaCost::changeCostTo(ManaCost * _manaCost)
|
||||
{
|
||||
if (!_manaCost)
|
||||
return;
|
||||
|
||||
cost.erase(cost.begin() ,cost.end());
|
||||
|
||||
for (int i = 0; i <= Constants::NB_Colors; i++)
|
||||
{
|
||||
cost.push_back(_manaCost->getCost(i));
|
||||
}
|
||||
|
||||
hybrids = _manaCost->hybrids;
|
||||
|
||||
SAFE_DELETE(extraCosts);
|
||||
|
||||
if (_manaCost->extraCosts)
|
||||
{
|
||||
extraCosts = _manaCost->extraCosts->clone();
|
||||
}
|
||||
|
||||
xColor = _manaCost->xColor;
|
||||
}
|
||||
|
||||
int ManaCost::getCost(int color)
|
||||
{
|
||||
if (cost.size() <= (size_t)color)
|
||||
|
||||
Reference in New Issue
Block a user