Files
wagic/projects/mtg/include/MTGDefinitions.h
zethfoxster 6ee00c138c Pretty huge patch here(sorry old habits never die :( )
lots of changes, many bug fixes,
first
added auto=count(targetchooser)
and countedamount wparsed int
they work together for cards where it is difficult to get working without knowing in advance how many we had ie: exile blah creatures, for each creature you exiled do effect.
auto=count(creature|mybattlefield)
auto=moveto(exile)
auto=draw:countedamount
it takes into account token creatures, which our old methods did not.

second, added "freeze" which is a "frozen" that automatically taps your target for you, for use when nesting or whenever needed where it was difficult to nest the ability with tap included.

added devotion for "iroas"

added reveal:x and scry x
reveal contains optionone/optiononeend ; optiontwo/optiontwoend ; repeat; afterrevealed/afterrevealed end.

this ability has heavy use of targetListIsSet(<amount>) and upto:amount, you MUST be certain that all cards being revealed have an action that removes them from reveal either in the first, second, or 3rd ability.
there are over 300 examples in the new card code, the ability is VERY easy to understand.

scry contains automatic put on top, put on bottom, then scrycore/scrycoreend which is an ability to fire.
it also contains keywords, dontshow which is nested in scrycore, scry reveals, puts on top or bottom, then reveal AGAIN, and does an effect, dontshow eliminates the 2nd revealing.
is also contains "delayed" keyword, which delays the ability until AFTER the core fires.

added bestow. update rules mtg.txt!!!!
examples are in primitives, every bestow card was supported.

added a new lord based on varibles and restrictions
while(restriction{morbid})
while(varible:blah)
this simplifies and expands on this(, allowing you to even use while(cantarget together and check if a card is targetable by the variable. examples are in primitives

added token(by card name)
auto=token(Eldrazi Scion) 
will search primitives and card dats for this card and give it to you as a token.
valid card dat info is still required.

added variable delirium
added restriction madnessplayed to allow checking if the card was played with madness.

added restriction "geared" for checking if a card has equipment on it.

added abilities words
skulk

menace <--cant be blocked except by 2 or more, if you dont block it with 2 or more we automatically unassign the single blocker and the creature is considered not blocked.

nosolo <--cant attack alone

mustblock <---if you dont assign as a blocker, we assign automatically the first thing it can block legally.

changed iscolorless back to "colorless"

enjoy, cards coming soon, theyre coded but im debating on not alpha sorting, cards being added this patch 965 uniques.

there is a section of the commit which was just VS2016 normalizing line ends, sorry if it makes it a cluster mess.
2016-06-28 18:40:55 -04:00

338 lines
7.7 KiB
C++

#ifndef _MTGDEFINITION_H_
#define _MTGDEFINITION_H_
const float DEFAULT_MENU_FONT_SCALE = 1.0f;
const float DEFAULT_MAIN_FONT_SCALE = 1.0f;
const float DEFAULT_TEXT_FONT_SCALE = 1.0f;
const float ACTIVE_MENU_FONT_SCALE = 1.2f;
#include <string>
using std::string;
typedef enum
{
GAME_TYPE_CLASSIC,
GAME_TYPE_MOMIR,
GAME_TYPE_RANDOM1,
GAME_TYPE_RANDOM2,
GAME_TYPE_STORY,
GAME_TYPE_DEMO,
GAME_TYPE_STONEHEWER,
GAME_TYPE_HERMIT,
#ifdef NETWORK_SUPPORT
GAME_TYPE_SLAVE,
#endif //NETWORK_SUPPORT
} GameType;
typedef enum
{
PLAYER_TYPE_CPU = 0,
PLAYER_TYPE_HUMAN = 1,
PLAYER_TYPE_TESTSUITE = 2,
PLAYER_TYPE_CPU_TEST = 3,
} PlayerType;
typedef enum
{
MTG_PHASE_INVALID = -1,
MTG_PHASE_BEFORE_BEGIN = 0,
MTG_PHASE_UNTAP = 1,
MTG_PHASE_UPKEEP = 2,
MTG_PHASE_DRAW = 3,
MTG_PHASE_FIRSTMAIN = 4,
MTG_PHASE_COMBATBEGIN = 5,
MTG_PHASE_COMBATATTACKERS = 6,
MTG_PHASE_COMBATBLOCKERS = 7,
MTG_PHASE_COMBATDAMAGE = 8,
MTG_PHASE_COMBATEND = 9,
MTG_PHASE_SECONDMAIN = 10,
MTG_PHASE_ENDOFTURN = 11,
MTG_PHASE_CLEANUP = 12,
MTG_PHASE_AFTER_EOT = 13,
NB_MTG_PHASES = 14
} GamePhase;
class Constants
{
public:
// Exception Codes
/* Exception codes */
const static int PARSER_FAILED_INSTANTIATION = 1000;
const static int PARSER_KEYWORD_NOT_MATCHED = 2000;
const static int PARSER_INVALID_KEYWORD = 3000;
// color constants
static const string kManaColorless;
static const string kManaGreen;
static const string kManaBlue;
static const string kManaRed;
static const string kManaBlack;
static const string kManaWhite;
static const string kManaWaste;
// alternative costs constants
static const string kAlternativeKeyword;
static const string kBuyBackKeyword;
static const string kFlashBackKeyword;
static const string kRetraceKeyword;
static const string kKickerKeyword;
static const string kMorphKeyword;
static const string kBestowKeyword;
// used for deck statistics
static const int STATS_FOR_TURNS = 8;
static const int STATS_MAX_MANA_COST = 9;
enum
{
MTG_COLOR_ARTIFACT = 0,
MTG_COLOR_GREEN = 1,
MTG_COLOR_BLUE = 2,
MTG_COLOR_RED = 3,
MTG_COLOR_BLACK = 4,
MTG_COLOR_WHITE = 5,
MTG_COLOR_WASTE = 6,
MTG_COLOR_LAND = 7,
MTG_NB_COLORS = 8,
MTG_UNCOLORED = 0,
MTG_FOREST = 1,
MTG_ISLAND = 2,
MTG_MOUNTAIN = 3,
MTG_SWAMP = 4,
MTG_PLAIN = 5,
MTG_TYPE_CREATURE = 10,
MTG_TYPE_ARTIFACT = 11,
MTG_TYPE_ENCHANTMENT = 12,
MTG_TYPE_SORCERY = 13,
MTG_TYPE_LAND = 14,
MTG_TYPE_INSTANT = 15,
TRAMPLE = 0,
FORESTWALK = 1,
ISLANDWALK = 2,
MOUNTAINWALK = 3,
SWAMPWALK = 4,
PLAINSWALK = 5,
FLYING = 6,
FIRSTSTRIKE = 7,
DOUBLESTRIKE = 8,
FEAR = 9,
FLASH = 10,
HASTE = 11,
LIFELINK = 12,
REACH = 13,
SHROUD = 14,
VIGILANCE = 15,
DEFENSER = 16,
DEFENDER = 16,
BANDING = 17,
PROTECTIONGREEN = 18,
PROTECTIONBLUE = 19,
PROTECTIONRED = 20,
PROTECTIONBLACK = 21,
PROTECTIONWHITE = 22,
UNBLOCKABLE = 23,
WITHER = 24,
PERSIST = 25,
RETRACE = 26,
EXALTED = 27,
NOFIZZLE = 28,
SHADOW = 29,
REACHSHADOW = 30,
FORESTHOME = 31,
ISLANDHOME = 32,
MOUNTAINHOME = 33,
SWAMPHOME = 34,
PLAINSHOME = 35,
CLOUD = 36,
CANTATTACK = 37,
MUSTATTACK = 38,
CANTBLOCK = 39,
DOESNOTUNTAP = 40,
OPPONENTSHROUD = 41,
INDESTRUCTIBLE = 42,
INTIMIDATE = 43,
DEATHTOUCH = 44,
HORSEMANSHIP = 45,
CANTREGEN = 46,
ONEBLOCKER = 47,
INFECT = 48,
POISONTOXIC = 49,
POISONTWOTOXIC = 50,
POISONTHREETOXIC = 51,
PHANTOM = 52,
WILTING = 53,
VIGOR = 54,
CHANGELING = 55,
ABSORB = 56,//this need to be coded for players too "If a source would deal damage"
TREASON = 57,
UNEARTH = 58,
CANTLOSE = 59,
CANTLIFELOSE = 60,
CANTMILLLOSE = 61,
SNOWWALK = 62,
NONBASICWALK = 63,
STRONG = 64,
STORM = 65,
PHASING = 66,
SPLITSECOND = 67,
WEAK = 68,
AFFINITYARTIFACTS = 69,
AFFINITYPLAINS = 70,
AFFINITYFOREST = 71,
AFFINITYISLAND = 72,
AFFINITYMOUNTAIN = 73,
AFFINITYSWAMP = 74,
AFFINITYGREENCREATURES = 75,
CANTWIN = 76,
NOMAXHAND = 77,
LEYLINE = 78,
PLAYERSHROUD = 79,
CONTROLLERSHROUD = 80,
SUNBURST = 81,
FLANKING = 82,
EXILEDEATH = 83,
LEGENDARYWALK = 84,
DESERTWALK = 85,
SNOWFORESTWALK = 86,
SNOWPLAINSWALK = 87,
SNOWMOUNTAINWALK = 88,
SNOWISLANDWALK = 89,
SNOWSWAMPWALK = 90,
CANATTACK = 91,
HYDRA = 92,
UNDYING = 93,
POISONSHROUD = 94,
NOACTIVATED = 95,
NOACTIVATEDTAP = 96,
NOMANA = 97,
ONLYMANA = 98,
POISONDAMAGER = 99,
soulbond = 100,
LURE = 101,
NOLEGEND = 102,
CANPLAYFROMGRAVEYARD = 103,
TOKENIZER = 104,
MYGRAVEEXILER = 105,
OPPGRAVEEXILER = 106,
LIBRARYDEATH = 107,
SHUFFLELIBRARYDEATH = 108,
OFFERING = 109,
EVADEBIGGER = 110,
SPELLMASTERY = 111,
NOLIFEGAIN = 112,
NOLIFEGAINOPPONENT = 113,
AURAWARD = 114,
MADNESS = 115,
PROTECTIONFROMCOLOREDSPELLS = 116,
MYGCREATUREEXILER = 117,
OPPGCREATUREEXILER = 118,
PAYZERO = 119,
TRINISPHERE = 120,
CANPLAYFROMEXILE = 121,
LIBRARYEATER = 122,
DEVOID = 123,
CANTCHANGELIFE = 124,
COMBATTOUGHNESS = 125,
CANTPAYLIFE = 126,
CANTBESACRIFIED = 127,
SKULK = 128,
MENACE = 129,
NOSOLO = 130,//cant attack alone
MUSTBLOCK = 131,//blocks each turn
NB_BASIC_ABILITIES = 132,
RARITY_S = 'S', //Special Rarity
RARITY_M = 'M', //Mythics
RARITY_R = 'R', //Rares
RARITY_U = 'U', //Uncommons
RARITY_C = 'C', //Commons
RARITY_L = 'L', //Lands
RARITY_T = 'T', //Tokens
ECON_NORMAL = 0, //Options default to 0.
ECON_HARD = 1,
ECON_LUCK = 2,
ECON_EASY = 3,
//Price for singles
PRICE_1M = 3000,
PRICE_1R = 500,
PRICE_1S = 200,
PRICE_1U = 100,
PRICE_1C = 20,
PRICE_1L = 5,
//Price in booster
PRICE_BOOSTER = 700,
PRICE_MIXED_BOOSTER = 800,
CHANCE_CUSTOM_PACK = 15,
CHANCE_PURE_OVERRIDE = 50,
CHANCE_MIXED_OVERRIDE = 25,
GRADE_SUPPORTED = 0,
GRADE_BORDERLINE = 1,
GRADE_UNOFFICIAL = 2,
GRADE_CRAPPY = 3,
GRADE_UNSUPPORTED = 4,
GRADE_DANGEROUS = 5,
ASKIP_NONE=0,
ASKIP_SAFE=1,
ASKIP_FULL=2,
WHO_P=0,
WHO_O=1,
WHO_R=2,
KICKER_ALWAYS=0,
KICKER_CHOICE=1,
};
enum
{
NOT_CAST = 0,
CAST_NORMALLY = 1,
CAST_WITH_KICKER = 2,
CAST_WITH_ALTERNATIVE = 3,
CAST_WITH_BUYBACK = 4,
CAST_WITH_FLASHBACK = 5,
CAST_WITH_RETRACE = 6,
CAST_WITH_MORPH = 7,
CAST_WITH_SUSPEND = 8,
CAST_WITH_BESTOW = 9,
CAST_ALTERNATE = -1, //matches all alternate costs, including itself
CAST_ALL = -2, // matches everything except NOT_CAST
CAST_DONT_CARE = -3 //matches everything
};
static char MTGColorChars[];
static vector <const char*> MTGColorStrings;
static int _r[], _g[], _b[];
static map<string,int> MTGBasicAbilitiesMap;
static const char* MTGBasicAbilities[];
static const string MTGPhaseNames[];
static const char* MTGPhaseCodeNames[];
static int GetBasicAbilityIndex(string mtgAbility);
static int GetColorStringIndex(string mtgColor);
static int NB_Colors;
};
#endif