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

239 lines
6.6 KiB
C++

#ifndef _MTG_CARD_INSTANCE_H_
#define _MTG_CARD_INSTANCE_H_
#include "MTGCard.h"
#include "CardPrimitive.h"
#include "MTGGameZones.h"
#include "MTGAbility.h"
#include "WResourceManager.h"
#include "ManaCost.h"
#include "Damage.h"
#include "Targetable.h"
class MTGCardInstance;
class MTGPlayerCards;
class MTGAbility;
class MTGCard;
class ManaCost;
class UntapBlockers;
class CardDescriptor;
class Counters;
struct Pos;
#include <list>
using namespace std;
class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable
#ifdef TRACK_OBJECT_USAGE
, public InstanceCounter<MTGCardInstance>
#endif
{
private:
bool blocked; //Blocked this turn or not?
protected:
int untapping;
int nb_damages;
string sample;
int tapped;
int lifeOrig;
MTGPlayerCards * belongs_to;
MTGCardInstance * getNextPartner();
void initMTGCI();
int addBlocker(MTGCardInstance * c);
int removeBlocker(MTGCardInstance * c);
int init();
public:
vector<MTGCardInstance*>parentCards;
vector<MTGCardInstance*>childrenCards;
vector<MTGAbility *>cardsAbilities;
int setAttacker(int value);
int setDefenser(MTGCardInstance * c);
MTGGameZone * currentZone;
Pos* view;
int X;
int castX;
int alternateCostPaid[ManaCost::MANA_PAID_WITH_SUSPEND + 1];
int paymenttype;
int castMethod; /* Tells if the card reached its current zone by being cast or not (brought into the zone by an effect). non 0 == cast, 0 == not cast */
int frozen;
int sunburst;
int equipment;
int auras;
bool wasDealtDamage;
bool damageToOpponent;
bool damageToController;
bool mPropertiesChangedSinceLastUpdate;
int reduxamount;
int flanked;
int regenerateTokens;
int isToken;
int origpower;
int origtoughness;
int isMultiColored;
int isLeveler;
bool enchanted;
int CDenchanted;
int CDdamaged;
bool blinked;
bool isExtraCostTarget;
bool morphed;
bool turningOver;
bool isMorphed;
bool isFlipped;
bool isPhased;
int phasedTurn;
bool graveEffects;
bool exileEffects;
bool suspended;
bool miracle;
int chooseacolor;
string chooseasubtype;
int coinSide;//1 = tails
int stillInUse();
int didattacked;
int didblocked;
int notblocked;
int fresh;
int MaxLevelUp;
int kicked;
int dredge;
bool isDualWielding;
bool stillNeeded;
Player * lastController;
MTGGameZone * getCurrentZone();
MTGGameZone * previousZone;
MTGCardInstance * previous;
MTGCardInstance * next;
int doDamageTest;
bool skipDamageTestOnce;
int summoningSickness;
ManaCost reducedCost;
ManaCost increasedCost;
ManaCost * getReducedManaCost();
ManaCost * getIncreasedManaCost();
bool matchesCastFilter(int castMethod);
// The recommended method to test for summoning Sickness !
int hasSummoningSickness();
MTGCardInstance * changeController(Player * newcontroller,bool notZone = false);
Player * owner;
Counters * counters;
const string getDisplayName() const;
MTGCardInstance * target;
Player * playerTarget;
vector<Targetable *> backupTargets;
//types
void addType(char * type_text);
virtual void addType(int id);
void setType(const char * type_text);
void setSubtype( string value);
int removeType(string value, int removeAll = 0);
int removeType(int value, int removeAll = 0);
//dangerranking is a hint to Ai which creatures are the ones it should be targetting for effects.
int DangerRanking();
//Combat
bool isBlocked() {return blocked;}; //Blocked this turn or not?
MTGCardInstance * defenser;
list<MTGCardInstance *>blockers;
int attacker;
int toggleDefenser(MTGCardInstance * opponent);
int raiseBlockerRankOrder(MTGCardInstance * blocker);
//Returns rank of the card in blockers if it is a blocker of this (starting at 1), 0 otherwise
int getDefenserRank(MTGCardInstance * blocker);
int toggleAttacker();
MTGCardInstance * banding; // If belongs to a band when attacking
int canBlock();
int canBlock(MTGCardInstance * opponent);
int canAttack();
int isAttacker();
Targetable * isAttacking;
MTGCardInstance * storedCard;
MTGCardInstance * myPair;
MTGCardInstance * createSnapShot();
MTGCardInstance * storedSourceCard;
MTGCardInstance * isDefenser();
int initAttackersDefensers();
MTGCardInstance * getNextOpponent(MTGCardInstance * previous=NULL);
int nbOpponents();
int stepPower(CombatStep step);
int afterDamage();
int has(int ability);
int cleanup();
MTGCard * model;
MTGCardInstance();
MTGCardInstance(MTGCard * card, MTGPlayerCards * _belongs_to);
int regenerate();
int triggerRegenerate();
Player * controller();
virtual ~MTGCardInstance();
int bury();
int destroy();
int addToToughness(int value);
int setToughness(int value);
vector<TargetChooser *>protections;
int addProtection(TargetChooser * tc);
int removeProtection(TargetChooser *tc, int erase = 0);
int protectedAgainst(MTGCardInstance * card);
vector<TargetChooser *>canttarget;
int addCantBeTarget(TargetChooser * tc);
int removeCantBeTarget(TargetChooser *tc, int erase = 0);
int CantBeTargetby(MTGCardInstance * card);
vector<TargetChooser *>cantBeBlockedBys;
vector<TargetChooser *>cantBeBlockerOfs;
vector<MTGCardInstance *>cantBeBlockerOfCards;
int addCantBeBlockedBy(TargetChooser * tc);
int removeCantBeBlockedBy(TargetChooser *tc, int erase = 0);
int cantBeBlockedBy(MTGCardInstance * card);
int addCantBeBlockerOf(TargetChooser * tc);
int removeCantBeBlockerOf(TargetChooser *tc, int erase = 0);
int cantBeBlockerOf(MTGCardInstance * card);
int addCantBeBlockerOfCard(MTGCardInstance * card);
int removeCantBeBlockerOfCard(MTGCardInstance * card, int erase = 0);
int cantBeBlockerOfCard(MTGCardInstance * card);
void copy(MTGCardInstance * card);
void setUntapping();
int isUntapping();
int isTapped();
void untap();
void tap();
void attemptUntap();
void eventattacked();
void eventattackedAlone();
void eventattackednotblocked();
void eventattackedblocked(MTGCardInstance * opponent);
void eventblocked(MTGCardInstance * opponent);
int isInPlay(GameObserver* game);
const string& getSample();
JQuadPtr getIcon();
ostream& toString(ostream&) const;
static MTGCardInstance AnyCard;
static MTGCardInstance NoCard;
bool parseLine(const string& ss);
virtual MTGCardInstance* clone();
};
#endif