diff --git a/Mage.Sets/src/mage/cards/d/DeathBaron.java b/Mage.Sets/src/mage/cards/d/DeathBaron.java index 49fd9011ed..7cc4b75336 100644 --- a/Mage.Sets/src/mage/cards/d/DeathBaron.java +++ b/Mage.Sets/src/mage/cards/d/DeathBaron.java @@ -44,7 +44,7 @@ public final class DeathBaron extends CardImpl { 1, 1, Duration.WhileOnBattlefield, filter, false )); ability.addEffect(new GainAbilityControlledEffect( - DeathtouchAbility.getInstance(), Duration.WhileOnBattlefield, filter, true + DeathtouchAbility.getInstance(), Duration.WhileOnBattlefield, filter ).setText("and have deathtouch")); this.addAbility(ability); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/ala/DeathBaronTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/ala/DeathBaronTest.java new file mode 100644 index 0000000000..ca8a65e7ce --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/ala/DeathBaronTest.java @@ -0,0 +1,66 @@ +package org.mage.test.cards.single.ala; + +import mage.abilities.Ability; +import mage.abilities.keyword.DeathtouchAbility; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author awjackson + */ +public class DeathBaronTest extends CardTestPlayerBase { + + private static final String baron = "Death Baron"; + private static final String skeleton = "Drudge Skeletons"; + private static final String zombie = "Scathe Zombies"; + private static final String knight = "Black Knight"; + + @Test + public void testDoesntNormallyAffectSelf() { + addCard(Zone.BATTLEFIELD, playerA, baron); + addCard(Zone.BATTLEFIELD, playerA, skeleton); + addCard(Zone.BATTLEFIELD, playerA, zombie); + addCard(Zone.BATTLEFIELD, playerA, knight); + + addCard(Zone.BATTLEFIELD, playerB, skeleton); + addCard(Zone.BATTLEFIELD, playerB, zombie); + + setStopAt(1, PhaseStep.PRECOMBAT_MAIN); + execute(); + + Ability deathtouch = DeathtouchAbility.getInstance(); + + // Death Baron doesn't normally affect itself + assertPowerToughness(playerA, baron, 2, 2); + assertAbility(playerA, baron, deathtouch, false); + + assertPowerToughness(playerA, skeleton, 2, 2); + assertPowerToughness(playerA, zombie, 3, 3); + assertPowerToughness(playerA, knight, 2, 2); + assertAbility(playerA, skeleton, deathtouch, true); + assertAbility(playerA, zombie, deathtouch, true); + assertAbility(playerA, knight, deathtouch, false); + + assertPowerToughness(playerB, skeleton, 1, 1); + assertPowerToughness(playerB, zombie, 2, 2); + assertAbility(playerB, skeleton, deathtouch, false); + assertAbility(playerB, zombie, deathtouch, false); + } + + @Test + public void testBecomeSkeleton() { + addCard(Zone.BATTLEFIELD, playerA, baron); + addCard(Zone.BATTLEFIELD, playerA, "Amoeboid Changeling"); + + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Target creature gains", baron); + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + // If you manage to turn it into a Skeleton, however, then it will give itself +1/+1 and deathtouch + assertPowerToughness(playerA, baron, 3, 3); + assertAbility(playerA, baron, DeathtouchAbility.getInstance(), true); + } +} diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostControlledEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostControlledEffect.java index c3acf90b58..bc9136f944 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostControlledEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostControlledEffect.java @@ -117,8 +117,9 @@ public class BoostControlledEffect extends ContinuousEffectImpl { } } } else { - for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { - if (!(excludeSource && perm.getId().equals(source.getSourceId()))) { + for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { + if (perm.isControlledBy(source.getControllerId()) + && (!(excludeSource && perm.getId().equals(source.getSourceId())))) { perm.addPower(power.calculate(game, source, this)); perm.addToughness(toughness.calculate(game, source, this)); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledEffect.java index eca20860e2..e7208691fa 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledEffect.java @@ -98,8 +98,9 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl { } } } else { - for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { - if (!(excludeSource && perm.getId().equals(source.getSourceId()))) { + for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { + if (perm.isControlledBy(source.getControllerId()) + && !(excludeSource && perm.getId().equals(source.getSourceId()))) { for (Ability abilityToAdd : ability) { perm.addAbility(abilityToAdd, source.getSourceId(), game); } @@ -149,5 +150,4 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl { setText(); return this; } - } diff --git a/Mage/src/main/java/mage/game/permanent/Battlefield.java b/Mage/src/main/java/mage/game/permanent/Battlefield.java index 7efd77533d..016c83c951 100644 --- a/Mage/src/main/java/mage/game/permanent/Battlefield.java +++ b/Mage/src/main/java/mage/game/permanent/Battlefield.java @@ -237,8 +237,8 @@ public class Battlefield implements Serializable { /** * Returns all {@link Permanent} on the battlefield that match the supplied - * filter. This method ignores the range of influence. It ignores controller - * predicates + * filter. This method ignores the range of influence and ignores + * ObjectSourcePlayer predicates in the filter (e.g. controller predicates) * * @param filter * @param game @@ -254,7 +254,8 @@ public class Battlefield implements Serializable { /** * Returns all {@link Permanent} that match the filter and are controlled by - * controllerId. This method ignores the range of influence. + * controllerId. This method ignores the range of influence and ignores + * ObjectSourcePlayer predicates in the filter * * @param filter * @param controllerId