Snow
Mana produced by snow permanent
This commit is contained in:
@@ -652,6 +652,10 @@ private:
|
||||
{
|
||||
intValue = target->controller()->epic;
|
||||
}
|
||||
else if (s == "snowcount")
|
||||
{
|
||||
intValue = target->controller()->snowManaG + target->controller()->snowManaU +target->controller()->snowManaR + target->controller()->snowManaB + target->controller()->snowManaW + target->controller()->snowManaC;
|
||||
}
|
||||
else if (s == "p" || s == "power")
|
||||
{
|
||||
intValue = target->getCurrentPower();
|
||||
|
||||
@@ -204,6 +204,17 @@ public:
|
||||
virtual TapCost * clone() const;
|
||||
};
|
||||
|
||||
//Snow cost
|
||||
class SnowCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
SnowCost();
|
||||
virtual int isPaymentSet();
|
||||
virtual int canPay();
|
||||
virtual int doPay();
|
||||
virtual SnowCost * clone() const;
|
||||
};
|
||||
|
||||
//untap cost
|
||||
class UnTapCost : public ExtraCost
|
||||
{
|
||||
|
||||
@@ -47,6 +47,12 @@ public:
|
||||
int initLife;
|
||||
int raidcount;
|
||||
int handmodifier;
|
||||
int snowManaG;
|
||||
int snowManaR;
|
||||
int snowManaB;
|
||||
int snowManaU;
|
||||
int snowManaW;
|
||||
int snowManaC;
|
||||
vector<string> prowledTypes;
|
||||
vector<MTGCardInstance*>curses;
|
||||
Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
|
||||
|
||||
@@ -127,6 +127,95 @@ int ExtraManaCost::doPay()
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Snow cost
|
||||
SnowCost * SnowCost::clone() const
|
||||
{
|
||||
SnowCost * ec = NEW SnowCost(*this);
|
||||
return ec;
|
||||
}
|
||||
|
||||
SnowCost::SnowCost() :
|
||||
ExtraCost("Snow Mana")
|
||||
{
|
||||
}
|
||||
|
||||
int SnowCost::isPaymentSet()
|
||||
{
|
||||
if (source->controller()->getManaPool()->getConvertedCost())
|
||||
{
|
||||
int result = 0;
|
||||
result += source->controller()->snowManaG;
|
||||
result += source->controller()->snowManaU;
|
||||
result += source->controller()->snowManaR;
|
||||
result += source->controller()->snowManaB;
|
||||
result += source->controller()->snowManaW;
|
||||
result += source->controller()->snowManaC;
|
||||
return result;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SnowCost::canPay()
|
||||
{
|
||||
return isPaymentSet();
|
||||
}
|
||||
|
||||
int SnowCost::doPay()
|
||||
{
|
||||
if (source->controller()->getManaPool()->getConvertedCost())
|
||||
{
|
||||
int result = 0;
|
||||
result += source->controller()->snowManaG;
|
||||
result += source->controller()->snowManaU;
|
||||
result += source->controller()->snowManaR;
|
||||
result += source->controller()->snowManaB;
|
||||
result += source->controller()->snowManaW;
|
||||
result += source->controller()->snowManaC;
|
||||
if (result)
|
||||
{
|
||||
if (source->controller()->snowManaC && source->controller()->getManaPool()->canAfford(ManaCost::parseManaCost("{1}",NULL,source)))
|
||||
{
|
||||
source->controller()->getManaPool()->pay(ManaCost::parseManaCost("{1}",NULL,source));
|
||||
source->controller()->snowManaC -= 1;
|
||||
}
|
||||
else if (source->controller()->snowManaG && source->controller()->getManaPool()->canAfford(ManaCost::parseManaCost("{g}",NULL,source)))
|
||||
{
|
||||
source->controller()->getManaPool()->pay(ManaCost::parseManaCost("{g}",NULL,source));
|
||||
source->controller()->snowManaG -= 1;
|
||||
}
|
||||
else if (source->controller()->snowManaU && source->controller()->getManaPool()->canAfford(ManaCost::parseManaCost("{u}",NULL,source)))
|
||||
{
|
||||
source->controller()->getManaPool()->pay(ManaCost::parseManaCost("{u}",NULL,source));
|
||||
source->controller()->snowManaU -= 1;
|
||||
}
|
||||
else if (source->controller()->snowManaR && source->controller()->getManaPool()->canAfford(ManaCost::parseManaCost("{r}",NULL,source)))
|
||||
{
|
||||
source->controller()->getManaPool()->pay(ManaCost::parseManaCost("{r}",NULL,source));
|
||||
source->controller()->snowManaR -= 1;
|
||||
}
|
||||
else if (source->controller()->snowManaB && source->controller()->getManaPool()->canAfford(ManaCost::parseManaCost("{b}",NULL,source)))
|
||||
{
|
||||
source->controller()->getManaPool()->pay(ManaCost::parseManaCost("{b}",NULL,source));
|
||||
source->controller()->snowManaB -= 1;
|
||||
}
|
||||
else if (source->controller()->snowManaW && source->controller()->getManaPool()->canAfford(ManaCost::parseManaCost("{w}",NULL,source)))
|
||||
{
|
||||
source->controller()->getManaPool()->pay(ManaCost::parseManaCost("{w}",NULL,source));
|
||||
source->controller()->snowManaW -= 1;
|
||||
}
|
||||
else if (source->controller()->snowManaC && source->controller()->getManaPool()->canAfford(ManaCost::parseManaCost("{c}",NULL,source)))
|
||||
{
|
||||
source->controller()->getManaPool()->pay(ManaCost::parseManaCost("{c}",NULL,source));
|
||||
source->controller()->snowManaC -= 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//life cost
|
||||
LifeCost * LifeCost::clone() const
|
||||
{
|
||||
|
||||
@@ -600,6 +600,32 @@ void GameObserver::gameStateBasedEffects()
|
||||
/////////////////////////////////////
|
||||
for (int d = 0; d < 2; d++)
|
||||
{
|
||||
////check snow count
|
||||
if (players[d]->snowManaC > players[d]->getManaPool()->getCost(0) + players[d]->getManaPool()->getCost(6))
|
||||
players[d]->snowManaC = players[d]->getManaPool()->getCost(0) + players[d]->getManaPool()->getCost(6);
|
||||
if (players[d]->snowManaC < 0)
|
||||
players[d]->snowManaC = 0;
|
||||
if (players[d]->snowManaG > players[d]->getManaPool()->getCost(1))
|
||||
players[d]->snowManaG = players[d]->getManaPool()->getCost(1);
|
||||
if (players[d]->snowManaG < 0)
|
||||
players[d]->snowManaG = 0;
|
||||
if (players[d]->snowManaU > players[d]->getManaPool()->getCost(2))
|
||||
players[d]->snowManaU = players[d]->getManaPool()->getCost(2);
|
||||
if (players[d]->snowManaU < 0)
|
||||
players[d]->snowManaU = 0;
|
||||
if (players[d]->snowManaR > players[d]->getManaPool()->getCost(3))
|
||||
players[d]->snowManaR = players[d]->getManaPool()->getCost(3);
|
||||
if (players[d]->snowManaR < 0)
|
||||
players[d]->snowManaR = 0;
|
||||
if (players[d]->snowManaB > players[d]->getManaPool()->getCost(4))
|
||||
players[d]->snowManaB = players[d]->getManaPool()->getCost(4);
|
||||
if (players[d]->snowManaB < 0)
|
||||
players[d]->snowManaB = 0;
|
||||
if (players[d]->snowManaW > players[d]->getManaPool()->getCost(5))
|
||||
players[d]->snowManaW = players[d]->getManaPool()->getCost(5);
|
||||
if (players[d]->snowManaW < 0)
|
||||
players[d]->snowManaW = 0;
|
||||
|
||||
MTGGameZone * dzones[] = { players[d]->game->inPlay, players[d]->game->graveyard, players[d]->game->hand, players[d]->game->library, players[d]->game->exile };
|
||||
for (int k = 0; k < 5; k++)
|
||||
{
|
||||
|
||||
@@ -233,6 +233,12 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
||||
manaCost->addExtraCost(NEW LifeorManaCost(NULL,manaType));
|
||||
break;
|
||||
}
|
||||
case 'i' :
|
||||
{
|
||||
SAFE_DELETE(tc);
|
||||
manaCost->addExtraCost(NEW SnowCost);
|
||||
break;
|
||||
}
|
||||
case 'q':
|
||||
if(value == "q")
|
||||
{
|
||||
@@ -754,6 +760,10 @@ int ManaCost::getConvertedCost()
|
||||
ExtraCost * pMana = dynamic_cast<LifeorManaCost*>(extraCosts->costs[i]);
|
||||
if (pMana)
|
||||
result++;
|
||||
//snow cost???
|
||||
ExtraCost * sMana = dynamic_cast<SnowCost*>(extraCosts->costs[i]);
|
||||
if (sMana)
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,12 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
|
||||
forcefield = 0;
|
||||
raidcount = 0;
|
||||
handmodifier = 0;
|
||||
snowManaG = 0;
|
||||
snowManaR = 0;
|
||||
snowManaB = 0;
|
||||
snowManaU = 0;
|
||||
snowManaW = 0;
|
||||
snowManaC = 0;
|
||||
prowledTypes.clear();
|
||||
doesntEmpty = NEW ManaCost();
|
||||
poolDoesntEmpty = NEW ManaCost();
|
||||
|
||||
@@ -149,7 +149,32 @@ WEventCreatureBlockerRank::WEventCreatureBlockerRank(MTGCardInstance * card, MTG
|
||||
|
||||
WEventEngageMana::WEventEngageMana(int color, MTGCardInstance* card, ManaPool * destination) :
|
||||
WEvent(), color(color), card(card), destination(destination)
|
||||
{
|
||||
{//controller snow
|
||||
if(color == 1 && card->controller()->getManaPool() == destination && card->hasType("snow"))
|
||||
card->controller()->snowManaG += 1;
|
||||
if(color == 2 && card->controller()->getManaPool() == destination && card->hasType("snow"))
|
||||
card->controller()->snowManaU += 1;
|
||||
if(color == 3 && card->controller()->getManaPool() == destination && card->hasType("snow"))
|
||||
card->controller()->snowManaR += 1;
|
||||
if(color == 4 && card->controller()->getManaPool() == destination && card->hasType("snow"))
|
||||
card->controller()->snowManaB += 1;
|
||||
if(color == 5 && card->controller()->getManaPool() == destination && card->hasType("snow"))
|
||||
card->controller()->snowManaW += 1;
|
||||
if((color == 0 || color == 6) && card->controller()->getManaPool() == destination && card->hasType("snow"))
|
||||
card->controller()->snowManaC += 1;
|
||||
//opponent snow
|
||||
if(color == 1 && card->controller()->opponent()->getManaPool() == destination && card->hasType("snow"))
|
||||
card->controller()->opponent()->snowManaG += 1;
|
||||
if(color == 2 && card->controller()->opponent()->getManaPool() == destination && card->hasType("snow"))
|
||||
card->controller()->opponent()->snowManaU += 1;
|
||||
if(color == 3 && card->controller()->opponent()->getManaPool() == destination && card->hasType("snow"))
|
||||
card->controller()->opponent()->snowManaR += 1;
|
||||
if(color == 4 && card->controller()->opponent()->getManaPool() == destination && card->hasType("snow"))
|
||||
card->controller()->opponent()->snowManaB += 1;
|
||||
if(color == 5 && card->controller()->opponent()->getManaPool() == destination && card->hasType("snow"))
|
||||
card->controller()->opponent()->snowManaW += 1;
|
||||
if((color == 0 || color == 6) && card->controller()->opponent()->getManaPool() == destination && card->hasType("snow"))
|
||||
card->controller()->opponent()->snowManaC += 1;
|
||||
}
|
||||
WEventConsumeMana::WEventConsumeMana(int color, ManaPool * source) :
|
||||
WEvent(), color(color), source(source)
|
||||
|
||||
Reference in New Issue
Block a user