Merge pull request #5178 from magefree/yuriko

Implemented Yuriko, the Tiger's Shadow
This commit is contained in:
LevelX2 2018-08-15 08:09:40 +02:00 committed by GitHub
commit 6e242fb11f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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

@ -322,6 +322,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 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("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));
}
}

View file

@ -1,4 +1,3 @@
package mage.abilities.keyword;
import java.util.UUID;
@ -16,6 +15,7 @@ import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.UnblockedPredicate;
import mage.game.Game;
import mage.game.command.CommandObject;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
@ -43,6 +43,7 @@ import mage.target.common.TargetControlledPermanent;
*/
public class NinjutsuAbility extends ActivatedAbilityImpl {
private final boolean commander;
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("unblocked attacker you control");
static {
@ -54,13 +55,19 @@ public class NinjutsuAbility extends ActivatedAbilityImpl {
* @param manaCost ninjutsu mana cost
*/
public NinjutsuAbility(ManaCost manaCost) {
super(Zone.HAND, new NinjutsuEffect(), manaCost);
this.addCost(new RevealNinjutsuCardCost());
this(manaCost, false);
}
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.commander = commander;
}
public NinjutsuAbility(NinjutsuAbility ability) {
super(ability);
this.commander = ability.commander;
}
@Override
@ -70,9 +77,13 @@ public class NinjutsuAbility extends ActivatedAbilityImpl {
@Override
public String getRule() {
return new StringBuilder("Ninjutsu ").append(getManaCostsToPay().getText()).append(" <i>(")
.append(getManaCostsToPay().getText())
.append(" Return an unblocked attacker you control to hand: Put this card onto the battlefield from your hand tapped and attacking.)</i>").toString();
return (commander ? "Commander n" : "N") + "injutsu "
+ getManaCostsToPay().getText() + " <i>("
+ 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() {
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) {
@ -165,12 +177,16 @@ class ReturnAttackerToHandTargetCost extends CostImpl {
class RevealNinjutsuCardCost extends CostImpl {
public RevealNinjutsuCardCost() {
private final boolean commander;
public RevealNinjutsuCardCost(boolean commander) {
this.text = "reveal ninjutsu card";
this.commander = commander;
}
public RevealNinjutsuCardCost(RevealNinjutsuCardCost cost) {
super(cost);
this.commander = cost.commander;
}
@Override
@ -178,6 +194,15 @@ class RevealNinjutsuCardCost extends CostImpl {
Player player = game.getPlayer(controllerId);
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) {
Cards cards = new CardsImpl(card);
player.revealCards("Ninjutsu", cards, game);