- Added the initial boolean flags for advanced Flash AI.

- Refactored the adv Flash logic to its own method.
This commit is contained in:
Agetian
2018-11-20 22:56:39 +03:00
parent 2d2ddac2e8
commit 81b5feb0f9
2 changed files with 18 additions and 1 deletions

View File

@@ -83,7 +83,7 @@ public class PermanentCreatureAi extends PermanentAi {
advancedFlash = ((PlayerControllerAi)ai.getController()).getAi().getBooleanProperty(AiProps.FLASH_ENABLE_ADVANCED_LOGIC); advancedFlash = ((PlayerControllerAi)ai.getController()).getAi().getBooleanProperty(AiProps.FLASH_ENABLE_ADVANCED_LOGIC);
} }
if (advancedFlash) { if (advancedFlash) {
return doAdvancedFlashLogic(card, ai, sa);
} else { } else {
// save cards with flash for surprise blocking // save cards with flash for surprise blocking
if (card.withFlash(ai) if (card.withFlash(ai)
@@ -102,6 +102,22 @@ public class PermanentCreatureAi extends PermanentAi {
return super.checkPhaseRestrictions(ai, sa, ph); 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 @Override
protected boolean checkApiLogic(Player ai, SpellAbility sa) { protected boolean checkApiLogic(Player ai, SpellAbility sa) {

View File

@@ -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: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:TrigReturn:DB$ ChangeZoneAll | Origin$ Exile | Destination$ Battlefield | ChangeType$ Card.IsRemembered | SubAbility$ ExileSelf
SVar:ExileSelf:DB$ ChangeZone | Origin$ Command | Destination$ Exile | Defined$ Self 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 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. 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.