Files
wagic/projects/mtg/include/MTGDefinitions.h
omegablast2002@yahoo.com 6399917d25 changes:
added abilities:
proliferate
ProliferateChooser:new targetchooser for cards with counter and poison counters "proliferation".

MenuAbility:new internal ability to create custom menus of abilities which can be activated in sequence one after another.

multikicker, syntax kicker=multi{b}
works with variable word "kicked", the amount of times it was kicked.

target=<number>tc,target=<upto:>tc,target=<anyamount>tc,target(<number>tc),target(<upto:>tc),target(<anynumber>tc);
multitarget is now supported with the exception of "devided any way you choose" which can not be supported becuase we allow detoggling of targeted cards with a "second" click....so you can not click the same card 2 times to add it to the targets list twice for example.
this is minor, as the bulk of multitarget is not "devided"
removed 's' parsing for multitarget, added a limit of 1000 to "unlimited" for easier handling; we currently can't handle activation of an ability on a 1000 cards very well on any platform(infact i don't suggest it)

Countershroud(counterstring), this MTGAbility allows you to denote that a card can not have counters of the type "counterstring" put on it.
"any" is for no counters allowed at all. this is a replacement effect. cards state that they can still be the targets of counter effects, however on resolve nothing is placed on them instead.

@counteradded(counterstring) from(target):,@counterremoved(counterstring) from(target):: these are triggers for cards which state "whenever you add a counter of "counterstring" to "target"; added counterEvents struct; 

other changes:
added support for ai handling of multitargeted spells.

changed a few of delete( into SAFE_DELETE(, safed up a couple areas where they did not seem safe to me;

added better handling of menus presented to ai, it will try to select the best based on eff returns.

added varible lastactioncontroller for ai use, it keeps it truely from ever tripping over itself and brings ai more inline with MTG rules.

converted TC into a protected member.
added "abilitybelongsto" string to tc, and set "owner" of the tc. a tc should never belong to "no one" it should always have a owner.
abilitybelongs to string is solely for easier debugging, i found it was a pain to never know what ability created a tc while i coded multitarget. the owner of the tc is the only one that should be using it, if an ability needs to declare the opponent as the owner (choose discard which is currently unsupported for example) this will allow us to better handle that situation by setting the tc owner in the ability which called it.

rewrote the logic of "checkonly" in ai choose targets, the only time it is "checkonly" is when it is trying to see if it had a target for a spell before it cast it, i now set this in the actual function call instead, the old method was far to error prone.

wrote logic for ai checking of menu objects presented to it,
ai will now make better choices when a menu is presented to it based on what it already knows. this changes it from it's old method of "just click the first option".

taught ai how to use multi-mana producers such as birds and duel lands by adding a method for it to find it's mana for a payment. it can effectively use cards like birds of paradise and sol ring(without locking up). It's primary method of pMana searching was maintain for performance(no need to deep search if we have it in pMana).

added a vector to actionlayer to store mana abilities for pMana. this provides us with a dramatic improvement when mana lords are present by reducing the amount of objects that need checking when ai checks pMana.
with 80 mana objects and a ton of lords one instance i checked went from 8000ish checks down to 80<===big difference.

added "tapped" green coloring(sorry i missed that!)...added red coloring to current actionLayers current action card (usually the source).

changed "type(" restrictions second amount from atoi into wparsedint for more flexiable coding.

add "&" parsing to CD targetchooser, removed "iscolorandcolor" variables and functions becuase they were a hack the real fix was this.
cretaure[dragon&black&blue] a creature that is a dragon, and black and also blue.

changed some of the ai computeactions and
removed unneeded gaurds in ai chooseblockers, they did more harm then good.
2011-09-01 20:03:26 +00:00

266 lines
6.0 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;
#include <string>
using std::string;
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;
// 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;
// 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_LAND = 6,
MTG_NB_COLORS = 7,
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,
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,
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,
NB_BASIC_ABILITIES = 93,
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_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 const char* MTGColorStrings[];
static int _r[], _g[], _b[];
static map<string,int> MTGBasicAbilitiesMap;
static const char* MTGBasicAbilities[];
static const char* MTGPhaseNames[];
static const char* MTGPhaseCodeNames[];
static int GetBasicAbilityIndex(string mtgAbility);
static int GetColorStringIndex(string mtgColor);
};
#endif