Files
wagic/projects/mtg/include/ManaCost.h
omegablast2002@yahoo.com b61cd2f69a megapatch contents
added
"whenever a creature enters the battlefield you may pay {1}, if you do gain one life"
conditional may pay({cost}) effect 
this version is a super type ability, and can only be used in certain combos.

to nest you will need to use it in its subtype pay[[{cost}]] effect
pay keyword can have sideeffects coded as follows
pay[[{1}]] life:1?life:-1
pay one mana and gain 1 life, if you dont then you lose one life. notice no space between the abilities and the question mark.

added castcard()
a method to cast a targeted card, this contains the following subkeywords which can be used in combinations
(normal)
(restricted)
(copied)
(noevent)
castcard(restricted copied noevent) for example will cast a card that is a copy or the spell without sending a cast event only when the spell is castable.
"normal" subkeyword cast the actual spell, not a copy.

extended the use of exiledeath to everyzone, any card going from any zone to graveyard is placed in exile if it has exiledeath.

limited swipe left to open hand only when hand is closed view.

"moveto(" can now be named.
2013-06-18 01:41:34 +00:00

128 lines
3.3 KiB
C++

#ifndef _MANACOST_H_
#define _MANACOST_H_
#include "utils.h"
#include "MTGDefinitions.h"
#include "ObjectAnalytics.h"
class ManaCostHybrid;
class ExtraCosts;
class ExtraCost;
class MTGAbility;
class MTGCardInstance;
class Player;
class ManaCost
#ifdef TRACK_OBJECT_USAGE
: public InstanceCounter<ManaCost>
#endif
{
friend std::ostream& operator<<(std::ostream& out, ManaCost& m);
friend std::ostream& operator<<(std::ostream& out, ManaCost* m);
friend std::ostream& operator<<(std::ostream& out, ManaCost m);
protected:
std::vector<int16_t> cost;
std::vector<ManaCostHybrid> hybrids;
virtual void init();
public:
enum
{
MANA_UNPAID = 0,
MANA_PAID = 1,
MANA_PAID_WITH_KICKER = 2,
MANA_PAID_WITH_ALTERNATIVE = 3,
MANA_PAID_WITH_BUYBACK = 4,
MANA_PAID_WITH_FLASHBACK = 5,
MANA_PAID_WITH_RETRACE = 6,
MANA_PAID_WITH_MORPH = 7,
MANA_PAID_WITH_SUSPEND = 8
};
ExtraCosts * extraCosts;
ManaCost * kicker;
ManaCost * alternative;
ManaCost * BuyBack;
ManaCost * FlashBack;
ManaCost * Retrace;
ManaCost * morph;
ManaCost * suspend;
ManaCost * manaUsedToCast;
string alternativeName;
bool isMulti;
static ManaCost * parseManaCost(string value, ManaCost * _manacost = NULL, MTGCardInstance * c = NULL);
virtual void resetCosts();
void x();
int hasX();
void specificX(int color = 0);
int hasSpecificX();
int xColor;
int hasAnotherCost();
ManaCost(std::vector<int16_t>& _cost, int nb_elems = 1);
ManaCost();
virtual ~ManaCost();
ManaCost(ManaCost * _manaCost);
ManaCost(const ManaCost& manaCost);
ManaCost& operator= (const ManaCost& manaCost);
void copy (ManaCost * _manaCost);
int isNull();
int getConvertedCost();
string toString();
int getCost(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 add(int color, int value);
//
// Extra Costs (sacrifice,counters...)
//
int addExtraCost(ExtraCost * _cost);
int addExtraCosts(ExtraCosts *_cost);
int setExtraCostsAction(MTGAbility * action, MTGCardInstance * card);
int isExtraPaymentSet();
int canPayExtra();
int doPayExtra();
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);
void randomDiffHybrids(ManaCost * _cost, std::vector<int16_t>& diff);
int add(ManaCost * _cost);
int remove(ManaCost * _cost);
int removeAll(int color);
int pay (ManaCost * _cost);
//return 1 if _cost can be paid with current data, 0 otherwise
int canAfford(ManaCost * _cost);
int isPositive();
ManaCost * Diff(ManaCost * _cost);
#ifdef WIN32
void Dump();
#endif
};
class ManaPool:public ManaCost{
protected:
Player * player;
public:
void Empty();
ManaPool(Player * player);
ManaPool(ManaCost * _manaCost, Player * player);
int remove (int color, int value);
int add(int color, int value, MTGCardInstance * source = NULL);
int add(ManaCost * _cost, MTGCardInstance * source = NULL);
int pay (ManaCost * _cost);
};
#endif