mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- Improved AI predicting some ETB triggers.
This commit is contained in:
@@ -670,8 +670,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
* a boolean.
|
||||
* @return a boolean.
|
||||
*/
|
||||
private static boolean isPreferredTarget(final AIPlayer ai, final SpellAbility sa,
|
||||
final boolean mandatory) {
|
||||
private static boolean isPreferredTarget(final AIPlayer ai, final SpellAbility sa, final boolean mandatory) {
|
||||
final Card source = sa.getSourceCard();
|
||||
final ZoneType origin = ZoneType.listValueOf(sa.getParam("Origin")).get(0);
|
||||
final ZoneType destination = ZoneType.smartValueOf(sa.getParam("Destination"));
|
||||
@@ -833,7 +832,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mandatory && (list.size() < tgt.getMinTargets(sa.getSourceCard(), sa))) {
|
||||
if (!mandatory && list.size() < tgt.getMinTargets(sa.getSourceCard(), sa)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -843,8 +842,8 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
Card choice = null;
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
final Card mostExpensive = ComputerUtilCard.getMostExpensivePermanentAI(list, sa, false);
|
||||
if (destination.equals(ZoneType.Battlefield) || origin.equals(ZoneType.Battlefield)) {
|
||||
final Card mostExpensive = ComputerUtilCard.getMostExpensivePermanentAI(list, sa, false);
|
||||
if (mostExpensive.isCreature()) {
|
||||
// if a creature is most expensive take the best one
|
||||
if (destination.equals(ZoneType.Exile)) {
|
||||
@@ -887,13 +886,13 @@ public class ChangeZoneAi extends SpellAbilityAi {
|
||||
}
|
||||
}
|
||||
if (choice == null) { // can't find anything left
|
||||
if ((tgt.getNumTargeted() == 0) || (tgt.getNumTargeted() < tgt.getMinTargets(sa.getSourceCard(), sa))) {
|
||||
if (tgt.getNumTargeted() == 0 || tgt.getNumTargeted() < tgt.getMinTargets(sa.getSourceCard(), sa)) {
|
||||
if (!mandatory) {
|
||||
tgt.resetTargets();
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
if (!ComputerUtil.shouldCastLessThanMax(ai, source)) {
|
||||
if (!sa.isTrigger() && !ComputerUtil.shouldCastLessThanMax(ai, source)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -327,6 +327,7 @@ public class SpellPermanent extends Spell {
|
||||
else {
|
||||
throw new InvalidParameterException("Either ai or sa must be not null!");
|
||||
}
|
||||
exSA.setTrigger(true);
|
||||
|
||||
// Run non-mandatory trigger.
|
||||
// These checks only work if the Executing SpellAbility is an
|
||||
|
||||
Reference in New Issue
Block a user