[BOK] Added 3 cards + Stranglehold. Fixed Painwracker Oni (to no intervening if clause).

This commit is contained in:
LevelX2 2014-10-23 17:41:15 +02:00
parent d95f3fff9b
commit cc6f1f0010
7 changed files with 530 additions and 43 deletions

View file

@ -0,0 +1,75 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.common.ExileFromZoneTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterSpiritOrArcaneCard;
import mage.target.common.TargetOpponent;
/**
*
* @author LevelX2
*/
public class KyokiSanitysEclipse extends CardImpl {
public KyokiSanitysEclipse(UUID ownerId) {
super(ownerId, 72, "Kyoki, Sanity's Eclipse", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{B}{B}");
this.expansionSetCode = "BOK";
this.supertype.add("Legendary");
this.subtype.add("Demon");
this.subtype.add("Spirit");
this.color.setBlack(true);
this.power = new MageInt(6);
this.toughness = new MageInt(4);
// Whenever you cast a Spirit or Arcane spell, target opponent exiles a card from his or her hand.
Ability ability = new SpellCastControllerTriggeredAbility(new ExileFromZoneTargetEffect(Zone.HAND, null, "", new FilterCard()), new FilterSpiritOrArcaneCard(), false);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
}
public KyokiSanitysEclipse(final KyokiSanitysEclipse card) {
super(card);
}
@Override
public KyokiSanitysEclipse copy() {
return new KyokiSanitysEclipse(this);
}
}

View file

@ -0,0 +1,102 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksOrBlocksTriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class ScourgeOfNumai extends CardImpl {
public ScourgeOfNumai(UUID ownerId) {
super(ownerId, 80, "Scourge of Numai", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{B}");
this.expansionSetCode = "BOK";
this.subtype.add("Demon");
this.subtype.add("Spirit");
this.color.setBlack(true);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// At the beginning of your upkeep, you lose 2 life if you don't control an Ogre.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new ScourgeOfNumaiEffect(), TargetController.YOU, false));
}
public ScourgeOfNumai(final ScourgeOfNumai card) {
super(card);
}
@Override
public ScourgeOfNumai copy() {
return new ScourgeOfNumai(this);
}
}
class ScourgeOfNumaiEffect extends OneShotEffect {
public ScourgeOfNumaiEffect() {
super(Outcome.LoseLife);
this.staticText = "you lose 2 life if you don't control an Ogre.";
}
public ScourgeOfNumaiEffect(final ScourgeOfNumaiEffect effect) {
super(effect);
}
@Override
public ScourgeOfNumaiEffect copy() {
return new ScourgeOfNumaiEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (game.getBattlefield().countAll(new FilterCreaturePermanent("Ogre", "Ogre"), source.getControllerId(), game) < 1) {
controller.loseLife(2, game);
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,101 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksOrBlocksTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class TakenumaBleeder extends CardImpl {
public TakenumaBleeder(UUID ownerId) {
super(ownerId, 86, "Takenuma Bleeder", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.expansionSetCode = "BOK";
this.subtype.add("Ogre");
this.subtype.add("Shaman");
this.color.setBlack(true);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Whenever Takenuma Bleeder attacks or blocks, you lose 1 life if you don't control a Demon.
this.addAbility(new AttacksOrBlocksTriggeredAbility(new TakenumaBleederEffect(), false));
}
public TakenumaBleeder(final TakenumaBleeder card) {
super(card);
}
@Override
public TakenumaBleeder copy() {
return new TakenumaBleeder(this);
}
}
class TakenumaBleederEffect extends OneShotEffect {
public TakenumaBleederEffect() {
super(Outcome.LoseLife);
this.staticText = "you lose 1 life if you don't control a Demon";
}
public TakenumaBleederEffect(final TakenumaBleederEffect effect) {
super(effect);
}
@Override
public TakenumaBleederEffect copy() {
return new TakenumaBleederEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (game.getBattlefield().countAll(new FilterCreaturePermanent("Demon", "Demon"), source.getControllerId(), game) < 1) {
controller.loseLife(1, game);
}
return true;
}
return false;
}
}

View file

@ -31,19 +31,17 @@ package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.common.SacrificeControllerEffect;
import mage.abilities.keyword.FearAbility;
import mage.cards.CardImpl;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
/**
*
@ -62,8 +60,9 @@ public class PainwrackerOni extends CardImpl {
// Fear (This creature can't be blocked except by artifact creatures and/or black creatures.)
this.addAbility(FearAbility.getInstance());
// At the beginning of your upkeep, sacrifice a creature if you don't control an Ogre.
this.addAbility(new PainwrackerOniTriggeredAbility1(new SacrificeControllerEffect(new FilterControlledCreaturePermanent(), 1, "")));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new PainwrackerOniEffect(new FilterControlledCreaturePermanent(), 1, ""), TargetController.YOU, false));
}
public PainwrackerOni (final PainwrackerOni card) {
@ -77,42 +76,27 @@ public class PainwrackerOni extends CardImpl {
}
class PainwrackerOniTriggeredAbility1 extends TriggeredAbilityImpl {
private static final FilterPermanent filter = new FilterPermanent();
static {
filter.add(new SubtypePredicate("Ogre"));
class PainwrackerOniEffect extends SacrificeControllerEffect {
public PainwrackerOniEffect(FilterPermanent filter, int count, String preText) {
super(filter, count, preText);
this.staticText = "sacrifice a creature if you don't control an Ogre";
}
public PainwrackerOniTriggeredAbility1(Effect effect) {
super(Zone.BATTLEFIELD, effect, false);
public PainwrackerOniEffect(final PainwrackerOniEffect effect) {
super(effect);
}
public PainwrackerOniTriggeredAbility1(final PainwrackerOniTriggeredAbility1 ability) {
super(ability);
}
@Override
public PainwrackerOniTriggeredAbility1 copy() {
return new PainwrackerOniTriggeredAbility1(this);
public PainwrackerOniEffect copy() {
return new PainwrackerOniEffect(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) {
return true;
public boolean apply(Game game, Ability source) {
if (game.getBattlefield().countAll(new FilterCreaturePermanent("Oger", "Oger"), source.getControllerId(), game) < 1) {
return super.apply(game, source);
}
return false;
return true;
}
@Override
public boolean checkInterveningIfClause(Game game) {
return game.getBattlefield().countAll(filter, this.controllerId, game) < 1;
}
@Override
public String getRule() {
return "At the beginning of your upkeep, sacrifice a creature if you don't control an Ogre.";
}
}
}

View file

@ -0,0 +1,154 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.commander;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class Stranglehold extends CardImpl {
public Stranglehold(UUID ownerId) {
super(ownerId, 136, "Stranglehold", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}");
this.expansionSetCode = "CMD";
this.color.setRed(true);
// Your opponents can't search libraries.
this.getSpellAbility().addEffect(new OpponentsCantSearchLibarariesEffect());
// If an opponent would begin an extra turn, that player skips that turn instead.
this.getSpellAbility().addEffect(new StrangleholdSkipExtraTurnsEffect());
}
public Stranglehold(final Stranglehold card) {
super(card);
}
@Override
public Stranglehold copy() {
return new Stranglehold(this);
}
}
class OpponentsCantSearchLibarariesEffect extends ContinuousRuleModifiyingEffectImpl {
public OpponentsCantSearchLibarariesEffect() {
super(Duration.EndOfTurn, Outcome.Benefit, true, false);
staticText = "Your opponents can't search libraries";
}
public OpponentsCantSearchLibarariesEffect(final OpponentsCantSearchLibarariesEffect effect) {
super(effect);
}
@Override
public OpponentsCantSearchLibarariesEffect copy() {
return new OpponentsCantSearchLibarariesEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public String getInfoMessage(Ability source, GameEvent event, Game game) {
MageObject mageObject = game.getObject(source.getSourceId());
if (mageObject != null) {
return "You can't search libraries (" + mageObject.getLogName() + " in play).";
}
return null;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (EventType.SEARCH_LIBRARY.equals(event.getType())) {
Player controller = game.getPlayer(source.getControllerId());
return controller != null && controller.hasOpponent(event.getPlayerId(), game);
}
return false;
}
}
class StrangleholdSkipExtraTurnsEffect extends ReplacementEffectImpl {
public StrangleholdSkipExtraTurnsEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
staticText = "If an opponent would begin an extra turn, that player skips that turn instead";
}
public StrangleholdSkipExtraTurnsEffect(final StrangleholdSkipExtraTurnsEffect effect) {
super(effect);
}
@Override
public StrangleholdSkipExtraTurnsEffect copy() {
return new StrangleholdSkipExtraTurnsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player player = game.getPlayer(event.getPlayerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (player != null && sourceObject != null) {
game.informPlayers(sourceObject.getLogName() + ": Extra turn of " + player.getName() + " skipped");
}
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (EventType.EXTRA_TURN.equals(event.getType())) {
Player controller = game.getPlayer(source.getControllerId());
return controller != null && controller.hasOpponent(event.getPlayerId(), game);
}
return false;
}
}

View file

@ -63,7 +63,10 @@ public class ObstinateBaloth extends CardImpl {
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// When Obstinate Baloth enters the battlefield, you gain 4 life.
this.addAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(4), false));
// If a spell or ability an opponent controls causes you to discard Obstinate Baloth, put it onto the battlefield instead of putting it into your graveyard.
this.addAbility(new SimpleStaticAbility(Zone.HAND, new ObstinateBalothEffect()));
}
@ -112,10 +115,10 @@ class ObstinateBalothEffect extends ReplacementEffectImpl {
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getSourceId());
if (card != null) {
Player player = game.getPlayer(card.getOwnerId());
if (player != null) {
if (card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), player.getId())) {
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DISCARDED_CARD, card.getId(), source.getSourceId(), player.getId()));
Player owner = game.getPlayer(card.getOwnerId());
if (owner != null) {
if (owner.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId())) {
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DISCARDED_CARD, card.getId(), source.getSourceId(), owner.getId()));
return true;
}
}

View file

@ -0,0 +1,68 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.cards.triggers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class ObstinateBalothTest extends CardTestPlayerBase {
/**
* Obstinate Baloth {2}{G}{G}
* Creature - Beast
* When Obstinate Baloth enters the battlefield, you gain 4 life.
* If a spell or ability an opponent controls causes you to discard Obstinate Baloth, put it onto the battlefield instead of putting it into your graveyard.
*
*/
@Test
public void TestLifeGainIfForcedToDiscard() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
// Target player discards a card.
addCard(Zone.HAND, playerA, "Raven's Crime");
addCard(Zone.HAND, playerB, "Obstinate Baloth");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Raven's Crime", playerB);
setChoice(playerB, "Obstinate Baloth");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Raven's Crime", 1);
assertPermanentCount(playerB, "Obstinate Baloth", 1);
assertLife(playerA, 20);
assertLife(playerB, 24); // + 4 from Obstinate Baloth entering the battlefield
}
}