- Added ForetoldWatcher, ForetoldCondition. Added card from

weirddan455 [KHM] Poison the Cup that uses it.
This commit is contained in:
jeffwadsworth 2021-01-26 10:59:46 -06:00
parent dacf30f4b9
commit 68f2a3d032
5 changed files with 130 additions and 4 deletions

View file

@ -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";
}
}

View file

@ -28,6 +28,7 @@ import mage.game.Game;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
import mage.watchers.common.ForetoldWatcher;
/**
* @author jeffwadsworth
@ -50,6 +51,7 @@ public class ForetellAbility extends SpecialAction {
// look at face-down card anytime
addSubAbility(new SimpleStaticAbility(Zone.ALL, new ForetellLookAtCardEffect()));
this.setRuleVisible(false);
this.addWatcher(new ForetoldWatcher());
}
private ForetellAbility(ForetellAbility ability) {
@ -196,10 +198,6 @@ class ForetellCostAbility extends SpellAbility {
&& exileZone.isEmpty()) {
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 (((SplitCard) card).getLeftHalfCard().getName().equals(abilityName)) {
return ((SplitCard) card).getLeftHalfCard().getSpellAbility().canActivate(playerId, game);