From 4ef9a75fe777f499f7a1f9820286e551ac1eeee8 Mon Sep 17 00:00:00 2001 From: jeffwadsworth Date: Wed, 18 Dec 2019 15:41:08 -0600 Subject: [PATCH] - Fixed #6101 --- .../effects/common/ReturnToHandTargetEffect.java | 12 +++++++----- .../java/mage/util/functions/ApplyToMageObject.java | 9 ++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandTargetEffect.java index 51252895a9d..574c005917f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandTargetEffect.java @@ -1,4 +1,3 @@ - package mage.abilities.effects.common; import java.util.ArrayList; @@ -68,9 +67,10 @@ public class ReturnToHandTargetEffect extends OneShotEffect { for (UUID targetId : targetPointer.getTargets(game, source)) { MageObject mageObject = game.getObject(targetId); if (mageObject != null) { - if (mageObject instanceof Spell && mageObject.isCopy()) { + if (mageObject instanceof Spell + && mageObject.isCopy()) { copyIds.add(targetId); - } else { + } else if (mageObject instanceof Card) { cards.add((Card) mageObject); } } @@ -83,7 +83,8 @@ public class ReturnToHandTargetEffect extends OneShotEffect { } @Override - public String getText(Mode mode) { + public String getText(Mode mode + ) { if (staticText != null && !staticText.isEmpty()) { return staticText; } @@ -93,7 +94,8 @@ public class ReturnToHandTargetEffect extends OneShotEffect { Target target = mode.getTargets().get(0); StringBuilder sb = new StringBuilder("return "); if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) { - sb.append("up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName()).append(" to their owners' hand"); + sb.append("up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ") + .append(target.getTargetName()).append(" to their owners' hand"); return sb.toString(); } else { if (target.getNumberOfTargets() > 1) { diff --git a/Mage/src/main/java/mage/util/functions/ApplyToMageObject.java b/Mage/src/main/java/mage/util/functions/ApplyToMageObject.java index ff827c01bb9..adbf0828689 100644 --- a/Mage/src/main/java/mage/util/functions/ApplyToMageObject.java +++ b/Mage/src/main/java/mage/util/functions/ApplyToMageObject.java @@ -3,7 +3,6 @@ package mage.util.functions; import mage.MageObject; import mage.abilities.Ability; import mage.game.Game; - import java.util.Objects; import java.util.UUID; @@ -14,11 +13,11 @@ public abstract class ApplyToMageObject { // WARNING: // 1. Applier uses for copy effects only; - // 2. It's applies to blueprint, not real object (real object is targetObjectId and can be card or token, even outside from game like EmptyToken); - // 3. "source" is current copy ability and can be different from original copy ability (copy of copy); + // 2. It applies to the blueprint, not the real object (the real object is targetObjectId and can be card or token, even from outside the game like EmptyToken); + // 3. "source" is the current copy ability and can be different from the original copy ability (copy of copy); // 4. Don't use "source" param at all; - // 5. Use isCopyOfCopy() to detect it (some effects can applies to copy of copy, but other can't -- ses Spark Double as example). - // TODO: check all aplliers implementations - remove source uses, add isCopyOfCopy processing + // 5. Use isCopyOfCopy() to detect it (some effects can apply to copy of copy, but others can't -- see Spark Double as an example). + // TODO: check all applier implementations - remove source uses, add isCopyOfCopy processing public abstract boolean apply(Game game, MageObject mageObject, Ability source, UUID targetObjectId); public boolean isCopyOfCopy(Ability source, UUID targetObjectId) {