mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08:00
Fixed Sith Manipulator: added new effect to send target permanent to owners library (#9800)
Co-authored-by: Daniel Eberhard <daniel.h.e@gmx.de>
This commit is contained in:
parent
409f4eb36c
commit
716e7dc18d
2 changed files with 50 additions and 2 deletions
|
|
@ -0,0 +1,48 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Merlingilb
|
||||
*/
|
||||
public class ReturnTargetToOwnersLibraryPermanentEffect extends OneShotEffect {
|
||||
|
||||
private final boolean toTop;
|
||||
|
||||
public ReturnTargetToOwnersLibraryPermanentEffect(boolean top) {
|
||||
super(Outcome.Neutral);
|
||||
staticText = "Put target card on "+ (top ? "top":"the bottom") + " of its owner's library";
|
||||
this.toTop = top;
|
||||
}
|
||||
|
||||
public ReturnTargetToOwnersLibraryPermanentEffect(final ReturnTargetToOwnersLibraryPermanentEffect effect) {
|
||||
super(effect);
|
||||
this.toTop = effect.toTop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getPermanent(source.getFirstTarget());
|
||||
if (card != null) {
|
||||
Player owner = game.getPlayer(card.getOwnerId());
|
||||
if (owner != null) {
|
||||
owner.moveCardToLibraryWithInfo(card, source, game, Zone.STACK, toTop, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReturnTargetToOwnersLibraryPermanentEffect copy() {
|
||||
return new ReturnTargetToOwnersLibraryPermanentEffect(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue