Test for Condemn - tests targeting attacking creatures and using LKI.

This commit is contained in:
magenoxx 2011-11-16 14:01:01 +04:00
parent 58b959ff65
commit 262e00f26a
3 changed files with 55 additions and 0 deletions

View file

@ -53,8 +53,10 @@ public class Condemn extends CardImpl<Condemn> {
super(ownerId, 13, "Condemn", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{W}");
this.expansionSetCode = "10E";
this.color.setWhite(true);
// Put target attacking creature on the bottom of its owner's library.
this.getSpellAbility().addTarget(new TargetAttackingCreature());
this.getSpellAbility().addEffect(new PutOnLibraryTargetEffect(false));
// Its controller gains life equal to its toughness.
this.getSpellAbility().addEffect(new CondemnEffect());
}

View file

@ -0,0 +1,49 @@
package org.mage.test.cards.targets.attacking;
import junit.framework.Assert;
import mage.Constants;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestBase;
/**
* @author ayratn
*/
public class CondemnTest extends CardTestBase {
@Test
public void testIllegalTarget() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains");
addCard(Constants.Zone.HAND, playerA, "Condemn");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Sejiri Merfolk");
castSpell(playerA, "Condemn");
// check with illegal target
addFixedTarget(playerA, "Condemn", "Sejiri Merfolk");
execute();
// spell shouldn't work
assertPermanentCount(playerB, "Sejiri Merfolk", 1);
assertLife(playerA, 20);
assertLife(playerB, 20);
}
@Test
public void testLegalTarget() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains");
addCard(Constants.Zone.HAND, playerA, "Condemn");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Sejiri Merfolk");
attack(playerB, "Sejiri Merfolk");
castSpell(playerA, "Condemn");
addFixedTarget(playerA, "Condemn", "Sejiri Merfolk");
setStopOnTurn(3);
execute();
assertPermanentCount(playerB, "Sejiri Merfolk", 0);
assertLife(playerA, 20);
assertLife(playerB, 21);
// check was put on top
Assert.assertEquals(currentGame.getPlayer(playerB.getId()).getLibrary().size(), 60);
}
}

View file

@ -373,4 +373,8 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP
public void useAbility(Player player, String cardName) {
}
public void attack(Player player, String cardName) {
player.addAction("attack:"+cardName);
}
}