added basic suspend.

syntax
suspend(number of time counter)={cost}
suspend(3)={g}
This commit is contained in:
omegablast2002@yahoo.com
2011-02-25 18:40:23 +00:00
parent 4b944bd345
commit 3f090c7be8
13 changed files with 203 additions and 16 deletions

View File

@@ -224,10 +224,11 @@ public:
TargetChooser * toTcCard, *fromTcCard;
bool once;
bool sourceUntapped;
bool isSuspended;
bool activeTrigger;
TrCardAddedToZone(int id, MTGCardInstance * source, TargetZoneChooser * toTcZone, TargetChooser * toTcCard,
TargetZoneChooser * fromTcZone = NULL, TargetChooser * fromTcCard = NULL,bool once = false,bool sourceUntapped = false) :
TriggeredAbility(id, source), toTcZone(toTcZone), fromTcZone(fromTcZone), toTcCard(toTcCard), fromTcCard(fromTcCard),once(once),sourceUntapped(sourceUntapped)
TargetZoneChooser * fromTcZone = NULL, TargetChooser * fromTcCard = NULL,bool once = false,bool sourceUntapped = false,bool isSuspended = false) :
TriggeredAbility(id, source), toTcZone(toTcZone), fromTcZone(fromTcZone), toTcCard(toTcCard), fromTcCard(fromTcCard),once(once),sourceUntapped(sourceUntapped),isSuspended(isSuspended)
{
activeTrigger = true;
}
@@ -245,6 +246,8 @@ public:
if (!e) return 0;
if(sourceUntapped && source->isTapped() == 1)
return 0;
if(isSuspended && !source->suspended)
return 0;
if(activeTrigger == false)
return 0;
if (!toTcZone->targetsZone(e->to)) return 0;

View File

@@ -96,6 +96,7 @@ class CardPrimitive {
bool hasRestriction;
int restriction;
string otherrestriction;
int suspendedTime;
vector<int>types;
CardPrimitive();

View File

@@ -119,6 +119,7 @@ class MTGAbility: public ActionElement{
ManaCost * FlashBack;
ManaCost * Retrace;
ManaCost * morph;
ManaCost * suspend;
Targetable * target;
int aType;
@@ -174,6 +175,7 @@ class MTGAbility: public ActionElement{
STANDARD_TEACH = 26,
STANDARD_TOKENCREATOR = 27,
MORPH_COST = 28,
SUSPEND_COST = 29,
};

View File

@@ -79,6 +79,7 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
int phasedTurn;
bool graveEffects;
bool exileEffects;
bool suspended;
int stillInUse();
int didattacked;

View File

@@ -115,6 +115,28 @@ public:
virtual MTGMorphCostRule * clone() const;
};
class MTGSuspendRule: public MTGAlternativeCostRule
{
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int MTGSuspendRule::receiveEvent(WEvent *e);
int reactToClick(MTGCardInstance * card);
int testDestroy();
string suspendmenu;
virtual ostream& toString(ostream& out) const;
MTGSuspendRule(int _id);
const char * getMenuText()
{
suspendmenu = "Suspend";
//char buffer[20];
//sprintf(buffer,"-%i",card->suspendedTime);
//suspendmenu.append(buffer);
//TODO:make this work so it shows "Suspend-the amount of turns"
return suspendmenu.c_str();
}
virtual MTGSuspendRule * clone() const;
};
class MTGAttackRule: public MTGAbility, public Limitor
{
public:

View File

@@ -33,7 +33,8 @@ public:
MANA_PAID_WITH_BUYBACK = 4,
MANA_PAID_WITH_FLASHBACK = 5,
MANA_PAID_WITH_RETRACE = 6,
MANA_PAID_WITH_MORPH = 7
MANA_PAID_WITH_MORPH = 7,
MANA_PAID_WITH_SUSPEND = 8
};
ExtraCosts * extraCosts;
@@ -43,6 +44,7 @@ public:
ManaCost * FlashBack;
ManaCost * Retrace;
ManaCost * morph;
ManaCost * suspend;
static ManaCost * parseManaCost(string value, ManaCost * _manacost = NULL, MTGCardInstance * c = NULL);
virtual void init();
void x();