[CLB] Implemented Descent into Avernus

This commit is contained in:
Evan Kranzler 2022-06-02 08:25:43 -04:00
parent aef01f034e
commit 1a6a17fa0f
3 changed files with 89 additions and 0 deletions

View file

@ -0,0 +1,87 @@
package mage.cards.d;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamagePlayersEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.token.TreasureToken;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class DescentIntoAvernus extends CardImpl {
private static final DynamicValue xValue = new CountersSourceCount(CounterType.DESCENT);
public DescentIntoAvernus(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}");
// At the beginning of your upkeep, put two descent counters on Descent into Avernus. Then each player creates X Treasure tokens and Descent into Avernus deals X damage to each player, where X is the number of descent counters on Descent into Avernus.
Ability ability = new BeginningOfUpkeepTriggeredAbility(
new AddCountersSourceEffect(CounterType.DESCENT.createInstance(2)),
TargetController.YOU, false
);
ability.addEffect(new DescentIntoAvernusEffect());
ability.addEffect(new DamagePlayersEffect(
Outcome.Damage, xValue, TargetController.ANY
).concatBy("and"));
this.addAbility(ability);
}
private DescentIntoAvernus(final DescentIntoAvernus card) {
super(card);
}
@Override
public DescentIntoAvernus copy() {
return new DescentIntoAvernus(this);
}
}
class DescentIntoAvernusEffect extends OneShotEffect {
DescentIntoAvernusEffect() {
super(Outcome.Benefit);
staticText = "Then each player creates X Treasure tokens";
}
private DescentIntoAvernusEffect(final DescentIntoAvernusEffect effect) {
super(effect);
}
@Override
public DescentIntoAvernusEffect copy() {
return new DescentIntoAvernusEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int count = Optional
.of(source.getSourcePermanentOrLKI(game))
.filter(Objects::nonNull)
.map(permanent -> permanent.getCounters(game))
.map(counters -> counters.getCount(CounterType.DESCENT))
.orElse(0);
if (count < 1) {
return false;
}
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
new TreasureToken().putOntoBattlefield(count, game, source);
}
return true;
}
}

View file

@ -158,6 +158,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
cards.add(new SetCardInfo("Deadly Dispute", 124, Rarity.COMMON, mage.cards.d.DeadlyDispute.class));
cards.add(new SetCardInfo("Decanter of Endless Water", 309, Rarity.COMMON, mage.cards.d.DecanterOfEndlessWater.class));
cards.add(new SetCardInfo("Demon Bolt", 787, Rarity.COMMON, mage.cards.d.DemonBolt.class));
cards.add(new SetCardInfo("Descent into Avernus", 169, Rarity.RARE, mage.cards.d.DescentIntoAvernus.class));
cards.add(new SetCardInfo("Desolate Lighthouse", 890, Rarity.RARE, mage.cards.d.DesolateLighthouse.class));
cards.add(new SetCardInfo("Despark", 841, Rarity.UNCOMMON, mage.cards.d.Despark.class));
cards.add(new SetCardInfo("Dimir Aqueduct", 891, Rarity.UNCOMMON, mage.cards.d.DimirAqueduct.class));

View file

@ -44,6 +44,7 @@ public enum CounterType {
DEATHTOUCH("deathtouch"),
DELAY("delay"),
DEPLETION("depletion"),
DESCENT("descent"),
DESPAIR("despair"),
DEVOTION("devotion"),
DIVINITY("divinity"),