Added object analytics around ExtraCost & ManaCost; some formatting style cleanup.
This commit is contained in:
@@ -3,13 +3,19 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "Counters.h"
|
#include "Counters.h"
|
||||||
|
#include "ObjectAnalytics.h"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
class TargetChooser;
|
class TargetChooser;
|
||||||
class MTGCardInstance;
|
class MTGCardInstance;
|
||||||
class MTGAbility;
|
class MTGAbility;
|
||||||
|
|
||||||
class ExtraCost{
|
class ExtraCost
|
||||||
|
#ifdef TRACK_OBJECT_USAGE
|
||||||
|
: public InstanceCounter<ExtraCost>
|
||||||
|
#endif
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
TargetChooser * tc;
|
TargetChooser * tc;
|
||||||
MTGCardInstance * source;
|
MTGCardInstance * source;
|
||||||
@@ -18,8 +24,13 @@ public:
|
|||||||
|
|
||||||
ExtraCost(const std::string& inCostRenderString, TargetChooser *_tc = NULL);
|
ExtraCost(const std::string& inCostRenderString, TargetChooser *_tc = NULL);
|
||||||
virtual ~ExtraCost();
|
virtual ~ExtraCost();
|
||||||
|
|
||||||
virtual int setPayment(MTGCardInstance * card);
|
virtual int setPayment(MTGCardInstance * card);
|
||||||
virtual int isPaymentSet() { return (target != NULL); }
|
virtual int isPaymentSet()
|
||||||
|
{
|
||||||
|
return (target != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
virtual int canPay() { return 1; }
|
virtual int canPay() { return 1; }
|
||||||
virtual int doPay() = 0;
|
virtual int doPay() = 0;
|
||||||
virtual void Render();
|
virtual void Render();
|
||||||
@@ -27,11 +38,13 @@ public:
|
|||||||
virtual ExtraCost* clone() const = 0;
|
virtual ExtraCost* clone() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExtraCosts{
|
class ExtraCosts
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
vector<ExtraCost *>costs;
|
vector<ExtraCost *>costs;
|
||||||
MTGCardInstance * source;
|
MTGCardInstance * source;
|
||||||
MTGAbility * action;
|
MTGAbility * action;
|
||||||
|
|
||||||
ExtraCosts();
|
ExtraCosts();
|
||||||
~ExtraCosts();
|
~ExtraCosts();
|
||||||
void Render();
|
void Render();
|
||||||
@@ -45,7 +58,8 @@ public:
|
|||||||
ExtraCosts * clone() const;
|
ExtraCosts * clone() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SacrificeCost: public ExtraCost{
|
class SacrificeCost : public ExtraCost
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
SacrificeCost(TargetChooser *_tc = NULL);
|
SacrificeCost(TargetChooser *_tc = NULL);
|
||||||
virtual int doPay();
|
virtual int doPay();
|
||||||
@@ -53,15 +67,18 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//life cost
|
//life cost
|
||||||
class LifeCost: public ExtraCost{
|
class LifeCost : public ExtraCost
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
LifeCost(TargetChooser *_tc = NULL);
|
LifeCost(TargetChooser *_tc = NULL);
|
||||||
virtual int canPay();
|
virtual int canPay();
|
||||||
virtual int doPay();
|
virtual int doPay();
|
||||||
virtual LifeCost * clone() const;
|
virtual LifeCost * clone() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
//pyrhaixa mana
|
//pyrhaixa mana
|
||||||
class LifeorManaCost: public ExtraCost{
|
class LifeorManaCost : public ExtraCost
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
LifeorManaCost(TargetChooser *_tc = NULL,string manaType = "");
|
LifeorManaCost(TargetChooser *_tc = NULL,string manaType = "");
|
||||||
string manaType;
|
string manaType;
|
||||||
@@ -69,8 +86,10 @@ public:
|
|||||||
virtual int doPay();
|
virtual int doPay();
|
||||||
virtual LifeorManaCost * clone() const;
|
virtual LifeorManaCost * clone() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Discard a random card cost
|
//Discard a random card cost
|
||||||
class DiscardRandomCost: public ExtraCost{
|
class DiscardRandomCost : public ExtraCost
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
DiscardRandomCost(TargetChooser *_tc = NULL);
|
DiscardRandomCost(TargetChooser *_tc = NULL);
|
||||||
virtual int canPay();
|
virtual int canPay();
|
||||||
@@ -79,7 +98,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//a choosen discard
|
//a choosen discard
|
||||||
class DiscardCost: public ExtraCost{
|
class DiscardCost : public ExtraCost
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
DiscardCost(TargetChooser *_tc = NULL);
|
DiscardCost(TargetChooser *_tc = NULL);
|
||||||
virtual int doPay();
|
virtual int doPay();
|
||||||
@@ -87,7 +107,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//tolibrary cost
|
//tolibrary cost
|
||||||
class ToLibraryCost: public ExtraCost{
|
class ToLibraryCost : public ExtraCost
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
ToLibraryCost(TargetChooser *_tc = NULL);
|
ToLibraryCost(TargetChooser *_tc = NULL);
|
||||||
virtual int doPay();
|
virtual int doPay();
|
||||||
@@ -95,7 +116,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//Millyourself cost
|
//Millyourself cost
|
||||||
class MillCost: public ExtraCost{
|
class MillCost : public ExtraCost
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
MillCost(TargetChooser *_tc = NULL);
|
MillCost(TargetChooser *_tc = NULL);
|
||||||
virtual int canPay();
|
virtual int canPay();
|
||||||
@@ -104,13 +126,16 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//Mill to exile yourself cost
|
//Mill to exile yourself cost
|
||||||
class MillExileCost: public MillCost{
|
class MillExileCost : public MillCost
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
MillExileCost(TargetChooser *_tc = NULL);
|
MillExileCost(TargetChooser *_tc = NULL);
|
||||||
virtual int doPay();
|
virtual int doPay();
|
||||||
};
|
};
|
||||||
|
|
||||||
//tap cost
|
//tap cost
|
||||||
class TapCost: public ExtraCost{
|
class TapCost : public ExtraCost
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
TapCost();
|
TapCost();
|
||||||
virtual int isPaymentSet();
|
virtual int isPaymentSet();
|
||||||
@@ -118,8 +143,10 @@ public:
|
|||||||
virtual int doPay();
|
virtual int doPay();
|
||||||
virtual TapCost * clone() const;
|
virtual TapCost * clone() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
//untap cost
|
//untap cost
|
||||||
class UnTapCost: public ExtraCost{
|
class UnTapCost : public ExtraCost
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
UnTapCost();
|
UnTapCost();
|
||||||
virtual int isPaymentSet();
|
virtual int isPaymentSet();
|
||||||
@@ -127,8 +154,10 @@ public:
|
|||||||
virtual int doPay();
|
virtual int doPay();
|
||||||
virtual UnTapCost * clone() const;
|
virtual UnTapCost * clone() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
//tap other cost
|
//tap other cost
|
||||||
class TapTargetCost: public ExtraCost{
|
class TapTargetCost : public ExtraCost
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
TapTargetCost(TargetChooser *_tc = NULL);
|
TapTargetCost(TargetChooser *_tc = NULL);
|
||||||
virtual int isPaymentSet();
|
virtual int isPaymentSet();
|
||||||
@@ -137,7 +166,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//exile as cost
|
//exile as cost
|
||||||
class ExileTargetCost: public ExtraCost{
|
class ExileTargetCost : public ExtraCost
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
ExileTargetCost(TargetChooser *_tc = NULL);
|
ExileTargetCost(TargetChooser *_tc = NULL);
|
||||||
virtual int doPay();
|
virtual int doPay();
|
||||||
@@ -145,7 +175,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//bounce cost
|
//bounce cost
|
||||||
class BounceTargetCost: public ExtraCost{
|
class BounceTargetCost : public ExtraCost
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
BounceTargetCost(TargetChooser *_tc = NULL);
|
BounceTargetCost(TargetChooser *_tc = NULL);
|
||||||
virtual int doPay();
|
virtual int doPay();
|
||||||
@@ -153,7 +184,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//bounce cost
|
//bounce cost
|
||||||
class Ninja: public ExtraCost{
|
class Ninja : public ExtraCost
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
Ninja(TargetChooser *_tc = NULL);
|
Ninja(TargetChooser *_tc = NULL);
|
||||||
virtual int isPaymentSet();
|
virtual int isPaymentSet();
|
||||||
@@ -161,7 +193,8 @@ public:
|
|||||||
virtual Ninja * clone() const;
|
virtual Ninja * clone() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CounterCost: public ExtraCost{
|
class CounterCost : public ExtraCost
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
Counter * counter;
|
Counter * counter;
|
||||||
int hasCounters;
|
int hasCounters;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "MTGDefinitions.h"
|
#include "MTGDefinitions.h"
|
||||||
|
#include "ObjectAnalytics.h"
|
||||||
|
|
||||||
class ManaCostHybrid;
|
class ManaCostHybrid;
|
||||||
class ExtraCosts;
|
class ExtraCosts;
|
||||||
@@ -12,7 +12,11 @@ class MTGAbility;
|
|||||||
class MTGCardInstance;
|
class MTGCardInstance;
|
||||||
class Player;
|
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);
|
||||||
friend std::ostream& operator<<(std::ostream& out, ManaCost* m);
|
friend std::ostream& operator<<(std::ostream& out, ManaCost* m);
|
||||||
|
|||||||
@@ -7,8 +7,10 @@
|
|||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "Counters.h"
|
#include "Counters.h"
|
||||||
|
|
||||||
ExtraCost::ExtraCost(const std::string& inCostRenderString, TargetChooser *_tc) :
|
SUPPORT_OBJECT_ANALYTICS(ExtraCost)
|
||||||
tc(_tc), source(NULL), target(NULL), mCostRenderString(inCostRenderString)
|
|
||||||
|
ExtraCost::ExtraCost(const std::string& inCostRenderString, TargetChooser *_tc)
|
||||||
|
: tc(_tc), source(NULL), target(NULL), mCostRenderString(inCostRenderString)
|
||||||
{
|
{
|
||||||
if (tc)
|
if (tc)
|
||||||
tc->targetter = NULL;
|
tc->targetter = NULL;
|
||||||
@@ -25,7 +27,7 @@ int ExtraCost::setSource(MTGCardInstance * _source)
|
|||||||
if (tc)
|
if (tc)
|
||||||
{
|
{
|
||||||
tc->source = _source;
|
tc->source = _source;
|
||||||
// "extra cost is not targetting, protections do not apply" this is not cryptic at all :) make an ability you will understand it then. this keeps the target chooser from being unable to select a creature with shroud/protections.
|
// this keeps the target chooser from being unable to select a creature with shroud/protections.
|
||||||
tc->targetter = NULL;
|
tc->targetter = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -69,20 +71,20 @@ LifeCost * LifeCost::clone() const
|
|||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
LifeCost::LifeCost(TargetChooser *_tc) :
|
LifeCost::LifeCost(TargetChooser *_tc)
|
||||||
ExtraCost("Life", _tc)
|
: ExtraCost("Life", _tc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int LifeCost::canPay()
|
int LifeCost::canPay()
|
||||||
|
{
|
||||||
|
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||||
|
if(_target->controller()->life <= 0)
|
||||||
{
|
{
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
return 0;
|
||||||
if(_target->controller()->life <= 0)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int LifeCost::doPay()
|
int LifeCost::doPay()
|
||||||
{
|
{
|
||||||
@@ -97,6 +99,7 @@ int LifeCost::doPay()
|
|||||||
tc->initTargets();
|
tc->initTargets();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//life or Mana cost
|
//life or Mana cost
|
||||||
LifeorManaCost * LifeorManaCost::clone() const
|
LifeorManaCost * LifeorManaCost::clone() const
|
||||||
{
|
{
|
||||||
@@ -106,26 +109,26 @@ LifeorManaCost * LifeorManaCost::clone() const
|
|||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
LifeorManaCost::LifeorManaCost(TargetChooser *_tc,string manaType) :
|
LifeorManaCost::LifeorManaCost(TargetChooser *_tc,string manaType)
|
||||||
ExtraCost("Phyrexian Mana", _tc),manaType(manaType)
|
: ExtraCost("Phyrexian Mana", _tc), manaType(manaType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int LifeorManaCost::canPay()
|
int LifeorManaCost::canPay()
|
||||||
|
{
|
||||||
|
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||||
|
string buildType ="{";
|
||||||
|
buildType.append(manaType);
|
||||||
|
buildType.append("}");
|
||||||
|
ManaCost * newCost = ManaCost::parseManaCost(buildType);
|
||||||
|
if(_target->controller()->getManaPool()->canAfford(newCost) || _target->controller()->life > 1)
|
||||||
{
|
{
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
SAFE_DELETE(newCost);
|
||||||
string buildType ="{";
|
return 1;
|
||||||
buildType.append(manaType);
|
|
||||||
buildType.append("}");
|
|
||||||
ManaCost * newCost = ManaCost::parseManaCost(buildType);
|
|
||||||
if(_target->controller()->getManaPool()->canAfford(newCost) || _target->controller()->life > 1)
|
|
||||||
{
|
|
||||||
SAFE_DELETE(newCost);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
SAFE_DELETE(newCost);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
SAFE_DELETE(newCost);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int LifeorManaCost::doPay()
|
int LifeorManaCost::doPay()
|
||||||
{
|
{
|
||||||
@@ -161,8 +164,8 @@ DiscardRandomCost * DiscardRandomCost::clone() const
|
|||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
DiscardRandomCost::DiscardRandomCost(TargetChooser *_tc) :
|
DiscardRandomCost::DiscardRandomCost(TargetChooser *_tc)
|
||||||
ExtraCost("Discard Random", _tc)
|
: ExtraCost("Discard Random", _tc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +204,7 @@ DiscardCost * DiscardCost::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
DiscardCost::DiscardCost(TargetChooser *_tc) :
|
DiscardCost::DiscardCost(TargetChooser *_tc) :
|
||||||
ExtraCost("Choose card to Discard", _tc)
|
ExtraCost("Choose card to Discard", _tc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,8 +234,8 @@ ToLibraryCost * ToLibraryCost::clone() const
|
|||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToLibraryCost::ToLibraryCost(TargetChooser *_tc) :
|
ToLibraryCost::ToLibraryCost(TargetChooser *_tc)
|
||||||
ExtraCost("Put a card on top of Library", _tc)
|
: ExtraCost("Put a card on top of Library", _tc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,8 +262,8 @@ MillCost * MillCost::clone() const
|
|||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
MillCost::MillCost(TargetChooser *_tc) :
|
MillCost::MillCost(TargetChooser *_tc)
|
||||||
ExtraCost("Deplete", _tc)
|
: ExtraCost("Deplete", _tc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,8 +282,8 @@ int MillCost::doPay()
|
|||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
_target->controller()->game->putInZone(
|
_target->controller()->game->putInZone(
|
||||||
_target->controller()->game->library->cards[_target->controller()->game->library->nb_cards - 1],
|
_target->controller()->game->library->cards[_target->controller()->game->library->nb_cards - 1],
|
||||||
_target->controller()->game->library, _target->controller()->game->graveyard);
|
_target->controller()->game->library, _target->controller()->game->graveyard);
|
||||||
target = NULL;
|
target = NULL;
|
||||||
if (tc)
|
if (tc)
|
||||||
tc->initTargets();
|
tc->initTargets();
|
||||||
@@ -289,8 +292,8 @@ int MillCost::doPay()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MillExileCost::MillExileCost(TargetChooser *_tc) :
|
MillExileCost::MillExileCost(TargetChooser *_tc)
|
||||||
MillCost(_tc)
|
: MillCost(_tc)
|
||||||
{
|
{
|
||||||
// override the base string here
|
// override the base string here
|
||||||
mCostRenderString = "Deplete To Exile";
|
mCostRenderString = "Deplete To Exile";
|
||||||
@@ -302,8 +305,8 @@ int MillExileCost::doPay()
|
|||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
_target->controller()->game->putInZone(
|
_target->controller()->game->putInZone(
|
||||||
_target->controller()->game->library->cards[_target->controller()->game->library->nb_cards - 1],
|
_target->controller()->game->library->cards[_target->controller()->game->library->nb_cards - 1],
|
||||||
_target->controller()->game->library, _target->controller()->game->exile);
|
_target->controller()->game->library, _target->controller()->game->exile);
|
||||||
target = NULL;
|
target = NULL;
|
||||||
if (tc)
|
if (tc)
|
||||||
tc->initTargets();
|
tc->initTargets();
|
||||||
@@ -319,8 +322,8 @@ TapCost * TapCost::clone() const
|
|||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
TapCost::TapCost() :
|
TapCost::TapCost()
|
||||||
ExtraCost("Tap")
|
: ExtraCost("Tap")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,7 +359,7 @@ UnTapCost * UnTapCost::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
UnTapCost::UnTapCost() :
|
UnTapCost::UnTapCost() :
|
||||||
ExtraCost("UnTap")
|
ExtraCost("UnTap")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,8 +397,8 @@ TapTargetCost * TapTargetCost::clone() const
|
|||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
TapTargetCost::TapTargetCost(TargetChooser *_tc) :
|
TapTargetCost::TapTargetCost(TargetChooser *_tc)
|
||||||
ExtraCost("Tap Target", _tc)
|
: ExtraCost("Tap Target", _tc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,8 +439,8 @@ ExileTargetCost * ExileTargetCost::clone() const
|
|||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExileTargetCost::ExileTargetCost(TargetChooser *_tc) :
|
ExileTargetCost::ExileTargetCost(TargetChooser *_tc)
|
||||||
ExtraCost("Exile Target", _tc)
|
: ExtraCost("Exile Target", _tc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,8 +467,8 @@ BounceTargetCost * BounceTargetCost::clone() const
|
|||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
BounceTargetCost::BounceTargetCost(TargetChooser *_tc) :
|
BounceTargetCost::BounceTargetCost(TargetChooser *_tc)
|
||||||
ExtraCost("Return Target to Hand", _tc)
|
: ExtraCost("Return Target to Hand", _tc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,7 +496,7 @@ Ninja * Ninja::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ninja::Ninja(TargetChooser *_tc) :
|
Ninja::Ninja(TargetChooser *_tc) :
|
||||||
ExtraCost("Select unblocked attacker", _tc)
|
ExtraCost("Select unblocked attacker", _tc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -502,7 +505,7 @@ int Ninja::isPaymentSet()
|
|||||||
GameObserver * g = GameObserver::GetInstance();
|
GameObserver * g = GameObserver::GetInstance();
|
||||||
int currentPhase = g->getCurrentGamePhase();
|
int currentPhase = g->getCurrentGamePhase();
|
||||||
if (target && ((target->isAttacker() && target->blocked) || target->isAttacker() < 1 || currentPhase
|
if (target && ((target->isAttacker() && target->blocked) || target->isAttacker() < 1 || currentPhase
|
||||||
!= Constants::MTG_PHASE_COMBATBLOCKERS))
|
!= Constants::MTG_PHASE_COMBATBLOCKERS))
|
||||||
{
|
{
|
||||||
tc->removeTarget(target);
|
tc->removeTarget(target);
|
||||||
target = NULL;
|
target = NULL;
|
||||||
@@ -515,7 +518,6 @@ int Ninja::isPaymentSet()
|
|||||||
|
|
||||||
int Ninja::doPay()
|
int Ninja::doPay()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
target->controller()->game->putInHand(target);
|
target->controller()->game->putInHand(target);
|
||||||
@@ -538,8 +540,8 @@ SacrificeCost * SacrificeCost::clone() const
|
|||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
SacrificeCost::SacrificeCost(TargetChooser *_tc) :
|
SacrificeCost::SacrificeCost(TargetChooser *_tc)
|
||||||
ExtraCost("Sacrifice", _tc)
|
: ExtraCost("Sacrifice", _tc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,12 +570,12 @@ CounterCost * CounterCost::clone() const
|
|||||||
ec->tc = tc->clone();
|
ec->tc = tc->clone();
|
||||||
if (counter)
|
if (counter)
|
||||||
ec->counter = NEW Counter(counter->target, counter->name.c_str(), counter->power, counter->toughness);
|
ec->counter = NEW Counter(counter->target, counter->name.c_str(), counter->power, counter->toughness);
|
||||||
ec->counter->nb = counter->nb;
|
ec->counter->nb = counter->nb;
|
||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
CounterCost::CounterCost(Counter * _counter, TargetChooser *_tc) :
|
CounterCost::CounterCost(Counter * _counter, TargetChooser *_tc) :
|
||||||
ExtraCost("Counters", _tc)
|
ExtraCost("Counters", _tc)
|
||||||
{
|
{
|
||||||
counter = _counter;
|
counter = _counter;
|
||||||
hasCounters = 0;
|
hasCounters = 0;
|
||||||
@@ -759,8 +761,8 @@ int ExtraCosts::doPay()
|
|||||||
int result = 0;
|
int result = 0;
|
||||||
for (size_t i = 0; i < costs.size(); i++)
|
for (size_t i = 0; i < costs.size(); i++)
|
||||||
{
|
{
|
||||||
if(costs[i]->target)
|
if(costs[i]->target)
|
||||||
costs[i]->target->isExtraCostTarget = false;
|
costs[i]->target->isExtraCostTarget = false;
|
||||||
result += costs[i]->doPay();
|
result += costs[i]->doPay();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "WEvent.h"
|
#include "WEvent.h"
|
||||||
#include "MTGAbility.h"
|
#include "MTGAbility.h"
|
||||||
|
|
||||||
|
SUPPORT_OBJECT_ANALYTICS(ManaCost)
|
||||||
|
|
||||||
ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstance * c)
|
ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstance * c)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#include "PrecompiledHeader.h"
|
#include "PrecompiledHeader.h"
|
||||||
|
|
||||||
#include "ObjectAnalytics.h"
|
#include "ObjectAnalytics.h"
|
||||||
|
|
||||||
#include "CardPrimitive.h"
|
#include "CardPrimitive.h"
|
||||||
#include "DebugRoutines.h"
|
#include "DebugRoutines.h"
|
||||||
|
#include "ExtraCost.h"
|
||||||
|
#include "ManaCost.h"
|
||||||
#include "MTGCard.h"
|
#include "MTGCard.h"
|
||||||
#include "MTGCardInstance.h"
|
#include "MTGCardInstance.h"
|
||||||
|
|
||||||
@@ -30,6 +32,16 @@ namespace ObjectAnalytics
|
|||||||
DebugTrace("MTGCardInstance max count: " << InstanceCounter<MTGCardInstance>::GetMaximumObjectCount());
|
DebugTrace("MTGCardInstance max count: " << InstanceCounter<MTGCardInstance>::GetMaximumObjectCount());
|
||||||
DebugTrace("MTGCardInstance max byte usage: " << InstanceCounter<MTGCardInstance>::GetMaximumByteCount() << std::endl);
|
DebugTrace("MTGCardInstance max byte usage: " << InstanceCounter<MTGCardInstance>::GetMaximumByteCount() << std::endl);
|
||||||
|
|
||||||
|
DebugTrace("ManaCost current count: " << InstanceCounter<ManaCost>::GetCurrentObjectCount());
|
||||||
|
DebugTrace("ManaCost current byte usage: " << InstanceCounter<ManaCost>::GetCurrentByteCount());
|
||||||
|
DebugTrace("ManaCost max count: " << InstanceCounter<ManaCost>::GetMaximumObjectCount());
|
||||||
|
DebugTrace("ManaCost max byte usage: " << InstanceCounter<ManaCost>::GetMaximumByteCount() << std::endl);
|
||||||
|
|
||||||
|
DebugTrace("ExtraCost current count: " << InstanceCounter<ExtraCost>::GetCurrentObjectCount());
|
||||||
|
DebugTrace("ExtraCost current byte usage: " << InstanceCounter<ExtraCost>::GetCurrentByteCount());
|
||||||
|
DebugTrace("ExtraCost max count: " << InstanceCounter<ExtraCost>::GetMaximumObjectCount());
|
||||||
|
DebugTrace("ExtraCost max byte usage: " << InstanceCounter<ExtraCost>::GetMaximumByteCount() << std::endl);
|
||||||
|
|
||||||
DebugTrace("-----------------------------------------------------------");
|
DebugTrace("-----------------------------------------------------------");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user