mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Implemented Energy Vortex
This commit is contained in:
parent
53f4241518
commit
c46b268819
3 changed files with 113 additions and 0 deletions
111
Mage.Sets/src/mage/cards/e/EnergyVortex.java
Normal file
111
Mage.Sets/src/mage/cards/e/EnergyVortex.java
Normal file
|
@ -0,0 +1,111 @@
|
|||
package mage.cards.e;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.IsStepCondition;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseOpponentEffect;
|
||||
import mage.abilities.effects.common.RemoveAllCountersSourceEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class EnergyVortex extends CardImpl {
|
||||
|
||||
public EnergyVortex(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
|
||||
|
||||
// As Energy Vortex enters the battlefield, choose an opponent.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseOpponentEffect(Outcome.Detriment)));
|
||||
|
||||
// At the beginning of your upkeep, remove all vortex counters from Energy Vortex.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
|
||||
new RemoveAllCountersSourceEffect(CounterType.VORTEX), TargetController.YOU, false
|
||||
));
|
||||
|
||||
// At the beginning of the chosen player's upkeep, Energy Vortex deals 3 damage to that player unless he or she pays {1} for each vortex counter on Energy Vortex.
|
||||
this.addAbility(new ConditionalTriggeredAbility(
|
||||
new BeginningOfUpkeepTriggeredAbility(
|
||||
new EnergyVortexEffect(), TargetController.ANY, false
|
||||
), EnergyVortexCondition.instance, "At the beginning of the chosen player's upkeep, " +
|
||||
"{this} deals 3 damage to that player unless they pay {1} for each vortex counter on {this}."
|
||||
));
|
||||
|
||||
// {X}: Put X vortex counters on Energy Vortex. Activate this ability only during your upkeep.
|
||||
this.addAbility(new ActivateIfConditionActivatedAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new AddCountersSourceEffect(
|
||||
CounterType.VORTEX.createInstance(),
|
||||
ManacostVariableValue.instance, true
|
||||
), new ManaCostsImpl("{X}"),
|
||||
new IsStepCondition(PhaseStep.UPKEEP)
|
||||
));
|
||||
}
|
||||
|
||||
private EnergyVortex(final EnergyVortex card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnergyVortex copy() {
|
||||
return new EnergyVortex(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum EnergyVortexCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return game.getActivePlayerId().equals(game.getState().getValue(source.getSourceId().toString() + ChooseOpponentEffect.VALUE_KEY));
|
||||
}
|
||||
}
|
||||
|
||||
class EnergyVortexEffect extends OneShotEffect {
|
||||
|
||||
EnergyVortexEffect() {
|
||||
super(Outcome.Benefit);
|
||||
}
|
||||
|
||||
private EnergyVortexEffect(final EnergyVortexEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnergyVortexEffect copy() {
|
||||
return new EnergyVortexEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(game.getActivePlayerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player == null || permanent == null) {
|
||||
return false;
|
||||
}
|
||||
int counters = permanent.getCounters(game).getCount(CounterType.VORTEX);
|
||||
Cost cost = new GenericManaCost(counters);
|
||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) {
|
||||
return true;
|
||||
}
|
||||
return player.damage(3, source.getSourceId(), game) > 0;
|
||||
}
|
||||
}
|
|
@ -103,6 +103,7 @@ public final class Mirage extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Emberwilde Caliph", 322, Rarity.RARE, mage.cards.e.EmberwildeCaliph.class));
|
||||
cards.add(new SetCardInfo("Emberwilde Djinn", 172, Rarity.RARE, mage.cards.e.EmberwildeDjinn.class));
|
||||
cards.add(new SetCardInfo("Energy Bolt", 263, Rarity.RARE, mage.cards.e.EnergyBolt.class));
|
||||
cards.add(new SetCardInfo("Energy Vortex", 64, Rarity.RARE, mage.cards.e.EnergyVortex.class));
|
||||
cards.add(new SetCardInfo("Enfeeblement", 121, Rarity.COMMON, mage.cards.e.Enfeeblement.class));
|
||||
cards.add(new SetCardInfo("Enlightened Tutor", 14, Rarity.UNCOMMON, mage.cards.e.EnlightenedTutor.class));
|
||||
cards.add(new SetCardInfo("Ersatz Gnomes", 301, Rarity.UNCOMMON, mage.cards.e.ErsatzGnomes.class));
|
||||
|
|
|
@ -134,6 +134,7 @@ public enum CounterType {
|
|||
VELOCITY("velocity"),
|
||||
VERSE("verse"),
|
||||
VITALITY("vitality"),
|
||||
VORTEX("vortex"),
|
||||
WIND("wind"),
|
||||
WISH("wish");
|
||||
|
||||
|
|
Loading…
Reference in a new issue