- Added some more Blink AI to AF ChangeZone to support Venser, the Sojourner.

This commit is contained in:
Sloth
2011-10-11 16:00:38 +00:00
parent 80bdf034ba
commit 3d8ec19e4a
2 changed files with 24 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ import forge.AllZone;
import forge.AllZoneUtil;
import forge.Card;
import forge.CardList;
import forge.CardListFilter;
import forge.CardListUtil;
import forge.CardUtil;
import forge.CombatUtil;
@@ -1163,10 +1164,9 @@ public final class AbilityFactory_ChangeZone {
if ((destination.equals(Zone.Hand)
|| (destination.equals(Zone.Exile) && (subAPI.equals("DelayedTrigger")
|| (subAPI.equals("ChangeZone") && subAffected.equals("Remembered")))))
&& tgt.getMinTargets(sa.getSourceCard(), sa) <= 1)
{
&& tgt.getMinTargets(sa.getSourceCard(), sa) <= 1) {
// check stack for something on the stack will kill anything i control
// check stack for something on the stack that will kill anything i control
if (AllZone.getStack().size() > 0) {
ArrayList<Object> objects = AbilityFactory.predictThreatenedObjects(af);
@@ -1196,6 +1196,22 @@ public final class AbilityFactory_ChangeZone {
}
}
}
// Blink permanents with ETB triggers
else if (AbilityFactory.playReusable(sa)){
aiPermanents = aiPermanents.filter(new CardListFilter() {
@Override
public boolean addCard(Card c) {
if (c.getNumberOfCounters() > 0)
return false; //don't blink something with counters TODO: check good and bad counters
return Spell_Permanent.checkETBEffects(c, null, null); //checks only if there is a dangerous ETB effect
}
});
if (!aiPermanents.isEmpty()) {
// Choose "best" of the remaining to save
tgt.addTarget(CardFactoryUtil.AI_getBest(aiPermanents));
return true;
}
}
}
} else if (origin.equals(Zone.Graveyard)) {

View File

@@ -287,7 +287,10 @@ public class Spell_Permanent extends Spell {
if (api != null && !af.getAPI().equals(api))
continue;
if(sa != null)
exSA.setActivatingPlayer(sa.getActivatingPlayer());
else
exSA.setActivatingPlayer(AllZone.getComputerPlayer());
// Run non-mandatory trigger.
// These checks only work if the Executing SpellAbility is an Ability_Sub.