Files
wagic/projects/mtg/include/ExtraCost.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

255 lines
5.1 KiB
C++

#ifndef _EXTRACOST_H_
#define _EXTRACOST_H_
#include <vector>
#include "Counters.h"
#include "ObjectAnalytics.h"
#include "ManaCost.h"
using std::vector;
class TargetChooser;
class MTGCardInstance;
class MTGAbility;
class ExtraCost
#ifdef TRACK_OBJECT_USAGE
: public InstanceCounter<ExtraCost>
#endif
{
public:
TargetChooser * tc;
ManaCost * costToPay;
MTGCardInstance * source;
MTGCardInstance * target;
std::string mCostRenderString;
ExtraCost(const std::string& inCostRenderString, TargetChooser *_tc = NULL,ManaCost * _costToPay = NULL);
virtual ~ExtraCost();
virtual int setPayment(MTGCardInstance * card);
virtual int isPaymentSet()
{
return (target != NULL);
}
virtual int canPay() { return 1; }
virtual int doPay() = 0;
virtual void Render();
virtual int setSource(MTGCardInstance * _source);
virtual ExtraCost* clone() const = 0;
};
class ExtraCosts
{
public:
vector<ExtraCost *>costs;
MTGCardInstance * source;
MTGAbility * action;
ExtraCosts();
~ExtraCosts();
void Render();
int tryToSetPayment(MTGCardInstance * card);
int isPaymentSet();
int canPay();
int doPay();
int reset();
int setAction(MTGAbility * _action, MTGCardInstance * _source);
void Dump();
ExtraCosts * clone() const;
};
//extraextra
class extraManaCost : public ExtraCost
{
public:
extraManaCost(ManaCost * cost = NULL);
virtual int tryToSetPayment(MTGCardInstance * card);
virtual int isPaymentSet();
virtual int canPay();
virtual int doPay();
virtual extraManaCost * clone() const;
};
class SacrificeCost : public ExtraCost
{
public:
SacrificeCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual SacrificeCost * clone() const;
};
//life cost
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
{
public:
LifeorManaCost(TargetChooser *_tc = NULL,string manaType = "");
string manaType;
virtual int canPay();
virtual int doPay();
virtual LifeorManaCost * clone() const;
};
//Discard a random card cost
class DiscardRandomCost : public ExtraCost
{
public:
DiscardRandomCost(TargetChooser *_tc = NULL);
virtual int canPay();
virtual int doPay();
virtual DiscardRandomCost * clone() const;
};
//a choosen discard
class DiscardCost : public ExtraCost
{
public:
DiscardCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual DiscardCost * clone() const;
};
//cycle
class CycleCost : public ExtraCost
{
public:
CycleCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual CycleCost * clone() const;
};
//tolibrary cost
class ToLibraryCost : public ExtraCost
{
public:
ToLibraryCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual ToLibraryCost * clone() const;
};
//Millyourself cost
class MillCost : public ExtraCost
{
public:
MillCost(TargetChooser *_tc = NULL);
virtual int canPay();
virtual int doPay();
virtual MillCost * clone() const;
};
//Mill to exile yourself cost
class MillExileCost : public MillCost
{
public:
MillExileCost(TargetChooser *_tc = NULL);
virtual int doPay();
};
//unattach cost
class unattachCost : public ExtraCost
{
public:
unattachCost(MTGCardInstance * realSource = NULL);
MTGCardInstance * rSource;
virtual int isPaymentSet();
virtual int canPay();
virtual int doPay();
virtual unattachCost * clone() const;
};
//tap cost
class TapCost : public ExtraCost
{
public:
TapCost();
virtual int isPaymentSet();
virtual int canPay();
virtual int doPay();
virtual TapCost * clone() const;
};
//untap cost
class UnTapCost : public ExtraCost
{
public:
UnTapCost();
virtual int isPaymentSet();
virtual int canPay();
virtual int doPay();
virtual UnTapCost * clone() const;
};
//tap other cost
class TapTargetCost : public ExtraCost
{
public:
TapTargetCost(TargetChooser *_tc = NULL);
virtual int isPaymentSet();
virtual int doPay();
virtual TapTargetCost * clone() const;
};
//untap a target as cost
class UnTapTargetCost : public ExtraCost
{
public:
UnTapTargetCost(TargetChooser *_tc = NULL);
virtual int isPaymentSet();
virtual int doPay();
virtual UnTapTargetCost * clone() const;
};
//exile as cost
class ExileTargetCost : public ExtraCost
{
public:
ExileTargetCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual ExileTargetCost * clone() const;
};
//bounce cost
class BounceTargetCost : public ExtraCost
{
public:
BounceTargetCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual BounceTargetCost * clone() const;
};
//bounce cost
class Ninja : public ExtraCost
{
public:
Ninja(TargetChooser *_tc = NULL);
virtual int canPay();
virtual int isPaymentSet();
virtual int doPay();
virtual Ninja * clone() const;
};
class CounterCost : public ExtraCost
{
public:
Counter * counter;
int hasCounters;
CounterCost(Counter * _counter,TargetChooser *_tc = NULL);
~CounterCost();
virtual int setPayment(MTGCardInstance * card);
virtual int isPaymentSet();
virtual int canPay();
virtual int doPay();
virtual CounterCost * clone() const;
};
#endif