mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
* Phyrexian Revier - Replaced ReplacementEffect with ContinuousRuleModifyingEffect.
This commit is contained in:
parent
7f6d5bcac6
commit
8bdc94082d
1 changed files with 16 additions and 8 deletions
|
@ -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()))) {
|
||||
|
|
Loading…
Reference in a new issue