- Improved usage of playReusable.

This commit is contained in:
Sloth
2013-03-03 08:47:27 +00:00
parent 50bc1772d1
commit 68def26221
5 changed files with 11 additions and 5 deletions

View File

@@ -84,6 +84,12 @@ public abstract class SpellAbilityAi {
if (sa.getRestrictions().getPlaneswalker() && Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.MAIN2)) {
return true;
}
if (sa.isTrigger()) {
return true;
}
if (sa.isSpell() && !sa.isBuyBackAbility()) {
return false;
}
PhaseHandler phase = Singletons.getModel().getGame().getPhaseHandler();
return phase.is(PhaseType.END_OF_TURN) && phase.getNextTurn().equals(ai);

View File

@@ -747,7 +747,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
}
}
// Blink permanents with ETB triggers
else if (sa.isAbility() && (sa.getPayCosts() != null) && SpellAbilityAi.playReusable(ai, sa)) {
else if (SpellAbilityAi.playReusable(ai, sa)) {
aiPermanents = CardLists.filter(aiPermanents, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {

View File

@@ -80,7 +80,7 @@ public class CounterAi extends SpellAbilityAi {
if (toPay <= usableManaSources) {
// If this is a reusable Resource, feel free to play it most of
// the time
if (!sa.getPayCosts().isReusuableResource() || sa.isSpell()) {
if (!SpellAbilityAi.playReusable(ai,sa)) {
return false;
}
}
@@ -148,7 +148,7 @@ public class CounterAi extends SpellAbilityAi {
if (toPay <= usableManaSources) {
// If this is a reusable Resource, feel free to play it most
// of the time
if (!sa.getPayCosts().isReusuableResource() || (MyRandom.getRandom().nextFloat() < .4)) {
if (!SpellAbilityAi.playReusable(ai,sa) || (MyRandom.getRandom().nextFloat() < .4)) {
return false;
}
}

View File

@@ -124,7 +124,7 @@ public class CountersPutAllAi extends SpellAbilityAi {
}
}
if (sa.isTrigger() || sa instanceof AbilitySub || SpellAbilityAi.playReusable(ai, sa)) {
if (SpellAbilityAi.playReusable(ai, sa)) {
return chance;
}

View File

@@ -132,7 +132,7 @@ public class LifeLoseAi extends SpellAbilityAi {
}
boolean randomReturn = r.nextFloat() <= .6667;
if (SpellAbilityAi.playReusable(ai, sa) || priority) {
if (priority || SpellAbilityAi.playReusable(ai, sa)) {
randomReturn = true;
}