Spike keyword
`DennisBergkamp wrote:I noticed with the spike keyword that it doesn't seem to remove counters
The AI was "moving" +1/+1 counters from his Spike Weaver to his Elephant token, but the weaver wasn't actually losing them.
`friarisol wrote:That cheater. It looks like I never changed the AI Targetting from the inherited stuff. And the Counter gets removed for the Human in selectCard, so it would need to happen in the chooseTargetAI code.
My local codebase is a mess right now if someone else wants to fix this up. I'll get to this when I can if noone else takes a whack at it.
I now have a canPlayAI(), chooseTargetAI() and getCreature() methods in place and have simplified the resolve() method. It looks like I still need to edit the input and want to do some StringBuilder work.
I am at an early stage at this moment and it is not yet ready to test.
- Code: Select all
@Override
public boolean canPlayAI() {
return getCreature().size() != 0
&& card.getCounters(Counters.P1P1) > 0
&& !CardFactoryUtil.AI_doesCreatureAttack(card);
}//canPlayAI()
@Override
public void chooseTargetAI() {
Card best = CardFactoryUtil.AI_getBestCreature(getCreature());
setTargetCard(best);
}//chooseTargetAI()
CardList getCreature() {
CardList list = new CardList(AllZone.Computer_Play.getCards());
list = list.filter(new CardListFilter() {
public boolean addCard(Card c) {
return c.isCreature()
&& CardFactoryUtil.canTarget(card, c)
&& c.getNetAttack() > card.getNetAttack()
&& c != card;
}
});
return list;
}//getCreature()
@Override
public void resolve() {
if (AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
card.subtractCounter(Counters.P1P1, 1);
getTargetCard().addCounter(Counters.P1P1, 1);
}
}//resolve()