+2 tests passed

This commit is contained in:
magenoxx 2012-05-23 21:14:40 +04:00
parent 0d732e8f86
commit 3d3e8bb36a
3 changed files with 27 additions and 15 deletions

View file

@ -27,7 +27,6 @@
*/ */
package mage.sets.innistrad; package mage.sets.innistrad;
import java.util.UUID;
import mage.Constants.CardType; import mage.Constants.CardType;
import mage.Constants.Rarity; import mage.Constants.Rarity;
import mage.MageInt; import mage.MageInt;
@ -40,6 +39,8 @@ import mage.cards.CardImpl;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import java.util.UUID;
/** /**
* *
* @author North * @author North
@ -59,7 +60,7 @@ public class BloodgiftDemon extends CardImpl<BloodgiftDemon> {
// At the beginning of your upkeep, target player draws a card and loses 1 life. // At the beginning of your upkeep, target player draws a card and loses 1 life.
Ability ability = new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new DrawCardTargetEffect(1), false); Ability ability = new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new DrawCardTargetEffect(1), false);
ability.addEffect(new LoseLifeTargetEffect(1)); ability.addEffect(new LoseLifeTargetEffect(1));
ability.addTarget(new TargetPlayer()); ability.addTarget(new TargetPlayer(true));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -10,7 +10,7 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
public class CloneTest extends CardTestPlayerBase { public class CloneTest extends CardTestPlayerBase {
/** /**
* Tests triggers working on both sides after Clone comming onto battlefield * Tests triggers working on both sides after Clone coming onto battlefield
*/ */
@Test @Test
public void testCloneTriggered() { public void testCloneTriggered() {
@ -27,8 +27,10 @@ public class CloneTest extends CardTestPlayerBase {
assertLife(playerA, 18); assertLife(playerA, 18);
assertLife(playerB, 19); assertLife(playerB, 19);
assertHandCount(playerA, 2); // 1 from draw steps + 2 from Demon
assertHandCount(playerB, 1); assertHandCount(playerA, 3);
// 2 from draw steps + 1 from Demon
assertHandCount(playerB, 3);
assertPermanentCount(playerA, "Bloodgift Demon", 1); assertPermanentCount(playerA, "Bloodgift Demon", 1);
assertPermanentCount(playerB, "Bloodgift Demon", 1); assertPermanentCount(playerB, "Bloodgift Demon", 1);
@ -37,7 +39,6 @@ public class CloneTest extends CardTestPlayerBase {
/** /**
* Tests Clone is sacrificed and only one effect is turned on * Tests Clone is sacrificed and only one effect is turned on
*/ */
//TODO: try this scenario in the game (bug report from player)
@Test @Test
public void testCloneSacrifice() { public void testCloneSacrifice() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Bloodgift Demon", 1); addCard(Constants.Zone.BATTLEFIELD, playerA, "Bloodgift Demon", 1);
@ -54,13 +55,17 @@ public class CloneTest extends CardTestPlayerBase {
setStopAt(4, Constants.PhaseStep.END_TURN); setStopAt(4, Constants.PhaseStep.END_TURN);
execute(); execute();
assertLife(playerA, 18);
assertLife(playerB, 19);
assertHandCount(playerA, 2);
assertHandCount(playerB, 0);
assertPermanentCount(playerA, "Bloodgift Demon", 1); assertPermanentCount(playerA, "Bloodgift Demon", 1);
assertGraveyardCount(playerA, "Diabolic Edict", 1);
assertPermanentCount(playerB, "Bloodgift Demon", 0); assertPermanentCount(playerB, "Bloodgift Demon", 0);
assertGraveyardCount(playerB, "Clone", 1);
// 1 from draw steps + 2 from Demon
assertHandCount(playerA, 3);
// 2 from draw steps + no from Demon (should be sacrificed)
assertHandCount(playerB, 2);
assertLife(playerA, 18);
assertLife(playerB, 20);
} }
} }

View file

@ -28,15 +28,16 @@
package mage.target; package mage.target;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.filter.FilterPlayer; import mage.filter.FilterPlayer;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
@ -45,6 +46,11 @@ public class TargetPlayer<T extends TargetPlayer<T>> extends TargetImpl<TargetPl
protected FilterPlayer filter = new FilterPlayer(); protected FilterPlayer filter = new FilterPlayer();
public TargetPlayer(boolean required) {
this();
setRequired(required);
}
public TargetPlayer() { public TargetPlayer() {
this(1, 1, false); this(1, 1, false);
} }