altercost should affect retrace, flashback, buyback costs
This commit is contained in:
@@ -122,8 +122,6 @@ class GameObserver{
|
|||||||
void gameStateBasedEffects();
|
void gameStateBasedEffects();
|
||||||
void enchantmentStatus();
|
void enchantmentStatus();
|
||||||
void Affinity();
|
void Affinity();
|
||||||
void ComputeTrinisphere();
|
|
||||||
void RemoveTrinisphere(MTGCardInstance * card);
|
|
||||||
void addObserver(MTGAbility * observer);
|
void addObserver(MTGAbility * observer);
|
||||||
bool removeObserver(ActionElement * observer);
|
bool removeObserver(ActionElement * observer);
|
||||||
void startGame(GameType, Rules * rules);
|
void startGame(GameType, Rules * rules);
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ public:
|
|||||||
COUNTERS = 30,
|
COUNTERS = 30,
|
||||||
PUT_INTO_PLAY_WITH_KICKER = 31,
|
PUT_INTO_PLAY_WITH_KICKER = 31,
|
||||||
STANDARD_FIZZLER = 32,
|
STANDARD_FIZZLER = 32,
|
||||||
|
CASTINGRAVEYARD_COST = 33,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -253,9 +253,25 @@ public:
|
|||||||
int cardistargetted;
|
int cardistargetted;
|
||||||
bool isTargetter();
|
bool isTargetter();
|
||||||
int cardistargetter;
|
int cardistargetter;
|
||||||
int tmodifier;
|
|
||||||
int tmodifierb;
|
|
||||||
int myconvertedcost;
|
int myconvertedcost;
|
||||||
|
ManaCost * computeNewCost(MTGCardInstance * card,ManaCost * oldCost)
|
||||||
|
{
|
||||||
|
if(card->isLand())
|
||||||
|
return oldCost;
|
||||||
|
|
||||||
|
if(!card)
|
||||||
|
return NULL;
|
||||||
|
//i don't know why this method doesn't affect cards in hand, but is working on other zones....//
|
||||||
|
//pay zero costs//
|
||||||
|
//kicker???...//
|
||||||
|
//morph cost todo//
|
||||||
|
//trinisphere must be here below//
|
||||||
|
if(card->has(Constants::TRINISPHERE))
|
||||||
|
for(int jj = oldCost->getConvertedCost(); jj < 3; jj++)
|
||||||
|
oldCost->add(Constants::MTG_COLOR_ARTIFACT, 1);
|
||||||
|
|
||||||
|
return oldCost;
|
||||||
|
};
|
||||||
|
|
||||||
void eventattacked();
|
void eventattacked();
|
||||||
void eventattackedAlone();
|
void eventattackedAlone();
|
||||||
|
|||||||
@@ -236,7 +236,8 @@ class Constants
|
|||||||
OPPGCREATUREEXILER = 118,
|
OPPGCREATUREEXILER = 118,
|
||||||
PAYZERO = 119,
|
PAYZERO = 119,
|
||||||
TRINISPHERE = 120,
|
TRINISPHERE = 120,
|
||||||
NB_BASIC_ABILITIES = 121,
|
CANPLAYFROMEXILE = 121,
|
||||||
|
NB_BASIC_ABILITIES = 122,
|
||||||
|
|
||||||
|
|
||||||
RARITY_S = 'S', //Special Rarity
|
RARITY_S = 'S', //Special Rarity
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ public:
|
|||||||
MTGPutInPlayRule(GameObserver* observer, int _id);
|
MTGPutInPlayRule(GameObserver* observer, int _id);
|
||||||
const string getMenuText()
|
const string getMenuText()
|
||||||
{
|
{
|
||||||
|
if(game && game->gameType() == GAME_TYPE_MOMIR)
|
||||||
|
return "Play Land";
|
||||||
return "Cast Card Normally";
|
return "Cast Card Normally";
|
||||||
}
|
}
|
||||||
virtual MTGPutInPlayRule * clone() const;
|
virtual MTGPutInPlayRule * clone() const;
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ public:
|
|||||||
MANA_PAID_WITH_FLASHBACK = 5,
|
MANA_PAID_WITH_FLASHBACK = 5,
|
||||||
MANA_PAID_WITH_RETRACE = 6,
|
MANA_PAID_WITH_RETRACE = 6,
|
||||||
MANA_PAID_WITH_MORPH = 7,
|
MANA_PAID_WITH_MORPH = 7,
|
||||||
MANA_PAID_WITH_SUSPEND = 8
|
MANA_PAID_WITH_SUSPEND = 8,
|
||||||
|
MANA_PAID_WITH_OTHERCOST = 9
|
||||||
};
|
};
|
||||||
ExtraCosts * extraCosts;
|
ExtraCosts * extraCosts;
|
||||||
|
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ bool Spell::FullfilledAlternateCost(const int &costType)
|
|||||||
hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_RETRACE);
|
hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_RETRACE);
|
||||||
break;
|
break;
|
||||||
case ManaCost::MANA_PAID_WITH_SUSPEND:
|
case ManaCost::MANA_PAID_WITH_SUSPEND:
|
||||||
hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_RETRACE);
|
hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_SUSPEND);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -885,9 +885,6 @@ void GameObserver::gameStateBasedEffects()
|
|||||||
// plus modify costs //
|
// plus modify costs //
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
Affinity();
|
Affinity();
|
||||||
//trinisphere? buggy...
|
|
||||||
//ComputeTrinisphere();
|
|
||||||
//end trinisphere
|
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
// Check colored statuses on cards //
|
// Check colored statuses on cards //
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
@@ -979,10 +976,14 @@ void GameObserver::Affinity()
|
|||||||
//only do any of the following if a card with the stated ability is in your hand.
|
//only do any of the following if a card with the stated ability is in your hand.
|
||||||
ManaCost * original = NEW ManaCost();
|
ManaCost * original = NEW ManaCost();
|
||||||
ManaCost * alternate = NEW ManaCost();
|
ManaCost * alternate = NEW ManaCost();
|
||||||
|
ManaCost * buyback = NEW ManaCost();
|
||||||
|
ManaCost * flashback = NEW ManaCost();
|
||||||
|
ManaCost * retrace = NEW ManaCost();
|
||||||
original->copy(card->model->data->getManaCost());
|
original->copy(card->model->data->getManaCost());
|
||||||
alternate->copy(card->model->data->getManaCost()->getAlternative());
|
alternate->copy(card->model->data->getManaCost()->getAlternative());
|
||||||
if (card->has(Constants::PAYZERO))
|
buyback->copy(card->model->data->getManaCost()->getBuyback());
|
||||||
original = ManaCost::parseManaCost("{0}",NULL,card);//can't figure out 2 or more alternative...
|
flashback->copy(card->model->data->getManaCost()->getFlashback());
|
||||||
|
retrace->copy(card->model->data->getManaCost()->getRetrace());
|
||||||
//have to run alter cost before affinity or the 2 cancel each other out.
|
//have to run alter cost before affinity or the 2 cancel each other out.
|
||||||
if(card->getIncreasedManaCost()->getConvertedCost()||card->getReducedManaCost()->getConvertedCost())
|
if(card->getIncreasedManaCost()->getConvertedCost()||card->getReducedManaCost()->getConvertedCost())
|
||||||
{
|
{
|
||||||
@@ -995,10 +996,22 @@ void GameObserver::Affinity()
|
|||||||
{
|
{
|
||||||
alternate->add(kc,card->getIncreasedManaCost()->getCost(kc));
|
alternate->add(kc,card->getIncreasedManaCost()->getCost(kc));
|
||||||
}
|
}
|
||||||
|
if (card->getManaCost()->getBuyback())
|
||||||
|
{
|
||||||
|
buyback->add(kc,card->getIncreasedManaCost()->getCost(kc));
|
||||||
|
}
|
||||||
|
if (card->getManaCost()->getFlashback())
|
||||||
|
{
|
||||||
|
flashback->add(kc,card->getIncreasedManaCost()->getCost(kc));
|
||||||
|
}
|
||||||
|
if (card->getManaCost()->getRetrace())
|
||||||
|
{
|
||||||
|
retrace->add(kc,card->getIncreasedManaCost()->getCost(kc));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(card->getReducedManaCost()->getConvertedCost())
|
if(card->getReducedManaCost()->getConvertedCost())
|
||||||
{
|
{
|
||||||
original->remove(card->getReducedManaCost());
|
original->remove(card->getReducedManaCost());
|
||||||
for(int kc = Constants::MTG_COLOR_ARTIFACT; kc < Constants::NB_Colors;kc++)
|
for(int kc = Constants::MTG_COLOR_ARTIFACT; kc < Constants::NB_Colors;kc++)
|
||||||
{
|
{
|
||||||
@@ -1006,12 +1019,30 @@ void GameObserver::Affinity()
|
|||||||
{
|
{
|
||||||
alternate->remove(kc,card->getReducedManaCost()->getCost(kc));
|
alternate->remove(kc,card->getReducedManaCost()->getCost(kc));
|
||||||
}
|
}
|
||||||
|
if (card->getManaCost()->getBuyback())
|
||||||
|
{
|
||||||
|
buyback->remove(kc,card->getIncreasedManaCost()->getCost(kc));
|
||||||
|
}
|
||||||
|
if (card->getManaCost()->getFlashback())
|
||||||
|
{
|
||||||
|
flashback->remove(kc,card->getIncreasedManaCost()->getCost(kc));
|
||||||
|
}
|
||||||
|
if (card->getManaCost()->getRetrace())
|
||||||
|
{
|
||||||
|
retrace->remove(kc,card->getIncreasedManaCost()->getCost(kc));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(card->getManaCost())
|
if(card->getManaCost())
|
||||||
card->getManaCost()->copy(original);
|
card->getManaCost()->copy(original);
|
||||||
if(card->getManaCost()->getAlternative())
|
if(card->getManaCost()->getAlternative())
|
||||||
card->getManaCost()->setAlternative(alternate);
|
card->getManaCost()->setAlternative(alternate);
|
||||||
|
if(card->getManaCost()->getBuyback())
|
||||||
|
card->getManaCost()->setBuyback(buyback);
|
||||||
|
if(card->getManaCost()->getFlashback())
|
||||||
|
card->getManaCost()->setFlashback(flashback);
|
||||||
|
if(card->getManaCost()->getRetrace())
|
||||||
|
card->getManaCost()->setRetrace(retrace);
|
||||||
if(card->getManaCost()->extraCosts)
|
if(card->getManaCost()->extraCosts)
|
||||||
{
|
{
|
||||||
for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++)
|
for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++)
|
||||||
@@ -1068,7 +1099,8 @@ void GameObserver::Affinity()
|
|||||||
card->has(Constants::AFFINITYISLAND)||
|
card->has(Constants::AFFINITYISLAND)||
|
||||||
card->has(Constants::AFFINITYMOUNTAIN)||
|
card->has(Constants::AFFINITYMOUNTAIN)||
|
||||||
card->has(Constants::AFFINITYPLAINS)||
|
card->has(Constants::AFFINITYPLAINS)||
|
||||||
card->has(Constants::AFFINITYSWAMP)){
|
card->has(Constants::AFFINITYSWAMP))
|
||||||
|
{
|
||||||
if (card->has(Constants::AFFINITYARTIFACTS))
|
if (card->has(Constants::AFFINITYARTIFACTS))
|
||||||
{
|
{
|
||||||
type = "artifact";
|
type = "artifact";
|
||||||
@@ -1123,86 +1155,13 @@ void GameObserver::Affinity()
|
|||||||
if(card->getManaCost()->getCost(color) > 0)
|
if(card->getManaCost()->getCost(color) > 0)
|
||||||
card->getManaCost()->remove(color,1);
|
card->getManaCost()->remove(color,1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
//SAFE_DELETE(original);
|
||||||
SAFE_DELETE(original);
|
|
||||||
}//end
|
}//end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameObserver::ComputeTrinisphere()
|
|
||||||
{
|
|
||||||
for (int td = 0; td < 2; td++)
|
|
||||||
{
|
|
||||||
MTGGameZone * dzones[] = { players[td]->game->graveyard, players[td]->game->hand, players[td]->game->library, players[td]->game->exile };
|
|
||||||
for (int tk = 0; tk < 4; tk++)
|
|
||||||
{
|
|
||||||
MTGGameZone * zone = dzones[tk];
|
|
||||||
for (int ct = zone->nb_cards - 1; ct >= 0; ct--)
|
|
||||||
{
|
|
||||||
if(zone->cards[ct]->has(Constants::TRINISPHERE))
|
|
||||||
{
|
|
||||||
if(zone->cards[ct]->getManaCost()->getConvertedCost() == 2)
|
|
||||||
{
|
|
||||||
zone->cards[ct]->getManaCost()->add(Constants::MTG_COLOR_ARTIFACT, 1);
|
|
||||||
zone->cards[ct]->tmodifier = 1;
|
|
||||||
}
|
|
||||||
else if(zone->cards[ct]->getManaCost()->getConvertedCost() == 1)
|
|
||||||
{
|
|
||||||
zone->cards[ct]->getManaCost()->add(Constants::MTG_COLOR_ARTIFACT, 2);
|
|
||||||
zone->cards[ct]->tmodifier = 2;
|
|
||||||
}
|
|
||||||
else if(zone->cards[ct]->getManaCost()->getConvertedCost() < 1)
|
|
||||||
{
|
|
||||||
zone->cards[ct]->getManaCost()->add(Constants::MTG_COLOR_ARTIFACT, 3);
|
|
||||||
zone->cards[ct]->tmodifier = 3;
|
|
||||||
}
|
|
||||||
if(zone->cards[ct]->getManaCost()->getAlternative())
|
|
||||||
{
|
|
||||||
ManaCost * currentAlternate = NEW ManaCost();
|
|
||||||
currentAlternate->copy(zone->cards[ct]->getManaCost()->getAlternative());
|
|
||||||
if(zone->cards[ct]->getManaCost()->getAlternative()->getConvertedCost() == 2)
|
|
||||||
zone->cards[ct]->tmodifierb = 1;
|
|
||||||
else if(zone->cards[ct]->getManaCost()->getAlternative()->getConvertedCost() == 1)
|
|
||||||
zone->cards[ct]->tmodifierb = 2;
|
|
||||||
else if(zone->cards[ct]->getManaCost()->getAlternative()->getConvertedCost() < 1)
|
|
||||||
zone->cards[ct]->tmodifierb = 3;
|
|
||||||
currentAlternate->add(Constants::MTG_COLOR_ARTIFACT, zone->cards[ct]->tmodifierb);
|
|
||||||
zone->cards[ct]->getManaCost()->setAlternative(currentAlternate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
RemoveTrinisphere(zone->cards[ct]);
|
|
||||||
if(zone->cards[ct]->getManaCost()->extraCosts)
|
|
||||||
{
|
|
||||||
for(unsigned int i = 0; i < zone->cards[ct]->getManaCost()->extraCosts->costs.size();i++)
|
|
||||||
{
|
|
||||||
zone->cards[ct]->getManaCost()->extraCosts->costs[i]->setSource(zone->cards[ct]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void GameObserver::RemoveTrinisphere(MTGCardInstance * card)
|
|
||||||
{
|
|
||||||
if(card->has(Constants::TRINISPHERE))
|
|
||||||
return;
|
|
||||||
if(card->tmodifier)
|
|
||||||
{
|
|
||||||
card->getManaCost()->remove(Constants::MTG_COLOR_ARTIFACT, card->tmodifier);
|
|
||||||
card->tmodifier = 0;
|
|
||||||
}
|
|
||||||
if(card->getManaCost()->getAlternative() && card->tmodifierb)
|
|
||||||
{
|
|
||||||
ManaCost * newalternate = NEW ManaCost();
|
|
||||||
newalternate->copy(card->getManaCost()->getAlternative());
|
|
||||||
newalternate->remove(Constants::MTG_COLOR_ARTIFACT, card->tmodifierb);
|
|
||||||
card->getManaCost()->setAlternative(newalternate);
|
|
||||||
card->tmodifierb = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void GameObserver::Render()
|
void GameObserver::Render()
|
||||||
{
|
{
|
||||||
if(mLayers)
|
if(mLayers)
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
|
|||||||
LKItoughness = toughness;
|
LKItoughness = toughness;
|
||||||
cardistargetted = 0;
|
cardistargetted = 0;
|
||||||
cardistargetter = 0;
|
cardistargetter = 0;
|
||||||
tmodifier = 0;
|
|
||||||
tmodifierb = 0;
|
|
||||||
myconvertedcost = getManaCost()->getConvertedCost();
|
myconvertedcost = getManaCost()->getConvertedCost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,8 @@ const char* Constants::MTGBasicAbilities[] = {
|
|||||||
"mygcreatureexiler",
|
"mygcreatureexiler",
|
||||||
"oppgcreatureexiler",
|
"oppgcreatureexiler",
|
||||||
"payzero",
|
"payzero",
|
||||||
"trinisphere"
|
"trinisphere",
|
||||||
|
"canplayfromexile"
|
||||||
};
|
};
|
||||||
|
|
||||||
map<string,int> Constants::MTGBasicAbilitiesMap;
|
map<string,int> Constants::MTGBasicAbilitiesMap;
|
||||||
|
|||||||
@@ -1132,7 +1132,7 @@ MTGMorphCostRule * MTGMorphCostRule::clone() const
|
|||||||
MTGPlayFromGraveyardRule::MTGPlayFromGraveyardRule(GameObserver* observer, int _id) :
|
MTGPlayFromGraveyardRule::MTGPlayFromGraveyardRule(GameObserver* observer, int _id) :
|
||||||
MTGAlternativeCostRule(observer, _id)
|
MTGAlternativeCostRule(observer, _id)
|
||||||
{
|
{
|
||||||
aType = MTGAbility::PUT_INTO_PLAY;
|
aType = MTGAbility::CASTINGRAVEYARD_COST;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGPlayFromGraveyardRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
int MTGPlayFromGraveyardRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||||
@@ -1155,9 +1155,9 @@ int MTGPlayFromGraveyardRule::reactToClick(MTGCardInstance * card)
|
|||||||
|
|
||||||
ManaCost * cost = card->getManaCost();
|
ManaCost * cost = card->getManaCost();
|
||||||
|
|
||||||
card->paymenttype = MTGAbility::PUT_INTO_PLAY;
|
card->paymenttype = MTGAbility::CASTINGRAVEYARD_COST;
|
||||||
|
|
||||||
return MTGAlternativeCostRule::reactToClick(card, cost, ManaCost::MANA_PAID);
|
return MTGAlternativeCostRule::reactToClick(card, cost, ManaCost::MANA_PAID_WITH_OTHERCOST);
|
||||||
}
|
}
|
||||||
|
|
||||||
ostream& MTGPlayFromGraveyardRule::toString(ostream& out) const
|
ostream& MTGPlayFromGraveyardRule::toString(ostream& out) const
|
||||||
|
|||||||
Reference in New Issue
Block a user