[MID] Implemented Secrets of the Key

This commit is contained in:
Evan Kranzler 2021-09-03 11:13:15 -04:00
parent 053bda0dce
commit be4715918c
5 changed files with 98 additions and 24 deletions

View file

@ -1,8 +1,5 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.effects.keyword.InvestigateEffect;
import mage.cards.CardImpl;
@ -10,27 +7,22 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.target.TargetSpell;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class ConfirmSuspicions extends CardImpl {
public ConfirmSuspicions(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{U}{U}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}{U}");
// Counter target spell.
getSpellAbility().addEffect(new CounterTargetEffect());
getSpellAbility().addTarget(new TargetSpell());
// Investigate three times.
Effect effect = new InvestigateEffect();
effect.setText("<BR><BR>Investigate three times.");
getSpellAbility().addEffect(effect);
effect = new InvestigateEffect();
effect.setText(null);
getSpellAbility().addEffect(effect);
getSpellAbility().addEffect(effect);
getSpellAbility().addEffect(new InvestigateEffect(3).concatBy("<br>"));
}
private ConfirmSuspicions(final ConfirmSuspicions card) {

View file

@ -0,0 +1,55 @@
package mage.cards.s;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.keyword.InvestigateEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TimingRule;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.stack.Spell;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SecretsOfTheKey extends CardImpl {
public SecretsOfTheKey(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}");
// Investigate. If this spell was cast from a graveyard, investigate twice instead.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new InvestigateEffect(2), new InvestigateEffect(), SecretsOfTheKeyCondition.instance,
"Investigate. If this spell was cast from a graveyard, investigate twice instead."
));
// Flashback {3}{U}
this.addAbility(new FlashbackAbility(new ManaCostsImpl<>("{3}{U}"), TimingRule.INSTANT));
}
private SecretsOfTheKey(final SecretsOfTheKey card) {
super(card);
}
@Override
public SecretsOfTheKey copy() {
return new SecretsOfTheKey(this);
}
}
enum SecretsOfTheKeyCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getSpell(source.getSourceId());
return spell != null && spell.getFromZone() == Zone.GRAVEYARD;
}
}

View file

@ -1,7 +1,6 @@
package mage.cards.w;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.keyword.InvestigateEffect;
import mage.abilities.keyword.EvokeAbility;
@ -29,9 +28,7 @@ public final class Wavesifter extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// When Wavesifter enters the battlefield, investigate twice.
Ability ability = new EntersBattlefieldTriggeredAbility(new InvestigateEffect().setText("investigate"));
ability.addEffect(new InvestigateEffect().setText("twice"));
this.addAbility(ability);
this.addAbility(new EntersBattlefieldTriggeredAbility(new InvestigateEffect(2)));
// Evoke {G}{U}
this.addAbility(new EvokeAbility("{G}{U}"));

View file

@ -54,6 +54,7 @@ public final class InnistradMidnightHunt extends ExpansionSet {
cards.add(new SetCardInfo("Plains", 268, Rarity.LAND, mage.cards.basiclands.Plains.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Play with Fire", 154, Rarity.UNCOMMON, mage.cards.p.PlayWithFire.class));
cards.add(new SetCardInfo("Rockfall Vale", 266, Rarity.RARE, mage.cards.r.RockfallVale.class));
cards.add(new SetCardInfo("Secrets of the Key", 73, Rarity.COMMON, mage.cards.s.SecretsOfTheKey.class));
cards.add(new SetCardInfo("Shipwreck Marsh", 267, Rarity.RARE, mage.cards.s.ShipwreckMarsh.class));
cards.add(new SetCardInfo("Sigarda, Champion of Light", 240, Rarity.MYTHIC, mage.cards.s.SigardaChampionOfLight.class));
cards.add(new SetCardInfo("Snarling Wolf", 199, Rarity.COMMON, mage.cards.s.SnarlingWolf.class));

View file

@ -1,37 +1,66 @@
package mage.abilities.effects.keyword;
import mage.abilities.Ability;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.ClueArtifactToken;
import mage.util.CardUtil;
/**
*
* @author LevelX2
*/
public class InvestigateEffect extends CreateTokenEffect {
public class InvestigateEffect extends OneShotEffect {
private final int amount;
public InvestigateEffect() {
super(new ClueArtifactToken());
this.staticText = "investigate. <i>(Create a colorless Clue artifact token with \"{2}, Sacrifice this artifact: Draw a card.\")</i>";
this(1);
}
public InvestigateEffect(int amount) {
super(Outcome.Benefit);
this.amount = amount;
}
public InvestigateEffect(final InvestigateEffect effect) {
super(effect);
this.amount = effect.amount;
}
@Override
public boolean apply(Game game, Ability source) {
if (super.apply(game, source)) {
new ClueArtifactToken().putOntoBattlefield(amount, game, source, source.getControllerId());
for (int i = 0; i < amount; i++) {
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.INVESTIGATED, source.getSourceId(), source, source.getControllerId()));
return true;
}
return false;
return true;
}
@Override
public InvestigateEffect copy() {
return new InvestigateEffect(this);
}
@Override
public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
String message;
switch (amount) {
case 1:
message = ". <i>(C";
break;
case 2:
message = "twice. <i>(To investigate, c";
break;
default:
message = CardUtil.numberToText(amount) + " times. <i>(To investigate, c";
}
return "investigate " + message + "reate a colorless Clue artifact token " +
"with \"{2}, Sacrifice this artifact: Draw a card.\")</i>";
}
}