From dab3dfdc5aa8152595292aa57a254f8d50da5198 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 11 Apr 2021 10:52:16 -0400 Subject: [PATCH] [STX] Implemented Extus, Oriq Overlord / Awaken the Blood Avatar --- .../src/mage/cards/e/ExtusOriqOverlord.java | 132 ++++++++++++++++++ .../mage/sets/StrixhavenSchoolOfMages.java | 1 + .../permanent/token/BloodAvatarToken.java | 38 +++++ 3 files changed, 171 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/e/ExtusOriqOverlord.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/BloodAvatarToken.java diff --git a/Mage.Sets/src/mage/cards/e/ExtusOriqOverlord.java b/Mage.Sets/src/mage/cards/e/ExtusOriqOverlord.java new file mode 100644 index 0000000000..bd7ce32d28 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/ExtusOriqOverlord.java @@ -0,0 +1,132 @@ +package mage.cards.e; + +import mage.abilities.Ability; +import mage.abilities.SpellAbility; +import mage.abilities.common.MagecraftAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.SacrificeXTargetCost; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect; +import mage.abilities.effects.common.SacrificeOpponentsEffect; +import mage.abilities.effects.common.cost.CostModificationEffectImpl; +import mage.abilities.keyword.DoubleStrikeAbility; +import mage.cards.CardSetInfo; +import mage.cards.ModalDoubleFacesCard; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.game.permanent.token.BloodAvatarToken; +import mage.target.common.TargetCardInYourGraveyard; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ExtusOriqOverlord extends ModalDoubleFacesCard { + + private static final FilterCard filter + = new FilterCreatureCard("nonlegendary creature card from your graveyard"); + + static { + filter.add(Predicates.not(SuperType.LEGENDARY.getPredicate())); + } + + public ExtusOriqOverlord(UUID ownerId, CardSetInfo setInfo) { + super( + ownerId, setInfo, + new CardType[]{CardType.CREATURE}, new SubType[]{SubType.HUMAN, SubType.WARLOCK}, "{1}{W}{B}{B}", + "Awaken the Blood Avatar", + new CardType[]{CardType.SORCERY}, new SubType[]{}, "{6}{B}{R}" + ); + + // 1. + // Extus, Oriq Overlord + // Legendary Creature - Human Warlock + this.getLeftHalfCard().addSuperType(SuperType.LEGENDARY); + this.getLeftHalfCard().setPT(2, 4); + + // Double strike + this.getLeftHalfCard().addAbility(DoubleStrikeAbility.getInstance()); + + // Magecraft — Whenever you cast or copy an instant or sorcery spell, return target nonlegendary creature card from your graveyard to your hand. + Ability ability = new MagecraftAbility(new ReturnFromGraveyardToHandTargetEffect()); + ability.addTarget(new TargetCardInYourGraveyard(filter)); + this.getLeftHalfCard().addAbility(ability); + + // 2. + // Awaken the Blood Avatar + // Sorcery + // As an additional cost to cast this spell, you may sacrifice any number of creatures. This spell costs {2} less to cast for each creature sacrificed this way. + Cost cost = new SacrificeXTargetCost(StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT); + cost.setText("As an additional cost to cast this spell, you may sacrifice any number of creatures"); + this.getRightHalfCard().getSpellAbility().addCost(cost); + this.getRightHalfCard().addAbility(new SimpleStaticAbility( + Zone.ALL, new AwakenTheBloodAvatarCostReductionEffect() + )); + + // Each opponent sacrifices a creature. Create a 3/6 black and red Avatar creature token with haste and "Whenever this creature attacks, it deals 3 damage to each opponent." + this.getRightHalfCard().getSpellAbility().addEffect(new SacrificeOpponentsEffect( + StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT + )); + this.getRightHalfCard().getSpellAbility().addEffect(new CreateTokenEffect(new BloodAvatarToken())); + } + + private ExtusOriqOverlord(final ExtusOriqOverlord card) { + super(card); + } + + @Override + public ExtusOriqOverlord copy() { + return new ExtusOriqOverlord(this); + } +} + +class AwakenTheBloodAvatarCostReductionEffect extends CostModificationEffectImpl { + + AwakenTheBloodAvatarCostReductionEffect() { + super(Duration.WhileOnStack, Outcome.Benefit, CostModificationType.REDUCE_COST); + staticText = "This spell costs {2} less to cast for each creature sacrificed this way"; + } + + private AwakenTheBloodAvatarCostReductionEffect(final AwakenTheBloodAvatarCostReductionEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source, Ability abilityToModify) { + SpellAbility spellAbility = (SpellAbility) abilityToModify; + for (Cost cost : spellAbility.getCosts()) { + if (!(cost instanceof SacrificeXTargetCost)) { + continue; + } + if (game.inCheckPlayableState()) { + // allows to cast in getPlayable + int reduction = ((SacrificeXTargetCost) cost).getMaxValue(spellAbility, game); + CardUtil.adjustCost(spellAbility, reduction * 2); + } else { + // real cast + int reduction = ((SacrificeXTargetCost) cost).getAmount(); + CardUtil.adjustCost(spellAbility, reduction * 2); + } + + break; + } + return true; + } + + @Override + public boolean applies(Ability abilityToModify, Ability source, Game game) { + return abilityToModify instanceof SpellAbility && abilityToModify.getSourceId().equals(source.getSourceId()); + } + + @Override + public AwakenTheBloodAvatarCostReductionEffect copy() { + return new AwakenTheBloodAvatarCostReductionEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java index d7abd92588..c462f751d7 100644 --- a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java +++ b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java @@ -111,6 +111,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet { cards.add(new SetCardInfo("Expel", 18, Rarity.COMMON, mage.cards.e.Expel.class)); cards.add(new SetCardInfo("Explosive Welcome", 100, Rarity.UNCOMMON, mage.cards.e.ExplosiveWelcome.class)); cards.add(new SetCardInfo("Exponential Growth", 130, Rarity.RARE, mage.cards.e.ExponentialGrowth.class)); + cards.add(new SetCardInfo("Extus, Oriq Overlord", 149, Rarity.MYTHIC, mage.cards.e.ExtusOriqOverlord.class)); cards.add(new SetCardInfo("Eyetwitch", 70, Rarity.UNCOMMON, mage.cards.e.Eyetwitch.class)); cards.add(new SetCardInfo("Fervent Mastery", 101, Rarity.RARE, mage.cards.f.FerventMastery.class)); cards.add(new SetCardInfo("Field Trip", 131, Rarity.COMMON, mage.cards.f.FieldTrip.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/BloodAvatarToken.java b/Mage/src/main/java/mage/game/permanent/token/BloodAvatarToken.java new file mode 100644 index 0000000000..ae42520f57 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/BloodAvatarToken.java @@ -0,0 +1,38 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.common.DamagePlayersEffect; +import mage.abilities.keyword.HasteAbility; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.TargetController; + +/** + * @author TheElk801 + */ +public final class BloodAvatarToken extends TokenImpl { + + public BloodAvatarToken() { + super("Avatar", "3/6 black and red Avatar creature token with haste and \"Whenever this creature attacks, it deals 3 damage to each opponent.\""); + cardType.add(CardType.CREATURE); + color.setBlack(true); + color.setRed(true); + subtype.add(SubType.AVATAR); + power = new MageInt(3); + toughness = new MageInt(6); + addAbility(HasteAbility.getInstance()); + addAbility(new AttacksTriggeredAbility( + new DamagePlayersEffect(3, TargetController.OPPONENT), false, + "Whenever this creature attacks, it deals 3 damage to each opponent." + )); + } + + private BloodAvatarToken(final BloodAvatarToken token) { + super(token); + } + + public BloodAvatarToken copy() { + return new BloodAvatarToken(this); + } +}