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.
This commit is contained in:
omegablast2002@yahoo.com
2010-12-03 20:59:46 +00:00
parent b07b772c8e
commit b5ec029d79
4 changed files with 54 additions and 9 deletions
+27
View File
@@ -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;
+18 -4
View File
@@ -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()