mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
commit
4fd8cff41e
2 changed files with 22 additions and 21 deletions
|
@ -33,7 +33,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.abilities.effects.common.ReturnFromExileForSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
|
@ -48,8 +48,8 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
|
||||
import mage.util.CardUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -58,13 +58,13 @@ import mage.target.TargetPermanent;
|
|||
public class DetentionSphere extends CardImpl {
|
||||
|
||||
static final protected FilterPermanent filter = new FilterNonlandPermanent("nonland permanent not named Detention Sphere");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new NamePredicate("Detention Sphere")));
|
||||
}
|
||||
|
||||
public DetentionSphere(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}{U}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{U}");
|
||||
|
||||
// When Detention Sphere enters the battlefield, you may exile
|
||||
// target nonland permanent not named Detention Sphere and all
|
||||
|
@ -73,7 +73,6 @@ public class DetentionSphere extends CardImpl {
|
|||
ability.addTarget(new TargetPermanent(filter));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
||||
// When Detention Sphere leaves the battlefield, return the exiled
|
||||
// cards to the battlefield under their owner's control.
|
||||
this.addAbility(new LeavesBattlefieldTriggeredAbility(new DetentionSphereLeavesEffect(), false));
|
||||
|
@ -91,7 +90,6 @@ public class DetentionSphere extends CardImpl {
|
|||
|
||||
class DetentionSphereEntersEffect extends OneShotEffect {
|
||||
|
||||
|
||||
public DetentionSphereEntersEffect() {
|
||||
super(Outcome.Exile);
|
||||
staticText = "you may exile target nonland permanent not named Detention Sphere and all other permanents with the same name as that permanent";
|
||||
|
@ -103,7 +101,7 @@ class DetentionSphereEntersEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
UUID exileId = source.getSourceId();
|
||||
UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
|
||||
Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
|
@ -143,15 +141,18 @@ class DetentionSphereLeavesEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
UUID exileId = source.getSourceId();
|
||||
ExileZone exile = game.getExile().getExileZone(exileId);
|
||||
if (exile != null) {
|
||||
exile = exile.copy();
|
||||
for (UUID cardId : exile) {
|
||||
Card card = game.getCard(cardId);
|
||||
card.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), card.getOwnerId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (sourceObject != null && controller != null) {
|
||||
Permanent permanentLeftBattlefield = (Permanent) getValue("permanentLeftBattlefield");
|
||||
if (permanentLeftBattlefield == null) {
|
||||
Logger.getLogger(ReturnFromExileForSourceEffect.class).error("Permanent not found: " + sourceObject.getName());
|
||||
return false;
|
||||
}
|
||||
ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), permanentLeftBattlefield.getZoneChangeCounter(game)));
|
||||
if (exile != null) {
|
||||
controller.moveCards(exile.getCards(game), Zone.BATTLEFIELD, source, game, false, false, true, null);
|
||||
}
|
||||
game.getExile().getExileZone(exileId).clear();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -68,11 +68,11 @@ public class PortalMage extends CardImpl {
|
|||
// Flash
|
||||
this.addAbility(FlashAbility.getInstance());
|
||||
|
||||
// If Portal Mage enters the battlefield during the declare attackers step, you may reselect the player or planeswalker that the target attacking creature attacks.
|
||||
// When Portal Mage enters the battlefield during the declare attackers step, you may reselect which player or planeswalker target attacking creature is attacking.
|
||||
Ability ability = new ConditionalTriggeredAbility(
|
||||
new EntersBattlefieldTriggeredAbility(new PortalMageEffect(), true),
|
||||
new IsStepCondition(PhaseStep.DECLARE_ATTACKERS, false),
|
||||
"If {this} enters the battlefield during the declare attackers step, you may reselect the player or planeswalker that the target attacking creature attacks. "
|
||||
"When {this} enters the battlefield during the declare attackers step, you may reselect which player or planeswalker target attacking creature is attacking. "
|
||||
+ "<i>(It can't attack its controller or its controller's planeswalkers.)</i>");
|
||||
ability.addTarget(new TargetCreaturePermanent(new FilterAttackingCreature()));
|
||||
this.addAbility(ability);
|
||||
|
@ -92,7 +92,7 @@ class PortalMageEffect extends OneShotEffect {
|
|||
|
||||
public PortalMageEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "you may reselect the player or planeswalker that the target attacking creature attacks";
|
||||
this.staticText = "you may reselect which player or planeswalker target attacking creature is attacking";
|
||||
}
|
||||
|
||||
public PortalMageEffect(final PortalMageEffect effect) {
|
||||
|
@ -147,7 +147,7 @@ class PortalMageEffect extends OneShotEffect {
|
|||
attacked = permanent.getLogName();
|
||||
}
|
||||
}
|
||||
game.informPlayers(attackingCreature.getLogName() + " attacks now " + attacked);
|
||||
game.informPlayers(attackingCreature.getLogName() + " now attacks " + attacked);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue