mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
* Ghostway - Fixed that the creatures returned wrongly tapped (fixes #753).
This commit is contained in:
parent
35f249cd44
commit
c681f1583c
1 changed files with 24 additions and 14 deletions
|
@ -28,18 +28,24 @@
|
||||||
package mage.sets.guildpact;
|
package mage.sets.guildpact;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.constants.*;
|
|
||||||
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.ReturnFromExileEffect;
|
import mage.abilities.effects.common.ReturnFromExileEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.TargetController;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -51,8 +57,6 @@ public class Ghostway extends CardImpl {
|
||||||
super(ownerId, 6, "Ghostway", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{2}{W}");
|
super(ownerId, 6, "Ghostway", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{2}{W}");
|
||||||
this.expansionSetCode = "GPT";
|
this.expansionSetCode = "GPT";
|
||||||
|
|
||||||
this.color.setWhite(true);
|
|
||||||
|
|
||||||
// Exile each creature you control. Return those cards to the battlefield under their owner's control at the beginning of the next end step.
|
// Exile each creature you control. Return those cards to the battlefield under their owner's control at the beginning of the next end step.
|
||||||
this.getSpellAbility().addEffect(new GhostwayEffect());
|
this.getSpellAbility().addEffect(new GhostwayEffect());
|
||||||
}
|
}
|
||||||
|
@ -87,19 +91,25 @@ class GhostwayEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
UUID exileId = source.getSourceId();
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (exileId != null) {
|
MageObject sourceObject = source.getSourceObject(game);
|
||||||
|
if (sourceObject != null && controller != null) {
|
||||||
|
int numberCreatures = 0;
|
||||||
|
UUID exileId = CardUtil.getObjectExileZoneId(game, sourceObject);
|
||||||
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
if (creature != null) {
|
if (creature != null) {
|
||||||
if (creature.moveToExile(source.getSourceId(), "Ghostway Exile", source.getSourceId(), game)) {
|
controller.moveCardToExileWithInfo(creature, exileId,sourceObject.getLogName(), source.getSourceId(), game, Zone.BATTLEFIELD);
|
||||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD, true));
|
numberCreatures++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (numberCreatures > 0) {
|
||||||
|
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
||||||
|
new ReturnFromExileEffect(exileId, Zone.BATTLEFIELD, false));
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
delayedAbility.setSourceId(source.getSourceId());
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
delayedAbility.setControllerId(source.getControllerId());
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game));
|
delayedAbility.setSourceObject(source.getSourceObject(game));
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
game.addDelayedTriggeredAbility(delayedAbility);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue