diff --git a/forge-game/src/main/java/forge/game/ability/effects/CopySpellAbilityEffect.java b/forge-game/src/main/java/forge/game/ability/effects/CopySpellAbilityEffect.java index 694dd2a26a3..090fee4514f 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/CopySpellAbilityEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/CopySpellAbilityEffect.java @@ -1,14 +1,8 @@ package forge.game.ability.effects; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.function.Predicate; - import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; - import forge.game.Game; import forge.game.GameEntity; import forge.game.ability.AbilityKey; @@ -21,12 +15,19 @@ import forge.game.card.CardLists; import forge.game.player.Player; import forge.game.replacement.ReplacementType; import forge.game.spellability.SpellAbility; +import forge.game.staticability.StaticAbilityCantBeCopied; import forge.util.Aggregates; import forge.util.CardTranslation; -import forge.util.Localizer; import forge.util.Lang; +import forge.util.Localizer; import forge.util.collect.FCollection; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.function.Predicate; + public class CopySpellAbilityEffect extends SpellAbilityEffect { @@ -74,7 +75,15 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect { controllers = AbilityUtils.getDefinedPlayers(card, sa.getParam("Controller"), sa); } - final List tgtSpells = getTargetSpells(sa); + List tgtSpells = getTargetSpells(sa); + List cantCopy = new ArrayList<>(); + + for (final SpellAbility tgtSA : tgtSpells) { + if (StaticAbilityCantBeCopied.cantBeCopied(tgtSA.getHostCard())) { + cantCopy.add(tgtSA); + } + } + tgtSpells.removeAll(cantCopy); if (tgtSpells.isEmpty() || amount == 0) { return; diff --git a/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantBeCopied.java b/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantBeCopied.java new file mode 100644 index 00000000000..1863c7663ea --- /dev/null +++ b/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantBeCopied.java @@ -0,0 +1,52 @@ +/* + * Forge: Play Magic: the Gathering. + * Copyright (C) 2011 Forge Team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package forge.game.staticability; + +import forge.game.Game; +import forge.game.card.Card; +import forge.game.zone.ZoneType; + +/** + * The Class StaticAbility_CantBeCopied. + */ +public class StaticAbilityCantBeCopied { + + static String MODE = "CantBeCopied"; + + public static boolean cantBeCopied(final Card c) { + final Game game = c.getGame(); + for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) { + for (final StaticAbility stAb : ca.getStaticAbilities()) { + if (!stAb.checkConditions(MODE)) { + continue; + } + if (cantBeCopiedCheck(stAb, c)) { + return true; + } + } + } + return false; + } + + public static boolean cantBeCopiedCheck(final StaticAbility stAb, final Card card) { + if (stAb.matchesValidParam("ValidCard", card)) { + return true; + } + return false; + } +} diff --git a/forge-gui/res/cardsfolder/upcoming/see_double.txt b/forge-gui/res/cardsfolder/upcoming/see_double.txt new file mode 100644 index 00000000000..fa76de266cf --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/see_double.txt @@ -0,0 +1,9 @@ +Name:See Double +ManaCost:2 U U +Types:Instant +S:Mode$ CantBeCopied | ValidCard$ Card.Self | EffectZone$ Stack | Description$ This spell can't be copied. +A:SP$ Charm | MinCharmNum$ 1 | CharmNum$ X | Choices$ CopySpell,CopyCreature | AdditionalDescription$ . If an opponent has eight or more cards in their graveyard, you may choose both. +SVar:X:Count$Compare PlayerCountOpponents$HighestCardsInGraveyard GE8.2.1 +SVar:CopySpell:DB$ CopySpellAbility | ValidTgts$ Card | TargetType$ Spell | MayChooseTarget$ True | SpellDescription$ Copy target spell. You may choose new targets for the copy. (A copy of a permanent spell becomes a token.) +SVar:CopyCreature:DB$ CopyPermanent | ValidTgts$ Creature | SpellDescription$ Create a token that's a copy of target creature. +Oracle:This spell can't be copied.\nChoose one. If an opponent has eight or more cards in their graveyard, you may choose both.\n• Copy target spell. You may choose new targets for the copy. (A copy of a permanent spell becomes a token.)\n• Create a token that's a copy of target creature.