mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
[MID] Implemented Light Up the Night
This commit is contained in:
parent
dbd4b32e6b
commit
1b5ad66ae5
3 changed files with 110 additions and 1 deletions
89
Mage.Sets/src/mage/cards/l/LightUpTheNight.java
Normal file
89
Mage.Sets/src/mage/cards/l/LightUpTheNight.java
Normal file
|
@ -0,0 +1,89 @@
|
|||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.common.RemoveVariableCountersTargetCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.dynamicvalue.common.GetXValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.FlashbackAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public final class LightUpTheNight extends CardImpl {
|
||||
|
||||
public LightUpTheNight(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{R}");
|
||||
|
||||
// Light Up the Night deals X damage to any target. It deals X plus 1 damage instead if that target is a creature or planeswalker.
|
||||
this.getSpellAbility().addEffect(new LightUpTheNightEffect());
|
||||
this.getSpellAbility().addTarget(new TargetAnyTarget());
|
||||
|
||||
// Flashback—{3}{R}, Remove X loyalty counters from among planeswalkers you control. If you cast this spell this way, X can't be 0.
|
||||
Ability ability = new FlashbackAbility(this, new ManaCostsImpl<>("{3}{R}"));
|
||||
ability.addCost(new RemoveVariableCountersTargetCost(
|
||||
StaticFilters.FILTER_CONTROLLED_PERMANENT_PLANESWALKER, CounterType.LOYALTY, "X", 1,
|
||||
"Remove X loyalty counters from among planeswalkers you control. If you cast this spell this way, X can't be 0"
|
||||
));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private LightUpTheNight(final LightUpTheNight card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LightUpTheNight copy() {
|
||||
return new LightUpTheNight(this);
|
||||
}
|
||||
}
|
||||
|
||||
class LightUpTheNightEffect extends OneShotEffect {
|
||||
|
||||
public LightUpTheNightEffect() {
|
||||
super(Outcome.Damage);
|
||||
staticText = "{this} deals X damage to any target. It deals X plus 1 damage instead if that target is a creature or planeswalker";
|
||||
}
|
||||
|
||||
private LightUpTheNightEffect(final LightUpTheNightEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LightUpTheNightEffect copy() {
|
||||
return new LightUpTheNightEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
// Normal cast
|
||||
int damage = source.getManaCostsToPay().getX();
|
||||
// Flashback cast
|
||||
damage += GetXValue.instance.calculate(game, source, this);
|
||||
UUID targetId = source.getFirstTarget();
|
||||
Player player = game.getPlayer(targetId);
|
||||
if (player != null) {
|
||||
player.damage(damage, source.getSourceId(), source, game);
|
||||
return true;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
permanent.damage(damage + 1, source.getSourceId(), source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -187,6 +187,7 @@ public final class InnistradMidnightHunt extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Larder Zombie", 58, Rarity.COMMON, mage.cards.l.LarderZombie.class));
|
||||
cards.add(new SetCardInfo("Lier, Disciple of the Drowned", 59, Rarity.MYTHIC, mage.cards.l.LierDiscipleOfTheDrowned.class));
|
||||
cards.add(new SetCardInfo("Liesa, Forgotten Archangel", 232, Rarity.RARE, mage.cards.l.LiesaForgottenArchangel.class));
|
||||
cards.add(new SetCardInfo("Light Up the Night", 146, Rarity.RARE, mage.cards.l.LightUpTheNight.class));
|
||||
cards.add(new SetCardInfo("Locked in the Cemetery", 60, Rarity.COMMON, mage.cards.l.LockedInTheCemetery.class));
|
||||
cards.add(new SetCardInfo("Lord of the Ulvenwald", 231, Rarity.UNCOMMON, mage.cards.l.LordOfTheUlvenwald.class));
|
||||
cards.add(new SetCardInfo("Loyal Gryff", 26, Rarity.UNCOMMON, mage.cards.l.LoyalGryff.class));
|
||||
|
|
|
@ -31,16 +31,25 @@ public class RemoveVariableCountersTargetCost extends VariableCostImpl {
|
|||
}
|
||||
|
||||
public RemoveVariableCountersTargetCost(FilterPermanent filter, CounterType counterTypeToRemove, String xText, int minValue) {
|
||||
this(filter, counterTypeToRemove, xText, minValue, null);
|
||||
}
|
||||
|
||||
public RemoveVariableCountersTargetCost(FilterPermanent filter, CounterType counterTypeToRemove, String xText, int minValue, String text) {
|
||||
super(VariableCostType.NORMAL, xText, new StringBuilder(counterTypeToRemove != null ? counterTypeToRemove.getName() + ' ' : "").append("counters to remove").toString());
|
||||
this.filter = filter;
|
||||
this.counterTypeToRemove = counterTypeToRemove;
|
||||
this.text = setText();
|
||||
if (text != null && !text.isEmpty()) {
|
||||
this.text = text;
|
||||
} else {
|
||||
this.text = setText();
|
||||
}
|
||||
this.minValue = minValue;
|
||||
}
|
||||
|
||||
public RemoveVariableCountersTargetCost(final RemoveVariableCountersTargetCost cost) {
|
||||
super(cost);
|
||||
this.filter = cost.filter;
|
||||
this.counterTypeToRemove = cost.counterTypeToRemove;
|
||||
this.minValue = cost.minValue;
|
||||
}
|
||||
|
||||
|
@ -63,6 +72,16 @@ public class RemoveVariableCountersTargetCost extends VariableCostImpl {
|
|||
return new RemoveVariableCountersTargetCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) {
|
||||
return getMaxValue(source, game) >= minValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinValue(Ability source, Game game) {
|
||||
return minValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxValue(Ability source, Game game) {
|
||||
int maxValue = 0;
|
||||
|
|
Loading…
Reference in a new issue