Devotion mechanics (thanks to excessum for patch)
+ some refactoring: extrManaCost --> ExtraManaCost unattachCost --> UnattachCost
This commit is contained in:
@@ -183,7 +183,12 @@ private:
|
||||
}
|
||||
else
|
||||
{
|
||||
replace(theType.begin(), theType.end(), ':', '|');
|
||||
replace(theType.begin(), theType.end(), ':', '|');
|
||||
}
|
||||
int color = 0;
|
||||
if (theType.find("mana") != string::npos) {
|
||||
color = ManaCost::parseManaSymbol(theType[4]);
|
||||
theType.replace(0, 5, "*");
|
||||
}
|
||||
TargetChooserFactory tf(card->getObserver());
|
||||
TargetChooser * tc = tf.createTargetChooser(theType.c_str(),NULL);
|
||||
@@ -194,8 +199,17 @@ private:
|
||||
for (int k = 0; k < 4; k++)
|
||||
{
|
||||
MTGGameZone * zone = zones[k];
|
||||
if(tc->targetsZone(zone,target))
|
||||
intValue += zone->countByCanTarget(tc);
|
||||
if (tc->targetsZone(zone, target))
|
||||
{
|
||||
if (color)
|
||||
{
|
||||
intValue += zone->countTotalManaSymbols(tc, color);
|
||||
}
|
||||
else
|
||||
{
|
||||
intValue += zone->countByCanTarget(tc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SAFE_DELETE(tc);
|
||||
|
||||
@@ -61,15 +61,15 @@ public:
|
||||
};
|
||||
|
||||
//extraextra
|
||||
class extraManaCost : public ExtraCost
|
||||
class ExtraManaCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
extraManaCost(ManaCost * cost = NULL);
|
||||
ExtraManaCost(ManaCost * cost = NULL);
|
||||
virtual int tryToSetPayment(MTGCardInstance * card);
|
||||
virtual int isPaymentSet();
|
||||
virtual int canPay();
|
||||
virtual int doPay();
|
||||
virtual extraManaCost * clone() const;
|
||||
virtual ExtraManaCost * clone() const;
|
||||
};
|
||||
|
||||
class SacrificeCost : public ExtraCost
|
||||
@@ -90,15 +90,18 @@ public:
|
||||
virtual LifeCost * clone() const;
|
||||
};
|
||||
|
||||
//pyrhaixa mana
|
||||
//phyrexian mana
|
||||
class LifeorManaCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
LifeorManaCost(TargetChooser *_tc = NULL,string manaType = "");
|
||||
private:
|
||||
string manaType;
|
||||
|
||||
public:
|
||||
LifeorManaCost(TargetChooser *_tc = NULL, string manaType = "");
|
||||
virtual int canPay();
|
||||
virtual int doPay();
|
||||
virtual LifeorManaCost * clone() const;
|
||||
ManaCost * getManaCost();
|
||||
};
|
||||
|
||||
//Discard a random card cost
|
||||
@@ -157,15 +160,15 @@ public:
|
||||
};
|
||||
|
||||
//unattach cost
|
||||
class unattachCost : public ExtraCost
|
||||
class UnattachCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
unattachCost(MTGCardInstance * realSource = NULL);
|
||||
UnattachCost(MTGCardInstance * realSource = NULL);
|
||||
MTGCardInstance * rSource;
|
||||
virtual int isPaymentSet();
|
||||
virtual int canPay();
|
||||
virtual int doPay();
|
||||
virtual unattachCost * clone() const;
|
||||
virtual UnattachCost * clone() const;
|
||||
};
|
||||
//tap cost
|
||||
class TapCost : public ExtraCost
|
||||
|
||||
@@ -97,6 +97,7 @@ class MTGGameZone {
|
||||
|
||||
unsigned int countByType(const char * value);
|
||||
unsigned int countByCanTarget(TargetChooser * tc);
|
||||
unsigned int countTotalManaSymbols(TargetChooser * tc, int color);
|
||||
MTGCardInstance * findByName(string name);
|
||||
|
||||
//returns true if one of the cards in the zone has the ability
|
||||
|
||||
@@ -56,6 +56,8 @@ public:
|
||||
string alternativeName;
|
||||
bool isMulti;
|
||||
static ManaCost * parseManaCost(string value, ManaCost * _manacost = NULL, MTGCardInstance * c = NULL);
|
||||
static int parseManaSymbol(char symbol);
|
||||
|
||||
virtual void resetCosts();
|
||||
void x();
|
||||
int hasX();
|
||||
@@ -69,15 +71,17 @@ public:
|
||||
ManaCost(ManaCost * _manaCost);
|
||||
ManaCost(const ManaCost& manaCost);
|
||||
ManaCost& operator= (const ManaCost& manaCost);
|
||||
void copy (ManaCost * _manaCost);
|
||||
void copy(ManaCost * _manaCost);
|
||||
int isNull();
|
||||
int getConvertedCost();
|
||||
string toString();
|
||||
int getCost(int color);
|
||||
int getManaSymbols(int color);
|
||||
|
||||
//Returns NULL if i is greater than nbhybrids
|
||||
ManaCostHybrid * getHybridCost(unsigned int i);
|
||||
int hasColor(int color);
|
||||
int remove (int color, int value);
|
||||
int remove(int color, int value);
|
||||
int add(int color, int value);
|
||||
|
||||
//
|
||||
@@ -92,7 +96,7 @@ public:
|
||||
ExtraCost * getExtraCost(unsigned int i);
|
||||
|
||||
int addHybrid(int c1, int v1, int c2, int v2);
|
||||
int tryToPayHybrids(std::vector<ManaCostHybrid>& _hybrids, int _nbhybrids,std::vector<int16_t>& diff);
|
||||
int tryToPayHybrids(const std::vector<ManaCostHybrid> &_hybrids, int _nbhybrids, std::vector<int16_t>& diff);
|
||||
void randomDiffHybrids(ManaCost * _cost, std::vector<int16_t>& diff);
|
||||
int add(ManaCost * _cost);
|
||||
int remove(ManaCost * _cost);
|
||||
|
||||
@@ -18,6 +18,7 @@ public:
|
||||
int hasColor(int color);
|
||||
string toString();
|
||||
int getConvertedCost();
|
||||
int getManaSymbols(int color);
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& out, ManaCostHybrid& m);
|
||||
friend std::ostream& operator<<(std::ostream& out, ManaCostHybrid* m);
|
||||
|
||||
Reference in New Issue
Block a user