Partial fix for Cards with Bestow
missing was to seperate the mode as aura enchantment or enchantment creature when cast and update the cost
This commit is contained in:
@@ -48698,11 +48698,11 @@ type=Legendary Land
|
||||
[card]
|
||||
name=Gods Willing
|
||||
target=creature|mybattlefield
|
||||
auto=choice name(green) transforms((,newability[protection from green],newability[scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) ueot
|
||||
auto=choice name(red) transforms((,newability[protection from red],newability[scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) ueot
|
||||
auto=choice name(blue) transforms((,newability[protection from blue],newability[scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) ueot
|
||||
auto=choice name(black) transforms((,newability[protection from black],newability[scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) ueot
|
||||
auto=choice name(white) transforms((,newability[protection from white],newability[scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) ueot
|
||||
auto=choice name(green) transforms((,newability[protection from green],newability[choice scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) ueot
|
||||
auto=choice name(red) transforms((,newability[protection from red],newability[choice scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) ueot
|
||||
auto=choice name(blue) transforms((,newability[protection from blue],newability[choice scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) ueot
|
||||
auto=choice name(black) transforms((,newability[protection from black],newability[choice scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) ueot
|
||||
auto=choice name(white) transforms((,newability[protection from white],newability[choice scry:1 scrycore delayed dontshow donothing scrycoreend scryend])) ueot
|
||||
text=Target creature you control gains protection from the color of your choice until end of turn. Scry 1. (Look at the top card of your library. You may put that card on the bottom of your library.)
|
||||
mana={W}
|
||||
type=Instant
|
||||
@@ -54244,6 +54244,7 @@ toughness=3
|
||||
[card]
|
||||
name=Hero of Iroas
|
||||
auto=lord(aura|mycastingzone) altercost(colorless,-1)
|
||||
auto=modbenchant(colorless:-1) controller
|
||||
auto=@targeted(this) from(*[instant;sorcery;enchantment]|mycastingzone):counter(1/1,1)
|
||||
text=Aura spells you cast cost 1 less to cast. -- Heroic -- Whenever you cast a spell that targets Hero of Iroas, put a +1/+1 counter on Hero of Iroas.
|
||||
mana={1}{W}
|
||||
@@ -80336,7 +80337,7 @@ subtype=Nissa
|
||||
name=Nissa, Vastwood Seer
|
||||
aicode=activate target(forest[basic]|mylibrary) moveto(myhand)
|
||||
auto=name(search card) Reveal:type:*:mylibrary revealzone(mylibrary) optionone name(choose card) target(<1>forest[basic]|reveal) transforms((,newability[all(other *|reveal) moveto(mylibrary) and!(shuffle)!],newability[moveto(myhand)])) optiononeend optiontwo name(shuffle) bottomoflibrary target(<1>*|reveal) and!( all(*|reveal) bottomoflibrary and!(shuffle)! )! optiontwoend revealend
|
||||
auto=@movedto(land|mybattlefield):moveto(exile) and!( moveto(ownerbattlefield) and!(flip(Nissa, Sage Animist) && counter(0/0,3,loyalty))! )!
|
||||
auto=@movedto(land|mybattlefield) restriction{type(land|mybattlefield)~morethan~6}:moveto(exile) and!( moveto(ownerbattlefield) and!(flip(Nissa, Sage Animist) && counter(0/0,3,loyalty))! )!
|
||||
text=When Nissa, Vastwood Seer enters the battlefield, you may search your library for a basic Forest card, reveal it, put it into your hand, then shuffle your library. -- Whenever a land enters the battlefield under your control, if you control seven or more lands, exile Nissa, then return her to the battlefield transformed under her owner's control.
|
||||
mana={2}{G}
|
||||
type=Legendary Creature
|
||||
@@ -92319,7 +92320,7 @@ toughness=6
|
||||
[/card]
|
||||
[card]
|
||||
name=Raven Familiar
|
||||
abilities=hiddenface
|
||||
abilities=flying,hiddenface
|
||||
auto=upcost[{2}{u};next upkeep] sacrifice
|
||||
aicode=activate transforms((,newability[moveto(myhand) all(*[zpos=1]|mylibrary) && bottomoflibrary all(*[zpos<=2]|mylibrary)])) ueot
|
||||
auto=reveal:3 optionone name(Get a card) target(<1>*|reveal) moveto(myhand) optiononeend optiontwo name(put on bottom) target(<3>*|reveal) bottomoflibrary optiontwoend revealend
|
||||
|
||||
@@ -4539,6 +4539,23 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
//Extra for Bestow cards
|
||||
class AAuraIncreaseReduce: public AbilityTP
|
||||
{
|
||||
public:
|
||||
MTGCardInstance * manaReducer;
|
||||
int amount;
|
||||
int color;
|
||||
AAuraIncreaseReduce(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int amount, int color, int who = TargetChooser::UNSET);
|
||||
int addToGame();
|
||||
int destroy();
|
||||
int testDestroy();
|
||||
const string getMenuText();
|
||||
AAuraIncreaseReduce * clone() const;
|
||||
//~AAuraIncreaseReduce();
|
||||
|
||||
};
|
||||
|
||||
//Modify Hand
|
||||
class AModifyHand: public AbilityTP
|
||||
{
|
||||
|
||||
@@ -276,7 +276,7 @@ public:
|
||||
int forcedBorderA;
|
||||
int forcedBorderB;
|
||||
int myconvertedcost;
|
||||
ManaCost * computeNewCost(MTGCardInstance * card,ManaCost * oldCost, ManaCost * refCost,bool noTrinisphere = false);
|
||||
ManaCost * computeNewCost(MTGCardInstance * card,ManaCost * oldCost, ManaCost * refCost,bool noTrinisphere = false, bool bestow = false);
|
||||
int countTrini;
|
||||
bool anymanareplacement;
|
||||
vector<MTGCardInstance*>imprintedCards;
|
||||
|
||||
@@ -87,6 +87,8 @@ public:
|
||||
bool DeadLifeState(bool check = false);
|
||||
ManaCost * doesntEmpty;
|
||||
ManaCost * poolDoesntEmpty;
|
||||
ManaCost * AuraIncreased;
|
||||
ManaCost * AuraReduced;
|
||||
void cleanupPhase();
|
||||
virtual int Act(float)
|
||||
{
|
||||
|
||||
@@ -4044,6 +4044,80 @@ AALifer * AALifer::clone() const
|
||||
return NEW AALifer(*this);
|
||||
}
|
||||
|
||||
//Extra for Bestow ... partial fix since there's no update when react to click for bestow cards...
|
||||
//There should be no problem if the bestow cards has chosen mode then update its bestow code on react to click but
|
||||
//I cant find alternate way... This Ability is general for enchantments since aura is an enchantment type however
|
||||
//it can't target card specific attributes... This one adds on the players side...
|
||||
AAuraIncreaseReduce::AAuraIncreaseReduce(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int amount, int color, int who) :
|
||||
AbilityTP(observer, _id, _source, _target, who), amount(amount), color(color)
|
||||
{
|
||||
manaReducer = source;
|
||||
}
|
||||
|
||||
int AAuraIncreaseReduce::addToGame()
|
||||
{
|
||||
Damageable * _target = (Damageable *) getTarget();
|
||||
Player * p = getPlayerFromDamageable(_target);
|
||||
|
||||
if (!p)
|
||||
return 0;
|
||||
|
||||
if (amount > 0)
|
||||
{
|
||||
p->AuraIncreased->add(color,amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
p->AuraReduced->add(color,abs(amount));
|
||||
}
|
||||
|
||||
return MTGAbility::addToGame();
|
||||
}
|
||||
|
||||
int AAuraIncreaseReduce::destroy()
|
||||
{
|
||||
Damageable * _target = (Damageable *) getTarget();
|
||||
Player * p = getPlayerFromDamageable(_target);
|
||||
|
||||
if (!p)
|
||||
return 0;
|
||||
|
||||
if(!this->manaReducer->isInPlay(game))
|
||||
{
|
||||
if (amount > 0)
|
||||
{
|
||||
p->AuraIncreased->remove(color,amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
p->AuraReduced->remove(color,abs(amount));
|
||||
}
|
||||
return MTGAbility::testDestroy();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AAuraIncreaseReduce::testDestroy()
|
||||
{
|
||||
if(!this->manaReducer->isInPlay(game))
|
||||
{
|
||||
return MTGAbility::testDestroy();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const string AAuraIncreaseReduce::getMenuText()
|
||||
{
|
||||
return "Aura Increaser/Reducer";
|
||||
}
|
||||
|
||||
AAuraIncreaseReduce * AAuraIncreaseReduce::clone() const
|
||||
{
|
||||
return NEW AAuraIncreaseReduce(*this);
|
||||
}
|
||||
|
||||
//players modify hand size
|
||||
AModifyHand::AModifyHand(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, string hand, int who) :
|
||||
AbilityTP(observer, _id, _source, _target, who), hand(hand)
|
||||
|
||||
@@ -1244,6 +1244,8 @@ void GameObserver::Affinity()
|
||||
card->has(Constants::AFFINITYPLAINS) ||
|
||||
card->has(Constants::AFFINITYSWAMP) ||
|
||||
card->has(Constants::CONDUITED) ||
|
||||
card->controller()->AuraIncreased->getConvertedCost() ||
|
||||
card->controller()->AuraReduced->getConvertedCost() ||
|
||||
card->getIncreasedManaCost()->getConvertedCost() ||
|
||||
card->getReducedManaCost()->getConvertedCost() ||
|
||||
NewAffinityFound)
|
||||
@@ -1272,10 +1274,10 @@ void GameObserver::Affinity()
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getBestow())
|
||||
{
|
||||
{//NOTE: there should be a limitation when the spell is cast with bestow its not both creature and aura...
|
||||
card->getManaCost()->getBestow()->resetCosts();
|
||||
ManaCost * newCost = NEW ManaCost();
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getBestow(), card->model->data->getManaCost()->getBestow()));
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getBestow(), card->model->data->getManaCost()->getBestow(), false, true));
|
||||
card->getManaCost()->getBestow()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
|
||||
@@ -3196,6 +3196,26 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return a;
|
||||
}
|
||||
|
||||
//Extra for Bestow
|
||||
vector<string> splitAuraIncreaseReduce = parseBetween(s, "modbenchant(", ")", true);
|
||||
if(splitAuraIncreaseReduce.size())
|
||||
{
|
||||
if(splitAuraIncreaseReduce[1].size())
|
||||
{
|
||||
Damageable * t = spell ? spell->getNextDamageableTarget() : NULL;
|
||||
vector<string> ccParameters = split( splitAuraIncreaseReduce[1], ':');
|
||||
int amount = atoi(ccParameters[1].c_str());
|
||||
int color = Constants::GetColorStringIndex(ccParameters[0]);
|
||||
if(ccParameters[0] == "colorless")
|
||||
color = 0;
|
||||
if(ccParameters[0].size() && ccParameters[1].size())
|
||||
{
|
||||
MTGAbility * a = NEW AAuraIncreaseReduce(observer, id, card, t, amount, color, who);
|
||||
return a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//set hand size
|
||||
vector<string> splitSetHand = parseBetween(s, "sethand:", " ", false);
|
||||
if (splitSetHand.size())
|
||||
|
||||
@@ -1059,7 +1059,7 @@ JQuadPtr MTGCardInstance::getIcon()
|
||||
return WResourceManager::Instance()->RetrieveCard(this, CACHE_THUMB);
|
||||
}
|
||||
|
||||
ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cost, ManaCost * Data, bool noTrinisphere)
|
||||
ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cost, ManaCost * Data, bool noTrinisphere, bool bestow)
|
||||
{
|
||||
int color = 0;
|
||||
string type = "";
|
||||
@@ -1074,10 +1074,13 @@ ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cos
|
||||
Cost->extraCosts->costs[i]->setSource(card);
|
||||
}
|
||||
}
|
||||
if (card->getIncreasedManaCost()->getConvertedCost() || card->getReducedManaCost()->getConvertedCost())
|
||||
if (card->getIncreasedManaCost()->getConvertedCost() || card->getReducedManaCost()->getConvertedCost()
|
||||
|| card->controller()->AuraReduced->getConvertedCost() || card->controller()->AuraIncreased->getConvertedCost())
|
||||
{//start1
|
||||
if (card->getIncreasedManaCost()->getConvertedCost())
|
||||
original->add(card->getIncreasedManaCost());
|
||||
if(bestow && card->controller()->AuraIncreased->getConvertedCost())
|
||||
original->add(card->controller()->AuraIncreased);
|
||||
//before removing get the diff for excess
|
||||
if(card->getReducedManaCost()->getConvertedCost())
|
||||
{
|
||||
@@ -1093,6 +1096,8 @@ ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cos
|
||||
//apply reduced
|
||||
if (card->getReducedManaCost()->getConvertedCost())
|
||||
original->remove(card->getReducedManaCost());
|
||||
if(bestow && card->controller()->AuraReduced->getConvertedCost())
|
||||
original->remove(card->controller()->AuraReduced);
|
||||
//try to reduce hybrid
|
||||
if (excess->getConvertedCost())
|
||||
{
|
||||
|
||||
@@ -939,7 +939,11 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alter
|
||||
copy->alternateCostPaid[alternateCostType] = 1;
|
||||
game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, spellCost, alternateCostType, 0);
|
||||
game->targetChooser = NULL;
|
||||
|
||||
if(alternateCostType == ManaCost::MANA_PAID_WITH_BESTOW)
|
||||
{
|
||||
copy->removeType("creature");
|
||||
copy->addType("aura");
|
||||
}
|
||||
if (card->has(Constants::STORM))
|
||||
{
|
||||
int storm = player->game->stack->seenThisTurn("*", Constants::CAST_ALL) + player->opponent()->game->stack->seenThisTurn("*", Constants::CAST_ALL);
|
||||
|
||||
@@ -49,6 +49,8 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
|
||||
prowledTypes.clear();
|
||||
doesntEmpty = NEW ManaCost();
|
||||
poolDoesntEmpty = NEW ManaCost();
|
||||
AuraIncreased = NEW ManaCost();
|
||||
AuraReduced = NEW ManaCost();
|
||||
if (deck != NULL)
|
||||
{
|
||||
game = NEW MTGPlayerCards(deck);
|
||||
@@ -82,6 +84,8 @@ Player::~Player()
|
||||
SAFE_DELETE(manaPool);
|
||||
SAFE_DELETE(doesntEmpty);
|
||||
SAFE_DELETE(poolDoesntEmpty);
|
||||
SAFE_DELETE(AuraIncreased);
|
||||
SAFE_DELETE(AuraReduced);
|
||||
SAFE_DELETE(game);
|
||||
if(mAvatarTex && observer->getResourceManager())
|
||||
observer->getResourceManager()->Release(mAvatarTex);
|
||||
|
||||
Reference in New Issue
Block a user