From b5ec029d796ffc5e958bcc99f2b9b284e2de3702 Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Fri, 3 Dec 2010 20:59:46 +0000 Subject: [PATCH] couple changes, first i re-added my fancy getMenuText for becomes/transforms abilities, somewhere in the refactor these were forgotten. Fix "Swap" ueot menutext display, it was returning "ability". fixed a Ai related bug, taught Ai not to mill itself to death basically. played a few matches which Ai was just destroying himself with a creature that allowed him to draw cards for each(whatever) in play. Ai will be a little more careful not to kill himself by Mill, also not to draw 30 cards in a turn when it clearly cant play them. --- projects/mtg/include/AllAbilities.h | 13 ++++++++----- projects/mtg/include/MTGAbility.h | 1 + projects/mtg/src/AIPlayer.cpp | 27 +++++++++++++++++++++++++++ projects/mtg/src/AllAbilities.cpp | 22 ++++++++++++++++++---- 4 files changed, 54 insertions(+), 9 deletions(-) diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 4547ff335..aeca297e8 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -3212,6 +3212,7 @@ public: list oldcolors; list oldtypes; bool remove; + string menu; ATransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities); int addToGame(); @@ -3228,6 +3229,7 @@ public: list abilities; list types; list colors; + string menu; AForeverTransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities); int addToGame(); @@ -3266,11 +3268,12 @@ public: class ASwapPTUEOT: public InstantAbility { public: - ASwapPT * ability; - ASwapPTUEOT(int id, MTGCardInstance * source, MTGCardInstance * target); - int resolve(); - ASwapPTUEOT * clone() const; - ~ASwapPTUEOT(); + ASwapPT * ability; + ASwapPTUEOT(int id, MTGCardInstance * source, MTGCardInstance * target); + int resolve(); + const char * getMenuText(); + ASwapPTUEOT * clone() const; + ~ASwapPTUEOT(); }; //becomes ability diff --git a/projects/mtg/include/MTGAbility.h b/projects/mtg/include/MTGAbility.h index c4c8618a4..7d921feb3 100644 --- a/projects/mtg/include/MTGAbility.h +++ b/projects/mtg/include/MTGAbility.h @@ -105,6 +105,7 @@ class MTGAbility: public ActionElement{ UNTAPPER = 22, TAPPER = 23, LIFER = 24, + CLONING = 25, }; diff --git a/projects/mtg/src/AIPlayer.cpp b/projects/mtg/src/AIPlayer.cpp index cb34cb059..f50122397 100644 --- a/projects/mtg/src/AIPlayer.cpp +++ b/projects/mtg/src/AIPlayer.cpp @@ -499,6 +499,33 @@ int AIAction::getEfficiency() break; } + case MTGAbility::STANDARD_DRAW: + { + //adding this case since i played a few games where Ai litterally decided to mill himself to death. fastest and easiest win ever. + //this should help a little, tho ultimately it will be decided later what the best course of action is. + efficiency = 0; + //eff of drawing ability is calculated by base 20 + the amount of cards in library minus the amount of cards in hand times 7. + //drawing is never going to return a hundred eff because later eff is multiplied by 1.3 if no cards in hand. + efficiency = int(20 + p->game->library->nb_cards) - int(p->game->hand->nb_cards * 7); + if(p->game->hand->nb_cards > 8)//reduce by 20 if cards in hand are over 8, high chance ai cant play them. + { + efficiency -= 20; + } + if(a->nbcardAmount >= p->game->library->nb_cards)//if the amount im drawing will mill me to death, eff is 0; + { + efficiency = 0; + } + break; + } + case MTGAbility::CLONING: + { + efficiency = 0; + if (p == target->controller()) + { + efficiency = 20 * target->DangerRanking(); + } + break; + } case MTGAbility::MANA_PRODUCER: efficiency = 0; break; diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 6d60d0f04..a8621c37f 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -630,6 +630,7 @@ AACloner::AACloner(int _id, MTGCardInstance * _source, MTGCardInstance * _target string abilitiesStringList) : ActivatedAbility(_id, _source, _cost, 0, 0), who(who) { + aType = MTGAbility::CLONING; target = _target; source = _source; if ( abilitiesStringList.size() > 0 ) @@ -1459,6 +1460,8 @@ ATransformer::ATransformer(int id, MTGCardInstance * source, MTGCardInstance * t { PopulateSubtypesIndexVector(types, stypes); } + + menu = stypes; } int ATransformer::addToGame() @@ -1551,7 +1554,9 @@ int ATransformer::destroy() const char * ATransformer::getMenuText() { - return "Transform"; + string s = menu; + sprintf(menuText, "Becomes %s", s.c_str()); + return menuText; } ATransformer * ATransformer::clone() const @@ -1576,6 +1581,7 @@ AForeverTransformer::AForeverTransformer(int id, MTGCardInstance * source, MTGCa PopulateAbilityIndexVector(abilities, sabilities); PopulateColorIndexVector(colors, sabilities); PopulateSubtypesIndexVector(types, stypes); + menu = stypes; } int AForeverTransformer::addToGame() @@ -1608,7 +1614,9 @@ int AForeverTransformer::addToGame() const char * AForeverTransformer::getMenuText() { - return "Transform"; + string s = menu; + sprintf(menuText, "Becomes %s", s.c_str()); + return menuText; } AForeverTransformer * AForeverTransformer::clone() const @@ -1638,7 +1646,7 @@ int ATransformerUEOT::resolve() } const char * ATransformerUEOT::getMenuText() { - return "Transform"; + return ability->getMenuText(); } ATransformerUEOT * ATransformerUEOT::clone() const @@ -1672,7 +1680,7 @@ int ATransformerFOREVER::resolve() const char * ATransformerFOREVER::getMenuText() { - return "Transform"; + return ability->getMenuText(); } ATransformerFOREVER * ATransformerFOREVER::clone() const @@ -1703,6 +1711,11 @@ int ASwapPTUEOT::resolve() return 1; } +const char * ASwapPTUEOT::getMenuText() +{ + return ability->getMenuText(); +} + ASwapPTUEOT * ASwapPTUEOT::clone() const { ASwapPTUEOT * a = NEW ASwapPTUEOT(*this); @@ -1726,6 +1739,7 @@ ABecomes::ABecomes(int id, MTGCardInstance * source, MTGCardInstance * target, s PopulateAbilityIndexVector(abilities, sabilities); PopulateColorIndexVector(colors, sabilities); PopulateSubtypesIndexVector(types, stypes); + menu = stypes; } int ABecomes::addToGame()