diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/conditional/TragicSlipTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/TragicSlipTest.java new file mode 100644 index 00000000000..b6c1b2b8b39 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/TragicSlipTest.java @@ -0,0 +1,84 @@ + package org.mage.test.cards.conditional; + +import mage.Constants; +import mage.abilities.keyword.FirstStrikeAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.game.permanent.Permanent; +import org.junit.Assert; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ + + + +public class TragicSlipTest extends CardTestPlayerBase { + + @Test + public void testNoCreatureDied() { + addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp"); + + // Tragic Slip - Instant, B - Target creature gets -1/-1 until end of turn. + // Morbid — That creature gets -13/-13 until end of turn instead if a creature died this turn. + addCard(Constants.Zone.HAND, playerA, "Tragic Slip"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Pillarfield Ox"); + + castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Tragic Slip", "Pillarfield Ox"); + + setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT); + execute(); + + assertPowerToughness(playerA, "Pillarfield Ox", 1, 3); + } + + @Test + public void testCreatureDiedAfter() { + addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 2); + + // Tragic Slip - Instant, B - Target creature gets -1/-1 until end of turn. + // Morbid — That creature gets -13/-13 until end of turn instead if a creature died this turn. + addCard(Constants.Zone.HAND, playerA, "Tragic Slip"); + // Searing Spear - Instant, 1R - Searing Spear deals 3 damage to target creature or player. + addCard(Constants.Zone.HAND, playerA, "Searing Spear"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Pillarfield Ox"); + + castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Tragic Slip", "Pillarfield Ox"); + + castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Searing Spear", "Silvercoat Lion"); + + setStopAt(1, Constants.PhaseStep.END_TURN); + execute(); + + assertPowerToughness(playerA, "Pillarfield Ox", 1, 3); + } + + @Test + public void testCreatureDiedBefore() { + addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp", 3); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 2); + + // Tragic Slip - Instant, B - Target creature gets -1/-1 until end of turn. + // Morbid — That creature gets -13/-13 until end of turn instead if a creature died this turn. + addCard(Constants.Zone.HAND, playerA, "Tragic Slip"); + // Searing Spear - Instant, 1R - Searing Spear deals 3 damage to target creature or player. + addCard(Constants.Zone.HAND, playerA, "Searing Spear"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Pillarfield Ox"); + + castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Searing Spear", "Silvercoat Lion"); + + castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Tragic Slip", "Pillarfield Ox"); + + setStopAt(1, Constants.PhaseStep.END_TURN); + execute(); + + assertPermanentCount(playerA, "Silvercoat Lion", 0); + assertPermanentCount(playerA, "Pillarfield Ox", 0); + } +} diff --git a/Mage/src/mage/abilities/condition/common/FixedCondition.java b/Mage/src/mage/abilities/condition/common/FixedCondition.java new file mode 100644 index 00000000000..d79ef273eb1 --- /dev/null +++ b/Mage/src/mage/abilities/condition/common/FixedCondition.java @@ -0,0 +1,53 @@ +/* + * 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.abilities.condition.common; + +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.game.Game; + +/** + * + * @author LevelX2 + */ + + +public class FixedCondition implements Condition{ + + protected boolean conditionMet; + + public FixedCondition(boolean conditionMet) { + this.conditionMet = conditionMet; + } + + @Override + public boolean apply(Game game, Ability source) { + return conditionMet; + } +} diff --git a/Mage/src/mage/abilities/decorator/ConditionalContinousEffect.java b/Mage/src/mage/abilities/decorator/ConditionalContinousEffect.java index 4356ddb534b..4f182b1bb62 100644 --- a/Mage/src/mage/abilities/decorator/ConditionalContinousEffect.java +++ b/Mage/src/mage/abilities/decorator/ConditionalContinousEffect.java @@ -4,6 +4,7 @@ import mage.Constants; import mage.Constants.Duration; import mage.abilities.Ability; import mage.abilities.condition.Condition; +import mage.abilities.condition.common.FixedCondition; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffectImpl; import mage.game.Game; @@ -18,11 +19,16 @@ public class ConditionalContinousEffect extends ContinuousEffectImpl