- Added AI support for Duneblast.

This commit is contained in:
Sloth
2014-09-22 07:25:46 +00:00
parent 49d4d3cd77
commit 44aed6b85d
2 changed files with 30 additions and 2 deletions

View File

@@ -105,6 +105,25 @@ public class ChooseCardAi extends SpellAbilityAi {
if (CardLists.getValidCards(choices, "Card.nonLand", host.getController(), host).isEmpty()) { if (CardLists.getValidCards(choices, "Card.nonLand", host.getController(), host).isEmpty()) {
return false; return false;
} }
} else if (logic.equals("Duneblast")) {
List<Card> aiCreatures = ai.getCreaturesInPlay();
List<Card> oppCreatures = ai.getOpponent().getCreaturesInPlay();
aiCreatures = CardLists.getNotKeyword(aiCreatures, "Indestructible");
oppCreatures = CardLists.getNotKeyword(oppCreatures, "Indestructible");
// Use it as a wrath, when the human creatures threat the ai's life
if (aiCreatures.isEmpty() && ComputerUtilCombat.sumDamageIfUnblocked(oppCreatures, ai) >= ai.getLife()) {
return true;
}
Card chosen = ComputerUtilCard.getBestCreatureAI(aiCreatures);
aiCreatures.remove(chosen);
int minGain = 200;
if ((ComputerUtilCard.evaluateCreatureList(aiCreatures) + minGain) >= ComputerUtilCard
.evaluateCreatureList(oppCreatures)) {
return false;
}
} }
} }
@@ -204,6 +223,16 @@ public class ChooseCardAi extends SpellAbilityAi {
} else { } else {
choice = ComputerUtilCard.getWorstPermanentAI(options, false, false, false, false); choice = ComputerUtilCard.getWorstPermanentAI(options, false, false, false, false);
} }
} else if (logic.equals("Duneblast")) {
List<Card> aiCreatures = ai.getCreaturesInPlay();
aiCreatures = CardLists.getNotKeyword(aiCreatures, "Indestructible");
if (aiCreatures.isEmpty()) {
return null;
}
Card chosen = ComputerUtilCard.getBestCreatureAI(aiCreatures);
return chosen;
} else { } else {
choice = ComputerUtilCard.getBestAI(options); choice = ComputerUtilCard.getBestAI(options);
} }

View File

@@ -1,9 +1,8 @@
Name:Duneblast Name:Duneblast
ManaCost:4 W B G ManaCost:4 W B G
Types:Sorcery Types:Sorcery
A:SP$ ChooseCard | Cost$ 4 W G B | Defined$ You | Amount$ 1 | Choices$ Creature | ChoiceTitle$ Choose a creature | SubAbility$ DBDestroyAll | RememberChosen$ True | SpellDescription$ Choose up to one creature. Destroy the rest. A:SP$ ChooseCard | Cost$ 4 W G B | Defined$ You | Amount$ 1 | Choices$ Creature | ChoiceTitle$ Choose a creature | AILogic$ Duneblast | SubAbility$ DBDestroyAll | RememberChosen$ True | SpellDescription$ Choose up to one creature. Destroy the rest.
SVar:DBDestroyAll:DB$ DestroyAll | ValidCards$ Creature.IsNotRemembered | SubAbility$ DBCleanup SVar:DBDestroyAll:DB$ DestroyAll | ValidCards$ Creature.IsNotRemembered | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/duneblast.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/duneblast.jpg
Oracle:Choose up to one creature. Destroy the rest. Oracle:Choose up to one creature. Destroy the rest.