- Improved AI of spells cast via copySpellontoStack.

This commit is contained in:
Sloth
2012-10-01 18:46:37 +00:00
parent 34efd19d3a
commit c3059f9909
2 changed files with 17 additions and 0 deletions

View File

@@ -719,6 +719,13 @@ public class AbilityFactoryZoneAffecting {
AbilityFactoryZoneAffecting.millResolve(af, this); AbilityFactoryZoneAffecting.millResolve(af, this);
} }
@Override
public boolean canPlayFromEffectAI(final boolean mandatory, final boolean withOutManaCost) {
if (withOutManaCost) {
return AbilityFactoryZoneAffecting.millTriggerNoCost(af, this, mandatory);
}
return AbilityFactoryZoneAffecting.millTrigger(af, this, mandatory);
}
}; };
return spMill; return spMill;
} }
@@ -1015,6 +1022,10 @@ public class AbilityFactoryZoneAffecting {
return false; return false;
} }
return millTriggerNoCost(af, sa, mandatory);
}
private static boolean millTriggerNoCost(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
if (!AbilityFactoryZoneAffecting.millTargetAI(af, sa, mandatory)) { if (!AbilityFactoryZoneAffecting.millTargetAI(af, sa, mandatory)) {
return false; return false;
} }

View File

@@ -28,6 +28,7 @@ import forge.CardCharacteristicName;
import forge.CardUtil; import forge.CardUtil;
import forge.Singletons; import forge.Singletons;
import forge.card.CardRules; import forge.card.CardRules;
import forge.card.spellability.Spell;
import forge.card.spellability.SpellAbility; import forge.card.spellability.SpellAbility;
import forge.card.spellability.SpellPermanent; import forge.card.spellability.SpellPermanent;
import forge.card.spellability.Target; import forge.card.spellability.Target;
@@ -212,6 +213,11 @@ public class CardFactory implements CardFactoryInterface {
if (controller.isHuman()) { if (controller.isHuman()) {
Singletons.getModel().getGameAction().playSpellAbilityForFree(copySA); Singletons.getModel().getGameAction().playSpellAbilityForFree(copySA);
} else if (copySA instanceof Spell) {
Spell spell = (Spell) copySA;
if (spell.canPlayFromEffectAI(false, true)) {
ComputerUtil.playStackFree(copySA);
}
} else if (copySA.canPlayAI()) { } else if (copySA.canPlayAI()) {
ComputerUtil.playStackFree(copySA); ComputerUtil.playStackFree(copySA);
} }