changed some logic for getting the pre x without shellcasting(?) spell...the variable word "prex" now returns the difference between the cards cost and the curentmanapool...giving us the value of pre x.some cards might need updating, doc can confirm it....
This commit is contained in:
@@ -321,50 +321,8 @@ int OrderedAIAction::getEfficiency()
|
||||
case MTGAbility::MANA_PRODUCER://only way to hit this condition is nested manaabilities, ai skips manaproducers by defualt when finding an ability to use.
|
||||
{
|
||||
efficiency = 0;
|
||||
|
||||
if(!coreAbilityCardTarget)
|
||||
break;
|
||||
|
||||
AManaProducer * amp = dynamic_cast<AManaProducer*>(a);
|
||||
|
||||
//trying to encourage Ai to use his foreach manaproducers in first main
|
||||
if (amp && amp->output && amp->output->getConvertedCost() && (g->getCurrentGamePhase() == Constants::MTG_PHASE_FIRSTMAIN
|
||||
|| g->getCurrentGamePhase() == Constants::MTG_PHASE_SECONDMAIN) && coreAbilityCardTarget->controller()->game->hand->nb_cards > 0)
|
||||
{
|
||||
for (int i = Constants::MTG_NB_COLORS - 1; i > 0; i--)
|
||||
{
|
||||
if ((p->game->hand->hasColor(i) || p->game->hand->hasColor(0))
|
||||
&& amp->output->hasColor(i))
|
||||
{
|
||||
efficiency = 100;
|
||||
}
|
||||
}
|
||||
|
||||
if (amp->getCost() && amp->getCost()->getConvertedCost() && p->game->hand->hasX())
|
||||
efficiency = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
AbilityFactory af;
|
||||
int suggestion = af.abilityEfficiency(a, p, MODE_ABILITY);
|
||||
|
||||
if (target && a->naType != MTGAbility::MANA_PRODUCER && ((suggestion == BAKA_EFFECT_BAD && p == target->controller())
|
||||
|| (suggestion == BAKA_EFFECT_GOOD && p != target->controller())))
|
||||
{
|
||||
efficiency = 0;
|
||||
}
|
||||
else if (a->naType != MTGAbility::MANA_PRODUCER && (g->getCurrentGamePhase() == Constants::MTG_PHASE_FIRSTMAIN
|
||||
|| g->getCurrentGamePhase() == Constants::MTG_PHASE_SECONDMAIN))
|
||||
{
|
||||
//if its not a manaproducing foreach, and its not targetted, its eff is 90.
|
||||
//added this basically to cover the unknown foreachs, or untrained ones which were not targetted effects.
|
||||
efficiency = 90;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MTGAbility::STANDARDABILITYGRANT:
|
||||
{
|
||||
efficiency = 0;
|
||||
@@ -856,7 +814,7 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
|
||||
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
|
||||
if(amp && (amp->getCost() && amp->getCost()->extraCosts && !amp->getCost()->extraCosts->canPay()))
|
||||
continue;
|
||||
if(fullColor == needColorConverted)
|
||||
if(fullColor == needColorConverted && result->getConvertedCost() < cost->getConvertedCost())
|
||||
{
|
||||
if(cost->hasColor(0) && amp)//find colorless after color mana.
|
||||
{
|
||||
@@ -878,8 +836,7 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
|
||||
}
|
||||
}
|
||||
}
|
||||
i = g->mLayers->actionLayer()->manaObjects.size();
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
GenericActivatedAbility * gmp = dynamic_cast<GenericActivatedAbility*>(a);
|
||||
if(gmp && canHandleCost(gmp))
|
||||
|
||||
@@ -34,14 +34,18 @@ int ActionLayer::removeFromGame(ActionElement * e)
|
||||
i = getIndexOf(e); //the destroy event might have changed the contents of mObjects, so we get the index again
|
||||
if (i == -1)
|
||||
return 0; //Should not happen, it means we deleted thesame object twice?
|
||||
AManaProducer * manaObject = dynamic_cast<AManaProducer*>(e);
|
||||
if(manaObject)
|
||||
AbilityFactory af;
|
||||
if(MTGAbility * a = dynamic_cast<MTGAbility*>(e))
|
||||
{
|
||||
for (size_t i = 0; i < manaObjects.size(); i++)
|
||||
if (manaObjects[i] == e)
|
||||
{
|
||||
manaObjects.erase(manaObjects.begin() + i);
|
||||
}
|
||||
AManaProducer * manaObject = dynamic_cast<AManaProducer*>(af.getCoreAbility((MTGAbility*)e));
|
||||
if(manaObject)
|
||||
{
|
||||
for (size_t i = 0; i < manaObjects.size(); i++)
|
||||
if (manaObjects[i] == e)
|
||||
{
|
||||
manaObjects.erase(manaObjects.begin() + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
mObjects.erase(mObjects.begin() + i);
|
||||
return 1;
|
||||
|
||||
@@ -243,8 +243,7 @@ Interruptible(id), tc(tc), cost(_cost), payResult(payResult)
|
||||
|
||||
int Spell::computeX(MTGCardInstance * card)
|
||||
{
|
||||
ManaCost * c = NULL;
|
||||
cost? c = cost->Diff(card->getManaCost()) : c = card->controller()->getManaPool()->Diff(card->getManaCost());
|
||||
ManaCost * c = NEW ManaCost(cost->Diff(card->getManaCost()));
|
||||
int x = c->getCost(Constants::MTG_NB_COLORS);
|
||||
delete c;
|
||||
return x;
|
||||
@@ -589,7 +588,8 @@ int ActionStack::setIsInterrupting(Player * player)
|
||||
// Is it a valid interruption request, or is uninterruptible stuff going on in the game?
|
||||
if (game->getCurrentTargetChooser())
|
||||
{
|
||||
DebugTrace("ActionStack: WARNING - We were asked to interrupt, but some un-interruptible action is already going on");
|
||||
DebugTrace("ActionStack: WARNING - We were asked to interrupt, During Targetchoosing" << endl
|
||||
<< "source: " << (game->getCurrentTargetChooser()->source ? game->getCurrentTargetChooser()->source->name : "None" ) << endl );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "GuiLayers.h"
|
||||
#include "Player.h"
|
||||
#include "AllAbilities.h"
|
||||
|
||||
GuiLayer::GuiLayer()
|
||||
{
|
||||
@@ -19,21 +20,32 @@ GuiLayer::~GuiLayer()
|
||||
void GuiLayer::Add(JGuiObject *object)
|
||||
{
|
||||
mObjects.push_back(object);
|
||||
AManaProducer * manaObject = dynamic_cast<AManaProducer*>(object);
|
||||
if(manaObject)
|
||||
manaObjects.push_back(object);
|
||||
AbilityFactory af;
|
||||
if(MTGAbility * a = dynamic_cast<MTGAbility*>(object))
|
||||
{
|
||||
AManaProducer * manaObject = dynamic_cast<AManaProducer*>(af.getCoreAbility((MTGAbility*)object));
|
||||
if(manaObject)
|
||||
{
|
||||
manaObjects.push_back(object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int GuiLayer::Remove(JGuiObject *object)
|
||||
{
|
||||
AManaProducer * manaObject = dynamic_cast<AManaProducer*>(object);
|
||||
if(manaObject)
|
||||
|
||||
AbilityFactory af;
|
||||
if(MTGAbility * a = dynamic_cast<MTGAbility*>(object))
|
||||
{
|
||||
for (size_t i = 0; i < manaObjects.size(); i++)
|
||||
if (manaObjects[i] == object)
|
||||
{
|
||||
manaObjects.erase(manaObjects.begin() + i);
|
||||
}
|
||||
AManaProducer * manaObject = dynamic_cast<AManaProducer*>(af.getCoreAbility((MTGAbility*)object));
|
||||
if(manaObject)
|
||||
{
|
||||
for (size_t i = 0; i < manaObjects.size(); i++)
|
||||
if (manaObjects[i] == object)
|
||||
{
|
||||
manaObjects.erase(manaObjects.begin() + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < mObjects.size(); i++)
|
||||
if (mObjects[i] == object)
|
||||
|
||||
@@ -168,8 +168,7 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card,Player * player
|
||||
}
|
||||
else if (i == 2)
|
||||
{
|
||||
Spell * spellCard = (Spell*)card;
|
||||
WParsedInt * secondA = NEW WParsedInt(comparasion[2].c_str(),spellCard?spellCard:NULL,card);
|
||||
WParsedInt * secondA = NEW WParsedInt(comparasion[2].c_str(),NULL,card);
|
||||
secondAmount = secondA->getValue();
|
||||
SAFE_DELETE(secondA);
|
||||
}
|
||||
|
||||
@@ -180,8 +180,7 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
{
|
||||
targetMin = true;//if upto: is not found, then we need to have a minimum of the amount....
|
||||
}
|
||||
Spell * sCard = (Spell*)card;
|
||||
WParsedInt * howmuch = NEW WParsedInt(howmany, sCard?sCard:NULL, card);
|
||||
WParsedInt * howmuch = NEW WParsedInt(howmany, NULL, card);
|
||||
howmany.find("anyamount") != string::npos?maxtargets = TargetChooser::UNLITMITED_TARGETS:maxtargets = howmuch->getValue();
|
||||
if(howmany.find("anyamount") != string::npos)
|
||||
targetMin = false;
|
||||
|
||||
Reference in New Issue
Block a user