Implemented Yurikp, the Tiger's Shadow

This commit is contained in:
Evan Kranzler 2018-07-28 21:48:29 -04:00
parent 3407a3e742
commit 95f375316b
3 changed files with 137 additions and 8 deletions

View file

@ -0,0 +1,103 @@
package mage.cards.y;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsDamageToAPlayerAllTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
import mage.abilities.keyword.NinjutsuAbility;
import mage.cards.Card;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author TheElk801
*/
public final class YurikoTheTigersShadow extends CardImpl {
private static final FilterCreaturePermanent filter
= new FilterCreaturePermanent(SubType.NINJA, "a Ninja you control");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
}
public YurikoTheTigersShadow(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.NINJA);
this.power = new MageInt(1);
this.toughness = new MageInt(3);
// Commander ninjutsu {U}{B}
this.addAbility(new NinjutsuAbility(new ManaCostsImpl("{U}{B}")));
// Whenever a Ninja you control deals combat damage to a player, reveal the top card of your library and put that card into your hand. Each opponent loses life equal to that card's converted mana cost.
this.addAbility(new DealsDamageToAPlayerAllTriggeredAbility(
new YurikoTheTigersShadowEffect(), filter,
false, SetTargetPointer.NONE, true
));
}
public YurikoTheTigersShadow(final YurikoTheTigersShadow card) {
super(card);
}
@Override
public YurikoTheTigersShadow copy() {
return new YurikoTheTigersShadow(this);
}
}
class YurikoTheTigersShadowEffect extends OneShotEffect {
public YurikoTheTigersShadowEffect() {
super(Outcome.Benefit);
this.staticText = "reveal the top card of your library "
+ "and put that card into your hand. Each opponent loses life "
+ "equal to that card's converted mana cost";
}
public YurikoTheTigersShadowEffect(final YurikoTheTigersShadowEffect effect) {
super(effect);
}
@Override
public YurikoTheTigersShadowEffect copy() {
return new YurikoTheTigersShadowEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Card card = player.getLibrary().getFromTop(game);
if (card == null) {
return false;
}
player.revealCards(source, new CardsImpl(card), game);
player.moveCards(card, Zone.HAND, source, game);
return new LoseLifeOpponentsEffect(
card.getConvertedManaCost()
).apply(game, source);
}
}

View file

@ -316,6 +316,7 @@ public final class Commander2018 extends ExpansionSet {
cards.add(new SetCardInfo("Yavimaya Elder", 166, Rarity.COMMON, mage.cards.y.YavimayaElder.class)); cards.add(new SetCardInfo("Yavimaya Elder", 166, Rarity.COMMON, mage.cards.y.YavimayaElder.class));
cards.add(new SetCardInfo("Yavimaya Enchantress", 167, Rarity.COMMON, mage.cards.y.YavimayaEnchantress.class)); cards.add(new SetCardInfo("Yavimaya Enchantress", 167, Rarity.COMMON, mage.cards.y.YavimayaEnchantress.class));
cards.add(new SetCardInfo("Yennet, Crypt Sovereign", 51, Rarity.MYTHIC, mage.cards.y.YennetCryptSovereign.class)); cards.add(new SetCardInfo("Yennet, Crypt Sovereign", 51, Rarity.MYTHIC, mage.cards.y.YennetCryptSovereign.class));
cards.add(new SetCardInfo("Yuriko, the Tiger's Shadow", 52, Rarity.RARE, mage.cards.y.YurikoTheTigersShadow.class));
cards.add(new SetCardInfo("Zendikar Incarnate", 195, Rarity.UNCOMMON, mage.cards.z.ZendikarIncarnate.class)); cards.add(new SetCardInfo("Zendikar Incarnate", 195, Rarity.UNCOMMON, mage.cards.z.ZendikarIncarnate.class));
} }
} }

View file

@ -1,4 +1,3 @@
package mage.abilities.keyword; package mage.abilities.keyword;
import java.util.UUID; import java.util.UUID;
@ -16,6 +15,7 @@ import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.UnblockedPredicate; import mage.filter.predicate.permanent.UnblockedPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.command.CommandObject;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
@ -43,6 +43,7 @@ import mage.target.common.TargetControlledPermanent;
*/ */
public class NinjutsuAbility extends ActivatedAbilityImpl { public class NinjutsuAbility extends ActivatedAbilityImpl {
private final boolean commander;
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("unblocked attacker you control"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("unblocked attacker you control");
static { static {
@ -54,13 +55,19 @@ public class NinjutsuAbility extends ActivatedAbilityImpl {
* @param manaCost ninjutsu mana cost * @param manaCost ninjutsu mana cost
*/ */
public NinjutsuAbility(ManaCost manaCost) { public NinjutsuAbility(ManaCost manaCost) {
super(Zone.HAND, new NinjutsuEffect(), manaCost); this(manaCost, false);
this.addCost(new RevealNinjutsuCardCost()); }
public NinjutsuAbility(ManaCost manaCost, boolean commander) {
super(commander ? Zone.ALL : Zone.HAND, new NinjutsuEffect(), manaCost);
this.addCost(new RevealNinjutsuCardCost(commander));
this.addCost(new ReturnAttackerToHandTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, true))); this.addCost(new ReturnAttackerToHandTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, true)));
this.commander = commander;
} }
public NinjutsuAbility(NinjutsuAbility ability) { public NinjutsuAbility(NinjutsuAbility ability) {
super(ability); super(ability);
this.commander = ability.commander;
} }
@Override @Override
@ -70,9 +77,13 @@ public class NinjutsuAbility extends ActivatedAbilityImpl {
@Override @Override
public String getRule() { public String getRule() {
return new StringBuilder("Ninjutsu ").append(getManaCostsToPay().getText()).append(" <i>(") return (commander ? "Commander n" : "N") + "injutsu "
.append(getManaCostsToPay().getText()) + getManaCostsToPay().getText() + " <i>("
.append(" Return an unblocked attacker you control to hand: Put this card onto the battlefield from your hand tapped and attacking.)</i>").toString(); + getManaCostsToPay().getText()
+ " Return an unblocked attacker you control to hand: "
+ "Put this card onto the battlefield from your hand"
+ (commander ? " or the command zone " : " ")
+ "tapped and attacking.)</i>";
} }
} }
@ -80,7 +91,8 @@ class NinjutsuEffect extends OneShotEffect {
public NinjutsuEffect() { public NinjutsuEffect() {
super(Outcome.PutCreatureInPlay); super(Outcome.PutCreatureInPlay);
this.staticText = "Put this card onto the battlefield from your hand tapped and attacking"; this.staticText = "Put this card onto the battlefield "
+ "from your hand tapped and attacking";
} }
public NinjutsuEffect(final NinjutsuEffect effect) { public NinjutsuEffect(final NinjutsuEffect effect) {
@ -165,12 +177,16 @@ class ReturnAttackerToHandTargetCost extends CostImpl {
class RevealNinjutsuCardCost extends CostImpl { class RevealNinjutsuCardCost extends CostImpl {
public RevealNinjutsuCardCost() { private final boolean commander;
public RevealNinjutsuCardCost(boolean commander) {
this.text = "reveal ninjutsu card"; this.text = "reveal ninjutsu card";
this.commander = commander;
} }
public RevealNinjutsuCardCost(RevealNinjutsuCardCost cost) { public RevealNinjutsuCardCost(RevealNinjutsuCardCost cost) {
super(cost); super(cost);
this.commander = cost.commander;
} }
@Override @Override
@ -178,6 +194,15 @@ class RevealNinjutsuCardCost extends CostImpl {
Player player = game.getPlayer(controllerId); Player player = game.getPlayer(controllerId);
Card card = player.getHand().get(ability.getSourceId(), game); Card card = player.getHand().get(ability.getSourceId(), game);
if (card == null && commander
&& player.getCommandersIds().contains(ability.getSourceId())) {
for (CommandObject coj : game.getState().getCommand()) {
if (coj != null && coj.getId().equals(ability.getSourceId())) {
card = game.getCard(ability.getSourceId());
}
break;
}
}
if (card != null) { if (card != null) {
Cards cards = new CardsImpl(card); Cards cards = new CardsImpl(card);
player.revealCards("Ninjutsu", cards, game); player.revealCards("Ninjutsu", cards, game);