mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
* Fixed exile and return back under owner control handling (e.g. Norin the Wary did not return from command zone when commander replacement effect was used).
This commit is contained in:
parent
cea7bb4e87
commit
8e0907c90c
8 changed files with 150 additions and 250 deletions
|
|
@ -25,26 +25,18 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.sets.championsofkamigawa;
|
package mage.sets.championsofkamigawa;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.common.ExileReturnToBattlefieldOwnerNextEndStepEffect;
|
||||||
import mage.abilities.effects.common.ReturnFromExileEffect;
|
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Rarity;
|
||||||
import mage.filter.common.FilterSpiritOrArcaneCard;
|
import mage.filter.common.FilterSpiritOrArcaneCard;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -66,7 +58,9 @@ public class HikariTwilightGuardian extends CardImpl {
|
||||||
this.addAbility(FlyingAbility.getInstance());
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
// Whenever you cast a Spirit or Arcane spell, you may exile Hikari, Twilight Guardian. If you do, return it to the battlefield under its owner's control at the beginning of the next end step.
|
// Whenever you cast a Spirit or Arcane spell, you may exile Hikari, Twilight Guardian. If you do, return it to the battlefield under its owner's control at the beginning of the next end step.
|
||||||
this.addAbility(new SpellCastControllerTriggeredAbility(new HikariTwilightGuardianEffect(), filter, true));
|
Effect effect = new ExileReturnToBattlefieldOwnerNextEndStepEffect();
|
||||||
|
effect.setText("you may exile {this}. If you do, return it to the battlefield under its owner's control at the beginning of the next end step");
|
||||||
|
this.addAbility(new SpellCastControllerTriggeredAbility(effect, filter, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
public HikariTwilightGuardian(final HikariTwilightGuardian card) {
|
public HikariTwilightGuardian(final HikariTwilightGuardian card) {
|
||||||
|
|
@ -79,41 +73,3 @@ public class HikariTwilightGuardian extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class HikariTwilightGuardianEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
private static final String effectText = "Exile {this}. Return it to the battlefield under your control at the beginning of the next end step";
|
|
||||||
|
|
||||||
HikariTwilightGuardianEffect ( ) {
|
|
||||||
super(Outcome.Benefit);
|
|
||||||
staticText = effectText;
|
|
||||||
}
|
|
||||||
|
|
||||||
HikariTwilightGuardianEffect(HikariTwilightGuardianEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (permanent != null) {
|
|
||||||
if (permanent.moveToExile(source.getSourceId(), "Hikari, Twilight Guardian", source.getSourceId(), game)) {
|
|
||||||
//create delayed triggered ability
|
|
||||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
|
||||||
new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
|
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HikariTwilightGuardianEffect copy() {
|
|
||||||
return new HikariTwilightGuardianEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -25,35 +25,25 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.sets.dragonsmaze;
|
package mage.sets.dragonsmaze;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.common.ExileReturnToBattlefieldOwnerNextEndStepEffect;
|
||||||
import mage.abilities.effects.common.ReturnFromExileEffect;
|
|
||||||
import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect;
|
import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect;
|
||||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.game.Game;
|
import mage.constants.CardType;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
public class AEtherling extends CardImpl {
|
public class AEtherling extends CardImpl {
|
||||||
|
|
||||||
public AEtherling(UUID ownerId) {
|
public AEtherling(UUID ownerId) {
|
||||||
|
|
@ -65,7 +55,7 @@ public class AEtherling extends CardImpl {
|
||||||
this.toughness = new MageInt(5);
|
this.toughness = new MageInt(5);
|
||||||
|
|
||||||
// {U}: Exile AEtherling. Return it to the battlefield under its owner's control at the beginning of the next end step.
|
// {U}: Exile AEtherling. Return it to the battlefield under its owner's control at the beginning of the next end step.
|
||||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AEherlingRemovingEffect(), new ManaCostsImpl("{U}")));
|
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileReturnToBattlefieldOwnerNextEndStepEffect(), new ManaCostsImpl("{U}")));
|
||||||
// {U}: AEtherling can't be blocked this turn
|
// {U}: AEtherling can't be blocked this turn
|
||||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBeBlockedSourceEffect(), new ManaCostsImpl("{U}")));
|
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBeBlockedSourceEffect(), new ManaCostsImpl("{U}")));
|
||||||
// {1}: AEtherling gets +1/-1 until end of turn.
|
// {1}: AEtherling gets +1/-1 until end of turn.
|
||||||
|
|
@ -84,40 +74,3 @@ public class AEtherling extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
class AEherlingRemovingEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
private static final String effectText = "Exile {this}. Return it to the battlefield under its owner's control at the beginning of the next end step";
|
|
||||||
|
|
||||||
AEherlingRemovingEffect () {
|
|
||||||
super(Outcome.Benefit);
|
|
||||||
staticText = effectText;
|
|
||||||
}
|
|
||||||
|
|
||||||
AEherlingRemovingEffect(AEherlingRemovingEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (permanent != null) {
|
|
||||||
if (permanent.moveToExile(source.getSourceId(), "AEherling Exile", source.getSourceId(), game)) {
|
|
||||||
//create delayed triggered ability
|
|
||||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
|
||||||
new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
|
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AEherlingRemovingEffect copy() {
|
|
||||||
return new AEherlingRemovingEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -28,20 +28,18 @@
|
||||||
package mage.sets.gatecrash;
|
package mage.sets.gatecrash;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.CipherEffect;
|
import mage.abilities.effects.common.CipherEffect;
|
||||||
import mage.abilities.effects.common.ReturnFromExileEffect;
|
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlSourceEffect;
|
||||||
import mage.cards.Card;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Rarity;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -54,7 +52,6 @@ public class Voidwalk extends CardImpl {
|
||||||
super(ownerId, 55, "Voidwalk", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{3}{U}");
|
super(ownerId, 55, "Voidwalk", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{3}{U}");
|
||||||
this.expansionSetCode = "GTC";
|
this.expansionSetCode = "GTC";
|
||||||
|
|
||||||
|
|
||||||
// Exile target creature. Return it to the battlefield under its owner's control at the beginning of the next end step.
|
// Exile target creature. Return it to the battlefield under its owner's control at the beginning of the next end step.
|
||||||
this.getSpellAbility().addEffect(new VoidwalkEffect());
|
this.getSpellAbility().addEffect(new VoidwalkEffect());
|
||||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||||
|
|
@ -88,22 +85,24 @@ class VoidwalkEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller != null) {
|
||||||
if (getTargetPointer().getFirst(game, source) != null) {
|
if (getTargetPointer().getFirst(game, source) != null) {
|
||||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
if (permanent.moveToExile(source.getSourceId(), "Voidwalk", source.getSourceId(), game)) {
|
int zcc = game.getState().getZoneChangeCounter(permanent.getId());
|
||||||
if (card != null) {
|
if (permanent.moveToExile(null, "", source.getSourceId(), game)) {
|
||||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
|
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
||||||
|
new ReturnToBattlefieldUnderOwnerControlSourceEffect(false, zcc + 1));
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
delayedAbility.setSourceId(source.getSourceId());
|
||||||
delayedAbility.setControllerId(card.getOwnerId());
|
delayedAbility.setControllerId(source.getControllerId());
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
game.addDelayedTriggeredAbility(delayedAbility);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,26 +25,23 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.sets.guildpact;
|
package mage.sets.guildpact;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
|
||||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.ReturnFromExileEffect;
|
import mage.abilities.effects.common.ExileReturnToBattlefieldOwnerNextEndStepEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetControlledCreaturePermanent;
|
import mage.target.common.TargetControlledCreaturePermanent;
|
||||||
import mage.target.common.TargetOpponent;
|
import mage.target.common.TargetOpponent;
|
||||||
|
|
@ -61,7 +58,6 @@ public class GhostCouncilOfOrzhova extends CardImpl {
|
||||||
this.supertype.add("Legendary");
|
this.supertype.add("Legendary");
|
||||||
this.subtype.add("Spirit");
|
this.subtype.add("Spirit");
|
||||||
|
|
||||||
|
|
||||||
this.power = new MageInt(4);
|
this.power = new MageInt(4);
|
||||||
this.toughness = new MageInt(4);
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
|
|
@ -71,7 +67,7 @@ public class GhostCouncilOfOrzhova extends CardImpl {
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
||||||
// {1}, Sacrifice a creature: Exile Ghost Council of Orzhova. Return it to the battlefield under its owner's control at the beginning of the next end step.
|
// {1}, Sacrifice a creature: Exile Ghost Council of Orzhova. Return it to the battlefield under its owner's control at the beginning of the next end step.
|
||||||
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GhostCouncilOfOrzhovaRemovingEffect(), new GenericManaCost(1));
|
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileReturnToBattlefieldOwnerNextEndStepEffect(), new GenericManaCost(1));
|
||||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
|
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
@ -88,6 +84,7 @@ public class GhostCouncilOfOrzhova extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
class GhostCouncilOfOrzhovaEffect extends OneShotEffect {
|
class GhostCouncilOfOrzhovaEffect extends OneShotEffect {
|
||||||
|
|
||||||
GhostCouncilOfOrzhovaEffect() {
|
GhostCouncilOfOrzhovaEffect() {
|
||||||
super(Outcome.Damage);
|
super(Outcome.Damage);
|
||||||
staticText = "target opponent loses 1 life and you gain 1 life";
|
staticText = "target opponent loses 1 life and you gain 1 life";
|
||||||
|
|
@ -114,44 +111,3 @@ class GhostCouncilOfOrzhovaEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class GhostCouncilOfOrzhovaRemovingEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
private static final String effectText = "Exile {this}. Return it to the battlefield under its owner's control at the beginning of the next end step";
|
|
||||||
|
|
||||||
GhostCouncilOfOrzhovaRemovingEffect () {
|
|
||||||
super(Outcome.Benefit);
|
|
||||||
staticText = effectText;
|
|
||||||
}
|
|
||||||
|
|
||||||
GhostCouncilOfOrzhovaRemovingEffect(GhostCouncilOfOrzhovaRemovingEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
|
||||||
if (controller != null) {
|
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (permanent != null) {
|
|
||||||
if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), permanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) {
|
|
||||||
//create delayed triggered ability
|
|
||||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
|
||||||
new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
|
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GhostCouncilOfOrzhovaRemovingEffect copy() {
|
|
||||||
return new GhostCouncilOfOrzhovaRemovingEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,11 @@ import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
|
||||||
import mage.abilities.condition.common.SourceOnBattlefieldCondition;
|
import mage.abilities.condition.common.SourceOnBattlefieldCondition;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.decorator.ConditionalActivatedAbility;
|
import mage.abilities.decorator.ConditionalActivatedAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.ReturnFromExileEffect;
|
import mage.abilities.effects.common.ExileReturnToBattlefieldOwnerNextEndStepEffect;
|
||||||
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
|
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
|
@ -98,19 +97,7 @@ class FreneticSliverEffect extends OneShotEffect {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (player.flipCoin(game)) {
|
if (player.flipCoin(game)) {
|
||||||
Permanent perm = game.getPermanent(source.getSourceId());
|
return new ExileReturnToBattlefieldOwnerNextEndStepEffect().apply(game, source);
|
||||||
if (perm != null) {
|
|
||||||
UUID exileZoneId = UUID.randomUUID();
|
|
||||||
perm.moveToExile(exileZoneId, perm.getName(), source.getSourceId(), game);
|
|
||||||
// and return it to the battlefield under its owner's control at the beginning of the next end step.
|
|
||||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
|
||||||
new ReturnFromExileEffect(exileZoneId, Zone.BATTLEFIELD));
|
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
Permanent perm = game.getPermanent(source.getSourceId());
|
Permanent perm = game.getPermanent(source.getSourceId());
|
||||||
if (perm != null) {
|
if (perm != null) {
|
||||||
|
|
|
||||||
|
|
@ -29,21 +29,15 @@ package mage.sets.timespiral;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
import mage.abilities.effects.common.ExileReturnToBattlefieldOwnerNextEndStepEffect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
|
||||||
import mage.abilities.effects.common.ReturnFromExileEffect;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.players.Player;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -79,7 +73,7 @@ public class NorinTheWary extends CardImpl {
|
||||||
class NorinTheWaryTriggeredAbility extends TriggeredAbilityImpl {
|
class NorinTheWaryTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
public NorinTheWaryTriggeredAbility() {
|
public NorinTheWaryTriggeredAbility() {
|
||||||
super(Zone.BATTLEFIELD, new NorinTheWaryRemovingEffect(), false);
|
super(Zone.BATTLEFIELD, new ExileReturnToBattlefieldOwnerNextEndStepEffect(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NorinTheWaryTriggeredAbility(final NorinTheWaryTriggeredAbility ability) {
|
public NorinTheWaryTriggeredAbility(final NorinTheWaryTriggeredAbility ability) {
|
||||||
|
|
@ -107,44 +101,3 @@ class NorinTheWaryTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
return new NorinTheWaryTriggeredAbility(this);
|
return new NorinTheWaryTriggeredAbility(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class NorinTheWaryRemovingEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
private static final String effectText = "exile {this}. Return it to the battlefield under its owner's control at the beginning of the next end step";
|
|
||||||
|
|
||||||
NorinTheWaryRemovingEffect () {
|
|
||||||
super(Outcome.Benefit);
|
|
||||||
staticText = effectText;
|
|
||||||
}
|
|
||||||
|
|
||||||
NorinTheWaryRemovingEffect(NorinTheWaryRemovingEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
|
||||||
if (controller != null) {
|
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (permanent != null) {
|
|
||||||
if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), permanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) {
|
|
||||||
//create delayed triggered ability
|
|
||||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
|
||||||
new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
|
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NorinTheWaryRemovingEffect copy() {
|
|
||||||
return new NorinTheWaryRemovingEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class ExileReturnToBattlefieldOwnerNextEndStepEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
private static final String effectText = "exile {this}. Return it to the battlefield under its owner's control at the beginning of the next end step";
|
||||||
|
|
||||||
|
public ExileReturnToBattlefieldOwnerNextEndStepEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = effectText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExileReturnToBattlefieldOwnerNextEndStepEffect(ExileReturnToBattlefieldOwnerNextEndStepEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller != null) {
|
||||||
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
if (permanent != null) {
|
||||||
|
int zcc = game.getState().getZoneChangeCounter(permanent.getId());
|
||||||
|
if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), permanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) {
|
||||||
|
//create delayed triggered ability and return it from every public zone he was next moved to
|
||||||
|
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
||||||
|
new ReturnToBattlefieldUnderOwnerControlSourceEffect(false, zcc + 1));
|
||||||
|
delayedAbility.setSourceId(source.getSourceId());
|
||||||
|
delayedAbility.setControllerId(source.getControllerId());
|
||||||
|
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||||
|
game.addDelayedTriggeredAbility(delayedAbility);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExileReturnToBattlefieldOwnerNextEndStepEffect copy() {
|
||||||
|
return new ExileReturnToBattlefieldOwnerNextEndStepEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
|
@ -42,20 +41,27 @@ import mage.game.Game;
|
||||||
public class ReturnToBattlefieldUnderOwnerControlSourceEffect extends OneShotEffect {
|
public class ReturnToBattlefieldUnderOwnerControlSourceEffect extends OneShotEffect {
|
||||||
|
|
||||||
private boolean tapped;
|
private boolean tapped;
|
||||||
|
private int zoneChangeCounter;
|
||||||
|
|
||||||
public ReturnToBattlefieldUnderOwnerControlSourceEffect() {
|
public ReturnToBattlefieldUnderOwnerControlSourceEffect() {
|
||||||
this(false);
|
this(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReturnToBattlefieldUnderOwnerControlSourceEffect(boolean tapped) {
|
public ReturnToBattlefieldUnderOwnerControlSourceEffect(boolean tapped) {
|
||||||
|
this(tapped, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReturnToBattlefieldUnderOwnerControlSourceEffect(boolean tapped, int zoneChangeCounter) {
|
||||||
super(Outcome.Benefit);
|
super(Outcome.Benefit);
|
||||||
this.tapped = tapped;
|
this.tapped = tapped;
|
||||||
|
this.zoneChangeCounter = zoneChangeCounter;
|
||||||
staticText = new StringBuilder("return that card to the battlefield").append(tapped ? " tapped" : "").append(" under its owner's control").toString();
|
staticText = new StringBuilder("return that card to the battlefield").append(tapped ? " tapped" : "").append(" under its owner's control").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReturnToBattlefieldUnderOwnerControlSourceEffect(final ReturnToBattlefieldUnderOwnerControlSourceEffect effect) {
|
public ReturnToBattlefieldUnderOwnerControlSourceEffect(final ReturnToBattlefieldUnderOwnerControlSourceEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.tapped = effect.tapped;
|
this.tapped = effect.tapped;
|
||||||
|
this.zoneChangeCounter = effect.zoneChangeCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -67,12 +73,19 @@ public class ReturnToBattlefieldUnderOwnerControlSourceEffect extends OneShotEff
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Card card = game.getCard(source.getSourceId());
|
Card card = game.getCard(source.getSourceId());
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
|
// return only from public zones
|
||||||
|
switch (game.getState().getZone(card.getId())) {
|
||||||
|
case EXILED:
|
||||||
|
case COMMAND:
|
||||||
|
case GRAVEYARD:
|
||||||
|
if (zoneChangeCounter < 0 || game.getState().getZoneChangeCounter(card.getId()) == zoneChangeCounter) {
|
||||||
Zone currentZone = game.getState().getZone(card.getId());
|
Zone currentZone = game.getState().getZone(card.getId());
|
||||||
if (card.putOntoBattlefield(game, currentZone, source.getSourceId(), card.getOwnerId(),tapped)) {
|
card.putOntoBattlefield(game, currentZone, source.getSourceId(), card.getOwnerId(), tapped);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue