mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
fixed Silent-Blade Oni's triggered ability not being optional (fixes #5949)
This commit is contained in:
parent
35b1233a2b
commit
9c7abca22d
1 changed files with 30 additions and 29 deletions
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -9,22 +7,19 @@ import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
|||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.NinjutsuAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterNonlandCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class SilentBladeOni extends CardImpl {
|
||||
|
@ -39,12 +34,14 @@ public final class SilentBladeOni extends CardImpl {
|
|||
|
||||
// Ninjutsu {4}{U}{B}
|
||||
this.addAbility(new NinjutsuAbility(new ManaCostsImpl("{4}{U}{B}")));
|
||||
// Whenever Silent-Blade Oni deals combat damage to a player, look at that player's hand. You may cast a nonland card in it without paying that card's mana cost.
|
||||
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new SilentBladeOniEffect(), false, true));
|
||||
|
||||
// Whenever Silent-Blade Oni deals combat damage to a player, look at that player's hand. You may cast a nonland card in it without paying that card's mana cost.
|
||||
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
|
||||
new SilentBladeOniEffect(), false, true
|
||||
));
|
||||
}
|
||||
|
||||
public SilentBladeOni(final SilentBladeOni card) {
|
||||
private SilentBladeOni(final SilentBladeOni card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -56,12 +53,13 @@ public final class SilentBladeOni extends CardImpl {
|
|||
|
||||
class SilentBladeOniEffect extends OneShotEffect {
|
||||
|
||||
public SilentBladeOniEffect() {
|
||||
SilentBladeOniEffect() {
|
||||
super(Outcome.PlayForFree);
|
||||
this.staticText = "look at that player's hand. You may cast a nonland card in it without paying that card's mana cost";
|
||||
this.staticText = "look at that player's hand. " +
|
||||
"You may cast a nonland card in it without paying that card's mana cost";
|
||||
}
|
||||
|
||||
public SilentBladeOniEffect(final SilentBladeOniEffect effect) {
|
||||
private SilentBladeOniEffect(final SilentBladeOniEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
@ -74,21 +72,24 @@ class SilentBladeOniEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (opponent != null && controller != null) {
|
||||
Cards cardsInHand = new CardsImpl();
|
||||
cardsInHand.addAll(opponent.getHand());
|
||||
if (!cardsInHand.isEmpty()) {
|
||||
TargetCard target = new TargetCard(1, Zone.HAND, new FilterNonlandCard());
|
||||
if (controller.chooseTarget(outcome, cardsInHand, target, source, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
controller.cast(card.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (opponent == null || controller == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cardsInHand = new CardsImpl();
|
||||
cardsInHand.addAll(opponent.getHand());
|
||||
if (cardsInHand.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
TargetCard target = new TargetCard(
|
||||
0, 1, Zone.HAND, StaticFilters.FILTER_CARD_A_NON_LAND
|
||||
);
|
||||
if (!controller.chooseUse(outcome, "Cast a card from " + opponent.getName() + "'s hand?", source, game)
|
||||
|| !controller.chooseTarget(outcome, cardsInHand, target, source, game)) {
|
||||
return true;
|
||||
}
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
return card != null && controller.cast(
|
||||
card.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue