add AILogic for Tough Cookie

This commit is contained in:
Anthony Calosa
2023-09-30 20:56:25 +08:00
parent 6d70d76efd
commit c3e632852f
2 changed files with 15 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType; import forge.game.ability.ApiType;
import forge.game.ability.effects.AnimateEffectBase; import forge.game.ability.effects.AnimateEffectBase;
import forge.game.card.*; import forge.game.card.*;
import forge.game.combat.Combat;
import forge.game.cost.CostPutCounter; import forge.game.cost.CostPutCounter;
import forge.game.phase.PhaseHandler; import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType; import forge.game.phase.PhaseType;
@@ -386,6 +387,19 @@ public class AnimateAi extends SpellAbilityAi {
} }
} }
if (logic.equals("ValuableAttackerOrBlocker")) {
if (ph.inCombat()) {
final Combat combat = ph.getCombat();
CardCollection list = CardLists.getTargetableCards(ai.getGame().getCardsIn(ZoneType.Battlefield), sa);
for (Card c : list) {
Card animated = becomeAnimated(c, sa);
boolean isValuableAttacker = ph.is(PhaseType.MAIN1, ai) && ComputerUtilCard.doesSpecifiedCreatureAttackAI(ai, animated);
boolean isValuableBlocker = combat != null && combat.getDefendingPlayers().contains(ai) && ComputerUtilCard.doesSpecifiedCreatureBlock(ai, animated);
if (isValuableAttacker || isValuableBlocker)
return true;
}
}
}
// This is reasonable for now. Kamahl, Fist of Krosa and a sorcery or // This is reasonable for now. Kamahl, Fist of Krosa and a sorcery or
// two are the only things // two are the only things
// that animate a target. Those can just use AI:RemoveDeck:All until // that animate a target. Those can just use AI:RemoveDeck:All until

View File

@@ -4,7 +4,7 @@ Types:Artifact Creature Food Golem
PT:2/2 PT:2/2
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigFood | TriggerDescription$ When CARDNAME enters the battlefield, create a Food token. (It's an artifact with "{2}, {T}, Sacrifice this artifact: You gain 3 life.") T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigFood | TriggerDescription$ When CARDNAME enters the battlefield, create a Food token. (It's an artifact with "{2}, {T}, Sacrifice this artifact: You gain 3 life.")
SVar:TrigFood:DB$ Token | TokenAmount$ 1 | TokenScript$ c_a_food_sac | TokenOwner$ You SVar:TrigFood:DB$ Token | TokenAmount$ 1 | TokenScript$ c_a_food_sac | TokenOwner$ You
A:AB$ Animate | Cost$ 2 G | ValidTgts$ Artifact.nonCreature+YouCtrl | TgtPrompt$ Select target noncreature artifact you control | Power$ 4 | Toughness$ 4 | Types$ Artifact,Creature | SpellDescription$ Target noncreature artifact you control becomes a 4/4 artifact creature until end of turn. A:AB$ Animate | Cost$ 2 G | ValidTgts$ Artifact.nonCreature+YouCtrl | TgtPrompt$ Select target noncreature artifact you control | Power$ 4 | Toughness$ 4 | Types$ Artifact,Creature | AILogic$ ValuableAttackerOrBlocker | SpellDescription$ Target noncreature artifact you control becomes a 4/4 artifact creature until end of turn.
A:AB$ GainLife | Cost$ 2 T Sac<1/CARDNAME> | LifeAmount$ 3 | SpellDescription$ You gain 3 life. A:AB$ GainLife | Cost$ 2 T Sac<1/CARDNAME> | LifeAmount$ 3 | SpellDescription$ You gain 3 life.
DeckHas:Ability$LifeGain|Sacrifice|Token & Type$Food DeckHas:Ability$LifeGain|Sacrifice|Token & Type$Food
DeckHints:Type$Artifact DeckHints:Type$Artifact