- Add some basic logic for Momir Avatar ability

This commit is contained in:
Sol
2013-05-11 17:55:17 +00:00
parent 7f2d1e49f9
commit 633d061977
2 changed files with 28 additions and 2 deletions

View File

@@ -2,7 +2,7 @@ Name:Momir Vig, Simic Visionary Avatar
ManaCost:no cost ManaCost:no cost
Types:Vanguard Types:Vanguard
HandLifeModifier:+0/+4 HandLifeModifier:+0/+4
A:AB$ NameCard | Cost$ X Discard<1/Card> | ActivationZone$ Command | AtRandom$ True | ValidCards$ Creature | ValidAttribute$ cmcEQX | References$ X | Amount$ 1 | SubAbility$ DBToken | SorcerySpeed$ True | ActivationLimit$ 1 | AILogic$ MomirAvatar | SpellDescription$ Put a token onto the battlefield that's a copy of a creature card with converted mana cost X chosen at random. Activate this ability only any time you could cast a sorcery and only once each turn. | StackDescription$ SpellDescription A:AB$ NameCard | Cost$ X Discard<1/Card> | AILogic$ MomirAvatar | ActivationZone$ Command | AtRandom$ True | ValidCards$ Creature | ValidAttribute$ cmcEQX | References$ X | Amount$ 1 | SubAbility$ DBToken | SorcerySpeed$ True | ActivationLimit$ 1 | AILogic$ MomirAvatar | SpellDescription$ Put a token onto the battlefield that's a copy of a creature card with converted mana cost X chosen at random. Activate this ability only any time you could cast a sorcery and only once each turn. | StackDescription$ SpellDescription
SVar:DBToken:DB$ CopyPermanent | ValidSupportedCopy$ Card | DefinedName$ NamedCard | NumCopies$ 1 | StackDescription$ SVar:DBToken:DB$ CopyPermanent | ValidSupportedCopy$ Card | DefinedName$ NamedCard | NumCopies$ 1 | StackDescription$
SVar:X:Count$xPaid SVar:X:Count$xPaid
SVar:Picture:http://www.cardforge.org/fpics/vgd-lq/momir_vig_simic_visionary_avatar.jpg SVar:Picture:http://www.cardforge.org/fpics/vgd-lq/momir_vig_simic_visionary_avatar.jpg

View File

@@ -1,22 +1,48 @@
package forge.card.ability.ai; package forge.card.ability.ai;
import forge.Card;
import forge.card.ability.SpellAbilityAi; import forge.card.ability.SpellAbilityAi;
import forge.card.spellability.SpellAbility; import forge.card.spellability.SpellAbility;
import forge.card.spellability.Target; import forge.card.spellability.Target;
import forge.game.ai.ComputerUtil; import forge.game.ai.ComputerUtil;
import forge.game.ai.ComputerUtilMana;
import forge.game.player.AIPlayer; import forge.game.player.AIPlayer;
public class ChooseCardNameAi extends SpellAbilityAi { public class ChooseCardNameAi extends SpellAbilityAi {
@Override @Override
protected boolean canPlayAI(AIPlayer ai, SpellAbility sa) { protected boolean canPlayAI(AIPlayer ai, SpellAbility sa) {
Card source = sa.getSourceCard();
if (sa.hasParam("AILogic")) { if (sa.hasParam("AILogic")) {
// Don't tap creatures that may be able to block // Don't tap creatures that may be able to block
if (ComputerUtil.waitForBlocking(sa)) { if (ComputerUtil.waitForBlocking(sa)) {
return false; return false;
} }
String logic = sa.getParam("AILogic");
if (logic.equals("MomirAvatar")) {
// Set PayX here to maximum value.
int tokenSize = ComputerUtilMana.determineLeftoverMana(sa, ai);
// Some basic strategy for Momir
if (tokenSize >= 11) {
tokenSize = 11;
} else if (tokenSize >= 9) {
tokenSize = 9;
} else if (tokenSize >= 8) {
tokenSize = 8;
} else if (tokenSize >= 6) {
tokenSize = 6;
} else if (tokenSize >= 4) {
tokenSize = 4;
} else if (tokenSize >= 2) {
tokenSize = 2;
} else {
return false;
}
source.setSVar("PayX", Integer.toString(tokenSize));
}
final Target tgt = sa.getTarget(); final Target tgt = sa.getTarget();
if (tgt != null) { if (tgt != null) {
tgt.resetTargets(); tgt.resetTargets();