- Better EffectAi for Vivien, Monsters' Advocate

This commit is contained in:
Michael Kamensky
2021-02-21 21:41:01 +03:00
parent 192ebb144c
commit eb68d4be04
2 changed files with 9 additions and 6 deletions

View File

@@ -1,11 +1,8 @@
package forge.ai.ability; package forge.ai.ability;
import java.util.List;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import forge.ai.*; import forge.ai.*;
import forge.game.Game; import forge.game.Game;
import forge.game.ability.ApiType; import forge.game.ability.ApiType;
@@ -21,6 +18,8 @@ import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType; import forge.game.zone.ZoneType;
import forge.util.MyRandom; import forge.util.MyRandom;
import java.util.List;
public class EffectAi extends SpellAbilityAi { public class EffectAi extends SpellAbilityAi {
@Override @Override
protected boolean canPlayAI(final Player ai,final SpellAbility sa) { protected boolean canPlayAI(final Player ai,final SpellAbility sa) {
@@ -103,10 +102,14 @@ public class EffectAi extends SpellAbilityAi {
randomReturn = true; randomReturn = true;
} else if (logic.equals("ChainVeil")) { } else if (logic.equals("ChainVeil")) {
if (!phase.isPlayerTurn(ai) || !phase.getPhase().equals(PhaseType.MAIN2) if (!phase.isPlayerTurn(ai) || !phase.getPhase().equals(PhaseType.MAIN2)
|| CardLists.getType(ai.getCardsIn(ZoneType.Battlefield), "Planeswalker").isEmpty()) { || CardLists.getType(ai.getCardsIn(ZoneType.Battlefield), "Planeswalker").isEmpty()) {
return false; return false;
} }
randomReturn = true; randomReturn = true;
} else if (logic.equals("WillCastCreature") && ai.isAI()) {
AiController aic = ((PlayerControllerAi)ai.getController()).getAi();
SpellAbility saCreature = aic.predictSpellToCastInMain2(ApiType.PermanentCreature);
randomReturn = saCreature != null && ComputerUtilMana.canPayManaCost(saCreature, ai, 0);
} else if (logic.equals("Always")) { } else if (logic.equals("Always")) {
randomReturn = true; randomReturn = true;
} else if (logic.equals("Main1")) { } else if (logic.equals("Main1")) {

View File

@@ -11,7 +11,7 @@ SVar:Reach:DB$ PutCounter | Choices$ Card.IsRemembered | ChoiceTitle$ Choose a t
SVar:Trample:DB$ PutCounter | Choices$ Card.IsRemembered | ChoiceTitle$ Choose a token to put a trample counter on | CounterType$ Trample | CounterNum$ 1 | SubAbility$ DBCleanup | SpellDescription$ Trample SVar:Trample:DB$ PutCounter | Choices$ Card.IsRemembered | ChoiceTitle$ Choose a token to put a trample counter on | CounterType$ Trample | CounterNum$ 1 | SubAbility$ DBCleanup | SpellDescription$ Trample
SVar:Vigilance:DB$ PutCounter | Choices$ Card.IsRemembered | ChoiceTitle$ Choose a token to put a vigilance counter on | CounterType$ Vigilance | CounterNum$ 1 | SubAbility$ DBCleanup | SpellDescription$ Vigilance SVar:Vigilance:DB$ PutCounter | Choices$ Card.IsRemembered | ChoiceTitle$ Choose a token to put a vigilance counter on | CounterType$ Vigilance | CounterNum$ 1 | SubAbility$ DBCleanup | SpellDescription$ Vigilance
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
A:AB$ Effect | Cost$ SubCounter<2/LOYALTY> | Planeswalker$ True | Ultimate$ True | Triggers$ TrigSearch | SVars$ DBSearch,X | AILogic$ Main1 | SpellDescription$ When you cast your next creature spell this turn, search your library for a creature card with lesser converted mana cost, put it onto the battlefield, then shuffle your library. A:AB$ Effect | Cost$ SubCounter<2/LOYALTY> | Planeswalker$ True | Ultimate$ True | Triggers$ TrigSearch | SVars$ DBSearch,X | AILogic$ WillCastCreature | SpellDescription$ When you cast your next creature spell this turn, search your library for a creature card with lesser converted mana cost, put it onto the battlefield, then shuffle your library.
SVar:TrigSearch:Mode$ SpellCast | ValidCard$ Creature | ValidActivatingPlayer$ You | OneOff$ True | TriggerZones$ Command | Execute$ DBSearch | TriggerDescription$ When you cast your next creature spell this turn, search your library for a creature card with lesser converted mana cost, put it onto the battlefield, then shuffle your library. SVar:TrigSearch:Mode$ SpellCast | ValidCard$ Creature | ValidActivatingPlayer$ You | OneOff$ True | TriggerZones$ Command | Execute$ DBSearch | TriggerDescription$ When you cast your next creature spell this turn, search your library for a creature card with lesser converted mana cost, put it onto the battlefield, then shuffle your library.
SVar:DBSearch:DB$ ChangeZone | Origin$ Library | Destination$ Battlefield | ChangeType$ Creature.cmcLTX | References$ X | ChangeNum$ 1 SVar:DBSearch:DB$ ChangeZone | Origin$ Library | Destination$ Battlefield | ChangeType$ Creature.cmcLTX | References$ X | ChangeNum$ 1
SVar:X:TriggerCount$CastSACMC SVar:X:TriggerCount$CastSACMC