From d8059b6e74d4e7cbb7efc6d538457b26730a3d88 Mon Sep 17 00:00:00 2001 From: jeffwadsworth Date: Mon, 9 Nov 2020 11:20:19 -0600 Subject: [PATCH] - Fixed the controller aspect of Martial Impetus --- .../src/mage/cards/m/MartialImpetus.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Mage.Sets/src/mage/cards/m/MartialImpetus.java b/Mage.Sets/src/mage/cards/m/MartialImpetus.java index 3ab0b2afe62..e251becd38c 100644 --- a/Mage.Sets/src/mage/cards/m/MartialImpetus.java +++ b/Mage.Sets/src/mage/cards/m/MartialImpetus.java @@ -69,12 +69,19 @@ enum MartialImpetusPredicate implements ObjectSourcePlayerPredicate input, Game game) { - Permanent attachedTo = game.getPermanentOrLKIBattlefield(game.getPermanent(input.getSourceId()).getAttachedTo()); - return attachedTo != null // check the creature that the aura is attached to, not the aura itself - && input.getObject() != null // creature being checked for predicate - && input.getObject() != attachedTo // must be other creature - && input.getObject().isAttacking() // attacking - && game.getOpponents(attachedTo.getControllerId()) // must be attacking an opponent - .contains(game.getCombat().getDefendingPlayerId(input.getObject().getId(), game)); + Permanent martialImpetus = game.getPermanentOrLKIBattlefield(input.getSourceId()); + if (martialImpetus != null) { + Permanent attachedTo = game.getPermanentOrLKIBattlefield(martialImpetus.getAttachedTo()); + UUID auraControllerId = martialImpetus.getControllerId(); + if (attachedTo != null // check the creature that the aura is attached to, not the aura itself + && input.getObject() != null // creature being checked for predicate + && input.getObject() != attachedTo // must be other creature + && input.getObject().isAttacking() // attacking + && game.getOpponents(auraControllerId) // check for opponents of aura's controller + .contains(game.getCombat().getDefendingPlayerId(input.getObject().getId(), game))) { + return true; + } + } + return false; } }