which tells the ai not to use the targetible cards as attackers, this can be card names, and CD modes.
modified the way ai handles multikicker. it will not be casting 1/1 joragas anymore :D
made WParsedInt ignore "+" signs....
added a new affinity ability...autohand=affinity(creature[vampire]|mygraveyard) ....
this is essentially affinity for creatures in your grave.
added supkeyword to clone clone addtype(zombie)....it adds the type listed to the cards types on clone...
reparse PT bonus on resolve.
reworked bushido, it should now work correctly...aside from that it now excepts word variables...fumiko is now bushido(type:creature[attacking]:battlefield/type:creature[attacking]:battlefield)
added a keyword to access acontrolsteal..the keyword is "steal"
auto=ueot steal target(creature)
reworked persist to handle undying..added the new counter handling rules intruduced by wotc in ISD
added a vector cardsAbilities to mtgcardinstance...this keeps the abilities added to the game for a card to use stored where we can easly alter or remove them.
added an automatic increase to geteff return if the ability is a putinplay ability.
finished coding support for flip and double sided cards, though viewing the "other side" is still not possible yet.
the ability follows the mtg rules.
the ability syntax is flip(card name)...a card can flip into any other card by name...even flip into itself.
added a "canPay() call for Ninja cost...to prevent it from coming up in a menu unless you're in blockers....
added 3 new restriction types that work very similar to type(
thisturn(tc)~morethan~2
lastturn(tc)~lessthan~thisturn(tc)
compare(wordvarible)~equalto~compare(wordvarible)
these are pretty self explanitory.
moved "&&" ability parsing below "this(" allowing "this(" to grant abilities now which contain &&...enclave egologist bug is fixed by this.
fixed an issue with combatspirit link for some reason the way i was doing the bool was not always working.
took care of the todo for AProtectionFrom...you can now give a protection from(blah) in a instant or ueot ability.
added altho very limited right now a "targetedplayer" tc word. i hope to increase this with time.
as always my sidekick doc already has some cards coded for this and test will follow the addition of the cards.
219 lines
5.8 KiB
C++
219 lines
5.8 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 alternateCostPaid[ManaCost::MANA_PAID_WITH_RETRACE + 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;
|
|
|
|
int stillInUse();
|
|
int didattacked;
|
|
int didblocked;
|
|
int notblocked;
|
|
int fresh;
|
|
int MaxLevelUp;
|
|
int kicked;
|
|
bool isDualWielding;
|
|
bool stillNeeded;
|
|
Player * lastController;
|
|
MTGGameZone * getCurrentZone();
|
|
MTGGameZone * previousZone;
|
|
MTGCardInstance * previous;
|
|
MTGCardInstance * next;
|
|
int doDamageTest;
|
|
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);
|
|
Player * owner;
|
|
Counters * counters;
|
|
const string getDisplayName() const;
|
|
MTGCardInstance * target;
|
|
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();
|
|
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;
|
|
int addCantBeBlockedBy(TargetChooser * tc);
|
|
int removeCantBeBlockedBy(TargetChooser *tc, int erase = 0);
|
|
int cantBeBlockedBy(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);
|
|
JSample * getSample();
|
|
|
|
JQuadPtr getIcon();
|
|
|
|
ostream& toString(ostream&) const;
|
|
|
|
static MTGCardInstance AnyCard;
|
|
static MTGCardInstance NoCard;
|
|
|
|
bool parseLine(const string& ss);
|
|
virtual MTGCardInstance* clone();
|
|
};
|
|
|
|
|
|
#endif
|