From 6091c7eae3dce7b2b4f75c27b5a038e354cabafa Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 28 Feb 2021 09:34:09 -0500 Subject: [PATCH] fixed trample and deathtouch not working when deathtouch is gained by an outside source (fixes #7633) --- .../test/combat/DamageDistributionTest.java | 17 +++++++++++++++++ .../java/mage/game/permanent/PermanentImpl.java | 5 ++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/combat/DamageDistributionTest.java b/Mage.Tests/src/test/java/org/mage/test/combat/DamageDistributionTest.java index 5299ed5260..c4f4c2218b 100644 --- a/Mage.Tests/src/test/java/org/mage/test/combat/DamageDistributionTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/combat/DamageDistributionTest.java @@ -180,4 +180,21 @@ public class DamageDistributionTest extends CardTestPlayerBase { assertLife(playerB, 20); } + @Test + public void testTrampleDeathtouch() { + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2); + addCard(Zone.BATTLEFIELD, playerA, "Colossal Dreadmaw"); + addCard(Zone.BATTLEFIELD, playerB, "Colossapede"); + addCard(Zone.HAND, playerA, "Bladebrand"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Bladebrand", "Colossal Dreadmaw"); + + attack(1, playerA, "Colossal Dreadmaw"); + block(1, playerB, "Colossapede", "Colossal Dreadmaw"); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertLife(playerB, 20 - 5); + } } diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index e78dee5f1c..61c3aa51ec 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -1038,7 +1038,10 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { lethal = Math.min(lethal, toughness.getValue()); } lethal = Math.max(lethal - this.damage, 0); - Card attacker = game.getCard(attackerId); + Card attacker = game.getPermanent(attackerId); + if (attacker == null) { + attacker = game.getCard(attackerId); + } if (attacker != null && attacker.getAbilities(game).containsKey(DeathtouchAbility.getInstance().getId())) { lethal = Math.min(1, lethal); }