- Improved AI predicting some ETB triggers.

This commit is contained in:
Sloth
2013-03-22 12:22:54 +00:00
parent 025c2a2e7f
commit 563d21a094
3 changed files with 8 additions and 8 deletions

View File

@@ -5,8 +5,8 @@ PT:5/6
K:Flying K:Flying
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigExile | TriggerDescription$ When CARDNAME enters the battlefield, you may exile up to three other target creatures from the battlefield and/or creature cards from graveyards. T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigExile | TriggerDescription$ When CARDNAME enters the battlefield, you may exile up to three other target creatures from the battlefield and/or creature cards from graveyards.
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.Self | Execute$ TrigReturn | TriggerController$ TriggeredCardController | TriggerDescription$ When CARDNAME leaves the battlefield, return the exiled card to the battlefield under its owner's control. T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.Self | Execute$ TrigReturn | TriggerController$ TriggeredCardController | TriggerDescription$ When CARDNAME leaves the battlefield, return the exiled card to the battlefield under its owner's control.
SVar:TrigExile:DB$ChangeZone | TargetMin$ 0 | TargetMax$ 3 | IsCurse$ True | ValidTgts$ Creature.Other | TgtPrompt$ Choose another target creature | RememberChanged$ True | Origin$ Battlefield,Graveyard | Destination$ Exile SVar:TrigExile:DB$ ChangeZone | TargetMin$ 0 | TargetMax$ 3 | IsCurse$ True | ValidTgts$ Creature.Other | TgtPrompt$ Choose another target creature | RememberChanged$ True | Origin$ Battlefield,Graveyard | Destination$ Exile
SVar:TrigReturn:DB$ChangeZone | Defined$ Remembered | Origin$ Exile | Destination$ Hand | SubAbility$ DBCleanup SVar:TrigReturn:DB$ ChangeZone | Defined$ Remembered | Origin$ Exile | Destination$ Hand | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:PlayMain1:TRUE SVar:PlayMain1:TRUE
SVar:Picture:http://www.wizards.com/global/images/magic/general/angel_of_serenity.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/angel_of_serenity.jpg

View File

@@ -670,8 +670,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
* a boolean. * a boolean.
* @return a boolean. * @return a boolean.
*/ */
private static boolean isPreferredTarget(final AIPlayer ai, final SpellAbility sa, private static boolean isPreferredTarget(final AIPlayer ai, final SpellAbility sa, final boolean mandatory) {
final boolean mandatory) {
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
final ZoneType origin = ZoneType.listValueOf(sa.getParam("Origin")).get(0); final ZoneType origin = ZoneType.listValueOf(sa.getParam("Origin")).get(0);
final ZoneType destination = ZoneType.smartValueOf(sa.getParam("Destination")); final ZoneType destination = ZoneType.smartValueOf(sa.getParam("Destination"));
@@ -833,7 +832,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
return false; return false;
} }
if (!mandatory && (list.size() < tgt.getMinTargets(sa.getSourceCard(), sa))) { if (!mandatory && list.size() < tgt.getMinTargets(sa.getSourceCard(), sa)) {
return false; return false;
} }
@@ -843,8 +842,8 @@ public class ChangeZoneAi extends SpellAbilityAi {
Card choice = null; Card choice = null;
if (!list.isEmpty()) { if (!list.isEmpty()) {
final Card mostExpensive = ComputerUtilCard.getMostExpensivePermanentAI(list, sa, false);
if (destination.equals(ZoneType.Battlefield) || origin.equals(ZoneType.Battlefield)) { if (destination.equals(ZoneType.Battlefield) || origin.equals(ZoneType.Battlefield)) {
final Card mostExpensive = ComputerUtilCard.getMostExpensivePermanentAI(list, sa, false);
if (mostExpensive.isCreature()) { if (mostExpensive.isCreature()) {
// if a creature is most expensive take the best one // if a creature is most expensive take the best one
if (destination.equals(ZoneType.Exile)) { if (destination.equals(ZoneType.Exile)) {
@@ -887,13 +886,13 @@ public class ChangeZoneAi extends SpellAbilityAi {
} }
} }
if (choice == null) { // can't find anything left 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) { if (!mandatory) {
tgt.resetTargets(); tgt.resetTargets();
} }
return false; return false;
} else { } else {
if (!ComputerUtil.shouldCastLessThanMax(ai, source)) { if (!sa.isTrigger() && !ComputerUtil.shouldCastLessThanMax(ai, source)) {
return false; return false;
} }
break; break;

View File

@@ -327,6 +327,7 @@ public class SpellPermanent extends Spell {
else { else {
throw new InvalidParameterException("Either ai or sa must be not null!"); throw new InvalidParameterException("Either ai or sa must be not null!");
} }
exSA.setTrigger(true);
// Run non-mandatory trigger. // Run non-mandatory trigger.
// These checks only work if the Executing SpellAbility is an // These checks only work if the Executing SpellAbility is an