mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
Implemented Medomai's Prophecy
This commit is contained in:
parent
93d17f5f34
commit
425ea1e74a
2 changed files with 155 additions and 0 deletions
154
Mage.Sets/src/mage/cards/m/MedomaisProphecy.java
Normal file
154
Mage.Sets/src/mage/cards/m/MedomaisProphecy.java
Normal file
|
@ -0,0 +1,154 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.common.SagaAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseACardNameEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.keyword.ScryEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static mage.abilities.effects.common.ChooseACardNameEffect.TypeOfName.ALL;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class MedomaisProphecy extends CardImpl {
|
||||
|
||||
public MedomaisProphecy(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
|
||||
|
||||
this.subtype.add(SubType.SAGA);
|
||||
|
||||
// (As this Saga enters and after your draw step, add a lore counter. Sacrifice after IV.)
|
||||
SagaAbility sagaAbility = new SagaAbility(this, SagaChapter.CHAPTER_IV);
|
||||
|
||||
// I — Scry 2.
|
||||
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_I, new ScryEffect(2));
|
||||
|
||||
// II — Choose a card name.
|
||||
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_II, new ChooseACardNameEffect(ALL));
|
||||
|
||||
// III — When you cast a spell with the chosen card name for the first time this turn, draw two cards.
|
||||
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_III, new MedomaisProphecyTriggerEffect());
|
||||
|
||||
// IV — Look at the top card of each player's library.
|
||||
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_IV, new MedomaisProphecyLookEffect());
|
||||
}
|
||||
|
||||
private MedomaisProphecy(final MedomaisProphecy card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MedomaisProphecy copy() {
|
||||
return new MedomaisProphecy(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MedomaisProphecyTriggerEffect extends OneShotEffect {
|
||||
|
||||
MedomaisProphecyTriggerEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "When you cast a spell with the chosen card name for the first time this turn, draw two cards.";
|
||||
}
|
||||
|
||||
private MedomaisProphecyTriggerEffect(final MedomaisProphecyTriggerEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MedomaisProphecyTriggerEffect copy() {
|
||||
return new MedomaisProphecyTriggerEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
String cardName = (String) game.getState().getValue(
|
||||
source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY
|
||||
);
|
||||
if (cardName == null || "".equals(cardName)) {
|
||||
return false;
|
||||
}
|
||||
game.addDelayedTriggeredAbility(new MedomaisProphecyDelayedTriggeredAbility(cardName), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class MedomaisProphecyDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
||||
private final String spellName;
|
||||
|
||||
MedomaisProphecyDelayedTriggeredAbility(String spellName) {
|
||||
super(new DrawCardSourceControllerEffect(2), Duration.EndOfTurn, true, false);
|
||||
this.spellName = spellName;
|
||||
}
|
||||
|
||||
private MedomaisProphecyDelayedTriggeredAbility(final MedomaisProphecyDelayedTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.spellName = ability.spellName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.SPELL_CAST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (!event.getPlayerId().equals(this.getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
return spell != null && spellName.equals(spell.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MedomaisProphecyDelayedTriggeredAbility copy() {
|
||||
return new MedomaisProphecyDelayedTriggeredAbility(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MedomaisProphecyLookEffect extends OneShotEffect {
|
||||
|
||||
MedomaisProphecyLookEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "look at the top card of each player's library";
|
||||
}
|
||||
|
||||
private MedomaisProphecyLookEffect(final MedomaisProphecyLookEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MedomaisProphecyLookEffect copy() {
|
||||
return new MedomaisProphecyLookEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourcePermanentOrLKI(game);
|
||||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
game.getState()
|
||||
.getPlayersInRange(source.getControllerId(), game)
|
||||
.stream()
|
||||
.map(game::getPlayer)
|
||||
.map(Player::getLibrary)
|
||||
.forEachOrdered(library -> controller.lookAtCards(
|
||||
sourceObject.getIdName(), library.getFromTop(game), game
|
||||
));
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -135,6 +135,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Leonin of the Lost Pride", 28, Rarity.COMMON, mage.cards.l.LeoninOfTheLostPride.class));
|
||||
cards.add(new SetCardInfo("Loathsome Chimera", 177, Rarity.COMMON, mage.cards.l.LoathsomeChimera.class));
|
||||
cards.add(new SetCardInfo("Mantle of the Wolf", 178, Rarity.RARE, mage.cards.m.MantleOfTheWolf.class));
|
||||
cards.add(new SetCardInfo("Medomai's Prophecy", 53, Rarity.UNCOMMON, mage.cards.m.MedomaisProphecy.class));
|
||||
cards.add(new SetCardInfo("Memory Drain", 54, Rarity.COMMON, mage.cards.m.MemoryDrain.class));
|
||||
cards.add(new SetCardInfo("Mindwrack Harpy", 276, Rarity.COMMON, mage.cards.m.MindwrackHarpy.class));
|
||||
cards.add(new SetCardInfo("Mire Triton", 105, Rarity.UNCOMMON, mage.cards.m.MireTriton.class));
|
||||
|
|
Loading…
Reference in a new issue