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:
@@ -71,7 +71,14 @@ public:
|
|||||||
size_t hD = s.find("halfdown");
|
size_t hD = s.find("halfdown");
|
||||||
s.erase(hD,hD + 8);
|
s.erase(hD,hD + 8);
|
||||||
}
|
}
|
||||||
if (s == "x" || s == "X")
|
if(s == "prex")
|
||||||
|
{
|
||||||
|
ManaCost * cX = NEW ManaCost(card->controller()->getManaPool()->Diff(card->getManaCost()));
|
||||||
|
int preX =
|
||||||
|
intValue = cX->getCost(Constants::MTG_NB_COLORS);
|
||||||
|
delete cX;
|
||||||
|
}
|
||||||
|
else if (s == "x" || s == "X")
|
||||||
{
|
{
|
||||||
intValue = computeX(spell, card);
|
intValue = computeX(spell, card);
|
||||||
if(intValue < 0)
|
if(intValue < 0)
|
||||||
|
|||||||
@@ -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.
|
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;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MTGAbility::STANDARDABILITYGRANT:
|
case MTGAbility::STANDARDABILITYGRANT:
|
||||||
{
|
{
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
@@ -856,7 +814,7 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
|
|||||||
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
|
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
|
||||||
if(amp && (amp->getCost() && amp->getCost()->extraCosts && !amp->getCost()->extraCosts->canPay()))
|
if(amp && (amp->getCost() && amp->getCost()->extraCosts && !amp->getCost()->extraCosts->canPay()))
|
||||||
continue;
|
continue;
|
||||||
if(fullColor == needColorConverted)
|
if(fullColor == needColorConverted && result->getConvertedCost() < cost->getConvertedCost())
|
||||||
{
|
{
|
||||||
if(cost->hasColor(0) && amp)//find colorless after color mana.
|
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();
|
continue;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
GenericActivatedAbility * gmp = dynamic_cast<GenericActivatedAbility*>(a);
|
GenericActivatedAbility * gmp = dynamic_cast<GenericActivatedAbility*>(a);
|
||||||
if(gmp && canHandleCost(gmp))
|
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
|
i = getIndexOf(e); //the destroy event might have changed the contents of mObjects, so we get the index again
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
return 0; //Should not happen, it means we deleted thesame object twice?
|
return 0; //Should not happen, it means we deleted thesame object twice?
|
||||||
AManaProducer * manaObject = dynamic_cast<AManaProducer*>(e);
|
AbilityFactory af;
|
||||||
if(manaObject)
|
if(MTGAbility * a = dynamic_cast<MTGAbility*>(e))
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < manaObjects.size(); i++)
|
AManaProducer * manaObject = dynamic_cast<AManaProducer*>(af.getCoreAbility((MTGAbility*)e));
|
||||||
if (manaObjects[i] == e)
|
if(manaObject)
|
||||||
{
|
{
|
||||||
manaObjects.erase(manaObjects.begin() + i);
|
for (size_t i = 0; i < manaObjects.size(); i++)
|
||||||
}
|
if (manaObjects[i] == e)
|
||||||
|
{
|
||||||
|
manaObjects.erase(manaObjects.begin() + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mObjects.erase(mObjects.begin() + i);
|
mObjects.erase(mObjects.begin() + i);
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -243,8 +243,7 @@ Interruptible(id), tc(tc), cost(_cost), payResult(payResult)
|
|||||||
|
|
||||||
int Spell::computeX(MTGCardInstance * card)
|
int Spell::computeX(MTGCardInstance * card)
|
||||||
{
|
{
|
||||||
ManaCost * c = NULL;
|
ManaCost * c = NEW ManaCost(cost->Diff(card->getManaCost()));
|
||||||
cost? c = cost->Diff(card->getManaCost()) : c = card->controller()->getManaPool()->Diff(card->getManaCost());
|
|
||||||
int x = c->getCost(Constants::MTG_NB_COLORS);
|
int x = c->getCost(Constants::MTG_NB_COLORS);
|
||||||
delete c;
|
delete c;
|
||||||
return x;
|
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?
|
// Is it a valid interruption request, or is uninterruptible stuff going on in the game?
|
||||||
if (game->getCurrentTargetChooser())
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "GuiLayers.h"
|
#include "GuiLayers.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
|
#include "AllAbilities.h"
|
||||||
|
|
||||||
GuiLayer::GuiLayer()
|
GuiLayer::GuiLayer()
|
||||||
{
|
{
|
||||||
@@ -19,21 +20,32 @@ GuiLayer::~GuiLayer()
|
|||||||
void GuiLayer::Add(JGuiObject *object)
|
void GuiLayer::Add(JGuiObject *object)
|
||||||
{
|
{
|
||||||
mObjects.push_back(object);
|
mObjects.push_back(object);
|
||||||
AManaProducer * manaObject = dynamic_cast<AManaProducer*>(object);
|
AbilityFactory af;
|
||||||
if(manaObject)
|
if(MTGAbility * a = dynamic_cast<MTGAbility*>(object))
|
||||||
manaObjects.push_back(object);
|
{
|
||||||
|
AManaProducer * manaObject = dynamic_cast<AManaProducer*>(af.getCoreAbility((MTGAbility*)object));
|
||||||
|
if(manaObject)
|
||||||
|
{
|
||||||
|
manaObjects.push_back(object);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int GuiLayer::Remove(JGuiObject *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++)
|
AManaProducer * manaObject = dynamic_cast<AManaProducer*>(af.getCoreAbility((MTGAbility*)object));
|
||||||
if (manaObjects[i] == object)
|
if(manaObject)
|
||||||
{
|
{
|
||||||
manaObjects.erase(manaObjects.begin() + i);
|
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++)
|
for (size_t i = 0; i < mObjects.size(); i++)
|
||||||
if (mObjects[i] == object)
|
if (mObjects[i] == object)
|
||||||
|
|||||||
@@ -168,8 +168,7 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card,Player * player
|
|||||||
}
|
}
|
||||||
else if (i == 2)
|
else if (i == 2)
|
||||||
{
|
{
|
||||||
Spell * spellCard = (Spell*)card;
|
WParsedInt * secondA = NEW WParsedInt(comparasion[2].c_str(),NULL,card);
|
||||||
WParsedInt * secondA = NEW WParsedInt(comparasion[2].c_str(),spellCard?spellCard:NULL,card);
|
|
||||||
secondAmount = secondA->getValue();
|
secondAmount = secondA->getValue();
|
||||||
SAFE_DELETE(secondA);
|
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....
|
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, NULL, card);
|
||||||
WParsedInt * howmuch = NEW WParsedInt(howmany, sCard?sCard:NULL, card);
|
|
||||||
howmany.find("anyamount") != string::npos?maxtargets = TargetChooser::UNLITMITED_TARGETS:maxtargets = howmuch->getValue();
|
howmany.find("anyamount") != string::npos?maxtargets = TargetChooser::UNLITMITED_TARGETS:maxtargets = howmuch->getValue();
|
||||||
if(howmany.find("anyamount") != string::npos)
|
if(howmany.find("anyamount") != string::npos)
|
||||||
targetMin = false;
|
targetMin = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user