code changes from trunk/src

This commit is contained in:
Maxmtg
2013-03-22 18:17:56 +00:00
parent e01b00d5d9
commit d192d4977f
3 changed files with 10 additions and 9 deletions

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"));
@@ -750,8 +749,8 @@ public class ChangeZoneAi extends SpellAbilityAi {
} }
} }
} }
// Blink permanents with ETB triggers // TODO: Blink permanents with ETB triggers
else if (!sa.isTrigger() && SpellAbilityAi.playReusable(ai, sa)) { /*else if (!sa.isTrigger() && SpellAbilityAi.playReusable(ai, sa)) {
aiPermanents = CardLists.filter(aiPermanents, new Predicate<Card>() { aiPermanents = CardLists.filter(aiPermanents, new Predicate<Card>() {
@Override @Override
public boolean apply(final Card c) { public boolean apply(final Card c) {
@@ -769,7 +768,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
tgt.addTarget(ComputerUtilCard.getBestAI(aiPermanents)); tgt.addTarget(ComputerUtilCard.getBestAI(aiPermanents));
return true; return true;
} }
} }*/
} }
} else if (origin.equals(ZoneType.Graveyard)) { } else if (origin.equals(ZoneType.Graveyard)) {
@@ -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

View File

@@ -1333,6 +1333,7 @@ public final class GameActionUtil {
while (child.getSubAbility() != null) { while (child.getSubAbility() != null) {
AbilitySub newChild = child.getSubAbility().getCopy(); AbilitySub newChild = child.getSubAbility().getCopy();
child.setSubAbility(newChild); child.setSubAbility(newChild);
child.setActivatingPlayer(s.getActivatingPlayer());
child = newChild; child = newChild;
} }