mirror of
https://github.com/correl/mage.git
synced 2025-01-11 11:05:23 +00:00
* 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:
parent
c1fd249c97
commit
fbc2a7258f
36 changed files with 309 additions and 219 deletions
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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>");
|
||||
}
|
||||
|
|
|
@ -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}")
|
||||
));
|
||||
}
|
||||
|
|
|
@ -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>");
|
||||
}
|
||||
|
||||
|
|
|
@ -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>");
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -78,4 +78,51 @@ public class TragicSlipTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Silvercoat Lion", 0);
|
||||
assertPermanentCount(playerA, "Pillarfield Ox", 0);
|
||||
}
|
||||
|
||||
/*
|
||||
Killed an opponent's Young Pyromancer with Ulcerate then flashed back Tragic Slip with Snapcaster Mage targeting his Tarmogoyf.
|
||||
Morbid didn't seem to work and only applied -1/-1 to the Tarmogoyf.
|
||||
*/
|
||||
@Test
|
||||
public void testPlayedWithFlashbackAgain() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
|
||||
// Tragic Slip - Instant, B - 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.
|
||||
addCard(Zone.HAND, playerA, "Tragic Slip");
|
||||
|
||||
// Creature - Human Wizard
|
||||
// 2/1
|
||||
// Flash
|
||||
// When Snapcaster Mage enters the battlefield, target instant or sorcery card in your graveyard gains flashback until end of turn. The flashback cost is equal to its mana cost.
|
||||
addCard(Zone.HAND, playerA, "Snapcaster Mage");
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
|
||||
// Tarmogoyf's power is equal to the number of card types among cards in all graveyards and its toughness is equal to that number plus 1
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Tarmogoyf");
|
||||
addCard(Zone.GRAVEYARD, playerB, "Mountain");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Tragic Slip", "Silvercoat Lion");
|
||||
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Snapcaster Mage");
|
||||
setChoice(playerA, "Tragic Slip");
|
||||
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "Snapcaster Mage");
|
||||
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Flashback {B}"); // now snapcaster mage is died so -13/-13
|
||||
addTarget(playerA, "Tarmogoyf");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertHandCount(playerA, "Tragic Slip", 0);
|
||||
assertPermanentCount(playerA, "Snapcaster Mage", 0);
|
||||
assertExileCount("Tragic Slip", 1);
|
||||
assertPermanentCount(playerB, "Silvercoat Lion", 1);
|
||||
assertPowerToughness(playerB, "Silvercoat Lion", 1,1);
|
||||
assertGraveyardCount(playerB, "Tarmogoyf", 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,8 +31,14 @@ import mage.abilities.Ability;
|
|||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* A simple {@link Condition} to check the condition only one time at the start (result locked in).
|
||||
* All subsequent checks return the first result.
|
||||
* The use of this class must be handled carefully because conditions don't
|
||||
* have a copy method, the condition state is kept when the effect or ability
|
||||
* is copied that uses the condition.
|
||||
* So if you use this class, you have to do it like in ConditionalContinuousEffect,
|
||||
* where always a new FixedCondition(condition.apply(...)) is used if a
|
||||
* LockedInCondition is given.
|
||||
*
|
||||
* Needs probably some redesign, don't like it the way it's done now.
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
@ -40,7 +46,7 @@ public class LockedInCondition implements Condition {
|
|||
|
||||
private boolean conditionChecked = false;
|
||||
private boolean result;
|
||||
private Condition condition;
|
||||
private final Condition condition;
|
||||
|
||||
public LockedInCondition ( Condition condition ) {
|
||||
this.condition = condition;
|
||||
|
@ -58,4 +64,8 @@ public class LockedInCondition implements Condition {
|
|||
return result;
|
||||
}
|
||||
|
||||
public Condition getBaseCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import mage.watchers.Watcher;
|
|||
*/
|
||||
public class MorbidCondition implements Condition {
|
||||
|
||||
private static MorbidCondition fInstance = new MorbidCondition();
|
||||
private static final MorbidCondition fInstance = new MorbidCondition();
|
||||
|
||||
public static Condition getInstance() {
|
||||
return fInstance;
|
||||
|
@ -48,4 +48,5 @@ public class MorbidCondition implements Condition {
|
|||
Watcher watcher = game.getState().getWatchers().get("Morbid");
|
||||
return watcher.conditionMet();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,19 +45,17 @@ public class ConditionalAsThoughEffect extends AsThoughEffectImpl {
|
|||
protected AsThoughEffect effect;
|
||||
protected AsThoughEffect otherwiseEffect;
|
||||
protected Condition condition;
|
||||
protected boolean lockedInCondition;
|
||||
protected boolean conditionState;
|
||||
|
||||
public ConditionalAsThoughEffect(AsThoughEffect effect, Condition condition, boolean lockedInCondition) {
|
||||
this(effect, condition, null, lockedInCondition);
|
||||
public ConditionalAsThoughEffect(AsThoughEffect effect, Condition condition) {
|
||||
this(effect, condition, null);
|
||||
}
|
||||
|
||||
public ConditionalAsThoughEffect(AsThoughEffect effect, Condition condition, AsThoughEffect otherwiseEffect, boolean lockedInCondition) {
|
||||
public ConditionalAsThoughEffect(AsThoughEffect effect, Condition condition, AsThoughEffect otherwiseEffect) {
|
||||
super(effect.getAsThoughEffectType(), effect.getDuration(), effect.getOutcome());
|
||||
this.effect = effect;
|
||||
this.condition = condition;
|
||||
this.otherwiseEffect = otherwiseEffect;
|
||||
this.lockedInCondition = lockedInCondition;
|
||||
}
|
||||
|
||||
public ConditionalAsThoughEffect(final ConditionalAsThoughEffect effect) {
|
||||
|
@ -67,7 +65,6 @@ public class ConditionalAsThoughEffect extends AsThoughEffectImpl {
|
|||
this.otherwiseEffect = (AsThoughEffect) effect.otherwiseEffect.copy();
|
||||
}
|
||||
this.condition = effect.condition;
|
||||
this.lockedInCondition = effect.lockedInCondition;
|
||||
this.conditionState = effect.conditionState;
|
||||
}
|
||||
|
||||
|
@ -78,9 +75,6 @@ public class ConditionalAsThoughEffect extends AsThoughEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (lockedInCondition && !(condition instanceof FixedCondition)) {
|
||||
condition = new FixedCondition(condition.apply(game, source));
|
||||
}
|
||||
conditionState = condition.apply(game, source);
|
||||
if (conditionState) {
|
||||
effect.setTargetPointer(this.targetPointer);
|
||||
|
@ -100,9 +94,6 @@ public class ConditionalAsThoughEffect extends AsThoughEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
|
||||
if (lockedInCondition && !(condition instanceof FixedCondition)) {
|
||||
condition = new FixedCondition(condition.apply(game, source));
|
||||
}
|
||||
conditionState = condition.apply(game, source);
|
||||
if (conditionState) {
|
||||
effect.setTargetPointer(this.targetPointer);
|
||||
|
|
|
@ -4,6 +4,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.Mode;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.FixedCondition;
|
||||
import mage.abilities.condition.LockedInCondition;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
|
@ -20,18 +21,15 @@ public class ConditionalContinousEffect extends ContinuousEffectImpl {
|
|||
|
||||
protected ContinuousEffect effect;
|
||||
protected ContinuousEffect otherwiseEffect;
|
||||
protected Condition baseCondition;
|
||||
protected Condition condition;
|
||||
protected boolean lockedInCondition;
|
||||
protected boolean initDone = false;
|
||||
|
||||
|
||||
public ConditionalContinousEffect(ContinuousEffect effect, Condition condition, String text) {
|
||||
this(effect, null, condition, text);
|
||||
}
|
||||
|
||||
public ConditionalContinousEffect(ContinuousEffect effect, Condition condition, String text, boolean lockedInCondition) {
|
||||
this(effect, null, condition, text, lockedInCondition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Only use this if both effects have the same layers
|
||||
*
|
||||
|
@ -41,25 +39,11 @@ public class ConditionalContinousEffect extends ContinuousEffectImpl {
|
|||
* @param text
|
||||
*/
|
||||
public ConditionalContinousEffect(ContinuousEffect effect, ContinuousEffect otherwiseEffect, Condition condition, String text) {
|
||||
this(effect, otherwiseEffect, condition, text, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Only use this if both effects have the same layers
|
||||
*
|
||||
* @param effect
|
||||
* @param otherwiseEffect
|
||||
* @param condition
|
||||
* @param text
|
||||
* @param lockedInCondition
|
||||
*/
|
||||
public ConditionalContinousEffect(ContinuousEffect effect, ContinuousEffect otherwiseEffect, Condition condition, String text, boolean lockedInCondition) {
|
||||
super(effect.getDuration(), effect.getLayer(), effect.getSublayer(), effect.getOutcome());
|
||||
this.effect = effect;
|
||||
this.otherwiseEffect = otherwiseEffect;
|
||||
this.condition = condition;
|
||||
this.baseCondition = condition;
|
||||
this.staticText = text;
|
||||
this.lockedInCondition = lockedInCondition;
|
||||
}
|
||||
|
||||
public ConditionalContinousEffect(final ConditionalContinousEffect effect) {
|
||||
|
@ -69,7 +53,7 @@ public class ConditionalContinousEffect extends ContinuousEffectImpl {
|
|||
this.otherwiseEffect = (ContinuousEffect) effect.otherwiseEffect.copy();
|
||||
}
|
||||
this.condition = effect.condition;
|
||||
this.lockedInCondition = effect.lockedInCondition;
|
||||
this.baseCondition = effect.baseCondition;
|
||||
this.initDone = effect.initDone;
|
||||
}
|
||||
|
||||
|
@ -80,8 +64,10 @@ public class ConditionalContinousEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
if (lockedInCondition) {
|
||||
condition = new FixedCondition(condition.apply(game, source));
|
||||
if (baseCondition instanceof LockedInCondition) {
|
||||
condition = new FixedCondition(((LockedInCondition) baseCondition).getBaseCondition().apply(game, source));
|
||||
} else {
|
||||
condition = baseCondition;
|
||||
}
|
||||
effect.setTargetPointer(this.targetPointer);
|
||||
effect.init(source, game);
|
||||
|
|
|
@ -31,6 +31,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.Mode;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.FixedCondition;
|
||||
import mage.abilities.condition.LockedInCondition;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffect;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.game.Game;
|
||||
|
@ -45,19 +46,18 @@ public class ConditionalContinuousRuleModifyingEffect extends ContinuousRuleModi
|
|||
protected ContinuousRuleModifiyingEffect effect;
|
||||
protected ContinuousRuleModifiyingEffect otherwiseEffect;
|
||||
protected Condition condition;
|
||||
protected boolean lockedInCondition;
|
||||
protected boolean conditionState;
|
||||
protected Condition baseCondition;
|
||||
protected boolean initDone = false;
|
||||
|
||||
public ConditionalContinuousRuleModifyingEffect(ContinuousRuleModifiyingEffect effect, Condition condition, boolean lockedInCondition) {
|
||||
this(effect, condition, null, lockedInCondition);
|
||||
public ConditionalContinuousRuleModifyingEffect(ContinuousRuleModifiyingEffect effect, Condition condition) {
|
||||
this(effect, condition, null);
|
||||
}
|
||||
|
||||
public ConditionalContinuousRuleModifyingEffect(ContinuousRuleModifiyingEffect effect, Condition condition, ContinuousRuleModifiyingEffect otherwiseEffect, boolean lockedInCondition) {
|
||||
public ConditionalContinuousRuleModifyingEffect(ContinuousRuleModifiyingEffect effect, Condition condition, ContinuousRuleModifiyingEffect otherwiseEffect) {
|
||||
super(effect.getDuration(), effect.getOutcome());
|
||||
this.effect = effect;
|
||||
this.condition = condition;
|
||||
this.baseCondition = condition;
|
||||
this.otherwiseEffect = otherwiseEffect;
|
||||
this.lockedInCondition = lockedInCondition;
|
||||
}
|
||||
|
||||
public ConditionalContinuousRuleModifyingEffect(final ConditionalContinuousRuleModifyingEffect effect) {
|
||||
|
@ -67,10 +67,28 @@ public class ConditionalContinuousRuleModifyingEffect extends ContinuousRuleModi
|
|||
this.otherwiseEffect = (ContinuousRuleModifiyingEffect) effect.otherwiseEffect.copy();
|
||||
}
|
||||
this.condition = effect.condition;
|
||||
this.lockedInCondition = effect.lockedInCondition;
|
||||
this.conditionState = effect.conditionState;
|
||||
this.baseCondition = effect.baseCondition;
|
||||
this.initDone = effect.initDone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
if (baseCondition instanceof LockedInCondition) {
|
||||
condition = new FixedCondition(((LockedInCondition) baseCondition).getBaseCondition().apply(game, source));
|
||||
} else {
|
||||
condition = baseCondition;
|
||||
}
|
||||
effect.setTargetPointer(this.targetPointer);
|
||||
effect.init(source, game);
|
||||
if (otherwiseEffect != null) {
|
||||
otherwiseEffect.setTargetPointer(this.targetPointer);
|
||||
otherwiseEffect.init(source, game);
|
||||
}
|
||||
initDone = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isDiscarded() {
|
||||
return effect.isDiscarded() || (otherwiseEffect != null && otherwiseEffect.isDiscarded());
|
||||
|
@ -83,11 +101,10 @@ public class ConditionalContinuousRuleModifyingEffect extends ContinuousRuleModi
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (lockedInCondition && !(condition instanceof FixedCondition)) {
|
||||
condition = new FixedCondition(condition.apply(game, source));
|
||||
if (!initDone) { // if simpleStaticAbility, init won't be called
|
||||
init(source, game);
|
||||
}
|
||||
conditionState = condition.apply(game, source);
|
||||
if (conditionState) {
|
||||
if (condition.apply(game, source)) {
|
||||
effect.setTargetPointer(this.targetPointer);
|
||||
return effect.applies(event, source, game);
|
||||
} else if (otherwiseEffect != null) {
|
||||
|
|
|
@ -31,6 +31,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.Mode;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.FixedCondition;
|
||||
import mage.abilities.condition.LockedInCondition;
|
||||
import mage.abilities.effects.ReplacementEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
|
@ -45,20 +46,20 @@ public class ConditionalReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
protected ReplacementEffect effect;
|
||||
protected ReplacementEffect otherwiseEffect;
|
||||
protected Condition baseCondition;
|
||||
protected Condition condition;
|
||||
protected boolean lockedInCondition;
|
||||
protected boolean conditionState;
|
||||
protected boolean initDone = false;
|
||||
|
||||
public ConditionalReplacementEffect(ReplacementEffect effect, Condition condition, boolean lockedInCondition) {
|
||||
this(effect, condition, null, lockedInCondition);
|
||||
public ConditionalReplacementEffect(ReplacementEffect effect, Condition condition) {
|
||||
this(effect, condition, null);
|
||||
}
|
||||
|
||||
public ConditionalReplacementEffect(ReplacementEffect effect, Condition condition, ReplacementEffect otherwiseEffect, boolean lockedInCondition) {
|
||||
public ConditionalReplacementEffect(ReplacementEffect effect, Condition condition, ReplacementEffect otherwiseEffect) {
|
||||
super(effect.getDuration(), effect.getOutcome());
|
||||
this.effect = effect;
|
||||
this.condition = condition;
|
||||
this.baseCondition = condition;
|
||||
this.otherwiseEffect = otherwiseEffect;
|
||||
this.lockedInCondition = lockedInCondition;
|
||||
}
|
||||
|
||||
public ConditionalReplacementEffect(final ConditionalReplacementEffect effect) {
|
||||
|
@ -68,8 +69,9 @@ public class ConditionalReplacementEffect extends ReplacementEffectImpl {
|
|||
this.otherwiseEffect = (ReplacementEffect) effect.otherwiseEffect.copy();
|
||||
}
|
||||
this.condition = effect.condition;
|
||||
this.lockedInCondition = effect.lockedInCondition;
|
||||
this.conditionState = effect.conditionState;
|
||||
this.baseCondition = effect.baseCondition;
|
||||
this.initDone = effect.initDone;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,6 +79,23 @@ public class ConditionalReplacementEffect extends ReplacementEffectImpl {
|
|||
return effect.isDiscarded() || (otherwiseEffect != null && otherwiseEffect.isDiscarded());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
if (baseCondition instanceof LockedInCondition) {
|
||||
condition = new FixedCondition(((LockedInCondition) baseCondition).getBaseCondition().apply(game, source));
|
||||
} else {
|
||||
condition = baseCondition;
|
||||
}
|
||||
effect.setTargetPointer(this.targetPointer);
|
||||
effect.init(source, game);
|
||||
if (otherwiseEffect != null) {
|
||||
otherwiseEffect.setTargetPointer(this.targetPointer);
|
||||
otherwiseEffect.init(source, game);
|
||||
}
|
||||
initDone = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
if (conditionState) {
|
||||
|
@ -102,8 +121,8 @@ public class ConditionalReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (lockedInCondition && !(condition instanceof FixedCondition)) {
|
||||
condition = new FixedCondition(condition.apply(game, source));
|
||||
if (!initDone) { // if simpleStaticAbility, init won't be called
|
||||
init(source, game);
|
||||
}
|
||||
conditionState = condition.apply(game, source);
|
||||
if (conditionState) {
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.FixedCondition;
|
||||
import mage.abilities.condition.LockedInCondition;
|
||||
import mage.abilities.effects.RequirementEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.EffectType;
|
||||
|
@ -47,8 +48,9 @@ public class ConditionalRequirementEffect extends RequirementEffect {
|
|||
protected RequirementEffect effect;
|
||||
protected RequirementEffect otherwiseEffect;
|
||||
protected Condition condition;
|
||||
protected boolean lockedInCondition;
|
||||
protected boolean conditionState;
|
||||
protected Condition baseCondition;
|
||||
protected boolean initDone = false;
|
||||
|
||||
public ConditionalRequirementEffect(RequirementEffect effect, Condition condition) {
|
||||
this(Duration.WhileOnBattlefield, effect, condition, null, false);
|
||||
|
@ -58,9 +60,8 @@ public class ConditionalRequirementEffect extends RequirementEffect {
|
|||
super(duration);
|
||||
this.effectType = EffectType.REQUIREMENT;
|
||||
this.effect = effect;
|
||||
this.condition = condition;
|
||||
this.baseCondition = condition;
|
||||
this.otherwiseEffect = otherwiseEffect;
|
||||
this.lockedInCondition = lockedInCondition;
|
||||
}
|
||||
|
||||
public ConditionalRequirementEffect(final ConditionalRequirementEffect effect) {
|
||||
|
@ -70,14 +71,32 @@ public class ConditionalRequirementEffect extends RequirementEffect {
|
|||
this.otherwiseEffect = (RequirementEffect) effect.otherwiseEffect.copy();
|
||||
}
|
||||
this.condition = effect.condition;
|
||||
this.lockedInCondition = effect.lockedInCondition;
|
||||
this.conditionState = effect.conditionState;
|
||||
this.baseCondition = effect.baseCondition;
|
||||
this.initDone = effect.initDone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
if (baseCondition instanceof LockedInCondition) {
|
||||
condition = new FixedCondition(((LockedInCondition) baseCondition).getBaseCondition().apply(game, source));
|
||||
} else {
|
||||
condition = baseCondition;
|
||||
}
|
||||
effect.setTargetPointer(this.targetPointer);
|
||||
effect.init(source, game);
|
||||
if (otherwiseEffect != null) {
|
||||
otherwiseEffect.setTargetPointer(this.targetPointer);
|
||||
otherwiseEffect.init(source, game);
|
||||
}
|
||||
initDone = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
if (lockedInCondition && !(condition instanceof FixedCondition)) {
|
||||
condition = new FixedCondition(condition.apply(game, source));
|
||||
if (!initDone) { // if simpleStaticAbility, init won't be called
|
||||
init(source, game);
|
||||
}
|
||||
conditionState = condition.apply(game, source);
|
||||
if (conditionState) {
|
||||
|
|
|
@ -31,6 +31,7 @@ package mage.abilities.decorator;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.FixedCondition;
|
||||
import mage.abilities.condition.LockedInCondition;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.EffectType;
|
||||
|
@ -47,20 +48,20 @@ public class ConditionalRestrictionEffect extends RestrictionEffect {
|
|||
protected RestrictionEffect effect;
|
||||
protected RestrictionEffect otherwiseEffect;
|
||||
protected Condition condition;
|
||||
protected boolean lockedInCondition;
|
||||
protected boolean conditionState;
|
||||
protected Condition baseCondition;
|
||||
protected boolean initDone = false;
|
||||
|
||||
public ConditionalRestrictionEffect(RestrictionEffect effect, Condition condition) {
|
||||
this(Duration.WhileOnBattlefield, effect, condition, null, false);
|
||||
this(Duration.WhileOnBattlefield, effect, condition, null);
|
||||
}
|
||||
|
||||
public ConditionalRestrictionEffect(Duration duration, RestrictionEffect effect, Condition condition, RestrictionEffect otherwiseEffect, boolean lockedInCondition) {
|
||||
public ConditionalRestrictionEffect(Duration duration, RestrictionEffect effect, Condition condition, RestrictionEffect otherwiseEffect) {
|
||||
super(duration);
|
||||
this.effectType = EffectType.RESTRICTION;
|
||||
this.effect = effect;
|
||||
this.condition = condition;
|
||||
this.baseCondition = condition;
|
||||
this.otherwiseEffect = otherwiseEffect;
|
||||
this.lockedInCondition = lockedInCondition;
|
||||
}
|
||||
|
||||
public ConditionalRestrictionEffect(final ConditionalRestrictionEffect effect) {
|
||||
|
@ -70,14 +71,33 @@ public class ConditionalRestrictionEffect extends RestrictionEffect {
|
|||
this.otherwiseEffect = (RestrictionEffect) effect.otherwiseEffect.copy();
|
||||
}
|
||||
this.condition = effect.condition;
|
||||
this.lockedInCondition = effect.lockedInCondition;
|
||||
this.conditionState = effect.conditionState;
|
||||
this.baseCondition = effect.baseCondition;
|
||||
this.initDone = effect.initDone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
if (baseCondition instanceof LockedInCondition) {
|
||||
condition = new FixedCondition(((LockedInCondition) baseCondition).getBaseCondition().apply(game, source));
|
||||
} else {
|
||||
condition = baseCondition;
|
||||
}
|
||||
effect.setTargetPointer(this.targetPointer);
|
||||
effect.init(source, game);
|
||||
if (otherwiseEffect != null) {
|
||||
otherwiseEffect.setTargetPointer(this.targetPointer);
|
||||
otherwiseEffect.init(source, game);
|
||||
}
|
||||
initDone = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
if (lockedInCondition && !(condition instanceof FixedCondition)) {
|
||||
condition = new FixedCondition(condition.apply(game, source));
|
||||
if (!initDone) { // if simpleStaticAbility, init won't be called
|
||||
init(source, game);
|
||||
}
|
||||
conditionState = condition.apply(game, source);
|
||||
if (conditionState) {
|
||||
|
|
|
@ -31,13 +31,14 @@ public class ConditionalTriggeredAbility extends TriggeredAbilityImpl {
|
|||
this.text = text;
|
||||
}
|
||||
|
||||
public ConditionalTriggeredAbility(ConditionalTriggeredAbility triggered) {
|
||||
public ConditionalTriggeredAbility(final ConditionalTriggeredAbility triggered) {
|
||||
super(triggered);
|
||||
this.ability = triggered.ability;
|
||||
this.condition = triggered.condition;
|
||||
this.text = triggered.text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkInterveningIfClause(Game game) {
|
||||
return condition.apply(game, this);
|
||||
|
|
|
@ -1957,6 +1957,11 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
playable.add(ability);
|
||||
}
|
||||
}
|
||||
LinkedHashMap<UUID, ActivatedAbility> useable = new LinkedHashMap<>();
|
||||
getOtherUseableActivatedAbilities(card, Zone.GRAVEYARD, game, useable);
|
||||
for (Ability ability: useable.values()) {
|
||||
playable.add(ability);
|
||||
}
|
||||
}
|
||||
for (ExileZone exile : game.getExile().getExileZones()) {
|
||||
for (Card card : exile.getCards(game)) {
|
||||
|
|
Loading…
Reference in a new issue