mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
- Improved AI gaining Threshold.
This commit is contained in:
@@ -7,6 +7,7 @@ import forge.card.ability.AbilityUtils;
|
|||||||
import forge.card.ability.SpellAbilityAi;
|
import forge.card.ability.SpellAbilityAi;
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.card.spellability.Target;
|
import forge.card.spellability.Target;
|
||||||
|
import forge.game.ai.ComputerUtil;
|
||||||
import forge.game.phase.PhaseType;
|
import forge.game.phase.PhaseType;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.player.PlayerActionConfirmMode;
|
import forge.game.player.PlayerActionConfirmMode;
|
||||||
@@ -51,7 +52,7 @@ public class DigAi extends SpellAbilityAi {
|
|||||||
|
|
||||||
// Don't use draw abilities before main 2 if possible
|
// Don't use draw abilities before main 2 if possible
|
||||||
if (ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) && !sa.hasParam("ActivationPhases")
|
if (ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) && !sa.hasParam("ActivationPhases")
|
||||||
&& !sa.hasParam("DestinationZone")) {
|
&& !sa.hasParam("DestinationZone") && !ComputerUtil.castSpellInMain1(ai, sa)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import forge.card.spellability.AbilityStatic;
|
|||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.card.spellability.SpellAbilityStackInstance;
|
import forge.card.spellability.SpellAbilityStackInstance;
|
||||||
import forge.card.spellability.Target;
|
import forge.card.spellability.Target;
|
||||||
|
import forge.card.staticability.StaticAbility;
|
||||||
import forge.error.BugReporter;
|
import forge.error.BugReporter;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.phase.Combat;
|
import forge.game.phase.Combat;
|
||||||
@@ -1099,14 +1100,23 @@ public class ComputerUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final List<Card> buffed = ai.getCardsIn(ZoneType.Battlefield);
|
final List<Card> buffed = ai.getCardsIn(ZoneType.Battlefield);
|
||||||
for (Card buffedcard : buffed) {
|
boolean checkThreshold = sa.isSpell() && !ai.hasThreshold() && !sa.getSourceCard().isInZone(ZoneType.Graveyard);
|
||||||
if (buffedcard.hasSVar("BuffedBy")) {
|
for (Card buffedCard : buffed) {
|
||||||
final String buffedby = buffedcard.getSVar("BuffedBy");
|
if (buffedCard.hasSVar("BuffedBy")) {
|
||||||
|
final String buffedby = buffedCard.getSVar("BuffedBy");
|
||||||
final String[] bffdby = buffedby.split(",");
|
final String[] bffdby = buffedby.split(",");
|
||||||
if (source.isValid(bffdby, buffedcard.getController(), buffedcard)) {
|
if (source.isValid(bffdby, buffedCard.getController(), buffedCard)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Fill the graveyard for Threshold
|
||||||
|
if (checkThreshold) {
|
||||||
|
for (StaticAbility stAb : buffedCard.getStaticAbilities()) {
|
||||||
|
if ("Threshold".equals(stAb.getMapParams().get("Condition"))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all cards the human controls with AntiBuffedBy
|
// get all cards the human controls with AntiBuffedBy
|
||||||
|
|||||||
Reference in New Issue
Block a user