Merge pull request #681 from kevlahnota/master
Couldn't find a way to reduce kicker & multikicker without crashing. Returning to previous will get the bug that you can't activate any ability if you paid a kicker with the options "Choice Offer" or manually. Copying the kicker from put into play fixes it.
This commit is contained in:
@@ -3665,8 +3665,8 @@ text=Multikicker (You may pay an additional any number of times as you cast thi
|
|||||||
type=Creature
|
type=Creature
|
||||||
subtype=Bird
|
subtype=Bird
|
||||||
mana={2}{W}
|
mana={2}{W}
|
||||||
power=1
|
power=2
|
||||||
toughness=1
|
toughness=2
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
name=Aphetto Alchemist
|
name=Aphetto Alchemist
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ manapool:{W}{W}{W}{W}{W}{W}{W}
|
|||||||
[PLAYER2]
|
[PLAYER2]
|
||||||
life:20
|
life:20
|
||||||
[DO]
|
[DO]
|
||||||
|
#apex hawks is {2}{W} so the mana remaining will be {W}{W}{W}{W}
|
||||||
Apex Hawks
|
Apex Hawks
|
||||||
|
#apex hawks has {1}{W} multikicker so we can afford {2}{W}{W} since our mana is {W}{W}{W}{W}
|
||||||
|
#it will come with two +1/+1 counters making it 1 4/4 Flyer
|
||||||
choice 1
|
choice 1
|
||||||
next
|
next
|
||||||
next
|
next
|
||||||
@@ -22,5 +25,6 @@ COMBATDAMAGE
|
|||||||
inplay:Apex Hawks,Fervor
|
inplay:Apex Hawks,Fervor
|
||||||
manapool:{0}
|
manapool:{0}
|
||||||
[PLAYER2]
|
[PLAYER2]
|
||||||
life:17
|
#life must be 16 not 17.....(20 - 4)
|
||||||
|
life:16
|
||||||
[END]
|
[END]
|
||||||
@@ -479,7 +479,7 @@ int AACopier::resolve()
|
|||||||
MTGCardInstance * myClone = NEW MTGCardInstance(clone, source->controller()->game);
|
MTGCardInstance * myClone = NEW MTGCardInstance(clone, source->controller()->game);
|
||||||
source->copy(myClone);
|
source->copy(myClone);
|
||||||
source->isACopier = true;
|
source->isACopier = true;
|
||||||
source->copiedID = _target->copiedID;
|
source->copiedID = _target->getMTGId();
|
||||||
source->modifiedbAbi = _target->modifiedbAbi;
|
source->modifiedbAbi = _target->modifiedbAbi;
|
||||||
source->origbasicAbilities = _target->origbasicAbilities;
|
source->origbasicAbilities = _target->origbasicAbilities;
|
||||||
if(_target->isMorphed)
|
if(_target->isMorphed)
|
||||||
|
|||||||
@@ -118,7 +118,14 @@ void MTGCardInstance::copy(MTGCardInstance * card)
|
|||||||
AbilityFactory af(observer);
|
AbilityFactory af(observer);
|
||||||
af.addAbilities(observer->mLayers->actionLayer()->getMaxId(), spell);
|
af.addAbilities(observer->mLayers->actionLayer()->getMaxId(), spell);
|
||||||
delete spell;
|
delete spell;
|
||||||
mtgid = backupid;
|
if(observer->players[1]->playMode == Player::MODE_TEST_SUITE)
|
||||||
|
mtgid = backupid; // there must be a way to get the token id...
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mtgid = card->getMTGId(); ///////////////////////////////////////////////////
|
||||||
|
setId = card->setId; // Copier/Cloner cards produces the same token...//
|
||||||
|
rarity = card->getRarity(); ///////////////////////////////////////////////////
|
||||||
|
}
|
||||||
castMethod = castMethodBackUP;
|
castMethod = castMethodBackUP;
|
||||||
backupTargets = this->backupTargets;
|
backupTargets = this->backupTargets;
|
||||||
storedCard = oldStored;
|
storedCard = oldStored;
|
||||||
|
|||||||
@@ -375,6 +375,12 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
|
|||||||
{
|
{
|
||||||
copy->miracle = true;
|
copy->miracle = true;
|
||||||
}
|
}
|
||||||
|
if(from == g->players[0]->game->battlefield || from == g->players[1]->game->battlefield)
|
||||||
|
if(to != g->players[0]->game->battlefield || to != g->players[1]->game->battlefield)
|
||||||
|
{
|
||||||
|
card->kicked = 0;
|
||||||
|
copy->kicked = 0;//kicked reset everflowing chalice...
|
||||||
|
}
|
||||||
if (card->discarded)
|
if (card->discarded)
|
||||||
{//set discarded for madness...
|
{//set discarded for madness...
|
||||||
if(from == g->players[0]->game->hand || from == g->players[1]->game->hand)
|
if(from == g->players[0]->game->hand || from == g->players[1]->game->hand)
|
||||||
|
|||||||
@@ -481,84 +481,86 @@ int MTGKickerRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
|
|||||||
return 0;
|
return 0;
|
||||||
if ((player->game->graveyard->hasCard(card) && !card->has(Constants::CANPLAYFROMGRAVEYARD)) || (player->game->exile->hasCard(card) && !card->has(Constants::CANPLAYFROMEXILE)))
|
if ((player->game->graveyard->hasCard(card) && !card->has(Constants::CANPLAYFROMGRAVEYARD)) || (player->game->exile->hasCard(card) && !card->has(Constants::CANPLAYFROMEXILE)))
|
||||||
return 0;
|
return 0;
|
||||||
ManaCost * kicker = card->getManaCost()->getKicker();
|
if(!allowedToCast(card,player))
|
||||||
if(!kicker)
|
|
||||||
{
|
|
||||||
SAFE_DELETE(kicker);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
if(!card->getManaCost()->getKicker())
|
||||||
ManaCost * playerMana = player->getManaPool();
|
|
||||||
ManaCost * withKickerCost= NEW ManaCost(card->model->data->getManaCost());
|
|
||||||
if(card->getIncreasedManaCost()->getConvertedCost())
|
|
||||||
withKickerCost->add(card->getIncreasedManaCost());
|
|
||||||
if(card->getReducedManaCost()->getConvertedCost())
|
|
||||||
withKickerCost->remove(card->getReducedManaCost());
|
|
||||||
withKickerCost->add(card->model->data->getManaCost()->getKicker());
|
|
||||||
if(!playerMana->canAfford(withKickerCost))
|
|
||||||
{
|
|
||||||
delete withKickerCost;
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || (card->StackIsEmptyandSorcerySpeed()))
|
||||||
|
{
|
||||||
|
if(card->controller()->epic)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (card->controller()->game->playRestrictions->canPutIntoZone(card, game->currentActionPlayer->game->stack) == PlayRestriction::CANT_PLAY)
|
||||||
|
return 0;
|
||||||
|
ManaCost * playerMana = player->getManaPool();
|
||||||
|
ManaCost * withKickerCost= NEW ManaCost(card->getManaCost());
|
||||||
|
withKickerCost->add(card->getManaCost()->getKicker());
|
||||||
|
//cost reduction/recalculation must be here or outside somehow...
|
||||||
|
#ifdef WIN32
|
||||||
|
withKickerCost->Dump();
|
||||||
|
#endif
|
||||||
|
if (playerMana->canAfford(withKickerCost))
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
delete withKickerCost;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGKickerRule::reactToClick(MTGCardInstance * card)
|
int MTGKickerRule::reactToClick(MTGCardInstance * card)
|
||||||
{
|
{
|
||||||
if(!isReactingToClick(card, NULL))
|
if (!isReactingToClick(card))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Player * player = game->currentlyActing();
|
Player * player = game->currentlyActing();
|
||||||
ManaCost * withKickerCost= NEW ManaCost(card->model->data->getManaCost());//using pointers here alters the real cost of the card.
|
ManaCost * cost = card->getManaCost();
|
||||||
if(card->getIncreasedManaCost()->getConvertedCost())
|
|
||||||
withKickerCost->add(card->getIncreasedManaCost());
|
//this handles extra cost payments at the moment a card is played.
|
||||||
if(card->getReducedManaCost()->getConvertedCost())
|
|
||||||
withKickerCost->remove(card->getReducedManaCost());
|
if (cost->isExtraPaymentSet())
|
||||||
if (card->model->data->getManaCost()->getKicker()->isMulti)
|
|
||||||
{
|
|
||||||
while(player->getManaPool()->canAfford(withKickerCost))
|
|
||||||
{
|
|
||||||
withKickerCost->add(card->model->data->getManaCost()->getKicker());
|
|
||||||
card->kicked += 1;
|
|
||||||
}
|
|
||||||
card->kicked -= 1;
|
|
||||||
//for(int i = 0;i < card->kicked;i++)
|
|
||||||
//player->getManaPool()->pay(card->getManaCost()->kicker);
|
|
||||||
card->paymenttype = MTGAbility::PUT_INTO_PLAY_WITH_KICKER;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
withKickerCost->add(card->model->data->getManaCost()->getKicker());
|
|
||||||
card->paymenttype = MTGAbility::PUT_INTO_PLAY_WITH_KICKER;
|
|
||||||
}
|
|
||||||
if (withKickerCost->isExtraPaymentSet())
|
|
||||||
{
|
{
|
||||||
if (!game->targetListIsSet(card))
|
if (!game->targetListIsSet(card))
|
||||||
{
|
{
|
||||||
delete withKickerCost;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
withKickerCost->setExtraCostsAction(this, card);
|
cost->setExtraCostsAction(this, card);
|
||||||
game->mExtraPayment = withKickerCost->extraCosts;
|
game->mExtraPayment = cost->extraCosts;
|
||||||
delete withKickerCost;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ManaCost * previousManaPool = NEW ManaCost(player->getManaPool());
|
ManaCost * previousManaPool = NEW ManaCost(player->getManaPool());
|
||||||
player->getManaPool()->pay(withKickerCost);
|
int payResult = player->getManaPool()->pay(card->getManaCost());
|
||||||
withKickerCost->doPayExtra();
|
if (card->getManaCost()->getKicker())
|
||||||
|
{ //cost reduction/recalculation must be here or outside somehow...
|
||||||
|
ManaCost * withKickerCost= NEW ManaCost(card->getManaCost());
|
||||||
|
withKickerCost->add(withKickerCost->getKicker());
|
||||||
|
if (card->getManaCost()->getKicker()->isMulti)
|
||||||
|
{
|
||||||
|
while(previousManaPool->canAfford(withKickerCost))
|
||||||
|
{
|
||||||
|
withKickerCost->add(withKickerCost->getKicker());
|
||||||
|
card->kicked += 1;
|
||||||
|
}
|
||||||
|
for(int i = 0;i < card->kicked;i++)
|
||||||
|
player->getManaPool()->pay(card->getManaCost()->getKicker());
|
||||||
|
payResult = ManaCost::MANA_PAID_WITH_KICKER;
|
||||||
|
}
|
||||||
|
else if (previousManaPool->canAfford(withKickerCost))
|
||||||
|
{
|
||||||
|
player->getManaPool()->pay(card->getManaCost()->getKicker());
|
||||||
|
payResult = ManaCost::MANA_PAID_WITH_KICKER;
|
||||||
|
}
|
||||||
|
delete withKickerCost;
|
||||||
|
}
|
||||||
|
card->getManaCost()->doPayExtra();
|
||||||
ManaCost * spellCost = previousManaPool->Diff(player->getManaPool());
|
ManaCost * spellCost = previousManaPool->Diff(player->getManaPool());
|
||||||
delete withKickerCost;
|
|
||||||
delete previousManaPool;
|
delete previousManaPool;
|
||||||
if (card->isLand())
|
if (card->isLand())
|
||||||
{
|
{
|
||||||
MTGCardInstance * copy = player->game->putInZone(card, card->currentZone, player->game->temp);
|
MTGCardInstance * copy = player->game->putInZone(card, card->currentZone, player->game->temp);
|
||||||
Spell * spell = NEW Spell(game, 0,copy,NULL,NULL, ManaCost::MANA_PAID_WITH_KICKER);
|
Spell * spell = NEW Spell(game, 0,copy,NULL,NULL, payResult);
|
||||||
spell->resolve();
|
spell->resolve();
|
||||||
delete spellCost;
|
delete spellCost;
|
||||||
delete spell;
|
delete spell;
|
||||||
@@ -569,21 +571,21 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
|
|||||||
MTGCardInstance * copy = player->game->putInZone(card, card->currentZone, player->game->stack);
|
MTGCardInstance * copy = player->game->putInZone(card, card->currentZone, player->game->stack);
|
||||||
if (game->targetChooser)
|
if (game->targetChooser)
|
||||||
{
|
{
|
||||||
spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, spellCost, ManaCost::MANA_PAID_WITH_KICKER, 0);
|
spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, spellCost, payResult, 0);
|
||||||
game->targetChooser = NULL;
|
game->targetChooser = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, spellCost, ManaCost::MANA_PAID_WITH_KICKER, 0);
|
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, spellCost, payResult, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (card->has(Constants::STORM))
|
if (card->has(Constants::STORM))
|
||||||
{
|
{
|
||||||
int storm = player->game->stack->seenThisTurn("*", Constants::CAST_ALL) + player->opponent()->game->stack->seenThisTurn("*", Constants::CAST_ALL);
|
int storm = player->game->stack->seenThisTurn("*", Constants::CAST_ALL) + player->opponent()->game->stack->seenThisTurn("*", Constants::CAST_ALL);
|
||||||
ManaCost * stormSpellCost = player->getManaPool();
|
ManaCost * spellCost = player->getManaPool();
|
||||||
for (int i = storm; i > 1; i--)
|
for (int i = storm; i > 1; i--)
|
||||||
{
|
{
|
||||||
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, stormSpellCost, ManaCost::MANA_PAID_WITH_KICKER, 1);
|
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, spellCost, payResult, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
}//end of storm
|
}//end of storm
|
||||||
|
|||||||
Reference in New Issue
Block a user