From 8bdc94082dc18f317edd8653609db094214ffab1 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 25 Jul 2014 15:53:47 +0200 Subject: [PATCH] * Phyrexian Revier - Replaced ReplacementEffect with ContinuousRuleModifyingEffect. --- .../mirrodinbesieged/PhyrexianRevoker.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java index 666861bc0e..2a6036b327 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java @@ -39,8 +39,8 @@ import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.ReplacementEffectImpl; import mage.cards.CardImpl; import mage.cards.repository.CardRepository; import mage.choices.Choice; @@ -48,7 +48,9 @@ import mage.choices.ChoiceImpl; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; import mage.players.Player; +import mage.util.CardUtil; /** * @@ -95,7 +97,8 @@ class PhyrexianRevokerEffect1 extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (controller != null && permanent != null) { Choice cardChoice = new ChoiceImpl(); cardChoice.setChoices(CardRepository.instance.getNonLandNames()); cardChoice.clearChoice(); @@ -105,8 +108,9 @@ class PhyrexianRevokerEffect1 extends OneShotEffect { } } String cardName = cardChoice.getChoice(); - game.informPlayers("Phyrexian Revoker, named card: [" + cardName + "]"); + game.informPlayers(permanent.getLogName() + ", named card: [" + cardName + "]"); game.getState().setValue(source.getSourceId().toString(), cardName); + permanent.addInfo("named card", CardUtil.addToolTipMarkTags("Named card: [" + cardName +"]")); } return false; } @@ -118,7 +122,7 @@ class PhyrexianRevokerEffect1 extends OneShotEffect { } -class PhyrexianRevokerEffect2 extends ReplacementEffectImpl { +class PhyrexianRevokerEffect2 extends ContinuousRuleModifiyingEffectImpl { public PhyrexianRevokerEffect2() { super(Duration.WhileOnBattlefield, Outcome.Detriment); @@ -138,14 +142,18 @@ class PhyrexianRevokerEffect2 extends ReplacementEffectImpl { public PhyrexianRevokerEffect2 copy() { return new PhyrexianRevokerEffect2(this); } - + @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - return true; + public String getInfoMessage(Ability source, Game game) { + MageObject mageObject = game.getObject(source.getSourceId()); + if (mageObject != null) { + return "You can't activate sources with that name (" + mageObject.getLogName() + " in play)."; + } + return null; } @Override - public boolean applies(GameEvent event, Ability source, Game game) { + public boolean applies(GameEvent event, Ability source, boolean checkPlayableMode ,Game game) { if (event.getType() == EventType.ACTIVATE_ABILITY) { MageObject object = game.getObject(event.getSourceId()); if (object != null && object.getName().equals(game.getState().getValue(source.getSourceId().toString()))) {