[CLB] Implemented Astral Confrontation

This commit is contained in:
Evan Kranzler 2022-05-18 09:32:53 -04:00
parent e5d30baf31
commit c74483488b
2 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,89 @@
package mage.cards.a;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.cost.SpellCostReductionForEachSourceEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.combat.CombatGroup;
import mage.target.common.TargetCreaturePermanent;
import java.util.Set;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class AstralConfrontation extends CardImpl {
private static final Hint hint = new ValueHint("Opponents you're attacking", AstralConfrontationValue.instance);
public AstralConfrontation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{W}");
// This spell costs {1} less to cast for each opponent you're attacking.
this.addAbility(new SimpleStaticAbility(
Zone.ALL, new SpellCostReductionForEachSourceEffect(1, AstralConfrontationValue.instance)
).setRuleAtTheTop(true));
// Exile target creature.
this.getSpellAbility().addEffect(new ExileTargetEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
private AstralConfrontation(final AstralConfrontation card) {
super(card);
}
@Override
public AstralConfrontation copy() {
return new AstralConfrontation(this);
}
}
enum AstralConfrontationValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Set<UUID> opponents = game.getOpponents(sourceAbility.getControllerId());
return game
.getCombat()
.getGroups()
.stream()
.filter(combatGroup -> combatGroup
.getAttackers()
.stream()
.map(game::getControllerId)
.anyMatch(sourceAbility::isControlledBy)
)
.map(CombatGroup::getDefenderId)
.distinct()
.filter(opponents::contains)
.mapToInt(x -> 1)
.sum();
}
@Override
public AstralConfrontationValue copy() {
return this;
}
@Override
public String getMessage() {
return "opponent you're attacking";
}
@Override
public String toString() {
return "1";
}
}

View file

@ -24,6 +24,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
cards.add(new SetCardInfo("Aarakocra Sneak", 54, Rarity.COMMON, mage.cards.a.AarakocraSneak.class));
cards.add(new SetCardInfo("Ancient Brass Dragon", 111, Rarity.MYTHIC, mage.cards.a.AncientBrassDragon.class));
cards.add(new SetCardInfo("Arcane Signet", 298, Rarity.UNCOMMON, mage.cards.a.ArcaneSignet.class));
cards.add(new SetCardInfo("Astral Confrontation", 6, Rarity.COMMON, mage.cards.a.AstralConfrontation.class));
cards.add(new SetCardInfo("Baldur's Gate", 345, Rarity.RARE, mage.cards.b.BaldursGate.class));
cards.add(new SetCardInfo("Bane's Invoker", 7, Rarity.COMMON, mage.cards.b.BanesInvoker.class));
cards.add(new SetCardInfo("Bhaal's Invoker", 163, Rarity.COMMON, mage.cards.b.BhaalsInvoker.class));