reverted previous change.
This commit is contained in:
@@ -223,6 +223,7 @@ int AIAction::getEfficiency()
|
|||||||
switch (a->aType)
|
switch (a->aType)
|
||||||
{
|
{
|
||||||
case MTGAbility::DAMAGER:
|
case MTGAbility::DAMAGER:
|
||||||
|
{
|
||||||
AADamager * aad = (AADamager *) a;
|
AADamager * aad = (AADamager *) a;
|
||||||
if (!target)
|
if (!target)
|
||||||
{
|
{
|
||||||
@@ -250,23 +251,26 @@ int AIAction::getEfficiency()
|
|||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case MTGAbility::STANDARD_REGENERATE:
|
case MTGAbility::STANDARD_REGENERATE:
|
||||||
|
{
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
if (!_target)
|
if (!_target)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!_target->regenerateTokens && g->getCurrentGamePhase() == Constants::MTG_PHASE_COMBATBLOCKERS && (_target->defenser
|
if (!_target->regenerateTokens && g->getCurrentGamePhase() == Constants::MTG_PHASE_COMBATBLOCKERS
|
||||||
|| _target->blockers.size()))
|
&& (_target->defenser || _target->blockers.size())
|
||||||
|
)
|
||||||
{
|
{
|
||||||
efficiency = 95;
|
efficiency = 95;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO If the card is the target of a damage spell
|
//TODO If the card is the target of a damage spell
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case MTGAbility::STANDARD_PREVENT:
|
case MTGAbility::STANDARD_PREVENT:
|
||||||
|
{
|
||||||
efficiency = 0;//starts out low to avoid spamming it when its not needed.
|
efficiency = 0;//starts out low to avoid spamming it when its not needed.
|
||||||
if (!target)
|
if (!target)
|
||||||
break;
|
break;
|
||||||
@@ -277,8 +281,8 @@ int AIAction::getEfficiency()
|
|||||||
{
|
{
|
||||||
if ((target->defenser || target->blockers.size()) && target->preventable < target->getNextOpponent()->power)
|
if ((target->defenser || target->blockers.size()) && target->preventable < target->getNextOpponent()->power)
|
||||||
NeedPreventing = true;
|
NeedPreventing = true;
|
||||||
if (p == target->controller() && target->controller()->isAI() && NeedPreventing == true
|
if (p == target->controller() && target->controller()->isAI() && NeedPreventing == true && !(target->getNextOpponent()->has(Constants::DEATHTOUCH)
|
||||||
&& !(target->getNextOpponent()->has(Constants::DEATHTOUCH) || target->getNextOpponent()->has(Constants::WITHER)))
|
|| target->getNextOpponent()->has(Constants::WITHER)))
|
||||||
{
|
{
|
||||||
efficiency = 20 * (target->DangerRanking());//increase this chance to be used in combat if the creature blocking/blocked could kill the creature this chance is taking into consideration how good the creature is, best creature will always be the first "saved"..
|
efficiency = 20 * (target->DangerRanking());//increase this chance to be used in combat if the creature blocking/blocked could kill the creature this chance is taking into consideration how good the creature is, best creature will always be the first "saved"..
|
||||||
if (target->toughness == 1 && target->getNextOpponent()->power == 1)
|
if (target->toughness == 1 && target->getNextOpponent()->power == 1)
|
||||||
@@ -303,8 +307,9 @@ int AIAction::getEfficiency()
|
|||||||
}
|
}
|
||||||
//TODO If the card is the target of a damage spell
|
//TODO If the card is the target of a damage spell
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case MTGAbility::STANDARD_EQUIP:
|
case MTGAbility::STANDARD_EQUIP:
|
||||||
|
{
|
||||||
|
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
if (!target)
|
if (!target)
|
||||||
@@ -329,8 +334,10 @@ int AIAction::getEfficiency()
|
|||||||
efficiency -= 5 * (target->equipment);
|
efficiency -= 5 * (target->equipment);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case MTGAbility::STANDARD_LEVELUP:
|
case MTGAbility::STANDARD_LEVELUP:
|
||||||
|
{
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
Counter * targetCounter = NULL;
|
Counter * targetCounter = NULL;
|
||||||
@@ -366,7 +373,6 @@ int AIAction::getEfficiency()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MTGAbility::STANDARD_PUMP:
|
case MTGAbility::STANDARD_PUMP:
|
||||||
{
|
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
if (!target)
|
if (!target)
|
||||||
@@ -397,8 +403,9 @@ int AIAction::getEfficiency()
|
|||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case MTGAbility::STANDARD_BECOMES:
|
case MTGAbility::STANDARD_BECOMES:
|
||||||
|
{
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
||||||
//nothing huge here, just ensuring that Ai makes his noncreature becomers into creatures during first main, so it can actually use them in combat.
|
//nothing huge here, just ensuring that Ai makes his noncreature becomers into creatures during first main, so it can actually use them in combat.
|
||||||
if (_target && !_target->hasType("Creature") && g->getCurrentGamePhase() == Constants::MTG_PHASE_FIRSTMAIN)
|
if (_target && !_target->hasType("Creature") && g->getCurrentGamePhase() == Constants::MTG_PHASE_FIRSTMAIN)
|
||||||
@@ -406,16 +413,20 @@ int AIAction::getEfficiency()
|
|||||||
efficiency = 100;
|
efficiency = 100;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case MTGAbility::UPCOST:
|
case MTGAbility::UPCOST:
|
||||||
|
{
|
||||||
//hello, Ai pay your upcost please :P, this entices Ai into paying upcost, the conditional isAi() is required strangely ai is able to pay upcost during YOUR upkeep.
|
//hello, Ai pay your upcost please :P, this entices Ai into paying upcost, the conditional isAi() is required strangely ai is able to pay upcost during YOUR upkeep.
|
||||||
if (g->getCurrentGamePhase() == Constants::MTG_PHASE_UPKEEP && g->currentPlayer->isAI())
|
if (g->getCurrentGamePhase() == Constants::MTG_PHASE_UPKEEP && g->currentPlayer->isAI())
|
||||||
{
|
{
|
||||||
efficiency = 100;
|
efficiency = 100;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case MTGAbility::FOREACH:
|
case MTGAbility::FOREACH:
|
||||||
|
{
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
||||||
MTGAbility * a = AbilityFactory::getCoreAbility(ability);
|
MTGAbility * a = AbilityFactory::getCoreAbility(ability);
|
||||||
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
|
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
|
||||||
@@ -457,8 +468,10 @@ int AIAction::getEfficiency()
|
|||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case MTGAbility::STANDARDABILITYGRANT:
|
case MTGAbility::STANDARDABILITYGRANT:
|
||||||
|
{
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
MTGCardInstance * _target = (MTGCardInstance *) (a->target);
|
||||||
if (!target)
|
if (!target)
|
||||||
@@ -480,7 +493,8 @@ int AIAction::getEfficiency()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!target->has(a->abilitygranted) && g->getCurrentGamePhase() == Constants::MTG_PHASE_COMBATBEGIN
|
if (!target->has(a->abilitygranted) && g->getCurrentGamePhase() == Constants::MTG_PHASE_COMBATBEGIN
|
||||||
&& p == target->controller() && p->isAI())
|
&& p == target->controller() && p->isAI()
|
||||||
|
)
|
||||||
{
|
{
|
||||||
efficiency += efficiencyModifier;
|
efficiency += efficiencyModifier;
|
||||||
}
|
}
|
||||||
@@ -492,15 +506,18 @@ int AIAction::getEfficiency()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((suggestion == BAKA_EFFECT_BAD && p == target->controller())
|
if ((suggestion == BAKA_EFFECT_BAD && p == target->controller())
|
||||||
|| (suggestion == BAKA_EFFECT_GOOD && p != target->controller()))
|
|| (suggestion == BAKA_EFFECT_GOOD && p != target->controller())
|
||||||
|
)
|
||||||
{
|
{
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
//stop giving trample to the players creatures.
|
//stop giving trample to the players creatures.
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case MTGAbility::UNTAPPER:
|
case MTGAbility::UNTAPPER:
|
||||||
//untap things that Ai owns and are tapped.
|
//untap things that Ai owns and are tapped.
|
||||||
|
{
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
if (!target)
|
if (!target)
|
||||||
break;
|
break;
|
||||||
@@ -510,9 +527,11 @@ int AIAction::getEfficiency()
|
|||||||
efficiency = (20 * target->DangerRanking());
|
efficiency = (20 * target->DangerRanking());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case MTGAbility::TAPPER:
|
case MTGAbility::TAPPER:
|
||||||
//tap things the player owns and that are untapped.
|
//tap things the player owns and that are untapped.
|
||||||
|
{
|
||||||
if (!target)
|
if (!target)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -523,8 +542,10 @@ int AIAction::getEfficiency()
|
|||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case MTGAbility::LIFER:
|
case MTGAbility::LIFER:
|
||||||
|
{
|
||||||
//use life abilities whenever possible.
|
//use life abilities whenever possible.
|
||||||
AALifer * alife = (AALifer *) a;
|
AALifer * alife = (AALifer *) a;
|
||||||
Targetable * _t = alife->getTarget();
|
Targetable * _t = alife->getTarget();
|
||||||
@@ -539,8 +560,9 @@ int AIAction::getEfficiency()
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case MTGAbility::STANDARD_DRAW:
|
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.
|
//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.
|
//this should help a little, tho ultimately it will be decided later what the best course of action is.
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
@@ -557,15 +579,16 @@ int AIAction::getEfficiency()
|
|||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case MTGAbility::CLONING:
|
case MTGAbility::CLONING:
|
||||||
|
{
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
if (p == target->controller())
|
if (p == target->controller())
|
||||||
{
|
{
|
||||||
efficiency = 20 * target->DangerRanking();
|
efficiency = 20 * target->DangerRanking();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case MTGAbility::MANA_PRODUCER:
|
case MTGAbility::MANA_PRODUCER:
|
||||||
efficiency = 0;
|
efficiency = 0;
|
||||||
break;
|
break;
|
||||||
@@ -801,18 +824,21 @@ int AIPlayer::chooseTarget(TargetChooser * _tc, Player * forceTarget)
|
|||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case TARGET_CARD:
|
case TARGET_CARD:
|
||||||
|
{
|
||||||
MTGCardInstance * card = ((MTGCardInstance *) potentialTargets[i]);
|
MTGCardInstance * card = ((MTGCardInstance *) potentialTargets[i]);
|
||||||
clickstream.push(NEW AIAction(card));
|
clickstream.push(NEW AIAction(card));
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case TARGET_PLAYER:
|
case TARGET_PLAYER:
|
||||||
|
{
|
||||||
Player * player = ((Player *) potentialTargets[i]);
|
Player * player = ((Player *) potentialTargets[i]);
|
||||||
clickstream.push(NEW AIAction(player));
|
clickstream.push(NEW AIAction(player));
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//Couldn't find any valid target,
|
//Couldn't find any valid target,
|
||||||
//usually that's because we played a card that has bad side effects (ex: when X comes into play, return target land you own to your hand)
|
//usually that's because we played a card that has bad side effects (ex: when X comes into play, return target land you own to your hand)
|
||||||
//so we try again to choose a target in the other player's field...
|
//so we try again to choose a target in the other player's field...
|
||||||
@@ -1214,6 +1240,8 @@ int AIPlayerBaka::computeActions()
|
|||||||
{
|
{
|
||||||
case Constants::MTG_PHASE_FIRSTMAIN:
|
case Constants::MTG_PHASE_FIRSTMAIN:
|
||||||
case Constants::MTG_PHASE_SECONDMAIN:
|
case Constants::MTG_PHASE_SECONDMAIN:
|
||||||
|
{
|
||||||
|
|
||||||
bool potential = false;
|
bool potential = false;
|
||||||
ManaCost * currentMana = getPotentialMana();
|
ManaCost * currentMana = getPotentialMana();
|
||||||
if (currentMana->getConvertedCost())
|
if (currentMana->getConvertedCost())
|
||||||
@@ -1313,15 +1341,13 @@ int AIPlayerBaka::computeActions()
|
|||||||
computeActions();
|
computeActions();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case Constants::MTG_PHASE_COMBATATTACKERS:
|
case Constants::MTG_PHASE_COMBATATTACKERS:
|
||||||
chooseAttackers();
|
chooseAttackers();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Constants::MTG_PHASE_ENDOFTURN:
|
case Constants::MTG_PHASE_ENDOFTURN:
|
||||||
Checked = false;
|
Checked = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
selectAbility();
|
selectAbility();
|
||||||
break;
|
break;
|
||||||
@@ -1335,13 +1361,11 @@ int AIPlayerBaka::computeActions()
|
|||||||
case Constants::MTG_PHASE_COMBATBLOCKERS:
|
case Constants::MTG_PHASE_COMBATBLOCKERS:
|
||||||
chooseBlockers();
|
chooseBlockers();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|||||||
Reference in New Issue
Block a user