diff --git a/Mage.Tests/src/test/java/org/mage/test/combat/RemoveFromCombatTest.java b/Mage.Tests/src/test/java/org/mage/test/combat/RemoveFromCombatTest.java index e77aa7428d..8926458d8e 100644 --- a/Mage.Tests/src/test/java/org/mage/test/combat/RemoveFromCombatTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/combat/RemoveFromCombatTest.java @@ -46,27 +46,32 @@ public class RemoveFromCombatTest extends CardTestPlayerBase { */ @Test public void testLeavesCombatIfNoLongerACreature() { - addCard(Zone.BATTLEFIELD, playerA, "Mountain"); - addCard(Zone.HAND, playerB, "Lightning Bolt", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4); + addCard(Zone.HAND, playerA, "Lightning Blast", 1); + + addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2); + addCard(Zone.BATTLEFIELD, playerB, "Elvish Mystic", 1); // Forests you control are 1/1 green Elf creatures that are still lands. - // {1}{G}, Sacrifice an Elf: Target creature gets +3/+3 until end of turn. + // {1}{G},Sacrifice an Elf: Target creature gets +3/+3 until end of turn. addCard(Zone.BATTLEFIELD, playerB, "Ambush Commander", 1); addCard(Zone.BATTLEFIELD, playerB, "Stomping Ground"); attack(2, playerB, "Stomping Ground"); - castSpell(2, PhaseStep.DECLARE_BLOCKERS, playerA, "Lightning Bolt", "Ambush Commander"); + activateAbility(2, PhaseStep.DECLARE_ATTACKERS, playerB, "{1}{G},Sacrifice an Elf: Target creature gets +3/+3", "Stomping Ground"); + castSpell(2, PhaseStep.DECLARE_BLOCKERS, playerA, "Lightning Blast", "Ambush Commander"); setStopAt(2, PhaseStep.POSTCOMBAT_MAIN); execute(); - assertLife(playerA, 20); - assertLife(playerB, 20); - - assertGraveyardCount(playerA, "Lightning Bolt", 1); + assertGraveyardCount(playerB, "Elvish Mystic", 1); + assertGraveyardCount(playerA, "Lightning Blast", 1); assertGraveyardCount(playerB, "Ambush Commander", 1); assertPowerToughness(playerB, "Stomping Ground", 0, 0); + assertLife(playerA, 20); + assertLife(playerB, 20); + } } diff --git a/Mage/src/mage/abilities/effects/common/continuous/BoostTargetEffect.java b/Mage/src/mage/abilities/effects/common/continuous/BoostTargetEffect.java index 21dc10a237..0cbb14b528 100644 --- a/Mage/src/mage/abilities/effects/common/continuous/BoostTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continuous/BoostTargetEffect.java @@ -33,6 +33,7 @@ import mage.abilities.Mode; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.ContinuousEffectImpl; +import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Layer; import mage.constants.Outcome; @@ -64,7 +65,8 @@ public class BoostTargetEffect extends ContinuousEffectImpl { * @param power * @param toughness * @param duration - * @param lockedIn if true, power and toughness will be calculated only once, when the ability resolves + * @param lockedIn if true, power and toughness will be calculated only + * once, when the ability resolves */ public BoostTargetEffect(DynamicValue power, DynamicValue toughness, Duration duration, boolean lockedIn) { super(duration, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, isCanKill(toughness) ? Outcome.UnboostCreature : Outcome.BoostCreature); @@ -99,7 +101,7 @@ public class BoostTargetEffect extends ContinuousEffectImpl { int affectedTargets = 0; for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent target = game.getPermanent(permanentId); - if (target != null) { + if (target != null && target.getCardType().contains(CardType.CREATURE)) { target.addPower(power.calculate(game, source, this)); target.addToughness(toughness.calculate(game, source, this)); affectedTargets++; @@ -115,7 +117,7 @@ public class BoostTargetEffect extends ContinuousEffectImpl { } StringBuilder sb = new StringBuilder(); Target target = mode.getTargets().get(0); - if(target.getMaxNumberOfTargets() > 1){ + if (target.getMaxNumberOfTargets() > 1) { if (target.getNumberOfTargets() < target.getNumberOfTargets()) { sb.append("up to "); } @@ -127,16 +129,15 @@ public class BoostTargetEffect extends ContinuousEffectImpl { sb.append(target.getTargetName()).append(" gets "); } String p = power.toString(); - if(!p.startsWith("-")) { + if (!p.startsWith("-")) { sb.append("+"); } sb.append(p).append("/"); String t = toughness.toString(); - if(!t.startsWith("-")){ - if(t.equals("0") && p.startsWith("-")) { + if (!t.startsWith("-")) { + if (t.equals("0") && p.startsWith("-")) { sb.append("-"); - } - else { + } else { sb.append("+"); } }