Added object analytics around ExtraCost & ManaCost; some formatting style cleanup.
This commit is contained in:
@@ -3,13 +3,19 @@
|
||||
|
||||
#include <vector>
|
||||
#include "Counters.h"
|
||||
#include "ObjectAnalytics.h"
|
||||
|
||||
using std::vector;
|
||||
|
||||
class TargetChooser;
|
||||
class MTGCardInstance;
|
||||
class MTGAbility;
|
||||
|
||||
class ExtraCost{
|
||||
class ExtraCost
|
||||
#ifdef TRACK_OBJECT_USAGE
|
||||
: public InstanceCounter<ExtraCost>
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
TargetChooser * tc;
|
||||
MTGCardInstance * source;
|
||||
@@ -18,8 +24,13 @@ public:
|
||||
|
||||
ExtraCost(const std::string& inCostRenderString, TargetChooser *_tc = NULL);
|
||||
virtual ~ExtraCost();
|
||||
|
||||
virtual int setPayment(MTGCardInstance * card);
|
||||
virtual int isPaymentSet() { return (target != NULL); }
|
||||
virtual int isPaymentSet()
|
||||
{
|
||||
return (target != NULL);
|
||||
}
|
||||
|
||||
virtual int canPay() { return 1; }
|
||||
virtual int doPay() = 0;
|
||||
virtual void Render();
|
||||
@@ -27,11 +38,13 @@ public:
|
||||
virtual ExtraCost* clone() const = 0;
|
||||
};
|
||||
|
||||
class ExtraCosts{
|
||||
class ExtraCosts
|
||||
{
|
||||
public:
|
||||
vector<ExtraCost *>costs;
|
||||
MTGCardInstance * source;
|
||||
MTGAbility * action;
|
||||
|
||||
ExtraCosts();
|
||||
~ExtraCosts();
|
||||
void Render();
|
||||
@@ -45,7 +58,8 @@ public:
|
||||
ExtraCosts * clone() const;
|
||||
};
|
||||
|
||||
class SacrificeCost: public ExtraCost{
|
||||
class SacrificeCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
SacrificeCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
@@ -53,15 +67,18 @@ public:
|
||||
};
|
||||
|
||||
//life cost
|
||||
class LifeCost: public ExtraCost{
|
||||
class LifeCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
LifeCost(TargetChooser *_tc = NULL);
|
||||
virtual int canPay();
|
||||
virtual int doPay();
|
||||
virtual LifeCost * clone() const;
|
||||
};
|
||||
|
||||
//pyrhaixa mana
|
||||
class LifeorManaCost: public ExtraCost{
|
||||
class LifeorManaCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
LifeorManaCost(TargetChooser *_tc = NULL,string manaType = "");
|
||||
string manaType;
|
||||
@@ -69,8 +86,10 @@ public:
|
||||
virtual int doPay();
|
||||
virtual LifeorManaCost * clone() const;
|
||||
};
|
||||
|
||||
//Discard a random card cost
|
||||
class DiscardRandomCost: public ExtraCost{
|
||||
class DiscardRandomCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
DiscardRandomCost(TargetChooser *_tc = NULL);
|
||||
virtual int canPay();
|
||||
@@ -79,7 +98,8 @@ public:
|
||||
};
|
||||
|
||||
//a choosen discard
|
||||
class DiscardCost: public ExtraCost{
|
||||
class DiscardCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
DiscardCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
@@ -87,7 +107,8 @@ public:
|
||||
};
|
||||
|
||||
//tolibrary cost
|
||||
class ToLibraryCost: public ExtraCost{
|
||||
class ToLibraryCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
ToLibraryCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
@@ -95,7 +116,8 @@ public:
|
||||
};
|
||||
|
||||
//Millyourself cost
|
||||
class MillCost: public ExtraCost{
|
||||
class MillCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
MillCost(TargetChooser *_tc = NULL);
|
||||
virtual int canPay();
|
||||
@@ -104,13 +126,16 @@ public:
|
||||
};
|
||||
|
||||
//Mill to exile yourself cost
|
||||
class MillExileCost: public MillCost{
|
||||
class MillExileCost : public MillCost
|
||||
{
|
||||
public:
|
||||
MillExileCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
};
|
||||
|
||||
//tap cost
|
||||
class TapCost: public ExtraCost{
|
||||
class TapCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
TapCost();
|
||||
virtual int isPaymentSet();
|
||||
@@ -118,8 +143,10 @@ public:
|
||||
virtual int doPay();
|
||||
virtual TapCost * clone() const;
|
||||
};
|
||||
|
||||
//untap cost
|
||||
class UnTapCost: public ExtraCost{
|
||||
class UnTapCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
UnTapCost();
|
||||
virtual int isPaymentSet();
|
||||
@@ -127,8 +154,10 @@ public:
|
||||
virtual int doPay();
|
||||
virtual UnTapCost * clone() const;
|
||||
};
|
||||
|
||||
//tap other cost
|
||||
class TapTargetCost: public ExtraCost{
|
||||
class TapTargetCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
TapTargetCost(TargetChooser *_tc = NULL);
|
||||
virtual int isPaymentSet();
|
||||
@@ -137,7 +166,8 @@ public:
|
||||
};
|
||||
|
||||
//exile as cost
|
||||
class ExileTargetCost: public ExtraCost{
|
||||
class ExileTargetCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
ExileTargetCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
@@ -145,7 +175,8 @@ public:
|
||||
};
|
||||
|
||||
//bounce cost
|
||||
class BounceTargetCost: public ExtraCost{
|
||||
class BounceTargetCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
BounceTargetCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
@@ -153,7 +184,8 @@ public:
|
||||
};
|
||||
|
||||
//bounce cost
|
||||
class Ninja: public ExtraCost{
|
||||
class Ninja : public ExtraCost
|
||||
{
|
||||
public:
|
||||
Ninja(TargetChooser *_tc = NULL);
|
||||
virtual int isPaymentSet();
|
||||
@@ -161,7 +193,8 @@ public:
|
||||
virtual Ninja * clone() const;
|
||||
};
|
||||
|
||||
class CounterCost: public ExtraCost{
|
||||
class CounterCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
Counter * counter;
|
||||
int hasCounters;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "utils.h"
|
||||
#include "MTGDefinitions.h"
|
||||
|
||||
#include "ObjectAnalytics.h"
|
||||
|
||||
class ManaCostHybrid;
|
||||
class ExtraCosts;
|
||||
@@ -12,7 +12,11 @@ class MTGAbility;
|
||||
class MTGCardInstance;
|
||||
class Player;
|
||||
|
||||
class ManaCost{
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user