I improved the AI for Crib Swap. The AI will now only target creatures with a net attack > 2. The AI will not include creatures named "Shapeshifter" unless the card has an aura and/or a P1P1 counter buff.
This will allow the AI to remove these types of buffs. Other types of buffs are not included, as there may be Lord like permanents in play granting the buffs.
- Code: Select all
//*************** START *********** START **************************
else if(cardName.equals("Crib Swap")) {
SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = -4567382566960071562L;
@Override
public void resolve() {
if(AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
String controller = getTargetCard().getController();
AllZone.GameAction.removeFromGame(getTargetCard());
CardFactoryUtil.makeToken("Shapeshifter", "C 1 1 Shapeshifter",
controller, "", new String[] {"Creature", "Shapeshifter"}, 1,
1, new String[] {"Changeling"});
}
}//resolve()
@Override
public boolean canPlayAI() {
return (getCreature().size() != 0) && (AllZone.Phase.getTurn() > 4);
}//canPlayAI()
CardList getCreature() {
CardList list = CardFactoryUtil.AI_getHumanCreature(card, true);
list = list.filter(new CardListFilter() {
public boolean addCard(Card c) {
return (c.getNetAttack() > 2
&& CardFactoryUtil.canTarget(card, c)
&& (!c.getName().equals("Shapeshifter")
|| (c.getName().equals("Shapeshifter")
&& (c.isEnchanted()
|| c.getCounters(Counters.P1P1) != 0))));
}
});
return list;
}//getCreature()
@Override
public void chooseTargetAI() {
Card best = CardFactoryUtil.AI_getBestCreature(getCreature());
setTargetCard(best);
}//chooseTargetAI()
};//SpellAbility
spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell));
card.setSVar("PlayMain1", "TRUE");
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************