mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
[CMR] Implemented Zara, Renegade Recruiter
This commit is contained in:
parent
c9170556c1
commit
9dba89f37d
3 changed files with 131 additions and 0 deletions
124
Mage.Sets/src/mage/cards/z/ZaraRenegadeRecruiter.java
Normal file
124
Mage.Sets/src/mage/cards/z/ZaraRenegadeRecruiter.java
Normal file
|
@ -0,0 +1,124 @@
|
|||
package mage.cards.z;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterPlayerOrPlaneswalker;
|
||||
import mage.filter.predicate.other.PlayerIdPredicate;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.common.TargetPlayerOrPlaneswalker;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class ZaraRenegadeRecruiter extends CardImpl {
|
||||
|
||||
public ZaraRenegadeRecruiter(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{R}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.PIRATE);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// Whenever Zara, Renegade Recruiter attacks, look at defending player's hand. You may put a creature card from it onto the battlefield under your control tapped and attacking that player or a planeswalker they control. Return that creature to its owner's hand at the beginning of the next end step.
|
||||
this.addAbility(new AttacksTriggeredAbility(
|
||||
new ZaraRenegadeRecruiterEffect(), false, null, SetTargetPointer.PLAYER
|
||||
));
|
||||
}
|
||||
|
||||
private ZaraRenegadeRecruiter(final ZaraRenegadeRecruiter card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZaraRenegadeRecruiter copy() {
|
||||
return new ZaraRenegadeRecruiter(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ZaraRenegadeRecruiterEffect extends OneShotEffect {
|
||||
|
||||
ZaraRenegadeRecruiterEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "look at defending player's hand. You may put a creature card from it onto the battlefield " +
|
||||
"under your control tapped and attacking that player or a planeswalker they control. " +
|
||||
"Return that creature to its owner's hand at the beginning of the next end step";
|
||||
}
|
||||
|
||||
private ZaraRenegadeRecruiterEffect(final ZaraRenegadeRecruiterEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZaraRenegadeRecruiterEffect copy() {
|
||||
return new ZaraRenegadeRecruiterEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (controller == null || player == null || player.getHand().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
TargetCardInHand targetCard = new TargetCardInHand(
|
||||
0, 1, StaticFilters.FILTER_CARD_CREATURE
|
||||
);
|
||||
controller.choose(outcome, player.getHand(), targetCard, game);
|
||||
Card card = game.getCard(targetCard.getFirstTarget());
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
controller.moveCards(
|
||||
card, Zone.BATTLEFIELD, source, game, true,
|
||||
false, false, null
|
||||
);
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
UUID defenderId;
|
||||
if (game.getBattlefield().count(
|
||||
StaticFilters.FILTER_CONTROLLED_PERMANENT_PLANESWALKER,
|
||||
source.getSourceId(), player.getId(), game
|
||||
) < 1) {
|
||||
defenderId = player.getId();
|
||||
} else {
|
||||
FilterPlayerOrPlaneswalker filter = new FilterPlayerOrPlaneswalker(
|
||||
player.getName() + " or a planeswalker controlled by " + player.getName()
|
||||
);
|
||||
filter.getPlayerFilter().add(new PlayerIdPredicate(player.getId()));
|
||||
filter.getPermanentFilter().add(new ControllerIdPredicate(player.getId()));
|
||||
TargetPlayerOrPlaneswalker target = new TargetPlayerOrPlaneswalker(filter);
|
||||
target.setNotTarget(true);
|
||||
controller.choose(outcome, target, source.getSourceId(), game);
|
||||
defenderId = target.getFirstTarget();
|
||||
}
|
||||
game.getCombat().addAttackerToCombat(permanent.getId(), defenderId, game);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
||||
new ReturnToHandTargetEffect().setTargetPointer(new FixedTarget(permanent, game))
|
||||
), source);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -235,6 +235,7 @@ public final class CommanderLegends extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Wildheart Invoker", 263, Rarity.COMMON, mage.cards.w.WildheartInvoker.class));
|
||||
cards.add(new SetCardInfo("Wrong Turn", 107, Rarity.RARE, mage.cards.w.WrongTurn.class));
|
||||
cards.add(new SetCardInfo("Xenagos, God of Revels", 541, Rarity.MYTHIC, mage.cards.x.XenagosGodOfRevels.class));
|
||||
cards.add(new SetCardInfo("Zara, Renegade Recruiter", 294, Rarity.RARE, mage.cards.z.ZaraRenegadeRecruiter.class));
|
||||
cards.add(new SetCardInfo("Zur the Enchanter", 544, Rarity.MYTHIC, mage.cards.z.ZurTheEnchanter.class));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -326,6 +326,12 @@ public final class StaticFilters {
|
|||
FILTER_CONTROLLED_PERMANENT_LANDS.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_PLANESWALKER = new FilterControlledPlaneswalkerPermanent("planeswalker you control");
|
||||
|
||||
static {
|
||||
FILTER_CONTROLLED_PERMANENT_PLANESWALKER.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterPermanent FILTER_OPPONENTS_PERMANENT = new FilterPermanent("permanent an opponent controls");
|
||||
|
||||
static {
|
||||
|
|
Loading…
Reference in a new issue