From 81b5feb0f99e47b7f6baaebee46c80404c237829 Mon Sep 17 00:00:00 2001 From: Agetian Date: Tue, 20 Nov 2018 22:56:39 +0300 Subject: [PATCH] - Added the initial boolean flags for advanced Flash AI. - Refactored the adv Flash logic to its own method. --- .../forge/ai/ability/PermanentCreatureAi.java | 18 +++++++++++++++++- .../res/cardsfolder/h/hixus_prison_warden.txt | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/forge-ai/src/main/java/forge/ai/ability/PermanentCreatureAi.java b/forge-ai/src/main/java/forge/ai/ability/PermanentCreatureAi.java index ba2ee36c339..7362c5d28f0 100644 --- a/forge-ai/src/main/java/forge/ai/ability/PermanentCreatureAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/PermanentCreatureAi.java @@ -83,7 +83,7 @@ public class PermanentCreatureAi extends PermanentAi { advancedFlash = ((PlayerControllerAi)ai.getController()).getAi().getBooleanProperty(AiProps.FLASH_ENABLE_ADVANCED_LOGIC); } if (advancedFlash) { - + return doAdvancedFlashLogic(card, ai, sa); } else { // save cards with flash for surprise blocking if (card.withFlash(ai) @@ -102,6 +102,22 @@ public class PermanentCreatureAi extends PermanentAi { return super.checkPhaseRestrictions(ai, sa, ph); } + private boolean doAdvancedFlashLogic(Card card, Player ai, SpellAbility sa) { + PhaseHandler ph = ai.getGame().getPhaseHandler(); + + boolean hasETBTrigger = card.hasETBTrigger(true); + boolean hasAmbushAI = card.hasSVar("AmbushAI"); + boolean hasFloatMana = ai.getManaPool().totalMana() > 0; + boolean willDiscardNow = ph.is(PhaseType.END_OF_TURN, ai) && ai.getCardsIn(ZoneType.Hand).size() > ai.getMaxHandSize(); + boolean wantToCastInMain1 = ph.is(PhaseType.MAIN1, ai) && ComputerUtil.castPermanentInMain1(ai, sa); + boolean valuableBlocker = false; // TODO: implement this + + boolean isOwnEOT = ph.is(PhaseType.END_OF_TURN, ai); + boolean isEOTBeforeMyTurn = ph.is(PhaseType.END_OF_TURN) && ph.getNextTurn().equals(ai); + + return true; + } + @Override protected boolean checkApiLogic(Player ai, SpellAbility sa) { diff --git a/forge-gui/res/cardsfolder/h/hixus_prison_warden.txt b/forge-gui/res/cardsfolder/h/hixus_prison_warden.txt index 7646b5967e5..0030694388a 100644 --- a/forge-gui/res/cardsfolder/h/hixus_prison_warden.txt +++ b/forge-gui/res/cardsfolder/h/hixus_prison_warden.txt @@ -9,5 +9,6 @@ SVar:DBEffect:DB$ Effect | Triggers$ ComeBack | RememberObjects$ TriggeredCard | SVar:ComeBack:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.IsImprinted | Execute$ TrigReturn | TriggerZones$ Command | TriggerController$ You | Static$ True | TriggerDescription$ That creature is exiled until EFFECTSOURCE leaves the battlefield SVar:TrigReturn:DB$ ChangeZoneAll | Origin$ Exile | Destination$ Battlefield | ChangeType$ Card.IsRemembered | SubAbility$ ExileSelf SVar:ExileSelf:DB$ ChangeZone | Origin$ Command | Destination$ Exile | Defined$ Self +SVar:AmbushAI:True SVar:Picture:http://www.wizards.com/global/images/magic/general/hixus_prison_warden.jpg Oracle:Flash (You may cast this spell any time you could cast an instant.)\nWhenever a creature deals combat damage to you, if Hixus, Prison Warden entered the battlefield this turn, exile that creature until Hixus leaves the battlefield.