- Initial setup for advanced Flash.

This commit is contained in:
Agetian
2018-11-20 22:47:54 +03:00
parent 94b3ff0195
commit 2d2ddac2e8
2 changed files with 23 additions and 14 deletions

View File

@@ -113,7 +113,8 @@ public enum AiProps { /** */
MOJHOSTO_CHANCE_TO_PREFER_JHOIRA_OVER_MOMIR ("50"), /** */
MOJHOSTO_CHANCE_TO_USE_JHOIRA_COPY_INSTANT ("20"), /** */
AI_IN_DANGER_THRESHOLD("4"), /** */
AI_IN_DANGER_MAX_THRESHOLD("4"); /** */
AI_IN_DANGER_MAX_THRESHOLD("4"), /** */
FLASH_ENABLE_ADVANCED_LOGIC("true"); /** */
// Experimental features, must be promoted or removed after extensive testing and, ideally, defaulting
// <-- There are no experimental options here -->

View File

@@ -1,8 +1,6 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilCost;
import forge.ai.*;
import forge.card.mana.ManaCost;
import forge.game.Game;
import forge.game.card.Card;
@@ -79,17 +77,27 @@ public class PermanentCreatureAi extends PermanentAi {
return false;
}
// Flash logic
boolean advancedFlash = false;
if (ai.getController().isAI()) {
advancedFlash = ((PlayerControllerAi)ai.getController()).getAi().getBooleanProperty(AiProps.FLASH_ENABLE_ADVANCED_LOGIC);
}
if (advancedFlash) {
} else {
// save cards with flash for surprise blocking
if (card.withFlash(ai)
&& (ai.isUnlimitedHandSize() || ai.getCardsIn(ZoneType.Hand).size() <= ai.getMaxHandSize()
|| ph.getPhase().isBefore(PhaseType.END_OF_TURN))
&& ai.getManaPool().totalMana() <= 0
&& (ph.isPlayerTurn(ai) || ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS))
&& (!card.hasETBTrigger(true) || card.hasSVar("AmbushAI")) && game.getStack().isEmpty()
&& (!card.hasETBTrigger(true) && !card.hasSVar("AmbushAI"))
&& game.getStack().isEmpty()
&& !ComputerUtil.castPermanentInMain1(ai, sa)) {
// AiPlayDecision.AnotherTime;
return false;
}
}
return super.checkPhaseRestrictions(ai, sa, ph);
}