mirror of
https://github.com/correl/mage.git
synced 2025-03-16 09:16:26 -09:00
- Added ForetoldWatcher, ForetoldCondition. Added card from
weirddan455 [KHM] Poison the Cup that uses it.
This commit is contained in:
parent
dacf30f4b9
commit
68f2a3d032
5 changed files with 130 additions and 4 deletions
41
Mage.Sets/src/mage/cards/p/PoisonTheCup.java
Normal file
41
Mage.Sets/src/mage/cards/p/PoisonTheCup.java
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
package mage.cards.p;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import mage.abilities.condition.common.ForetoldCondition;
|
||||||
|
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||||
|
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||||
|
import mage.abilities.effects.keyword.ScryEffect;
|
||||||
|
import mage.abilities.keyword.ForetellAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author weirddan455
|
||||||
|
*/
|
||||||
|
public final class PoisonTheCup extends CardImpl {
|
||||||
|
|
||||||
|
public PoisonTheCup(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}{B}");
|
||||||
|
|
||||||
|
// Destroy target creature. If this spell was foretold, scry 2.
|
||||||
|
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
||||||
|
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new ScryEffect(2), ForetoldCondition.instance));
|
||||||
|
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||||
|
|
||||||
|
// Foretell {1}{B}
|
||||||
|
this.addAbility(new ForetellAbility(this, "{1}{B}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private PoisonTheCup(final PoisonTheCup card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PoisonTheCup copy() {
|
||||||
|
return new PoisonTheCup(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -83,6 +83,7 @@ public final class Kaldheim extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Cleaving Reaper", 376, Rarity.RARE, mage.cards.c.CleavingReaper.class));
|
cards.add(new SetCardInfo("Cleaving Reaper", 376, Rarity.RARE, mage.cards.c.CleavingReaper.class));
|
||||||
cards.add(new SetCardInfo("Codespell Cleric", 7, Rarity.COMMON, mage.cards.c.CodespellCleric.class));
|
cards.add(new SetCardInfo("Codespell Cleric", 7, Rarity.COMMON, mage.cards.c.CodespellCleric.class));
|
||||||
cards.add(new SetCardInfo("Colossal Plow", 236, Rarity.UNCOMMON, mage.cards.c.ColossalPlow.class));
|
cards.add(new SetCardInfo("Colossal Plow", 236, Rarity.UNCOMMON, mage.cards.c.ColossalPlow.class));
|
||||||
|
cards.add(new SetCardInfo("Cosima, God of the Voyage", 50, Rarity.MYTHIC, mage.cards.c.CosimaGodOfTheVoyage.class));
|
||||||
cards.add(new SetCardInfo("Cosmos Elixir", 237, Rarity.RARE, mage.cards.c.CosmosElixir.class));
|
cards.add(new SetCardInfo("Cosmos Elixir", 237, Rarity.RARE, mage.cards.c.CosmosElixir.class));
|
||||||
cards.add(new SetCardInfo("Craven Hulk", 127, Rarity.COMMON, mage.cards.c.CravenHulk.class));
|
cards.add(new SetCardInfo("Craven Hulk", 127, Rarity.COMMON, mage.cards.c.CravenHulk.class));
|
||||||
cards.add(new SetCardInfo("Crippling Fear", 82, Rarity.RARE, mage.cards.c.CripplingFear.class));
|
cards.add(new SetCardInfo("Crippling Fear", 82, Rarity.RARE, mage.cards.c.CripplingFear.class));
|
||||||
|
@ -212,6 +213,7 @@ public final class Kaldheim extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Path to the World Tree", 186, Rarity.UNCOMMON, mage.cards.p.PathToTheWorldTree.class));
|
cards.add(new SetCardInfo("Path to the World Tree", 186, Rarity.UNCOMMON, mage.cards.p.PathToTheWorldTree.class));
|
||||||
cards.add(new SetCardInfo("Pilfering Hawk", 71, Rarity.COMMON, mage.cards.p.PilferingHawk.class));
|
cards.add(new SetCardInfo("Pilfering Hawk", 71, Rarity.COMMON, mage.cards.p.PilferingHawk.class));
|
||||||
cards.add(new SetCardInfo("Plains", 394, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Plains", 394, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
||||||
|
cards.add(new SetCardInfo("Poison the Cup", 103, Rarity.UNCOMMON, mage.cards.p.PoisonTheCup.class));
|
||||||
cards.add(new SetCardInfo("Port of Karfell", 265, Rarity.UNCOMMON, mage.cards.p.PortOfKarfell.class));
|
cards.add(new SetCardInfo("Port of Karfell", 265, Rarity.UNCOMMON, mage.cards.p.PortOfKarfell.class));
|
||||||
cards.add(new SetCardInfo("Priest of the Haunted Edge", 104, Rarity.COMMON, mage.cards.p.PriestOfTheHauntedEdge.class));
|
cards.add(new SetCardInfo("Priest of the Haunted Edge", 104, Rarity.COMMON, mage.cards.p.PriestOfTheHauntedEdge.class));
|
||||||
cards.add(new SetCardInfo("Provoke the Trolls", 144, Rarity.UNCOMMON, mage.cards.p.ProvokeTheTrolls.class));
|
cards.add(new SetCardInfo("Provoke the Trolls", 144, Rarity.UNCOMMON, mage.cards.p.ProvokeTheTrolls.class));
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package mage.abilities.condition.common;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.condition.Condition;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.watchers.common.ForetoldWatcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jeffwadsworth
|
||||||
|
*/
|
||||||
|
public enum ForetoldCondition implements Condition {
|
||||||
|
|
||||||
|
instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
ForetoldWatcher watcher = game.getState().getWatcher(ForetoldWatcher.class);
|
||||||
|
if (watcher != null) {
|
||||||
|
return watcher.foretoldSpellWasCast(source.getSourceId());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "this card was foretold";
|
||||||
|
}
|
||||||
|
}
|
|
@ -28,6 +28,7 @@ import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
import mage.watchers.common.ForetoldWatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
|
@ -50,6 +51,7 @@ public class ForetellAbility extends SpecialAction {
|
||||||
// look at face-down card anytime
|
// look at face-down card anytime
|
||||||
addSubAbility(new SimpleStaticAbility(Zone.ALL, new ForetellLookAtCardEffect()));
|
addSubAbility(new SimpleStaticAbility(Zone.ALL, new ForetellLookAtCardEffect()));
|
||||||
this.setRuleVisible(false);
|
this.setRuleVisible(false);
|
||||||
|
this.addWatcher(new ForetoldWatcher());
|
||||||
}
|
}
|
||||||
|
|
||||||
private ForetellAbility(ForetellAbility ability) {
|
private ForetellAbility(ForetellAbility ability) {
|
||||||
|
@ -196,10 +198,6 @@ class ForetellCostAbility extends SpellAbility {
|
||||||
&& exileZone.isEmpty()) {
|
&& exileZone.isEmpty()) {
|
||||||
return ActivationStatus.getFalse();
|
return ActivationStatus.getFalse();
|
||||||
}
|
}
|
||||||
// Cards with no Mana Costs cant't be flashbacked (e.g. Ancestral Vision)
|
|
||||||
if (card.getManaCost().isEmpty()) {
|
|
||||||
return ActivationStatus.getFalse();
|
|
||||||
}
|
|
||||||
if (card instanceof SplitCard) {
|
if (card instanceof SplitCard) {
|
||||||
if (((SplitCard) card).getLeftHalfCard().getName().equals(abilityName)) {
|
if (((SplitCard) card).getLeftHalfCard().getName().equals(abilityName)) {
|
||||||
return ((SplitCard) card).getLeftHalfCard().getSpellAbility().canActivate(playerId, game);
|
return ((SplitCard) card).getLeftHalfCard().getSpellAbility().canActivate(playerId, game);
|
||||||
|
|
56
Mage/src/main/java/mage/watchers/common/ForetoldWatcher.java
Normal file
56
Mage/src/main/java/mage/watchers/common/ForetoldWatcher.java
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package mage.watchers.common;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.constants.WatcherScope;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.stack.Spell;
|
||||||
|
import mage.util.CardUtil;
|
||||||
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jeffwadsworth
|
||||||
|
*/
|
||||||
|
public class ForetoldWatcher extends Watcher {
|
||||||
|
|
||||||
|
// If a card was Foretold during a turn, this list stores it. Cleared at the end of the turn.
|
||||||
|
|
||||||
|
private final Set<UUID> foretoldCardsThisTurn = new HashSet<>();
|
||||||
|
|
||||||
|
public ForetoldWatcher() {
|
||||||
|
super(WatcherScope.GAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void watch(GameEvent event, Game game) {
|
||||||
|
if (event.getType() == GameEvent.EventType.SPELL_CAST
|
||||||
|
&& event.getZone() == Zone.EXILED) {
|
||||||
|
Spell spell = (Spell) game.getObject(event.getTargetId());
|
||||||
|
if (spell != null) {
|
||||||
|
UUID exileId = CardUtil.getExileZoneId(spell.getSourceId().toString() + "foretellAbility", game);
|
||||||
|
if (exileId != null) {
|
||||||
|
foretoldCardsThisTurn.add(spell.getSourceId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean foretoldSpellWasCast(UUID sourceId) {
|
||||||
|
return foretoldCardsThisTurn.contains(sourceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset() {
|
||||||
|
super.reset();
|
||||||
|
foretoldCardsThisTurn.clear();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue