* Fixed function and handling of the Ice Age depletion counter lands.

This commit is contained in:
LevelX2 2015-10-11 19:20:12 +02:00
parent ef3e432188
commit 01a14a2665
9 changed files with 95 additions and 79 deletions

View file

@ -31,9 +31,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
@ -83,12 +81,12 @@ class CantBeEquippedSourceEffect extends ContinuousRuleModifyingEffectImpl {
}
public CantBeEquippedSourceEffect() {
super(Duration.WhileOnBattlefield, Outcome.Neutral);
staticText = "{this} can't be equipped";
super(Duration.WhileOnBattlefield, Outcome.Neutral);
staticText = "{this} can't be equipped";
}
@Override
public ContinuousEffect copy() {
public CantBeEquippedSourceEffect copy() {
return new CantBeEquippedSourceEffect(this);
}
@ -96,14 +94,14 @@ class CantBeEquippedSourceEffect extends ContinuousRuleModifyingEffectImpl {
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ATTACH;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getTargetId().equals(source.getSourceId())) {
Permanent permanent = game.getPermanent(event.getSourceId());
if(permanent != null && permanent.getSubtype().contains("Equipment")){
return true;
}
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null && permanent.getSubtype().contains("Equipment")) {
return true;
}
}
return false;
}

View file

@ -34,7 +34,6 @@ import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.SourceHasCounterCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DontUntapInControllersUntapStepSourceEffect;
@ -50,7 +49,7 @@ import mage.counters.CounterType;
/**
*
* @author anonymous
* @author Luna Skyrise
*/
public class LandCap extends CardImpl {
@ -59,15 +58,15 @@ public class LandCap extends CardImpl {
this.expansionSetCode = "ICE";
// Land Cap doesn't untap during your untap step if it has a depletion counter on it.
Effect effect = new ConditionalContinuousRuleModifyingEffect(new DontUntapInControllersUntapStepSourceEffect(),
new SourceHasCounterCondition(CounterType.DEPLETION, 0));
Effect effect = new ConditionalContinuousRuleModifyingEffect(new DontUntapInControllersUntapStepSourceEffect(false, true),
new SourceHasCounterCondition(CounterType.DEPLETION, 1, Integer.MAX_VALUE));
effect.setText("{this} doesn't untap during your untap step if it has a depletion counter on it");
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
this.addAbility(ability);
// At the beginning of your upkeep, remove a depletion counter from Land Cap.
Ability ability2 = new BeginningOfUpkeepTriggeredAbility(new RemoveCounterSourceEffect(CounterType.DEPLETION.createInstance()), TargetController.YOU, false);
this.addAbility(ability2);
// {tap}: Add {W} or {U} to your mana pool. Put a depletion counter on Land Cap.
// {T}: Add {W} or {U} to your mana pool. Put a depletion counter on Land Cap.
Ability ability3 = new SimpleManaAbility(Zone.BATTLEFIELD, Mana.WhiteMana, new TapSourceCost());
ability3.addEffect(new AddCountersSourceEffect(CounterType.DEPLETION.createInstance()));
this.addAbility(ability3);

View file

@ -49,7 +49,7 @@ import mage.counters.CounterType;
/**
*
* @author anonymous
* @author Luna Skyrise
*/
public class LavaTubes extends CardImpl {
@ -58,8 +58,8 @@ public class LavaTubes extends CardImpl {
this.expansionSetCode = "ICE";
// Lava Tubes doesn't untap during your untap step if it has a depletion counter on it.
Effect effect = new ConditionalContinuousRuleModifyingEffect(new DontUntapInControllersUntapStepSourceEffect(),
new SourceHasCounterCondition(CounterType.DEPLETION, 0));
Effect effect = new ConditionalContinuousRuleModifyingEffect(new DontUntapInControllersUntapStepSourceEffect(false, true),
new SourceHasCounterCondition(CounterType.DEPLETION, 1, Integer.MAX_VALUE));
effect.setText("{this} doesn't untap during your untap step if it has a depletion counter on it");
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
this.addAbility(ability);

View file

@ -34,7 +34,6 @@ import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.SourceHasCounterCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DontUntapInControllersUntapStepSourceEffect;
@ -50,7 +49,7 @@ import mage.counters.CounterType;
/**
*
* @author anonymous
* @author Luna Skyrise
*/
public class RiverDelta extends CardImpl {
@ -59,8 +58,8 @@ public class RiverDelta extends CardImpl {
this.expansionSetCode = "ICE";
// River Delta doesn't untap during your untap step if it has a depletion counter on it.
Effect effect = new ConditionalContinuousRuleModifyingEffect(new DontUntapInControllersUntapStepSourceEffect(),
new SourceHasCounterCondition(CounterType.DEPLETION, 0));
Effect effect = new ConditionalContinuousRuleModifyingEffect(new DontUntapInControllersUntapStepSourceEffect(false, true),
new SourceHasCounterCondition(CounterType.DEPLETION, 1, Integer.MAX_VALUE));
effect.setText("{this} doesn't untap during your untap step if it has a depletion counter on it");
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
this.addAbility(ability);

View file

@ -49,7 +49,7 @@ import mage.counters.CounterType;
/**
*
* @author anonymous
* @author Luna Skyrise
*/
public class TimberlineRidge extends CardImpl {
@ -58,8 +58,8 @@ public class TimberlineRidge extends CardImpl {
this.expansionSetCode = "ICE";
// Timberline Ridge doesn't untap during your untap step if it has a depletion counter on it.
Effect effect = new ConditionalContinuousRuleModifyingEffect(new DontUntapInControllersUntapStepSourceEffect(),
new SourceHasCounterCondition(CounterType.DEPLETION, 0));
Effect effect = new ConditionalContinuousRuleModifyingEffect(new DontUntapInControllersUntapStepSourceEffect(false, true),
new SourceHasCounterCondition(CounterType.DEPLETION, 1, Integer.MAX_VALUE));
effect.setText("{this} doesn't untap during your untap step if it has a depletion counter on it");
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
this.addAbility(ability);

View file

@ -49,7 +49,7 @@ import mage.counters.CounterType;
/**
*
* @author anonymous
* @author Luna Skyrise
*/
public class Veldt extends CardImpl {
@ -58,8 +58,8 @@ public class Veldt extends CardImpl {
this.expansionSetCode = "ICE";
// Veldt doesn't untap during your untap step if it has a depletion counter on it.
Effect effect = new ConditionalContinuousRuleModifyingEffect(new DontUntapInControllersUntapStepSourceEffect(),
new SourceHasCounterCondition(CounterType.DEPLETION, 0));
Effect effect = new ConditionalContinuousRuleModifyingEffect(new DontUntapInControllersUntapStepSourceEffect(false, true),
new SourceHasCounterCondition(CounterType.DEPLETION, 1, Integer.MAX_VALUE));
effect.setText("{this} doesn't untap during your untap step if it has a depletion counter on it");
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
this.addAbility(ability);

View file

@ -41,7 +41,7 @@ import mage.game.events.GameEvent;
*
* @author LevelX2
*/
public class ConditionalContinuousRuleModifyingEffect extends ContinuousRuleModifyingEffectImpl {
public class ConditionalContinuousRuleModifyingEffect extends ContinuousRuleModifyingEffectImpl {
protected ContinuousRuleModifyingEffect effect;
protected ContinuousRuleModifyingEffect otherwiseEffect;
@ -88,7 +88,6 @@ public class ConditionalContinuousRuleModifyingEffect extends ContinuousRuleModi
initDone = true;
}
@Override
public boolean isDiscarded() {
return effect.isDiscarded() || (otherwiseEffect != null && otherwiseEffect.isDiscarded());
@ -136,4 +135,20 @@ public class ConditionalContinuousRuleModifyingEffect extends ContinuousRuleModi
public ConditionalContinuousRuleModifyingEffect copy() {
return new ConditionalContinuousRuleModifyingEffect(this);
}
@Override
public boolean sendMessageToGameLog() {
return effect.sendMessageToGameLog(); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean sendMessageToUser() {
return effect.sendMessageToUser(); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getInfoMessage(Ability source, GameEvent event, Game game) {
return effect.getInfoMessage(source, event, game); //To change body of generated methods, choose Tools | Templates.
}
}

View file

@ -1,31 +1,30 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects;
import mage.MageObject;
@ -45,20 +44,18 @@ public abstract class ContinuousRuleModifyingEffectImpl extends ContinuousEffect
protected final boolean messageToUser;
protected final boolean messageToGameLog;
protected final String infoMessage;
// 613.10
// Some continuous effects affect game rules rather than objects. For example, effects may modify
// Some continuous effects affect game rules rather than objects. For example, effects may modify
// a player’s maximum hand size, or say that a creature must attack this turn if able. These effects
// are applied after all other continuous effects have been applied. Continuous effects that affect
// the costs of spells or abilities are applied according to the order specified in rule 601.2e.
// All other such effects are applied in timestamp order. See also the rules for timestamp order
// the costs of spells or abilities are applied according to the order specified in rule 601.2e.
// All other such effects are applied in timestamp order. See also the rules for timestamp order
// and dependency (rules 613.6 and 613.7).
// Some of this rule modifying effects are implemented as normal CONTINUOUS effects using the Layer.RulesEffects.
// But if the rule change can be implemented simply by preventing an event from happening, CONTINUOUS_RULE_MODIFICATION effects can be used.
// They work technical like a replacement effect that replaces the event completely.
// They work technical like a replacement effect that replaces the event completely.
// But player isn't asked to choose order of effects if multiple are applied to the same event.
public ContinuousRuleModifyingEffectImpl(Duration duration, Outcome outcome) {
this(duration, outcome, true, false);
}
@ -67,11 +64,13 @@ public abstract class ContinuousRuleModifyingEffectImpl extends ContinuousEffect
*
* @param duration
* @param outcome
* @param messageToUser - Every time the effect replaces an event, the user gets a message in a dialog window.
* Don't set it to true if the event happens regularly or very often. The message itself can be
* changed by overriding the getInfoMessage method.
* @param messageToLog - Every time the effect replaces an event, a message is posted to the game log. The message
* can be changed by overriding the getInfoMessage method.
* @param messageToUser - Every time the effect replaces an event, the user
* gets a message in a dialog window. Don't set it to true if the event
* happens regularly or very often. The message itself can be changed by
* overriding the getInfoMessage method.
* @param messageToLog - Every time the effect replaces an event, a message
* is posted to the game log. The message can be changed by overriding the
* getInfoMessage method.
*/
public ContinuousRuleModifyingEffectImpl(Duration duration, Outcome outcome, boolean messageToUser, boolean messageToLog) {
super(duration, outcome);
@ -89,9 +88,11 @@ public abstract class ContinuousRuleModifyingEffectImpl extends ContinuousEffect
}
/**
* An early check for the event types this effect applies to. This check was added
* to speed up event handling. Once all existing ContinuousRuleModifiyingEffects have
* implemented this method, the method should be changed to abstract here or removed.
* An early check for the event types this effect applies to. This check was
* added to speed up event handling. Once all existing
* ContinuousRuleModifiyingEffects have implemented this method, the method
* should be changed to abstract here or removed.
*
* @param event
* @param game
* @return
@ -112,10 +113,10 @@ public abstract class ContinuousRuleModifyingEffectImpl extends ContinuousEffect
String message;
MageObject object = game.getObject(source.getSourceId());
if (object != null) {
message = source.getRule(object.getLogName());
message = source.getRule(messageToUser ? object.getIdName() : object.getLogName());
} else {
message = source.getRule();
}
}
return message;
} else {
return infoMessage;
@ -132,5 +133,4 @@ public abstract class ContinuousRuleModifyingEffectImpl extends ContinuousEffect
return messageToGameLog;
}
}

View file

@ -27,11 +27,11 @@
*/
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.PhaseStep;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -44,7 +44,11 @@ import mage.game.permanent.Permanent;
public class DontUntapInControllersUntapStepSourceEffect extends ContinuousRuleModifyingEffectImpl {
public DontUntapInControllersUntapStepSourceEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment, false, true);
this(false, true);
}
public DontUntapInControllersUntapStepSourceEffect(boolean messageToUser, boolean messageToLog) {
super(Duration.WhileOnBattlefield, Outcome.Detriment, messageToUser, messageToLog);
staticText = "{this} doesn't untap during your untap step";
}
@ -78,4 +82,5 @@ public class DontUntapInControllersUntapStepSourceEffect extends ContinuousRuleM
}
return false;
}
}