forked from External/mage
* Fixed that effects with "as long as Intet remains on the battlefield" condition were reapplied as the card returned to battlefield.
Some other minor fixes.
This commit is contained in:
parent
044b254155
commit
3beaec4525
15 changed files with 102 additions and 26 deletions
|
|
@ -96,6 +96,7 @@ class AwakenerDruidToken extends TokenImpl {
|
|||
super(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AwakenerDruidToken copy() {
|
||||
return new AwakenerDruidToken(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.DealsDamageToACreatureAttachedTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.SourceOnBattlefieldCondition;
|
||||
import mage.abilities.condition.common.SourceRemainsInZoneCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
|
|
@ -16,6 +17,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
|
|
@ -40,8 +42,8 @@ public final class Charisma extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// Whenever enchanted creature deals damage to a creature, gain control of the other creature for as long as Charisma remains on the battlefield.
|
||||
Condition condition = SourceOnBattlefieldCondition.instance;
|
||||
ConditionalContinuousEffect conditionalEffect = new ConditionalContinuousEffect(new GainControlTargetEffect(Duration.Custom), condition, rule);
|
||||
ConditionalContinuousEffect conditionalEffect = new ConditionalContinuousEffect(new GainControlTargetEffect(Duration.Custom),
|
||||
new SourceRemainsInZoneCondition(Zone.BATTLEFIELD), rule);
|
||||
this.addAbility(new DealsDamageToACreatureAttachedTriggeredAbility(conditionalEffect, false, "enchanted creature", false, true));
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.condition.common.SourceOnBattlefieldCondition;
|
||||
import mage.abilities.condition.common.SourceRemainsInZoneCondition;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
|
|
@ -47,7 +48,7 @@ public final class CytoplastManipulator extends CardImpl {
|
|||
// {U}, {tap}: Gain control of target creature with a +1/+1 counter on it for as long as Cytoplast Manipulator remains on the battlefield.
|
||||
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(
|
||||
new GainControlTargetEffect(Duration.Custom, true),
|
||||
SourceOnBattlefieldCondition.instance,
|
||||
new SourceRemainsInZoneCondition(Zone.BATTLEFIELD),
|
||||
"gain control of target creature with a +1/+1 counter on it for as long as {this} remains on the battlefield");
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{U}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.condition.common.SourceOnBattlefieldCondition;
|
||||
import mage.abilities.condition.common.SourceRemainsInZoneCondition;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
|
|
@ -52,7 +53,7 @@ public final class InfernalDenizen extends CardImpl {
|
|||
// {tap}: Gain control of target creature for as long as Infernal Denizen remains on the battlefield.
|
||||
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(
|
||||
new GainControlTargetEffect(Duration.Custom, true),
|
||||
SourceOnBattlefieldCondition.instance,
|
||||
new SourceRemainsInZoneCondition(Zone.BATTLEFIELD),
|
||||
"gain control of target creature for as long as {this} remains on the battlefield");
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new TapSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import mage.players.Player;
|
|||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.condition.common.SourceOnBattlefieldCondition;
|
||||
import mage.abilities.condition.common.SourceRemainsInZoneCondition;
|
||||
import mage.abilities.decorator.ConditionalAsThoughEffect;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect;
|
||||
|
|
@ -83,11 +83,11 @@ class IntetTheDreamerExileEffect extends OneShotEffect {
|
|||
card.setFaceDown(true, game);
|
||||
controller.moveCardsToExile(card, source, game, false,
|
||||
CardUtil.getExileZoneId(game, source.getSourceId(), sourceObject.getZoneChangeCounter(game)), // sourceObject must be used due to source not working correctly
|
||||
sourceObject.getIdName());
|
||||
sourceObject.getIdName() + " (" + sourceObject.getZoneChangeCounter(game) + ")");
|
||||
card.setFaceDown(true, game);
|
||||
ContinuousEffect effect = new ConditionalAsThoughEffect(
|
||||
new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, TargetController.YOU, Duration.Custom, true),
|
||||
SourceOnBattlefieldCondition.instance);
|
||||
new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, TargetController.YOU, Duration.Custom, true),
|
||||
new SourceRemainsInZoneCondition(Zone.BATTLEFIELD));
|
||||
effect.setTargetPointer(new FixedTarget(card, game));
|
||||
game.getState().addEffect(effect, source);
|
||||
game.getState().setValue("Exiled_IntetTheDreamer" + card.getId(), Boolean.TRUE); // TODO This value will never be removed
|
||||
|
|
@ -130,10 +130,16 @@ class IntetTheDreamerLookEffect extends AsThoughEffectImpl {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Card card = game.getCard(objectId);
|
||||
return (card != null
|
||||
&& card.isFaceDown(game)
|
||||
&& game.getExile().containsId(card.getId(), game)
|
||||
&& Boolean.TRUE.equals(game.getState().getValue("Exiled_IntetTheDreamer" + card.getId())));
|
||||
if (card != null) {
|
||||
if (card.isFaceDown(game)
|
||||
&& game.getExile().containsId(card.getId(), game)
|
||||
&& Boolean.TRUE.equals(game.getState().getValue("Exiled_IntetTheDreamer" + card.getId()))) {
|
||||
return true;
|
||||
} else {
|
||||
this.discard();
|
||||
game.getState().setValue("Exiled_IntetTheDreamer" + card.getId(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.DealsDamageToACreatureAttachedTriggeredAbility;
|
||||
import mage.abilities.common.DealsDamageToAPlayerAttachedTriggeredAbility;
|
||||
import mage.abilities.condition.common.SourceOnBattlefieldCondition;
|
||||
import mage.abilities.condition.common.SourceRemainsInZoneCondition;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffect;
|
||||
|
|
@ -19,6 +20,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -33,7 +35,8 @@ public final 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.
|
||||
ContinuousRuleModifyingEffect skipUntapEffect = new DontUntapInControllersUntapStepTargetEffect(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, SourceOnBattlefieldCondition.instance);
|
||||
ConditionalContinuousRuleModifyingEffect effect = new ConditionalContinuousRuleModifyingEffect(skipUntapEffect,
|
||||
new SourceRemainsInZoneCondition(Zone.BATTLEFIELD));
|
||||
Ability ability = new DealsDamageToACreatureAttachedTriggeredAbility(new TapTargetEffect("that creature"), false, "equipped creature", false, true);
|
||||
ability.addEffect(effect);
|
||||
this.addAbility(ability);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import mage.target.common.TargetArtifactPermanent;
|
|||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.condition.common.SourceRemainsInZoneCondition;
|
||||
|
||||
/**
|
||||
* @author L_J
|
||||
|
|
@ -47,7 +48,7 @@ public final class ScarwoodBandits extends CardImpl {
|
|||
new DoUnlessAnyOpponentPaysEffect(
|
||||
new ConditionalContinuousEffect(
|
||||
new GainControlTargetEffect(Duration.Custom, true),
|
||||
SourceOnBattlefieldCondition.instance,
|
||||
new SourceRemainsInZoneCondition(Zone.BATTLEFIELD),
|
||||
"gain control of target artifact for as long as {this} remains on the battlefield"),
|
||||
new GenericManaCost(2)),
|
||||
new ManaCostsImpl("{2}{G}"));
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.condition.common.HateCondition;
|
||||
import mage.abilities.condition.common.SourceRemainsInZoneCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
@ -13,6 +15,7 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.watchers.common.LifeLossOtherFromCombatWatcher;
|
||||
|
||||
|
|
@ -29,11 +32,16 @@ public final class SithMindseer extends CardImpl {
|
|||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// <i>Hate</i> — When Sith Mindseer enters the battlefield, if an opponent loses life from a source other than combat damage, gain control of target creature for as long as Sith Mindseer remains on the battlefield.
|
||||
// <i>Hate</i> — When Sith Mindseer enters the battlefield, if an opponent loses life from a source other than combat damage,
|
||||
// gain control of target creature for as long as Sith Mindseer remains on the battlefield.
|
||||
Ability ability = new ConditionalInterveningIfTriggeredAbility(
|
||||
new EntersBattlefieldTriggeredAbility(new GainControlTargetEffect(Duration.WhileOnBattlefield)),
|
||||
new EntersBattlefieldTriggeredAbility(new ConditionalContinuousEffect(
|
||||
new GainControlTargetEffect(Duration.Custom, true),
|
||||
new SourceRemainsInZoneCondition(Zone.BATTLEFIELD),
|
||||
"gain control of target creature for as long as {this} remains on the battlefield")),
|
||||
HateCondition.instance,
|
||||
"<i>Hate</i> — When Sith Mindseer enters the battlefield, if an opponent loses life from a source other than combat damage, gain control of target creature for as long as Sith Mindseer remains on the battlefield.");
|
||||
"<i>Hate</i> — When {this} enters the battlefield, if an opponent loses life from a source other than combat damage,"
|
||||
+ " gain control of target creature for as long as {this} remains on the battlefield.");
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability, new LifeLossOtherFromCombatWatcher());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.condition.common.SourceOnBattlefieldCondition;
|
||||
import mage.abilities.condition.common.SourceRemainsInZoneCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
|
@ -44,7 +45,7 @@ public final class Somnophore extends CardImpl {
|
|||
// Whenever Somnophore deals damage to a player, tap target creature that player controls. That creature doesn't untap during its controller's untap step for as long as Somnophore remains on the battlefield.
|
||||
ContinuousRuleModifyingEffect skipUntapEffect = new DontUntapInControllersUntapStepTargetEffect(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, SourceOnBattlefieldCondition.instance);
|
||||
ConditionalContinuousRuleModifyingEffect effect = new ConditionalContinuousRuleModifyingEffect(skipUntapEffect, new SourceRemainsInZoneCondition(Zone.BATTLEFIELD));
|
||||
Ability ability = new SomnophoreTriggeredAbility(new TapTargetEffect());
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
ability.addEffect(effect);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.condition.common.SourceOnBattlefieldCondition;
|
||||
import mage.abilities.condition.common.SourceRemainsInZoneCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
|
|
@ -16,6 +17,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
|
|
@ -78,7 +80,7 @@ class SowerOfTemptationGainControlEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(
|
||||
new GainControlTargetEffect(Duration.Custom),
|
||||
SourceOnBattlefieldCondition.instance,
|
||||
new SourceRemainsInZoneCondition(Zone.BATTLEFIELD),
|
||||
"gain control of target creature for as long as {this} remains on the battlefield");
|
||||
game.addEffect(effect, source);
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksAndIsNotBlockedTriggeredAbility;
|
||||
import mage.abilities.condition.common.SourceRemainsInZoneCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.continuous.AssignNoCombatDamageSourceEffect;
|
||||
import mage.constants.SubType;
|
||||
|
|
@ -15,6 +17,7 @@ import mage.constants.Duration;
|
|||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
|
@ -32,8 +35,14 @@ public final class StromgaldSpy extends CardImpl {
|
|||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Whenever Stromgald Spy attacks and isn't blocked, you may have defending player play with their hand revealed for as long as Stromgald Spy remains on the battlefield. If you do, Stromgald Spy assigns no combat damage this turn.
|
||||
Ability ability = new AttacksAndIsNotBlockedTriggeredAbility(new StromgaldSpyEffect(), true, true);
|
||||
// Whenever Stromgald Spy attacks and isn't blocked, you may have defending player play with their hand revealed
|
||||
// for as long as Stromgald Spy remains on the battlefield. If you do, Stromgald Spy assigns no combat damage this turn.
|
||||
Ability ability = new AttacksAndIsNotBlockedTriggeredAbility(
|
||||
new ConditionalContinuousEffect(
|
||||
new StromgaldSpyEffect(),
|
||||
new SourceRemainsInZoneCondition(Zone.BATTLEFIELD),
|
||||
"you may have defending player play with their hand revealed for as long as {this} remains on the battlefield"),
|
||||
true, true);
|
||||
ability.addEffect(new AssignNoCombatDamageSourceEffect(Duration.EndOfTurn, true));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
@ -51,8 +60,7 @@ public final class StromgaldSpy extends CardImpl {
|
|||
class StromgaldSpyEffect extends ContinuousEffectImpl {
|
||||
|
||||
public StromgaldSpyEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.PlayerEffects, SubLayer.NA, Outcome.Detriment);
|
||||
this.staticText = "you may have defending player play with their hand revealed for as long as Stromgald Spy remains on the battlefield";
|
||||
super(Duration.Custom, Layer.PlayerEffects, SubLayer.NA, Outcome.Detriment);
|
||||
}
|
||||
|
||||
public StromgaldSpyEffect(final StromgaldSpyEffect effect) {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import mage.game.Game;
|
|||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.condition.common.SourceRemainsInZoneCondition;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
|
|
@ -42,8 +43,8 @@ public final class TheAkroanWar extends CardImpl {
|
|||
SagaChapter.CHAPTER_I,
|
||||
new ConditionalContinuousEffect(
|
||||
new GainControlTargetEffect(Duration.Custom, true),
|
||||
SourceOnBattlefieldCondition.instance, "gain control of target creature " +
|
||||
"for as long as {this} remains on the battlefield"
|
||||
new SourceRemainsInZoneCondition(Zone.BATTLEFIELD),
|
||||
"gain control of target creature for as long as {this} remains on the battlefield"
|
||||
), new TargetCreaturePermanent()
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class SourceRemainsInZoneCondition implements Condition {
|
||||
|
||||
private final Zone zone;
|
||||
private int timesChangedZones = -1;
|
||||
|
||||
public SourceRemainsInZoneCondition(Zone zone) {
|
||||
this.zone = zone;
|
||||
this.timesChangedZones = -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (timesChangedZones == -1) { // Only changed on first execution
|
||||
timesChangedZones = game.getState().getZoneChangeCounter(source.getSourceId());
|
||||
}
|
||||
return (timesChangedZones == game.getState().getZoneChangeCounter(source.getSourceId())
|
||||
&& zone.equals(game.getState().getZone(source.getSourceId())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "for as long as {this} remains on the " + zone.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -177,6 +177,7 @@ public class ConditionalContinuousEffect extends ContinuousEffectImpl {
|
|||
|
||||
/**
|
||||
* Return all effects list, for tests only
|
||||
* @return
|
||||
*/
|
||||
public List<ContinuousEffect> getAllEffects() {
|
||||
List<ContinuousEffect> res = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
private Map<UUID, Integer> zoneChangeCounter = new HashMap<>();
|
||||
private Map<UUID, Card> copiedCards = new HashMap<>();
|
||||
private int permanentOrderNumber;
|
||||
private Map<UUID, FilterCreaturePermanent> usePowerInsteadOfToughnessForDamageLethalityFilters = new HashMap<>();
|
||||
private final Map<UUID, FilterCreaturePermanent> usePowerInsteadOfToughnessForDamageLethalityFilters = new HashMap<>();
|
||||
private final Set<MageObjectReference> commandersToStay = new HashSet<>();
|
||||
|
||||
private int applyEffectsCounter; // Upcounting number of each applyEffects execution
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue