This commit is contained in:
jeffwadsworth 2019-12-18 15:41:08 -06:00
parent cde9957f54
commit 4ef9a75fe7
2 changed files with 11 additions and 10 deletions

View file

@ -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) {

View file

@ -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) {