- Improved the AI of Echoing Decay.

This commit is contained in:
Sloth
2012-01-10 11:32:06 +00:00
parent 416da2490b
commit 660d09121f
2 changed files with 9 additions and 28 deletions

View File

@@ -3,7 +3,6 @@ ManaCost:1 B
Types:Instant
Text:Target creature and all other creatures with the same name as that creature get -2/-2 until end of turn.
SVar:Rarity:Common
SVar:RemAIDeck:True
SVar:Picture:http://resources.wizards.com/magic/cards/dst/en-us/card46176.jpg
SetInfo:DST|Common|http://magiccards.info/scans/en/ds/41.jpg
Oracle:Target creature and all other creatures with the same name as that creature get -2/-2 until end of turn.

View File

@@ -25,7 +25,6 @@ import forge.ButtonUtil;
import forge.Card;
import forge.CardList;
import forge.CardListFilter;
import forge.CardListUtil;
import forge.CardUtil;
import forge.Command;
import forge.ComputerUtil;
@@ -284,36 +283,19 @@ public class CardFactoryInstants {
@Override
public boolean canPlayAI() {
final CardList c = this.getCreature();
if (c.isEmpty()) {
final CardList cl = CardFactoryUtil.getHumanCreatureAI(2, this, true);
if (cl.isEmpty()) {
return false;
} else {
this.setTargetCard(c.get(0));
return true;
}
Card best = CardFactoryUtil.getBestCreatureAI(cl);
// don't target a creature that would hurt your own
if (!AllZone.getComputerPlayer().getCardsIn(Constant.Zone.Battlefield, best.getName()).isEmpty()) {
return false;
}
this.setTargetCard(best);
return true;
} // canPlayAI()
CardList getCreature() {
final CardList out = new CardList();
final CardList list = CardFactoryUtil.getHumanCreatureAI("Flying", this, true);
list.shuffle();
for (int i = 0; i < list.size(); i++) {
if ((list.get(i).getNetAttack() >= 2) && (list.get(i).getNetDefense() <= 2)) {
out.add(list.get(i));
}
}
// in case human player only has a few creatures in play,
// target anything
if (out.isEmpty() && (0 < CardFactoryUtil.getHumanCreatureAI(2, this, true).size())
&& (3 > CardFactoryUtil.getHumanCreatureAI(this, true).size())) {
out.addAll(CardFactoryUtil.getHumanCreatureAI(2, this, true));
CardListUtil.sortFlying(out);
}
return out;
} // getCreature()
@Override
public void resolve() {
if (AllZoneUtil.isCardInPlay(this.getTargetCard()) && this.getTargetCard().canBeTargetedBy(this)) {