Limitations: - Operators for "greater than", "less than", "unequal" have not been implemented, but if a card actually needs them, you can use a preceding minus sign to negate a comparison. Example: -power=3 means "power not equal to 3", -toughness<=3 means "toughness>3". - You can't use spaces when specifying such restrictions. Write "power<=3" instead of "power <= 3" - You now need to use a space before the "<" and ">" commands that count the matches for lord(), foreach(), all() and aslongas(). So far we always did use spaces in front of them without actually needing to, now we need to. - manacost restrictions don't take "X" costs into account. Example: Mistmeadow Skulkin (FUT) has protection from manacost>=3. Blaze has a converted manacost of 1, but when you cast it with an X of 2, then it actually has a converted manacost of 3 while on the stack, and Mistmeadow Skulkin would be protected from it, but currently it isn't. Please review the code, I'll add a few remarks/questions of my own.
46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
/*
|
|
A Filter/Mask system for Card Instances to find cards matching specific settings such as color, type, etc...
|
|
*/
|
|
|
|
#ifndef _CARDDESCRIPTOR_H_
|
|
#define _CARDDESCRIPTOR_H_
|
|
|
|
#include "MTGCardInstance.h"
|
|
#include "MTGGameZones.h"
|
|
|
|
#define CD_OR 1
|
|
#define CD_AND 2
|
|
|
|
enum ENUM_COMPARISON_MODES
|
|
{
|
|
COMPARISON_NONE = 0, // Needs to remain 0 for quick if(comparison_mode) checks
|
|
COMPARISON_AT_MOST,
|
|
COMPARISON_AT_LEAST,
|
|
COMPARISON_EQUAL,
|
|
COMPARISON_GREATER,
|
|
COMPARISON_LESS,
|
|
COMPARISON_UNEQUAL
|
|
};
|
|
|
|
class CardDescriptor: public MTGCardInstance{
|
|
protected:
|
|
MTGCardInstance * match_or(MTGCardInstance * card);
|
|
MTGCardInstance * match_and(MTGCardInstance * card);
|
|
bool valueInRange(int comparisonMode, int value, int criterion);
|
|
public:
|
|
int mode;
|
|
int powerComparisonMode;
|
|
int toughnessComparisonMode;
|
|
int manacostComparisonMode;
|
|
int convertedManacost; // might fit better into MTGCardInstance?
|
|
int init();
|
|
CardDescriptor();
|
|
void unsecureSetTapped(int i);
|
|
void setNegativeSubtype( string value);
|
|
MTGCardInstance * match(MTGCardInstance * card);
|
|
MTGCardInstance * match(MTGGameZone * zone);
|
|
MTGCardInstance * nextmatch(MTGGameZone * zone, MTGCardInstance * previous);
|
|
};
|
|
|
|
#endif
|