[CLB] Implemented Pack Attack

This commit is contained in:
Evan Kranzler 2022-05-30 10:18:28 -04:00
parent 11aedad38d
commit cc1c965a15
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,79 @@
package mage.cards.p;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.combat.CombatGroup;
import java.util.Objects;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class PackAttack extends CardImpl {
public PackAttack(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}");
// Attacking creatures get +X/+0 until end of turn, where X is the number of players being attacked.
this.getSpellAbility().addEffect(new BoostAllEffect(
PackAttackValue.instance, StaticValue.get(0), Duration.EndOfTurn,
StaticFilters.FILTER_ATTACKING_CREATURES, false, null, true
));
// Draw a card.
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1).concatBy("<br>"));
}
private PackAttack(final PackAttack card) {
super(card);
}
@Override
public PackAttack copy() {
return new PackAttack(this);
}
}
enum PackAttackValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return game
.getCombat()
.getGroups()
.stream()
.map(CombatGroup::getDefenderId)
.distinct()
.map(game::getPlayer)
.filter(Objects::nonNull)
.mapToInt(x -> 1)
.sum();
}
@Override
public PackAttackValue copy() {
return this;
}
@Override
public String getMessage() {
return "the number of players being attacked";
}
@Override
public String toString() {
return "X";
}
}

View file

@ -197,6 +197,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
cards.add(new SetCardInfo("Oji, the Exquisite Blade", 290, Rarity.UNCOMMON, mage.cards.o.OjiTheExquisiteBlade.class));
cards.add(new SetCardInfo("Overwhelming Encounter", 245, Rarity.UNCOMMON, mage.cards.o.OverwhelmingEncounter.class));
cards.add(new SetCardInfo("Owlbear Shepherd", 247, Rarity.UNCOMMON, mage.cards.o.OwlbearShepherd.class));
cards.add(new SetCardInfo("Pack Attack", 190, Rarity.COMMON, mage.cards.p.PackAttack.class));
cards.add(new SetCardInfo("Parasitic Impetus", 140, Rarity.COMMON, mage.cards.p.ParasiticImpetus.class));
cards.add(new SetCardInfo("Passageway Seer", 141, Rarity.UNCOMMON, mage.cards.p.PassagewaySeer.class));
cards.add(new SetCardInfo("Patriar's Seal", 332, Rarity.UNCOMMON, mage.cards.p.PatriarsSeal.class));