* Started to change ReplacementEffects for UNTAP event to ContinuousRuleModifyingEffect (not finished).

This commit is contained in:
LevelX2 2014-07-28 17:46:25 +02:00
parent caf8a1e5ec
commit 9f9d140fa5
3 changed files with 25 additions and 19 deletions

View file

@ -46,6 +46,9 @@ public class CloudcrestLake extends CardImpl {
public CloudcrestLake(UUID ownerId) {
super(ownerId, 274, "Cloudcrest Lake", Rarity.UNCOMMON, new CardType[]{CardType.LAND}, "");
this.expansionSetCode = "CHK";
// {T}: Add {1} to your mana pool.
// {T}: Add {W} or {U} to your mana pool. Cloudcrest Lake doesn't untap during your next untap step.
this.addAbility(new ColorlessManaAbility());
Ability whiteManaAbility = new WhiteManaAbility();
whiteManaAbility.addEffect(new SkipNextUntapSourceEffect());

View file

@ -1,7 +1,7 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.PhaseStep;
@ -12,7 +12,7 @@ import mage.game.permanent.Permanent;
/**
* @author nantuko
*/
public class SkipEnchantedUntapEffect extends ReplacementEffectImpl {
public class SkipEnchantedUntapEffect extends ContinuousRuleModifiyingEffectImpl {
public SkipEnchantedUntapEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
@ -34,12 +34,7 @@ public class SkipEnchantedUntapEffect extends ReplacementEffectImpl {
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
public boolean applies(GameEvent event, Ability source, boolean checkPlayableMode, Game game) {
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == GameEvent.EventType.UNTAP) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null && enchantment.getAttachedTo() != null) {

View file

@ -1,18 +1,21 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.PhaseStep;
import mage.game.Game;
import mage.game.events.GameEvent;
public class SkipNextUntapSourceEffect extends ReplacementEffectImpl {
public class SkipNextUntapSourceEffect extends ContinuousRuleModifiyingEffectImpl {
private int validForTurnNum;
public SkipNextUntapSourceEffect() {
super(Duration.OneUse, Outcome.Detriment);
super(Duration.Custom, Outcome.Detriment);
staticText = "{this} doesn't untap during your next untap step";
validForTurnNum = 0;
}
public SkipNextUntapSourceEffect(final SkipNextUntapSourceEffect effect) {
@ -30,19 +33,24 @@ public class SkipNextUntapSourceEffect extends ReplacementEffectImpl {
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
used = true;
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
public boolean applies(GameEvent event, Ability source, boolean checkPlayableMode, Game game) {
if (validForTurnNum > 0 && validForTurnNum < game.getTurnNum()) {
discard();
return false;
}
if (GameEvent.EventType.UNTAP_STEP.equals(event.getType())
&& game.getActivePlayerId().equals(source.getControllerId())) {
validForTurnNum = game.getTurnNum();
}
if (game.getTurn().getStepType() == PhaseStep.UNTAP
&& event.getType() == GameEvent.EventType.UNTAP
&& event.getTargetId().equals(source.getSourceId())) {
if (!checkPlayableMode) {
discard();
}
return true;
}
return false;
}
}
}