[LCI] Implement Malcolm, Alluring Scoundrel

This commit is contained in:
Susucre 2023-10-29 13:22:47 +01:00
parent 9707ba9a35
commit db7198620e
3 changed files with 102 additions and 1 deletions

View file

@ -0,0 +1,99 @@
package mage.cards.m;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlashAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author Susucr
*/
public final class MalcolmAlluringScoundrel extends CardImpl {
public MalcolmAlluringScoundrel(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.SIREN);
this.subtype.add(SubType.PIRATE);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Flash
this.addAbility(FlashAbility.getInstance());
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever Malcolm, Alluring Scoundrel deals combat damage to a player, put a chorus counter on it. Draw a card, then discard a card. If there are four or more chorus counters on Malcolm, you may cast the discarded card without paying its mana cost.
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(
new AddCountersSourceEffect(CounterType.CHORUS.createInstance()), false
);
ability.addEffect(new MalcolmAlluringScoundrelEffect());
this.addAbility(ability);
}
private MalcolmAlluringScoundrel(final MalcolmAlluringScoundrel card) {
super(card);
}
@Override
public MalcolmAlluringScoundrel copy() {
return new MalcolmAlluringScoundrel(this);
}
}
class MalcolmAlluringScoundrelEffect extends OneShotEffect {
MalcolmAlluringScoundrelEffect() {
super(Outcome.Benefit);
staticText = "Draw a card, then discard a card. "
+ "If there are four or more chorus counters on {this}, you may cast the discarded card without paying its mana cost.";
}
private MalcolmAlluringScoundrelEffect(final MalcolmAlluringScoundrelEffect effect) {
super(effect);
}
@Override
public MalcolmAlluringScoundrelEffect copy() {
return new MalcolmAlluringScoundrelEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
controller.drawCards(1, source, game);
Cards cards = controller.discard(1, false, false, source, game);
Permanent malcolm = source.getSourcePermanentOrLKI(game);
if (!cards.isEmpty() && malcolm != null && malcolm.getCounters(game).getCount(CounterType.CHORUS) >= 4) {
CardUtil.castSpellWithAttributesForFree(controller, source, game, cards, StaticFilters.FILTER_CARD);
}
return true;
}
}

View file

@ -76,6 +76,7 @@ public final class TheLostCavernsOfIxalan extends ExpansionSet {
cards.add(new SetCardInfo("Kellan, Daring Traveler", 231, Rarity.RARE, mage.cards.k.KellanDaringTraveler.class));
cards.add(new SetCardInfo("Kinjalli's Dawnrunner", 19, Rarity.UNCOMMON, mage.cards.k.KinjallisDawnrunner.class));
cards.add(new SetCardInfo("Malamet War Scribe", 21, Rarity.UNCOMMON, mage.cards.m.MalametWarScribe.class));
cards.add(new SetCardInfo("Malcolm, Alluring Scoundrel", 63, Rarity.RARE, mage.cards.m.MalcolmAlluringScoundrel.class));
cards.add(new SetCardInfo("Master's Guide-Mural", 233, Rarity.UNCOMMON, mage.cards.m.MastersGuideMural.class));
cards.add(new SetCardInfo("Master's Manufactory", 233, Rarity.UNCOMMON, mage.cards.m.MastersManufactory.class));
cards.add(new SetCardInfo("Matzalantli, the Great Door", 256, Rarity.RARE, mage.cards.m.MatzalantliTheGreatDoor.class));

View file

@ -35,6 +35,7 @@ public enum CounterType {
CARRION("carrion"),
CHARGE("charge"),
CHIP("chip"),
CHORUS("chorus"),
COIN("coin"),
COLLECTION("collection"),
COMPONENT("component"),
@ -228,7 +229,7 @@ public enum CounterType {
}
CounterType(String name) {
this(name, "aeiou".contains( String.valueOf( name.charAt( 0 ) ) ) ? "an" : "a");
this(name, "aeiou".contains(String.valueOf(name.charAt(0))) ? "an" : "a");
}
CounterType(String name, String article) {