[CLB] Implemented Amber Gristle O'Maul

This commit is contained in:
Evan Kranzler 2022-05-24 19:06:18 -04:00
parent a601df86a0
commit c36d5121de
2 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,96 @@
package mage.cards.a;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.ChooseABackgroundAbility;
import mage.abilities.costs.common.DiscardHandCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.game.Game;
import mage.game.combat.CombatGroup;
import java.util.Objects;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class AmberGristleOMaul extends CardImpl {
public AmberGristleOMaul(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.DWARF);
this.subtype.add(SubType.CLERIC);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Haste
this.addAbility(HasteAbility.getInstance());
// Whenver Amber Gristle O'Maul attacks, you may discard your hand. If you do, draw a card for each player you're attacking.
this.addAbility(new AttacksTriggeredAbility(new DoIfCostPaid(
new DrawCardSourceControllerEffect(AmberGristleOMaulValue.instance), new DiscardHandCost()
)));
// Choose a Background
this.addAbility(ChooseABackgroundAbility.getInstance());
}
private AmberGristleOMaul(final AmberGristleOMaul card) {
super(card);
}
@Override
public AmberGristleOMaul copy() {
return new AmberGristleOMaul(this);
}
}
enum AmberGristleOMaulValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return game
.getCombat()
.getGroups()
.stream()
.filter(combatGroup -> combatGroup
.getAttackers()
.stream()
.map(game::getControllerId)
.anyMatch(sourceAbility::isControlledBy))
.map(CombatGroup::getDefenderId)
.distinct()
.map(game::getPlayer)
.filter(Objects::nonNull)
.mapToInt(x -> 1)
.sum();
}
@Override
public AmberGristleOMaulValue copy() {
return this;
}
@Override
public String getMessage() {
return "player 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("Agent of the Iron Throne", 107, Rarity.UNCOMMON, mage.cards.a.AgentOfTheIronThrone.class));
cards.add(new SetCardInfo("Alora, Merry Thief", 55, Rarity.UNCOMMON, mage.cards.a.AloraMerryThief.class));
cards.add(new SetCardInfo("Amber Gristle O'Maul", 159, Rarity.UNCOMMON, mage.cards.a.AmberGristleOMaul.class));
cards.add(new SetCardInfo("Ambition's Cost", 110, Rarity.UNCOMMON, mage.cards.a.AmbitionsCost.class));
cards.add(new SetCardInfo("Amethyst Dragon", 160, Rarity.UNCOMMON, mage.cards.a.AmethystDragon.class));
cards.add(new SetCardInfo("Ancient Brass Dragon", 111, Rarity.MYTHIC, mage.cards.a.AncientBrassDragon.class));