* Notion Thief - Fixed that the replacment effect was not always applied as intended.

This commit is contained in:
LevelX2 2015-06-26 15:16:33 +02:00
parent 5b7d57aec9
commit d65581809f
3 changed files with 44 additions and 16 deletions

View file

@ -61,15 +61,16 @@ public class FaithsFetters extends CardImpl {
this.expansionSetCode = "DDC";
this.subtype.add("Aura");
// Enchant permanent
TargetPermanent auraTarget = new TargetPermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.GainControl));
this.getSpellAbility().addEffect(new AttachEffect(Outcome.LoseAbility));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// When Faith's Fetters enters the battlefield, you gain 4 life.
this.addAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(4)));
// Enchanted permanent can't attack or block, and its activated abilities can't be activated unless they're mana abilities.
Effect effect = new CantAttackBlockAttachedEffect(AttachmentType.AURA);
effect.setText("Enchanted permanent can't attack or block,");
@ -108,12 +109,12 @@ class FaithsFettersEffect extends ContinuousRuleModifyingEffectImpl {
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent enchantment = game.getPermanent(source.getSourceId());
@ -127,4 +128,4 @@ class FaithsFettersEffect extends ContinuousRuleModifyingEffectImpl {
}
return false;
}
}
}

View file

@ -37,6 +37,7 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.PhaseStep;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
@ -76,7 +77,6 @@ public class NotionThief extends CardImpl {
}
}
class NotionThiefReplacementEffect extends ReplacementEffectImpl {
public NotionThiefReplacementEffect() {
@ -106,21 +106,22 @@ class NotionThiefReplacementEffect extends ReplacementEffectImpl {
}
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DRAW_CARD;
}
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
if (game.getActivePlayerId().equals(event.getPlayerId())) {
if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getStep().getType().equals(PhaseStep.DRAW)) {
CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get("CardsDrawnDuringDrawStep");
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {
return true;
}
} else {
// not an opponents players draw step, always replace draw
return true;
}
}