Added Strafe

This commit is contained in:
jendave
2011-08-06 09:17:28 +00:00
parent 78cecc8943
commit a2b531e21c

View File

@@ -2033,7 +2033,89 @@ public class CardFactory_Sorceries {
spell.setBeforePayMana(target);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Strafe")) {
final SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = -8327381630150660908L;
int damage = 3;
Card check;
@Override
public boolean canPlayAI() {
check = getFlying();
return check != null;
}
@Override
public void chooseTargetAI() {
Card c = getFlying();
if((c == null) || (!check.equals(c))) throw new RuntimeException(card
+ " error in chooseTargetAI() - Card c is " + c + ", Card check is " + check);
setTargetCard(c);
}//chooseTargetAI()
//uses "damage" variable
Card getFlying() {
CardList flying = CardFactoryUtil.AI_getHumanCreature("Flying", card, true);
for(int i = 0; i < flying.size(); i++)
if(flying.get(i).getNetDefense() <= damage
&& (!(flying.get(i)).isRed())) {
return flying.get(i);
}
return null;
}
@Override
public void resolve() {
if(AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
Card c = getTargetCard();
c.addDamage(damage, card);
}
}//resolve()
};//SpellAbility
card.clearSpellAbility();
card.addSpellAbility(spell);
card.setSVar("PlayMain1", "TRUE");
//target
Input target = new Input() {
private static final long serialVersionUID = -579437555773493417L;
@Override
public void showMessage() {
AllZone.Display.showMessage("Select target non-red creature for " + spell.getSourceCard());
ButtonUtil.enableOnlyCancel();
}
@Override
public void selectButtonCancel() {
stop();
}
@Override
public void selectCard(Card card, PlayerZone zone) {
if((!card.isRed()) && card.isCreature()
&& zone.is(Constant.Zone.Play)) {
spell.setTargetCard(card);
if (this.isFree())
{
this.setFree(false);
AllZone.Stack.add(spell);
stop();
}
else
stopSetNext(new Input_PayManaCost(spell));
}
}
};//SpellAbility - target
spell.setBeforePayMana(target);
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Sunlance")) {
final SpellAbility spell = new Spell(card) {