Merge branch 'master' into 'master'

A simple AI logic to enable Oko, the Trickster ultimate

See merge request core-developers/forge!3916
This commit is contained in:
Michael Kamensky
2021-02-19 11:38:15 +00:00
2 changed files with 16 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
package forge.ai.ability; package forge.ai.ability;
import forge.ai.ComputerUtilCard;
import forge.ai.SpellAbilityAi; import forge.ai.SpellAbilityAi;
import forge.game.card.Card;
import forge.game.player.Player; import forge.game.player.Player;
import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbility;
@@ -8,12 +10,23 @@ public class AnimateAllAi extends SpellAbilityAi {
@Override @Override
protected boolean canPlayAI(Player aiPlayer, SpellAbility sa) { protected boolean canPlayAI(Player aiPlayer, SpellAbility sa) {
return "Always".equals(sa.getParam("AILogic")); String logic = sa.getParamOrDefault("AILogic", "");
if ("CreatureAdvantage".equals(logic) && !aiPlayer.getCreaturesInPlay().isEmpty()) {
// TODO: improve this or implement a better logic for abilities like Oko, the Trickster ultimate
for (Card c : aiPlayer.getCreaturesInPlay()) {
if (ComputerUtilCard.doesCreatureAttackAI(aiPlayer, c)) {
return true;
}
}
}
return "Always".equals(logic);
} // end animateAllCanPlayAI() } // end animateAllCanPlayAI()
@Override @Override
protected boolean doTriggerAINoCost(Player aiPlayer, SpellAbility sa, boolean mandatory) { protected boolean doTriggerAINoCost(Player aiPlayer, SpellAbility sa, boolean mandatory) {
return mandatory; return mandatory || canPlayAI(aiPlayer, sa);
} }
} // end class AbilityFactoryAnimate } // end class AbilityFactoryAnimate

View File

@@ -5,6 +5,6 @@ Loyalty:4
A:AB$ PutCounter | Cost$ AddCounter<1/LOYALTY> | Planeswalker$ True | TargetMin$ 0 | TargetMax$ 1 | CounterType$ P1P1 | CounterNum$ 2 | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | SpellDescription$ Put two +1/+1 counters on up to one target creature you control. A:AB$ PutCounter | Cost$ AddCounter<1/LOYALTY> | Planeswalker$ True | TargetMin$ 0 | TargetMax$ 1 | CounterType$ P1P1 | CounterNum$ 2 | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | SpellDescription$ Put two +1/+1 counters on up to one target creature you control.
A:AB$ Clone | Cost$ AddCounter<0/LOYALTY> | ValidTgts$ Creature.YouCtrl | Planeswalker$ True | TgtPrompt$ Select target creature you control | Duration$ UntilEndOfTurn | SubAbility$ DBPrevent | StackDescription$ SpellDescription | SpellDescription$ Until end of turn, CARDNAME becomes a copy of target creature you control. Prevent all damage that would be dealt to him this turn. A:AB$ Clone | Cost$ AddCounter<0/LOYALTY> | ValidTgts$ Creature.YouCtrl | Planeswalker$ True | TgtPrompt$ Select target creature you control | Duration$ UntilEndOfTurn | SubAbility$ DBPrevent | StackDescription$ SpellDescription | SpellDescription$ Until end of turn, CARDNAME becomes a copy of target creature you control. Prevent all damage that would be dealt to him this turn.
SVar:DBPrevent:DB$ Pump | Defined$ Self | KW$ Prevent all damage that would be dealt to CARDNAME. SVar:DBPrevent:DB$ Pump | Defined$ Self | KW$ Prevent all damage that would be dealt to CARDNAME.
A:AB$ AnimateAll | Cost$ SubCounter<7/LOYALTY> | Planeswalker$ True | Ultimate$ True | ValidCards$ Creature.YouCtrl | Power$ 10 | Toughness$ 10 | Keywords$ Trample | SpellDescription$ Until end of turn, each creature you control has base power and toughness 10/10 and gains trample. A:AB$ AnimateAll | Cost$ SubCounter<7/LOYALTY> | Planeswalker$ True | Ultimate$ True | ValidCards$ Creature.YouCtrl | Power$ 10 | Toughness$ 10 | Keywords$ Trample | AILogic$ CreatureAdvantage | SpellDescription$ Until end of turn, each creature you control has base power and toughness 10/10 and gains trample.
DeckHas:Ability$Counters DeckHas:Ability$Counters
Oracle:[+1]: Put two +1/+1 counters on up to one target creature you control.\n[0]: Until end of turn, Oko, the Trickster becomes a copy of target creature you control. Prevent all damage that would be dealt to him this turn.\n[7]: Until end of turn, each creature you control has base power and toughness 10/10 and gains trample. Oracle:[+1]: Put two +1/+1 counters on up to one target creature you control.\n[0]: Until end of turn, Oko, the Trickster becomes a copy of target creature you control. Prevent all damage that would be dealt to him this turn.\n[7]: Until end of turn, each creature you control has base power and toughness 10/10 and gains trample.