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
|
|
@ -8,8 +8,8 @@ import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.condition.InvertCondition;
|
import mage.abilities.condition.InvertCondition;
|
||||||
import mage.abilities.condition.common.HateCondition;
|
import mage.abilities.condition.common.HateCondition;
|
||||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||||
|
import mage.abilities.effects.common.ReturnTargetToOwnersLibraryPermanentEffect;
|
||||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||||
import mage.abilities.effects.common.ReturnToLibraryPermanentEffect;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
|
@ -40,7 +40,7 @@ public final class SithManipulator extends CardImpl {
|
||||||
|
|
||||||
// <i>Hate</i> — If opponent lost life from source other than combat damage this turn, put that card on top of its owner's library instead.
|
// <i>Hate</i> — If opponent lost life from source other than combat damage this turn, put that card on top of its owner's library instead.
|
||||||
ability = new ConditionalInterveningIfTriggeredAbility(
|
ability = new ConditionalInterveningIfTriggeredAbility(
|
||||||
new EntersBattlefieldTriggeredAbility(new ReturnToLibraryPermanentEffect(true)),
|
new EntersBattlefieldTriggeredAbility(new ReturnTargetToOwnersLibraryPermanentEffect(true)),
|
||||||
HateCondition.instance,
|
HateCondition.instance,
|
||||||
"<i>Hate</i> — If opponent lost life from source other than combat damage this turn, put that card on top of its owner's library instead");
|
"<i>Hate</i> — If opponent lost life from source other than combat damage this turn, put that card on top of its owner's library instead");
|
||||||
ability.addTarget(new TargetCreaturePermanent());
|
ability.addTarget(new TargetCreaturePermanent());
|
||||||
|
|
|
||||||
|
|
@ -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