Files
wagic/projects/mtg/include/Counters.h
omegablast2002@yahoo.com f7b34295fb added a way to set the max amount a counter ability can give you...aka the clockworks effect...as per mtg rules, you are still allowed to activate the effect but if it would put the target counters higher then the max allowed by that ability, then it will do nothing.
it strings exactly like normal counters did, except now after the name you can add yet another "," and a number or word varible...if you will not have a name it is still required that you add the extra comma, as it is a seperator for the parser. so clock works swarm would be counter(1/0,1,,4)...no matter what, this ability will do nothing if the amount of the target counter is already higher then the max allowed, in this case 4...other effects can give the creature more counters...however..this ability will resolve to nothing if youve exceeded the limit. until you are under the amount again.
2011-02-08 15:12:14 +00:00

46 lines
1.3 KiB
C++

#ifndef _COUNTERS_H_
#define _COUNTERS_H_
#include <string>
using std::string;
class MTGCardInstance;
/* One family of counters. Ex : +1/+1 */
class Counter
{
public:
string name;
int nb;
int maxNb;
int power, toughness;
MTGCardInstance * target;
Counter(MTGCardInstance * _target, int _power, int _toughness);
Counter(MTGCardInstance * _target, const char * _name, int _power = 0, int _toughness = 0);
int init(MTGCardInstance * _target, const char * _name, int _power, int _toughness);
bool sameAs(const char * _name, int _power, int _toughness);
bool cancels(int _power, int _toughness);
int added();
int removed();
};
/* Various families of counters attached to an instance of a card */
class Counters
{
public:
int mCount;
Counter * counters[10];
MTGCardInstance * target;
Counters(MTGCardInstance * _target);
~Counters();
int addCounter(const char * _name, int _power = 0, int _toughness = 0);
int addCounter(int _power, int _toughness);
int removeCounter(const char * _name, int _power = 0, int _toughness = 0);
int removeCounter(int _power, int _toughness);
Counter * hasCounter(const char * _name, int _power = 0, int _toughness = 0);
Counter * hasCounter(int _power, int _toughness);
Counter * getNext(Counter * previous = NULL);
int init();
};
#endif