[CMM] Implement Commodore Guff

This commit is contained in:
theelk801 2023-05-06 09:06:22 -04:00
parent eaca4c01ac
commit cd3fb997a7
4 changed files with 139 additions and 0 deletions

View file

@ -0,0 +1,79 @@
package mage.cards.c;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.CanBeYourCommanderAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DamagePlayersEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledPlaneswalkerPermanent;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.game.permanent.token.CommodoreGuffToken;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class CommodoreGuff extends CardImpl {
private static final FilterPermanent filter
= new FilterControlledPlaneswalkerPermanent("another target planeswalker you control");
static {
filter.add(AnotherPredicate.instance);
}
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(StaticFilters.FILTER_CONTROLLED_PERMANENT_PLANESWALKER);
private static final Hint hint = new ValueHint("Planeswalkers you control", xValue);
public CommodoreGuff(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{1}{U}{R}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.GUFF);
this.setStartingLoyalty(6);
// At the beginning of your end step, put a loyalty counter on another target planeswalker you control.
Ability ability = new BeginningOfEndStepTriggeredAbility(
new AddCountersTargetEffect(CounterType.LOYALTY.createInstance()), TargetController.YOU, false
);
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
// +1: Create a 1/1 red Wizard creature token with "{T}: Add {R}. Spend this mana only to cast a planeswalker spell."
this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new CommodoreGuffToken()), 1));
// -3: You draw X cards and Commodore Guff deals X damage to each opponent, where X is the number of planeswalkers you control.
ability = new LoyaltyAbility(new DrawCardSourceControllerEffect(xValue).setText("you draw X cards"), -3);
ability.addEffect(new DamagePlayersEffect(
Outcome.Damage, xValue, TargetController.OPPONENT
).concatBy("and"));
this.addAbility(ability.addHint(hint));
// Commodore Guff can be your commander.
this.addAbility(CanBeYourCommanderAbility.getInstance());
}
private CommodoreGuff(final CommodoreGuff card) {
super(card);
}
@Override
public CommodoreGuff copy() {
return new CommodoreGuff(this);
}
}

View file

@ -19,6 +19,7 @@ public final class CommanderMasters extends ExpansionSet {
this.hasBoosters = false; //temporary
cards.add(new SetCardInfo("Capture of Jingzhou", 79, Rarity.RARE, mage.cards.c.CaptureOfJingzhou.class));
cards.add(new SetCardInfo("Commodore Guff", 706, Rarity.MYTHIC, mage.cards.c.CommodoreGuff.class));
cards.add(new SetCardInfo("Jeweled Lotus", 396, Rarity.MYTHIC, mage.cards.j.JeweledLotus.class));
cards.add(new SetCardInfo("Personal Tutor", 110, Rarity.RARE, mage.cards.p.PersonalTutor.class));
cards.add(new SetCardInfo("Selvala, Heart of the Wilds", 220, Rarity.MYTHIC, mage.cards.s.SelvalaHeartOfTheWilds.class));

View file

@ -448,6 +448,7 @@ public enum SubType {
GARRUK("Garruk", SubTypeSet.PlaneswalkerType),
GIDEON("Gideon", SubTypeSet.PlaneswalkerType),
GRIST("Grist", SubTypeSet.PlaneswalkerType),
GUFF("Guff", SubTypeSet.PlaneswalkerType),
HUATLI("Huatli", SubTypeSet.PlaneswalkerType),
JACE("Jace", SubTypeSet.PlaneswalkerType),
JARED("Jared", SubTypeSet.PlaneswalkerType),

View file

@ -0,0 +1,58 @@
package mage.game.permanent.token;
import mage.ConditionalMana;
import mage.MageInt;
import mage.Mana;
import mage.abilities.mana.ConditionalColoredManaAbility;
import mage.abilities.mana.builder.ConditionalManaBuilder;
import mage.abilities.mana.conditional.PlaneswalkerCastManaCondition;
import mage.constants.CardType;
import mage.constants.SubType;
/**
* @author TheElk801
*/
public final class CommodoreGuffToken extends TokenImpl {
public CommodoreGuffToken() {
super("Wizard Token", "1/1 red Wizard creature token with \"{T}: Add {R}. Spend this mana only to cast a planeswalker spell.\"");
cardType.add(CardType.CREATURE);
subtype.add(SubType.WIZARD);
color.setRed(true);
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(new ConditionalColoredManaAbility(Mana.RedMana(1), new CommodoreGuffTokenManaBuilder()));
setOriginalExpansionSetCode("CMM");
}
private CommodoreGuffToken(final CommodoreGuffToken token) {
super(token);
}
public CommodoreGuffToken copy() {
return new CommodoreGuffToken(this);
}
}
class CommodoreGuffTokenManaBuilder extends ConditionalManaBuilder {
@Override
public ConditionalMana build(Object... options) {
return new CommodoreGuffTokenConditionalMana(this.mana);
}
@Override
public String getRule() {
return "Spend this mana only to cast a planeswalker spell.";
}
}
class CommodoreGuffTokenConditionalMana extends ConditionalMana {
CommodoreGuffTokenConditionalMana(Mana mana) {
super(mana);
addCondition(new PlaneswalkerCastManaCondition());
}
}