* Fixed problems with LockedInCondition() that did not work as intended if spells were reused because conditions have no deep copy.

This commit is contained in:
LevelX2 2014-08-30 00:46:29 +02:00
parent c1fd249c97
commit fbc2a7258f
36 changed files with 309 additions and 219 deletions

View file

@ -59,7 +59,7 @@ public class NekoTe extends CardImpl {
// Whenever equipped creature deals damage to a creature, tap that creature. That creature doesn't untap during its controller's untap step for as long as Neko-Te remains on the battlefield.
ContinuousRuleModifiyingEffect skipUntapEffect = new SkipUntapTargetEffect(Duration.WhileOnBattlefield);
skipUntapEffect.setText("That creature doesn't untap during its controller's untap step for as long as {this} remains on the battlefield");
ConditionalContinuousRuleModifyingEffect effect = new ConditionalContinuousRuleModifyingEffect(skipUntapEffect, new SourceOnBattelfieldCondition(), false);
ConditionalContinuousRuleModifyingEffect effect = new ConditionalContinuousRuleModifyingEffect(skipUntapEffect, new SourceOnBattelfieldCondition());
Ability ability = new DealsDamageToACreatureAttachedTriggeredAbility(new TapTargetEffect("that creature"), false, "equipped creature", false, true);
ability.addEffect(effect);
this.addAbility(ability);

View file

@ -61,7 +61,7 @@ public class PillarOfWar extends CardImpl {
// As long as Pillar of War is enchanted, it can attack as though it didn't have defender.
Effect effect = new ConditionalAsThoughEffect(
new CanAttackAsThoughtItDidntHaveDefenderEffect(Duration.WhileOnBattlefield),
new EnchantedCondition(), false);
new EnchantedCondition());
effect.setText("As long as {this} is enchanted, it can attack as though it didn't have defender");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));

View file

@ -28,6 +28,7 @@
package mage.sets.darkascension;
import java.util.UUID;
import mage.abilities.condition.LockedInCondition;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
@ -57,8 +58,8 @@ public class BreakOfDay extends CardImpl {
// Fateful hour - If you have 5 or less life, those creatures also are indestructible this turn.
this.getSpellAbility().addEffect(new ConditionalContinousEffect(
new GainAbilityAllEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn, new FilterControlledCreaturePermanent("creatures you control"), false),
FatefulHourCondition.getInstance(),
"If you have 5 or less life, those creatures also are indestructible this turn", true));
new LockedInCondition(FatefulHourCondition.getInstance()),
"If you have 5 or less life, those creatures also are indestructible this turn"));
}
public BreakOfDay(final BreakOfDay card) {

View file

@ -28,7 +28,6 @@
package mage.sets.darkascension;
import java.util.UUID;
import mage.abilities.condition.FixedCondition;
import mage.abilities.condition.LockedInCondition;
import mage.constants.CardType;
import mage.constants.Duration;
@ -57,8 +56,7 @@ public class TragicSlip extends CardImpl {
new BoostTargetEffect(-13, -13, Duration.EndOfTurn),
new BoostTargetEffect(-1, -1, Duration.EndOfTurn),
new LockedInCondition(MorbidCondition.getInstance()),
"Target creature gets -1/-1 until end of turn. Morbid - That creature gets -13/-13 until end of turn instead if a creature died this turn",
true));
"Target creature gets -1/-1 until end of turn. Morbid - That creature gets -13/-13 until end of turn instead if a creature died this turn"));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}

View file

@ -29,6 +29,7 @@ package mage.sets.eventide;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.LockedInCondition;
import mage.abilities.condition.common.ManaWasSpentCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.decorator.ConditionalReplacementEffect;
@ -61,7 +62,7 @@ public class BatwingBrume extends CardImpl {
// Prevent all combat damage that would be dealt this turn if {W} was spent to cast Batwing Brume. Each player loses 1 life for each attacking creature he or she controls if {B} was spent to cast Batwing Brume.
Effect effect = new ConditionalReplacementEffect(new PreventAllDamageByAllEffect(Duration.EndOfTurn, true),
new ManaWasSpentCondition(ColoredManaSymbol.W), true);
new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.W)));
effect.setText("Prevent all combat damage that would be dealt this turn if {W} was spent to cast {this}");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(

View file

@ -28,6 +28,7 @@
package mage.sets.eventide;
import java.util.UUID;
import mage.abilities.condition.LockedInCondition;
import mage.abilities.condition.common.ManaWasSpentCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.effects.common.continious.BoostTargetEffect;
@ -56,10 +57,12 @@ public class CankerousThirst extends CardImpl {
// If {B} was spent to cast Cankerous Thirst, you may have target creature get -3/-3 until end of turn. If {G} was spent to cast Cankerous Thirst, you may have target creature get +3/+3 until end of turn.
this.getSpellAbility().addEffect(new ConditionalContinousEffect(
new BoostTargetEffect(-3, -3, Duration.EndOfTurn),
new ManaWasSpentCondition(ColoredManaSymbol.B), "If {B} was spent to cast {this}, you may have target creature get -3/-3 until end of turn", true));
new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.B)),
"If {B} was spent to cast {this}, you may have target creature get -3/-3 until end of turn"));
this.getSpellAbility().addEffect(new ConditionalContinousEffect(
new BoostTargetEffect(3, 3, Duration.EndOfTurn),
new ManaWasSpentCondition(ColoredManaSymbol.G), "If {G} was spent to cast {this}, you may have target creature get +3/+3 until end of turn", true));
new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.G)),
"If {G} was spent to cast {this}, you may have target creature get +3/+3 until end of turn"));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.addInfo("Info1", "<i>(Do both if {B}{G} was spent.)<i>");
}

View file

@ -30,6 +30,7 @@ package mage.sets.eventide;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.LockedInCondition;
import mage.abilities.condition.common.SourceMatchesFilterCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalContinousEffect;
@ -78,9 +79,8 @@ public class FigureOfDestiny extends CardImpl {
Zone.BATTLEFIELD,
new ConditionalContinousEffect(
new BecomesCreatureSourceEffect(new FigureOfDestiny.FigureOfDestinyToken2(), "", Duration.Custom),
new SourceMatchesFilterCondition(filter2),
"If {this} is a Spirit, it becomes a Kithkin Spirit Warrior with base power and toughness 4/4",
true),
new LockedInCondition(new SourceMatchesFilterCondition(filter2)),
"If {this} is a Spirit, it becomes a Kithkin Spirit Warrior with base power and toughness 4/4"),
new ManaCostsImpl("{R/W}{R/W}{R/W}")
));
// {RW}{RW}{RW}{RW}{RW}{RW}: If Figure of Destiny is a Warrior, it becomes a Kithkin Spirit Warrior Avatar with base power and toughness 8/8, flying, and first strike.
@ -88,9 +88,8 @@ public class FigureOfDestiny extends CardImpl {
Zone.BATTLEFIELD,
new ConditionalContinousEffect(
new BecomesCreatureSourceEffect(new FigureOfDestiny.FigureOfDestinyToken3(), "", Duration.Custom),
new SourceMatchesFilterCondition(filter3),
"If {this} is a Warrior, it becomes a Kithkin Spirit Warrior Avatar with base power and toughness 8/8, flying, and first strike",
true),
new LockedInCondition(new SourceMatchesFilterCondition(filter3)),
"If {this} is a Warrior, it becomes a Kithkin Spirit Warrior Avatar with base power and toughness 8/8, flying, and first strike"),
new ManaCostsImpl("{R/W}{R/W}{R/W}{R/W}{R/W}{R/W}")
));
}

View file

@ -30,6 +30,7 @@ package mage.sets.eventide;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.LockedInCondition;
import mage.abilities.condition.common.ManaWasSpentCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.effects.ContinuousEffectImpl;
@ -40,7 +41,6 @@ import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.ManaType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.SubLayer;
@ -65,10 +65,12 @@ public class InvertTheSkies extends CardImpl {
// Creatures your opponents control lose flying until end of turn if {G} was spent to cast Invert the Skies, and creatures you control gain flying until end of turn if {U} was spent to cast it.
this.getSpellAbility().addEffect(new ConditionalContinousEffect(
new InvertTheSkiesEffect(),
new ManaWasSpentCondition(ColoredManaSymbol.G), "Creatures your opponents control lose flying until end of turn if {G} was spent to cast {this},", true));
new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.G)),
"Creatures your opponents control lose flying until end of turn if {G} was spent to cast {this},"));
this.getSpellAbility().addEffect(new ConditionalContinousEffect(
new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.EndOfTurn),
new ManaWasSpentCondition(ColoredManaSymbol.U), "and creatures you control gain flying until end of turn if {U} was spent to cast it", true));
new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.U)),
"and creatures you control gain flying until end of turn if {U} was spent to cast it"));
this.addInfo("Info1", "<i>(Do both if {G}{U} was spent.)<i>");
}

View file

@ -30,6 +30,7 @@ package mage.sets.eventide;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.condition.LockedInCondition;
import mage.abilities.condition.common.ManaWasSpentCondition;
import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect;
import mage.abilities.effects.ContinuousRuleModifiyingEffect;
@ -65,10 +66,10 @@ public class Moonhold extends CardImpl {
effect2.setText("and can't play creature cards this turn if {W} was spent to cast it.");
this.getSpellAbility().addEffect(new ConditionalContinuousRuleModifyingEffect(
effect,
new ManaWasSpentCondition(ColoredManaSymbol.R), false));
new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.R))));
this.getSpellAbility().addEffect(new ConditionalContinuousRuleModifyingEffect(
effect2,
new ManaWasSpentCondition(ColoredManaSymbol.W), false));
new LockedInCondition(new ManaWasSpentCondition(ColoredManaSymbol.W))));
this.getSpellAbility().addTarget(new TargetPlayer());
this.addInfo("Info1", "<i>(Do both if {R}{W} was spent.)</i>");
}

View file

@ -85,7 +85,7 @@ public class ArmamentOfNyx extends CardImpl {
condition, "Enchanted creature has double strike as long as it's an enchantment"));
ReplacementEffect effect = new PreventAllDamageByAttachedEffect(Duration.WhileOnBattlefield, "enchanted creature", false);
effect.setText("Otherwise, prevent all damage that would be dealt by enchanted creature");
ability.addEffect(new ConditionalReplacementEffect(effect, new InvertCondition(condition), false));
ability.addEffect(new ConditionalReplacementEffect(effect, new InvertCondition(condition)));
this.addAbility(ability);
}

View file

@ -40,6 +40,7 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterNonlandCard;
import mage.game.ExileZone;
import mage.game.Game;
@ -107,16 +108,18 @@ class BrainMaggotExileEffect extends OneShotEffect {
Player opponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && opponent != null && sourcePermanent != null) {
opponent.revealCards(sourcePermanent.getName(), opponent.getHand(), game);
opponent.revealCards(sourcePermanent.getLogName(), opponent.getHand(), game);
TargetCard target = new TargetCard(Zone.HAND, new FilterNonlandCard("nonland card to exile"));
if (controller.choose(Outcome.Exile, opponent.getHand(), target, game)) {
FilterCard filter = new FilterNonlandCard("nonland card to exile");
TargetCard target = new TargetCard(Zone.HAND, filter);
if (opponent.getHand().count(filter, game) > 0 && controller.choose(Outcome.Exile, opponent.getHand(), target, game)) {
Card card = opponent.getHand().get(target.getFirstTarget(), game);
// If source permanent leaves the battlefield before its triggered ability resolves, the target card won't be exiled.
if (card != null && game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) {
controller.moveCardToExileWithInfo(card, CardUtil.getCardExileZoneId(game, source), sourcePermanent.getName(), source.getSourceId(), game, Zone.HAND);
}
}
}
return true;
}
return false;

View file

@ -31,6 +31,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.condition.LockedInCondition;
import mage.abilities.condition.common.ControlsPermanentCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.effects.Effect;
@ -70,9 +71,8 @@ public class FesteringNewt extends CardImpl {
Effect effect = new ConditionalContinousEffect(
new BoostTargetEffect(-4,-4, Duration.EndOfTurn),
new BoostTargetEffect(-1,-1, Duration.EndOfTurn),
new ControlsPermanentCondition(filterBogbrewWitch),
"target creature an opponent controls gets -1/-1 until end of turn. That creature gets -4/-4 instead if you control a creature named Bogbrew Witch",
true);
new LockedInCondition(new ControlsPermanentCondition(filterBogbrewWitch)),
"target creature an opponent controls gets -1/-1 until end of turn. That creature gets -4/-4 instead if you control a creature named Bogbrew Witch");
Ability ability = new DiesTriggeredAbility(effect);
ability.addTarget(new TargetCreaturePermanent(filterCreature));
this.addAbility(ability);

View file

@ -28,6 +28,7 @@
package mage.sets.mirrodinbesieged;
import java.util.UUID;
import mage.abilities.condition.LockedInCondition;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
@ -53,7 +54,8 @@ public class MirranMettle extends CardImpl {
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new BoostTargetEffect(2, 2, Duration.EndOfTurn));
this.getSpellAbility().addEffect(new ConditionalContinousEffect(new BoostTargetEffect(2, 2, Duration.EndOfTurn), MetalcraftCondition.getInstance(), effectText, true));
this.getSpellAbility().addEffect(new ConditionalContinousEffect(new BoostTargetEffect(2, 2, Duration.EndOfTurn),
new LockedInCondition(MetalcraftCondition.getInstance()), effectText));
}
public MirranMettle(final MirranMettle card) {

View file

@ -65,7 +65,7 @@ public class SpireSerpent extends CardImpl {
ConditionalContinousEffect effect1 = new ConditionalContinousEffect(new BoostSourceEffect(2, 2, Duration.WhileOnBattlefield), MetalcraftCondition.getInstance(), abilityText1);
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect1);
Effect effect = new ConditionalAsThoughEffect(new CanAttackAsThoughtItDidntHaveDefenderEffect(Duration.WhileOnBattlefield),
MetalcraftCondition.getInstance(), false);
MetalcraftCondition.getInstance());
effect.setText("and can attack as though it didn't have defender");
ability.addEffect(effect);
this.addAbility(ability);

View file

@ -80,15 +80,13 @@ public class RepentantVampire extends CardImpl {
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(
new SetCardColorSourceEffect(ObjectColor.WHITE, Duration.WhileOnBattlefield),
new CardsInControllerGraveCondition(7),
"<i>Threshold</i> - As long as seven or more cards are in your graveyard, {this} is white",
false));
"<i>Threshold</i> - As long as seven or more cards are in your graveyard, {this} is white"));
Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new TapSourceCost());
gainedAbility.addTarget(new TargetCreaturePermanent(filter));
ability.addEffect(new ConditionalContinousEffect(
new GainAbilitySourceEffect(gainedAbility, Duration.WhileOnBattlefield),
new CardsInControllerGraveCondition(7),
"and has \"{t}: Destroy target black creature.\"",
false));
"and has \"{t}: Destroy target black creature.\""));
this.addAbility(ability);
}

View file

@ -74,26 +74,22 @@ public class WaywardAngel extends CardImpl {
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(
new BoostSourceEffect(3, 3, Duration.WhileOnBattlefield),
new CardsInControllerGraveCondition(7),
"<i>Threshold</i> - As long as seven or more cards are in your graveyard, {this} gets +3/+3,",
false));
"<i>Threshold</i> - As long as seven or more cards are in your graveyard, {this} gets +3/+3,"));
ability.addEffect(new ConditionalContinousEffect(
new SetCardColorSourceEffect(ObjectColor.BLACK, Duration.WhileOnBattlefield),
new CardsInControllerGraveCondition(7),
" is black,",
false));
" is black,"));
ability.addEffect(new ConditionalContinousEffect(
new GainAbilitySourceEffect(TrampleAbility.getInstance()),
new CardsInControllerGraveCondition(7),
" has trample,",
false));
" has trample,"));
Ability gainedAbility = new BeginningOfUpkeepTriggeredAbility(new SacrificeControllerEffect(new FilterControlledCreaturePermanent(), 1, ""), TargetController.YOU, false);
ability.addEffect(new ConditionalContinousEffect(
new GainAbilitySourceEffect(gainedAbility),
new CardsInControllerGraveCondition(7),
" and has \"At the beginning of your upkeep, sacrifice a creature.\" ",
false));
" and has \"At the beginning of your upkeep, sacrifice a creature.\" "));
this.addAbility(ability);
}

View file

@ -30,17 +30,17 @@ package mage.sets.planeshift;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.condition.LockedInCondition;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.combat.CantAttackAllAnyPlayerEffect;
import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
@ -65,7 +65,7 @@ public class OrimsChant extends CardImpl {
this.getSpellAbility().addEffect(new OrimsChantCantCastEffect());
// If Orim's Chant was kicked, creatures can't attack this turn.
this.getSpellAbility().addEffect(new OrimsChantCantAttackEffect());
this.getSpellAbility().addEffect(new OrimsChantEffect());
}
public OrimsChant(final OrimsChant card) {
@ -79,6 +79,32 @@ public class OrimsChant extends CardImpl {
}
class OrimsChantEffect extends OneShotEffect {
public OrimsChantEffect() {
super(Outcome.Benefit);
this.staticText = "If {this} was kicked, creatures can't attack this turn";
}
public OrimsChantEffect(final OrimsChantEffect effect) {
super(effect);
}
@Override
public OrimsChantEffect copy() {
return new OrimsChantEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && KickedCondition.getInstance().apply(game, source)) {
game.addEffect(new CantAttackAllAnyPlayerEffect(Duration.EndOfTurn, new FilterCreaturePermanent("creatures")), source);
}
return false;
}
}
class OrimsChantCantCastEffect extends ContinuousRuleModifiyingEffectImpl {
public OrimsChantCantCastEffect() {
@ -111,46 +137,3 @@ class OrimsChantCantCastEffect extends ContinuousRuleModifiyingEffectImpl {
return false;
}
}
class OrimsChantCantAttackEffect extends ReplacementEffectImpl {
private static final String effectText = "If {this} was kicked, creatures can't attack this turn";
private Condition condition = new LockedInCondition(KickedCondition.getInstance());
OrimsChantCantAttackEffect ( ) {
super(Duration.EndOfTurn, Outcome.Benefit);
staticText = effectText;
}
OrimsChantCantAttackEffect (final OrimsChantCantAttackEffect effect ) {
super(effect);
this.condition = effect.condition;
}
@Override
public boolean apply(Game game, Ability source) {
throw new UnsupportedOperationException("Not supported.");
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER) {
return true;
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER && condition.apply(game, source)) {
return true;
}
return false;
}
@Override
public OrimsChantCantAttackEffect copy() {
return new OrimsChantCantAttackEffect(this);
}
}

View file

@ -74,7 +74,7 @@ public class ColossusOfAkros extends CardImpl {
MonstrousCondition.getInstance(),
"As long as {this} is monstrous, it has trample"));
Effect effect = new ConditionalAsThoughEffect(new CanAttackAsThoughtItDidntHaveDefenderEffect(Duration.WhileOnBattlefield),
MonstrousCondition.getInstance(), false);
MonstrousCondition.getInstance());
effect.setText("and can attack as though it didn't have defender");
ability.addEffect(effect);
this.addAbility(ability);

View file

@ -28,6 +28,7 @@
package mage.sets.timespiral;
import java.util.UUID;
import mage.abilities.condition.LockedInCondition;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
@ -53,9 +54,8 @@ public class MightOfOldKrosa extends CardImpl {
this.getSpellAbility().addEffect(new ConditionalContinousEffect(
new BoostTargetEffect(4,4, Duration.EndOfTurn),
new BoostTargetEffect(2, 2, Duration.EndOfTurn),
MyMainPhaseCondition.getInstance(),
"Target creature gets +2/+2 until end of turn. If you cast this spell during your main phase, that creature gets +4/+4 until end of turn instead",
true));
new LockedInCondition(MyMainPhaseCondition.getInstance()),
"Target creature gets +2/+2 until end of turn. If you cast this spell during your main phase, that creature gets +4/+4 until end of turn instead"));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}

View file

@ -62,7 +62,7 @@ public class QuestForRenewal extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(
new UntapAllDuringEachOtherPlayersUntapStepEffect(filter),
new SourceHasCounterCondition(CounterType.QUEST, 4),
"As long as there are four or more quest counters on {this}, untap all creatures you control during each other player's untap step.", false)));
"As long as there are four or more quest counters on {this}, untap all creatures you control during each other player's untap step.")));
}
public QuestForRenewal(final QuestForRenewal card) {

View file

@ -28,6 +28,7 @@
package mage.sets.worldwake;
import java.util.UUID;
import mage.abilities.condition.LockedInCondition;
import mage.constants.CardType;
import mage.constants.Rarity;
@ -54,7 +55,9 @@ public class TombHex extends CardImpl {
// Target creature gets -2/-2 until end of turn.
// Landfall - If you had a land enter the battlefield under your control this turn, that creature gets -4/-4 until end of turn instead.
this.addWatcher(new LandfallWatcher());
this.getSpellAbility().addEffect(new ConditionalContinousEffect(new BoostTargetEffect(-4, -4, Duration.EndOfTurn), new BoostTargetEffect(-2, -2, Duration.EndOfTurn), LandfallCondition.getInstance(), "Target creature gets -2/-2 until end of turn. Landfall - If you had a land enter the battlefield under your control this turn, that creature gets -4/-4 until end of turn instead", true));
this.getSpellAbility().addEffect(new ConditionalContinousEffect(new BoostTargetEffect(-4, -4, Duration.EndOfTurn), new BoostTargetEffect(-2, -2, Duration.EndOfTurn),
new LockedInCondition(LandfallCondition.getInstance()),
"Target creature gets -2/-2 until end of turn. Landfall - If you had a land enter the battlefield under your control this turn, that creature gets -4/-4 until end of turn instead"));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}

View file

@ -27,14 +27,10 @@
*/
package mage.sets.zendikar;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.condition.LockedInCondition;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
import mage.abilities.keyword.FirstStrikeAbility;
@ -42,20 +38,17 @@ import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import java.util.UUID;
import mage.players.Player;
/**
* @author nantuko, Loki
*/
public class BoldDefense extends CardImpl {
private final String staticText = "If {this]} was kicked, instead creatures you control get +2/+2 and gain first strike until end of turn";
public BoldDefense(UUID ownerId) {
super(ownerId, 3, "Bold Defense", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{W}");
this.expansionSetCode = "ZEN";
@ -65,10 +58,7 @@ public class BoldDefense extends CardImpl {
this.addAbility(new KickerAbility("{3}{W}"));
// Creatures you control get +1/+1 until end of turn. If Bold Defense was kicked, instead creatures you control get +2/+2 and gain first strike until end of turn.
DynamicValue dn = new BoldDefensePTCount();
this.getSpellAbility().addEffect(new BoostControlledEffect(dn, dn, Duration.EndOfTurn));
ContinuousEffect effect = new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, new FilterCreaturePermanent(), false);
this.getSpellAbility().addEffect(new ConditionalContinousEffect(effect, KickedCondition.getInstance(), staticText, true));
this.getSpellAbility().addEffect(new BoldDefenseEffect());
}
public BoldDefense(final BoldDefense card) {
@ -81,39 +71,33 @@ public class BoldDefense extends CardImpl {
}
}
class BoldDefensePTCount implements DynamicValue {
class BoldDefenseEffect extends OneShotEffect {
private Condition condition = new LockedInCondition(KickedCondition.getInstance());
public BoldDefenseEffect() {
super(Outcome.BoostCreature);
this.staticText = "Creatures you control get +1/+1 until end of turn. If {this} was kicked, instead creatures you control get +2/+2 and gain first strike until end of turn";
}
public BoldDefensePTCount() {
public BoldDefenseEffect(final BoldDefenseEffect effect) {
super(effect);
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
if (condition.apply(game, sourceAbility)) {
return 2;
} else {
return 1;
public BoldDefenseEffect copy() {
return new BoldDefenseEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (KickedCondition.getInstance().apply(game, source)) {
game.addEffect(new BoostControlledEffect(2, 2, Duration.EndOfTurn), source);
game.addEffect(new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, new FilterCreaturePermanent(), false), source);
} else {
game.addEffect(new BoostControlledEffect(1, 1, Duration.EndOfTurn), source);
}
}
}
public BoldDefensePTCount(final BoldDefensePTCount dynamicValue) {
this.condition = dynamicValue.condition;
}
@Override
public DynamicValue copy() {
return new BoldDefensePTCount(this);
}
@Override
public String toString() {
return "1";
}
@Override
public String getMessage() {
return "1";
return false;
}
}

View file

@ -64,7 +64,7 @@ public class GoblinBushwhacker extends CardImpl {
// When Goblin Bushwhacker enters the battlefield, if it was kicked, creatures you control get +1/+0 and gain haste until end of turn.
EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new BoostControlledEffect(1, 0, Duration.EndOfTurn), false);
ability.addEffect(new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.EndOfTurn));
this.addAbility(new ConditionalTriggeredAbility(ability, new LockedInCondition(KickedCondition.getInstance()), "When {this} enters the battlefield, if it was kicked, creatures you control get +1/+0 and gain haste until end of turn."));
this.addAbility(new ConditionalTriggeredAbility(ability, KickedCondition.getInstance(), "When {this} enters the battlefield, if it was kicked, creatures you control get +1/+0 and gain haste until end of turn."));
}
public GoblinBushwhacker(final GoblinBushwhacker card) {

View file

@ -65,7 +65,7 @@ public class KorAeronaut extends CardImpl {
EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), false);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(new ConditionalTriggeredAbility(ability, new LockedInCondition(KickedCondition.getInstance()), "When {this} enters the battlefield, if it was kicked, target creature gains flying until end of turn."));
this.addAbility(new ConditionalTriggeredAbility(ability, KickedCondition.getInstance(), "When {this} enters the battlefield, if it was kicked, target creature gains flying until end of turn."));
}
public KorAeronaut(final KorAeronaut card) {

View file

@ -73,7 +73,7 @@ public class MoldShambler extends CardImpl {
EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), false);
Target target = new TargetPermanent(filter);
ability.addTarget(target);
this.addAbility(new ConditionalTriggeredAbility(ability, new LockedInCondition(KickedCondition.getInstance()), "When {this} enters the battlefield, if it was kicked, destroy target noncreature permanent."));
this.addAbility(new ConditionalTriggeredAbility(ability, KickedCondition.getInstance(), "When {this} enters the battlefield, if it was kicked, destroy target noncreature permanent."));
}
public MoldShambler(final MoldShambler card) {