mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[WHO] Implement Impending Flux
This commit is contained in:
parent
acc235c69c
commit
3ed232fe63
5 changed files with 152 additions and 72 deletions
54
Mage.Sets/src/mage/cards/i/ImpendingFlux.java
Normal file
54
Mage.Sets/src/mage/cards/i/ImpendingFlux.java
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
package mage.cards.i;
|
||||
|
||||
import mage.abilities.dynamicvalue.AdditiveDynamicValue;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.SpellsCastNotFromHandValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.common.DamageAllEffect;
|
||||
import mage.abilities.effects.common.DamagePlayersEffect;
|
||||
import mage.abilities.keyword.ForetellAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AbilityWord;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.watchers.common.SpellsCastNotFromHandWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class ImpendingFlux extends CardImpl {
|
||||
|
||||
private static final DynamicValue xValue = new AdditiveDynamicValue(SpellsCastNotFromHandValue.instance, StaticValue.get(1));
|
||||
|
||||
public ImpendingFlux(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}");
|
||||
|
||||
// Paradox -- Impending Flux deals X damage to each opponent and each creature they control, where X is 1 plus the number of spells you've cast from anywhere other than your hand this turn.
|
||||
this.getSpellAbility().addEffect(new DamagePlayersEffect(
|
||||
xValue, TargetController.OPPONENT
|
||||
).setText("{this} deals X damage to each opponent"));
|
||||
this.getSpellAbility().addEffect(new DamageAllEffect(
|
||||
xValue, StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE
|
||||
).setText("and each creature they control, where X is 1 plus the number " +
|
||||
"of spells you've cast from anywhere other than your hand this turn"));
|
||||
this.getSpellAbility().setAbilityWord(AbilityWord.PARADOX);
|
||||
this.getSpellAbility().addWatcher(new SpellsCastNotFromHandWatcher());
|
||||
this.getSpellAbility().addHint(SpellsCastNotFromHandValue.getHint());
|
||||
|
||||
// Foretell {1}{R}{R}
|
||||
this.addAbility(new ForetellAbility(this, "{1}{R}{R}"));
|
||||
}
|
||||
|
||||
private ImpendingFlux(final ImpendingFlux card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImpendingFlux copy() {
|
||||
return new ImpendingFlux(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,14 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.dynamicvalue.common.SpellsCastNotFromHandValue;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.keyword.ForetellAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AbilityWord;
|
||||
import mage.constants.CardType;
|
||||
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;
|
||||
import mage.watchers.common.SpellsCastNotFromHandWatcher;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
|
@ -30,9 +20,9 @@ public final class SurgeOfBrilliance extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
|
||||
|
||||
// Paradox -- Draw a card for each spell you've cast this turn from anywhere other than your hand.
|
||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(SurgeOfBrillianceValue.instance));
|
||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(SpellsCastNotFromHandValue.instance));
|
||||
this.getSpellAbility().setAbilityWord(AbilityWord.PARADOX);
|
||||
this.getSpellAbility().addWatcher(new SurgeOfBrillianceWatcher());
|
||||
this.getSpellAbility().addWatcher(new SpellsCastNotFromHandWatcher());
|
||||
|
||||
// Foretell {1}{U}
|
||||
this.addAbility(new ForetellAbility(this, "{1}{U}"));
|
||||
|
|
@ -47,61 +37,3 @@ public final class SurgeOfBrilliance extends CardImpl {
|
|||
return new SurgeOfBrilliance(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum SurgeOfBrillianceValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return SurgeOfBrillianceWatcher.getCount(sourceAbility.getControllerId(), game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurgeOfBrillianceValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "spell you've cast this turn from anywhere other than your hand";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "1";
|
||||
}
|
||||
}
|
||||
|
||||
class SurgeOfBrillianceWatcher extends Watcher {
|
||||
|
||||
private final Map<UUID, Integer> map = new HashMap<>();
|
||||
|
||||
SurgeOfBrillianceWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() != GameEvent.EventType.SPELL_CAST) {
|
||||
return;
|
||||
}
|
||||
Spell spell = game.getSpell(event.getSourceId());
|
||||
if (spell != null && spell.getFromZone() != Zone.HAND) {
|
||||
map.compute(event.getPlayerId(), CardUtil::setOrIncrementValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
map.clear();
|
||||
}
|
||||
|
||||
static int getCount(UUID playerId, Game game) {
|
||||
return game
|
||||
.getState()
|
||||
.getWatcher(SurgeOfBrillianceWatcher.class)
|
||||
.map
|
||||
.getOrDefault(playerId, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ public final class DoctorWho extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Heroic Intervention", 233, Rarity.RARE, mage.cards.h.HeroicIntervention.class));
|
||||
cards.add(new SetCardInfo("Horizon Canopy", 287, Rarity.RARE, mage.cards.h.HorizonCanopy.class));
|
||||
cards.add(new SetCardInfo("Ian Chesterton", 22, Rarity.RARE, mage.cards.i.IanChesterton.class));
|
||||
cards.add(new SetCardInfo("Impending Flux", 87, Rarity.RARE, mage.cards.i.ImpendingFlux.class));
|
||||
cards.add(new SetCardInfo("Inspiring Refrain", 216, Rarity.RARE, mage.cards.i.InspiringRefrain.class));
|
||||
cards.add(new SetCardInfo("Into the Time Vortex", 88, Rarity.RARE, mage.cards.i.IntoTheTimeVortex.class));
|
||||
cards.add(new SetCardInfo("Iraxxa, Empress of Mars", 89, Rarity.UNCOMMON, mage.cards.i.IraxxaEmpressOfMars.class));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.game.Game;
|
||||
import mage.watchers.common.SpellsCastNotFromHandWatcher;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum SpellsCastNotFromHandValue implements DynamicValue {
|
||||
instance;
|
||||
private static final Hint hint = new ValueHint(
|
||||
"Spells you've cast this turn from anywhere other than your hand", instance
|
||||
);
|
||||
|
||||
public static Hint getHint() {
|
||||
return hint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return SpellsCastNotFromHandWatcher.getCount(sourceAbility.getControllerId(), game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpellsCastNotFromHandValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "spell you've cast this turn from anywhere other than your hand";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "1";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package mage.watchers.common;
|
||||
|
||||
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;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class SpellsCastNotFromHandWatcher extends Watcher {
|
||||
|
||||
private final Map<UUID, Integer> map = new HashMap<>();
|
||||
|
||||
public SpellsCastNotFromHandWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() != GameEvent.EventType.SPELL_CAST) {
|
||||
return;
|
||||
}
|
||||
Spell spell = game.getSpell(event.getSourceId());
|
||||
if (spell != null && spell.getFromZone() != Zone.HAND) {
|
||||
map.compute(event.getPlayerId(), CardUtil::setOrIncrementValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
map.clear();
|
||||
}
|
||||
|
||||
public static int getCount(UUID playerId, Game game) {
|
||||
return game
|
||||
.getState()
|
||||
.getWatcher(SpellsCastNotFromHandWatcher.class)
|
||||
.map
|
||||
.getOrDefault(playerId, 0);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue