More tests. One test fails.

This commit is contained in:
magenoxx 2012-05-11 17:34:24 +04:00
parent 7b1ffb6ced
commit 1eba9096b0
3 changed files with 88 additions and 5 deletions

View file

@ -35,7 +35,6 @@ import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
@ -43,7 +42,6 @@ import java.util.UUID;
/**
*
* @author noxx
*/
public class MistRaven extends CardImpl<MistRaven> {
@ -60,9 +58,7 @@ public class MistRaven extends CardImpl<MistRaven> {
// When Mist Raven enters the battlefield, return target creature to its owner's hand.
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect());
Target target = new TargetCreaturePermanent();
target.setRequired(true);
ability.addTarget(target);
ability.addTarget(new TargetCreaturePermanent(true));
this.addAbility(ability);
}

View file

@ -0,0 +1,33 @@
package org.mage.test.cards.abilities.enters;
import junit.framework.Assert;
import mage.Constants;
import mage.game.permanent.Permanent;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author noxx
*/
public class AEtherFigmentTest extends CardTestPlayerBase {
@Test
public void testEnteringWithCounters() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 5);
addCard(Constants.Zone.HAND, playerA, "AEther Figment");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "AEther Figment");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPermanentCount(playerA, "AEther Figment", 1);
Permanent aetherFigment = getPermanent("AEther Figment", playerA.getId());
Assert.assertEquals(3, aetherFigment.getPower().getValue());
Assert.assertEquals(3, aetherFigment.getToughness().getValue());
}
}

View file

@ -0,0 +1,54 @@
package org.mage.test.combat;
import junit.framework.Assert;
import mage.Constants;
import mage.game.permanent.Permanent;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* Test restrictions for choosing attackers and blockers.
*
* @author noxx
*/
public class AttackBlockRestrictionsTest extends CardTestPlayerBase {
@Test
public void testFlyingVsNonFlying() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Captain of the Mists");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Mist Raven");
attack(2, playerB, "Mist Raven");
block(2, playerA, "Captain of the Mists", "Mist Raven");
setStopAt(2, Constants.PhaseStep.END_TURN);
execute();
assertLife(playerA, 18);
assertLife(playerB, 20);
Permanent mistRaven = getPermanent("Mist Raven", playerB.getId());
Assert.assertTrue("Should be tapped because of attacking", mistRaven.isTapped());
}
/**
* Tests attacking creature doesn't untap after being blocked by Wall of Frost
*/
@Test
public void testWallofWrost() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Wall of Frost");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Craw Wurm");
attack(2, playerB, "Craw Wurm");
block(2, playerA, "Wall of Frost", "Craw Wurm");
setStopAt(4, Constants.PhaseStep.END_TURN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
Permanent crawWurm = getPermanent("Craw Wurm", playerB.getId());
Assert.assertTrue("Should be tapped because of being blocked by Wall of Frost", crawWurm.isTapped());
}
}