- Adding AI for Combustible Gearhulk based upon known information.

- Adding current Energy count to payenergy cost
This commit is contained in:
Sol
2016-09-23 14:36:21 +00:00
parent 8563218aa2
commit cbaa40d499
3 changed files with 22 additions and 7 deletions

View File

@@ -5,12 +5,8 @@ import forge.ai.ComputerUtilCost;
import forge.ai.SpellAbilityAi; import forge.ai.SpellAbilityAi;
import forge.card.MagicColor; import forge.card.MagicColor;
import forge.game.Game; import forge.game.Game;
import forge.game.card.Card; import forge.game.card.*;
import forge.game.card.CardCollection;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates.Presets; import forge.game.card.CardPredicates.Presets;
import forge.game.card.CardUtil;
import forge.game.card.CounterType;
import forge.game.combat.Combat; import forge.game.combat.Combat;
import forge.game.combat.CombatUtil; import forge.game.combat.CombatUtil;
import forge.game.cost.Cost; import forge.game.cost.Cost;
@@ -274,6 +270,24 @@ public class ChooseGenericEffectAi extends SpellAbilityAi {
int evalToken = ComputerUtilCard.evaluateCreatureList(tokenList); int evalToken = ComputerUtilCard.evaluateCreatureList(tokenList);
return evalToken >= evalCounter ? tokenSA : counterSA; return evalToken >= evalCounter ? tokenSA : counterSA;
} else if ("CombustibleGearhulk".equals(logic)) {
Player controller = sa.getActivatingPlayer();
List<ZoneType> zones = ZoneType.listValueOf("Graveyard, Battlefield, Exile");
int life = player.getLife();
CardCollectionView revealedCards = controller.getCardsIn(zones);
if (revealedCards.size() < 5) {
// Not very many revealed cards, just guess based on lifetotal
return life < 7 ? spells.get(0) : spells.get(1);
}
int totalCMC = 0;
for(Card c : revealedCards) {
totalCMC += c.getCMC();
}
int bestGuessDamage = totalCMC * 3 / revealedCards.size();
return life <= bestGuessDamage ? spells.get(0) : spells.get(1);
} }
return spells.get(0); // return first choice if no logic found return spells.get(0); // return first choice if no logic found
} }

View File

@@ -4,7 +4,7 @@ Types:Artifact Creature Construct
PT:6/6 PT:6/6
K:First Strike K:First Strike
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ DBChoice | TriggerDescription$ When CARDNAME enters the battlefield, target opponent may have you draw three cards. If the player doesn't, put the top three cards of your library into your graveyard, then CARDNAME deals damage to that player equal to the total converted mana cost of those cards. T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ DBChoice | TriggerDescription$ When CARDNAME enters the battlefield, target opponent may have you draw three cards. If the player doesn't, put the top three cards of your library into your graveyard, then CARDNAME deals damage to that player equal to the total converted mana cost of those cards.
SVar:DBChoice:DB$ GenericChoice | ValidTgts$ Opponent | Choices$ CombustDraw,CombustDamage SVar:DBChoice:DB$ GenericChoice | ValidTgts$ Opponent | Choices$ CombustDraw,CombustDamage | AILogic$ CombustibleGearhulk
SVar:CombustDraw:DB$ Draw | Defined$ You | NumCards$ 3 | SpellDescription$ Controller draws three cards SVar:CombustDraw:DB$ Draw | Defined$ You | NumCards$ 3 | SpellDescription$ Controller draws three cards
SVar:CombustDamage:DB$ Mill | Defined$ You | NumCards$ 3 | RememberMilled$ True | SubAbility$ DamageOpponent | SpellDescription$ Mill 3 and take damage equal to total converted mana cost. SVar:CombustDamage:DB$ Mill | Defined$ You | NumCards$ 3 | RememberMilled$ True | SubAbility$ DamageOpponent | SpellDescription$ Mill 3 and take damage equal to total converted mana cost.
SVar:DamageOpponent:DB$ DealDamage | Defined$ ParentTarget | NumDmg$ X | References$ X | SubAbility$ DBCleanup SVar:DamageOpponent:DB$ DealDamage | Defined$ ParentTarget | NumDmg$ X | References$ X | SubAbility$ DBCleanup

View File

@@ -581,7 +581,8 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
} }
if (player.canPayEnergy(c) && player.getController().confirmPayment(cost, "Pay " + c + " Energy?")) { if (player.canPayEnergy(c) &&
player.getController().confirmPayment(cost, "Pay " + c + " Energy? (You have " + player.getCounters(CounterType.ENERGY) + ")")) {
return PaymentDecision.number(c); return PaymentDecision.number(c);
} }
return null; return null;