[40K] Implemented Magnus the Red

This commit is contained in:
Evan Kranzler 2022-10-05 20:03:05 -04:00
parent c4a58aa650
commit 50acdbb823
4 changed files with 136 additions and 0 deletions

View file

@ -0,0 +1,107 @@
package mage.cards.m;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.permanent.token.SpawnToken;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class MagnusTheRed extends CardImpl {
public MagnusTheRed(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{R}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.DEMON);
this.subtype.add(SubType.PRIMARCH);
this.power = new MageInt(4);
this.toughness = new MageInt(5);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Unearthly Power -- Instant and sorcery spells you cast cost {1} less to cast for each creature token you control.
this.addAbility(new SimpleStaticAbility(new MagnusTheRedEffect())
.withFlavorWord("Unearthly Power")
.addHint(MagnusTheRedEffect.getHint()));
// Blade of Magnus -- Whenever Magnus the Red deals combat damage to a player, create a 3/3 red Spawn creature token.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
new CreateTokenEffect(new SpawnToken()), false
).withFlavorWord("Blade of Magnus"));
}
private MagnusTheRed(final MagnusTheRed card) {
super(card);
}
@Override
public MagnusTheRed copy() {
return new MagnusTheRed(this);
}
}
class MagnusTheRedEffect extends CostModificationEffectImpl {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent();
static {
filter.add(TokenPredicate.TRUE);
}
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter);
private static final Hint hint = new ValueHint("Creature tokens you control", xValue);
MagnusTheRedEffect() {
super(Duration.WhileOnStack, Outcome.Benefit, CostModificationType.REDUCE_COST);
staticText = "instant and sorcery spells you cast cost {1} less to cast for each creature token you control";
}
private MagnusTheRedEffect(final MagnusTheRedEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
CardUtil.reduceCost(abilityToModify, xValue.calculate(game, source, this));
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
return abilityToModify instanceof SpellAbility
&& abilityToModify.isControlledBy(source.getControllerId())
&& ((SpellAbility) abilityToModify).getCharacteristics(game).isInstantOrSorcery(game)
&& game.getCard(abilityToModify.getSourceId()) != null;
}
@Override
public MagnusTheRedEffect copy() {
return new MagnusTheRedEffect(this);
}
public static Hint getHint() {
return hint;
}
}

View file

@ -149,6 +149,7 @@ public final class Warhammer40000 extends ExpansionSet {
cards.add(new SetCardInfo("Lokhust Heavy Destroyer", 38, Rarity.RARE, mage.cards.l.LokhustHeavyDestroyer.class)); cards.add(new SetCardInfo("Lokhust Heavy Destroyer", 38, Rarity.RARE, mage.cards.l.LokhustHeavyDestroyer.class));
cards.add(new SetCardInfo("Lord of Change", 24, Rarity.RARE, mage.cards.l.LordOfChange.class)); cards.add(new SetCardInfo("Lord of Change", 24, Rarity.RARE, mage.cards.l.LordOfChange.class));
cards.add(new SetCardInfo("Lychguard", 39, Rarity.RARE, mage.cards.l.Lychguard.class)); cards.add(new SetCardInfo("Lychguard", 39, Rarity.RARE, mage.cards.l.Lychguard.class));
cards.add(new SetCardInfo("Magnus the Red", 131, Rarity.RARE, mage.cards.m.MagnusTheRed.class));
cards.add(new SetCardInfo("Malanthrope", 132, Rarity.RARE, mage.cards.m.Malanthrope.class)); cards.add(new SetCardInfo("Malanthrope", 132, Rarity.RARE, mage.cards.m.Malanthrope.class));
cards.add(new SetCardInfo("Mandate of Abaddon", 40, Rarity.RARE, mage.cards.m.MandateOfAbaddon.class)); cards.add(new SetCardInfo("Mandate of Abaddon", 40, Rarity.RARE, mage.cards.m.MandateOfAbaddon.class));
cards.add(new SetCardInfo("Martial Coup", 189, Rarity.RARE, mage.cards.m.MartialCoup.class)); cards.add(new SetCardInfo("Martial Coup", 189, Rarity.RARE, mage.cards.m.MartialCoup.class));

View file

@ -295,6 +295,7 @@ public enum SubType {
PIRATE("Pirate", SubTypeSet.CreatureType), PIRATE("Pirate", SubTypeSet.CreatureType),
PLANT("Plant", SubTypeSet.CreatureType), PLANT("Plant", SubTypeSet.CreatureType),
PRAETOR("Praetor", SubTypeSet.CreatureType), PRAETOR("Praetor", SubTypeSet.CreatureType),
PRIMARCH("Primarch", SubTypeSet.CreatureType),
PRISM("Prism", SubTypeSet.CreatureType), PRISM("Prism", SubTypeSet.CreatureType),
PROCESSOR("Processor", SubTypeSet.CreatureType), PROCESSOR("Processor", SubTypeSet.CreatureType),
PUREBLOOD("Pureblood", SubTypeSet.CreatureType, true), PUREBLOOD("Pureblood", SubTypeSet.CreatureType, true),

View file

@ -0,0 +1,27 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.SubType;
/**
* @author TheElk801
*/
public final class SpawnToken extends TokenImpl {
public SpawnToken() {
super("Spawn Token", "3/3 red Spawn creature token");
cardType.add(CardType.CREATURE);
this.subtype.add(SubType.SPAWN);
power = new MageInt(3);
toughness = new MageInt(3);
}
public SpawnToken(final SpawnToken token) {
super(token);
}
public SpawnToken copy() {
return new SpawnToken(this);
}
}