mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
* Displace - fixed that it return cards under your control instead owner;
This commit is contained in:
parent
748d14e55e
commit
3a681d565a
2 changed files with 30 additions and 14 deletions
|
@ -1,32 +1,30 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.ExileTargetForSourceEffect;
|
||||
import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect;
|
||||
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class Displace extends CardImpl {
|
||||
|
||||
public Displace(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}");
|
||||
|
||||
// Exile up to two target creatures you control, then return those cards to the battlefield under their owner's control.
|
||||
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, 2, new FilterControlledCreaturePermanent("creatures you control"), false));
|
||||
Effect effect = new ExileTargetForSourceEffect();
|
||||
effect.setText("Exile up to two target creatures you control");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
effect = new ReturnToBattlefieldUnderYourControlTargetEffect(true);
|
||||
effect.setText(", then return those cards to the battlefield under their owner's control");
|
||||
effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect()
|
||||
.withReturnNames("those cards", "their owner's").concatBy(", then");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
|
@ -15,14 +13,17 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ReturnToBattlefieldUnderOwnerControlTargetEffect extends OneShotEffect {
|
||||
|
||||
private boolean tapped;
|
||||
protected boolean fromExileZone;
|
||||
private String returnName = "that card";
|
||||
private String returnUnderControlName = "its owner's";
|
||||
|
||||
public ReturnToBattlefieldUnderOwnerControlTargetEffect() {
|
||||
this(false);
|
||||
|
@ -34,15 +35,26 @@ public class ReturnToBattlefieldUnderOwnerControlTargetEffect extends OneShotEff
|
|||
|
||||
public ReturnToBattlefieldUnderOwnerControlTargetEffect(boolean tapped, boolean fromExileZone) {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "return that card to the battlefield under its owner's control";
|
||||
this.tapped = tapped;
|
||||
this.fromExileZone = fromExileZone;
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
||||
public ReturnToBattlefieldUnderOwnerControlTargetEffect(final ReturnToBattlefieldUnderOwnerControlTargetEffect effect) {
|
||||
super(effect);
|
||||
this.tapped = effect.tapped;
|
||||
this.fromExileZone = effect.fromExileZone;
|
||||
this.returnName = effect.returnName;
|
||||
this.returnUnderControlName = effect.returnUnderControlName;
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
||||
private void updateText() {
|
||||
this.staticText = "return " + this.returnName
|
||||
+ " to the battlefield under " + this.returnUnderControlName + " control"
|
||||
+ (tapped ? " tapped" : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,8 +75,7 @@ public class ReturnToBattlefieldUnderOwnerControlTargetEffect extends OneShotEff
|
|||
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
|
||||
if (exileZone.contains(targetId)) {
|
||||
cardsToBattlefield.add(targetId);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Card card = game.getCard(targetId);
|
||||
if (card instanceof MeldCard) {
|
||||
MeldCard meldCard = (MeldCard) card;
|
||||
|
@ -91,4 +102,11 @@ public class ReturnToBattlefieldUnderOwnerControlTargetEffect extends OneShotEff
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ReturnToBattlefieldUnderOwnerControlTargetEffect withReturnNames(String returnName, String returnUnderControlName) {
|
||||
this.returnName = returnName;
|
||||
this.returnUnderControlName = returnUnderControlName;
|
||||
updateText();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue