mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Merge pull request #5178 from magefree/yuriko
Implemented Yuriko, the Tiger's Shadow
This commit is contained in:
commit
6e242fb11f
3 changed files with 137 additions and 8 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue