diff --git a/Mage/src/main/java/mage/abilities/effects/common/CipherEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CipherEffect.java index 9dd49c7ea60..af625b9c7a2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CipherEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CipherEffect.java @@ -1,7 +1,6 @@ package mage.abilities.effects.common; -import java.util.UUID; import mage.MageObjectReference; import mage.abilities.Ability; import mage.abilities.SpellAbility; @@ -20,11 +19,13 @@ import mage.players.Player; import mage.target.common.TargetControlledCreaturePermanent; import mage.target.targetpointer.FixedTarget; +import java.util.UUID; + /** * FAQ 2013/01/11 - * + *
* 702.97. Cipher - * + *
* 702.97a Cipher appears on some instants and sorceries. It represents two * static abilities, one that functions while the spell is on the stack and one * that functions while the card with cipher is in the exile zone. "Cipher" @@ -33,17 +34,17 @@ import mage.target.targetpointer.FixedTarget; * that creature, that creature has 'Whenever this creature deals combat damage * to a player, you may copy this card and you may cast the copy without paying * its mana cost.'" - * + *
* 702.97b The term "encoded" describes the relationship between the card with * cipher while in the exile zone and the creature chosen when the spell * represented by that card resolves. - * + *
* 702.97c The card with cipher remains encoded on the chosen creature as long * as the card with cipher remains exiled and the creature remains on the * battlefield. The card remains encoded on that object even if it changes * controller or stops being a creature, as long as it remains on the * battlefield. - * + *
* TODO: Implement Cipher as two static abilities concerning the rules. * * @author LevelX2 @@ -118,16 +119,9 @@ class CipherStoreEffect extends OneShotEffect { Card copyCard = game.copyCard(cipherCard, source, controller.getId()); SpellAbility ability = copyCard.getSpellAbility(); // remove the cipher effect from the copy - Effect cipherEffect = null; - for (Effect effect : ability.getEffects()) { - if (effect instanceof CipherEffect) { - cipherEffect = effect; - } - } - ability.getEffects().remove(cipherEffect); - if (ability instanceof SpellAbility) { - controller.cast(ability, game, true, new MageObjectReference(source.getSourceObject(game), game)); - } + ability.getEffects().removeIf(effect -> effect instanceof CipherEffect); + controller.cast(ability, game, true, new MageObjectReference(source.getSourceObject(game), game)); + } return false;