Files
wagic/projects/mtg/src/MTGDefinitions.cpp
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

231 lines
5.4 KiB
C++

#include "PrecompiledHeader.h"
#include <string.h>
using std::string;
#include "MTGDefinitions.h"
char Constants::MTGColorChars[] = {'x','g','u','r','b','w','c','l'};
vector <const char*> Constants::MTGColorStrings;
const string Constants::kManaColorless = "colorless";
const string Constants::kManaGreen = "green";
const string Constants::kManaBlue = "blue";
const string Constants::kManaRed = "red";
const string Constants::kManaBlack = "black";
const string Constants::kManaWhite = "white";
const string Constants::kManaWaste = "waste";
int Constants::_r[7] = {75,20,20,200,50,255,128};
int Constants::_g[7] = {30,140,30,15,50,255,128};
int Constants::_b[7] = {20,0,140,15,50,255,128};
const string Constants::kAlternativeKeyword = "alternative";
const string Constants::kBuyBackKeyword = "buyback";
const string Constants::kFlashBackKeyword = "flashback";
const string Constants::kRetraceKeyword = "retrace";
const string Constants::kKickerKeyword = "kicker";
const string Constants::kMorphKeyword = "facedown";
const string Constants::kBestowKeyword = "bestow";
int Constants::NB_Colors = 0; //Store the Max number of colors.
const char* Constants::MTGBasicAbilities[] = {
"trample",
"forestwalk",
"islandwalk",
"mountainwalk",
"swampwalk",
"plainswalk",
"flying",
"first strike",
"double strike",
"fear",
"flash",
"haste",
"lifelink",
"reach",
"shroud",
"vigilance",
"defender",
"banding",
"protection from green",
"protection from blue",
"protection from red",
"protection from black",
"protection from white",
"unblockable",
"wither",
"persist",
"retrace",
"exalted",
"nofizzle",
"shadow",
"reachshadow",
"foresthome",
"islandhome",
"mountainhome",
"swamphome",
"plainshome",
"cloud",
"cantattack",
"mustattack",
"cantblock",
"doesnotuntap",
"opponentshroud",
"indestructible",
"intimidate",
"deathtouch",
"horsemanship",
"cantregen",
"oneblocker",
"infect",
"poisontoxic",
"poisontwotoxic",
"poisonthreetoxic",
"phantom",//prevents damage and remove 1 +1/+1 counter
"wilting",//source takes damage in the form of -1/-1 counters.
"vigor",//instead of taking damage the source gains +1/+1 counters
"changeling",//this card is every creature type at all times
"absorb",//timeshifted sliver ability. if damage would be dealt to card, prevent 1 of that damage.
"treason",
"unearth",
"cantlose",
"cantlifelose",
"cantmilllose",
"snowlandwalk",
"nonbasiclandwalk",
"strong",//cant be blocked by creature with less power
"storm",
"phasing",
"split second",
"weak",//cant block creatures with more power
"affinityartifacts",
"affinityplains",
"affinityforests",
"affinityislands",
"affinitymountains",
"affinityswamps",
"affinitygreencreatures",
"cantwin",
"nomaxhand",
"leyline",
"playershroud",
"controllershroud",
"sunburst",
"flanking",
"exiledeath",
"legendarylandwalk",
"desertlandwalk",
"snowforestlandwalk",
"snowplainslandwalk",
"snowmountainlandwalk",
"snowislandlandwalk",
"snowswamplandwalk",
"canattack",
"hydra",
"undying",
"poisonshroud",
"noactivatedability",
"notapability",
"nomanaability",
"onlymanaability",
"poisondamager",//deals damage to players as poison counters.
"soulbond",
"lure",
"nolegend",
"canplayfromgraveyard",
"tokenizer",//parallel lives,
"mygraveexiler",
"oppgraveexiler",
"librarydeath",
"shufflelibrarydeath",
"offering",
"evadebigger",
"spellmastery",
"nolifegain",
"nolifegainopponent",
"auraward",
"madness",
"protectionfromcoloredspells",
"mygcreatureexiler",
"oppgcreatureexiler",
"zerocast",
"trinisphere",
"canplayfromexile",
"libraryeater",
"devoid",
"cantchangelife",
"combattoughness",
"cantpaylife",
"cantbesacrified",
"skulk",
"menace",
"nosolo",
"mustblock"
};
map<string,int> Constants::MTGBasicAbilitiesMap;
int Constants::GetBasicAbilityIndex(string basicAbllity)
{
if ( Constants::MTGBasicAbilitiesMap.size() == 0 )
{
for (int idx = 0; idx < Constants::NB_BASIC_ABILITIES; ++idx)
{
string ability = MTGBasicAbilities[idx];
MTGBasicAbilitiesMap[ability] = idx;
}
}
if ( Constants::MTGBasicAbilitiesMap.find(basicAbllity) != Constants::MTGBasicAbilitiesMap.end() )
return Constants::MTGBasicAbilitiesMap[basicAbllity];
return -1;
}
int Constants::GetColorStringIndex(string mtgColor)
{
for (int idx = 0; idx < Constants::NB_Colors; ++idx)
{
if (Constants::MTGColorStrings[idx] == mtgColor)
return idx;
}
return -1;
}
const string Constants::MTGPhaseNames[] =
{
"---",
"Untap",
"Upkeep",
"Draw",
"Main phase 1",
"Combat begins",
"Attackers",
"Blockers",
"Combat damage",
"Combat ends",
"Main phase 2",
"End",
"Cleanup",
"---"
};
const char* Constants::MTGPhaseCodeNames[] =
{
"beginofturn",
"untap",
"upkeep",
"draw",
"firstmain",
"combatbegins",
"attackers",
"blockers",
"combatdamage",
"combatends",
"secondmain",
"end",
"cleanup",
"beforenextturn"
};