mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Improve discard check
This commit is contained in:
@@ -139,7 +139,7 @@ public class ComputerUtilCost {
|
||||
if (source.getAbilityText().contains("Bloodrush")) {
|
||||
continue;
|
||||
} else if (ai.getGame().getPhaseHandler().is(PhaseType.END_OF_TURN, ai)
|
||||
&& ai.getCardsIn(ZoneType.Hand).size() > ai.getMaxHandSize()) {
|
||||
&& !ai.isUnlimitedHandSize() && ai.getCardsIn(ZoneType.Hand).size() > ai.getMaxHandSize()) {
|
||||
// Better do something than just discard stuff
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public abstract class SpellAbilityAi {
|
||||
if (sa.hasParam("AILogic")) {
|
||||
final String logic = sa.getParam("AILogic");
|
||||
final boolean alwaysOnDiscard = "AlwaysOnDiscard".equals(logic) && ai.getGame().getPhaseHandler().is(PhaseType.END_OF_TURN, ai)
|
||||
&& ai.getCardsIn(ZoneType.Hand).size() > ai.getMaxHandSize();
|
||||
&& !ai.isUnlimitedHandSize() && ai.getCardsIn(ZoneType.Hand).size() > ai.getMaxHandSize();
|
||||
if (!checkAiLogic(ai, sa, logic)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ public class AttachAi extends SpellAbilityAi {
|
||||
|
||||
boolean hasFloatMana = ai.getManaPool().totalMana() > 0;
|
||||
boolean willDiscardNow = game.getPhaseHandler().is(PhaseType.END_OF_TURN, ai)
|
||||
&& ai.getCardsIn(ZoneType.Hand).size() > ai.getMaxHandSize();
|
||||
&& !ai.isUnlimitedHandSize() && ai.getCardsIn(ZoneType.Hand).size() > ai.getMaxHandSize();
|
||||
boolean willDieNow = combat != null && ComputerUtilCombat.lifeInSeriousDanger(ai, combat);
|
||||
boolean willRespondToStack = canRespondToStack && MyRandom.percentTrue(chanceToRespondToStack);
|
||||
boolean willCastEarly = MyRandom.percentTrue(chanceToCastEarly);
|
||||
|
||||
@@ -119,7 +119,7 @@ public abstract class DamageAiBase extends SpellAbilityAi {
|
||||
PhaseHandler phase = game.getPhaseHandler();
|
||||
// If this is a spell, cast it instead of discarding
|
||||
if ((phase.is(PhaseType.END_OF_TURN) || phase.is(PhaseType.MAIN2))
|
||||
&& phase.isPlayerTurn(comp) && (hand.size() > comp.getMaxHandSize())) {
|
||||
&& phase.isPlayerTurn(comp) && hand.size() > comp.getMaxHandSize()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ public class PermanentCreatureAi extends PermanentAi {
|
||||
boolean hasAmbushAI = card.hasSVar("AmbushAI");
|
||||
boolean defOnlyAmbushAI = hasAmbushAI && "BlockOnly".equals(card.getSVar("AmbushAI"));
|
||||
boolean hasFloatMana = ai.getManaPool().totalMana() > 0;
|
||||
boolean willDiscardNow = isOwnEOT && ai.getCardsIn(ZoneType.Hand).size() > ai.getMaxHandSize();
|
||||
boolean willDiscardNow = isOwnEOT && !ai.isUnlimitedHandSize() && ai.getCardsIn(ZoneType.Hand).size() > ai.getMaxHandSize();
|
||||
boolean willDieNow = combat != null && ComputerUtilCombat.lifeInSeriousDanger(ai, combat);
|
||||
boolean wantToCastInMain1 = ph.is(PhaseType.MAIN1, ai) && ComputerUtil.castPermanentInMain1(ai, sa);
|
||||
boolean isCommander = card.isCommander();
|
||||
|
||||
Reference in New Issue
Block a user