[BRO] Implemented Splitting the Powerstone

This commit is contained in:
Evan Kranzler 2022-10-28 08:25:18 -04:00
parent acf140193f
commit 59afefd527
4 changed files with 71 additions and 3 deletions

View file

@ -0,0 +1,63 @@
package mage.cards.s;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.token.PowerstoneToken;
import mage.util.CardUtil;
import java.util.Collection;
import java.util.Objects;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SplittingThePowerstone extends CardImpl {
public SplittingThePowerstone(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}");
// As an additional cost to cast this spell, sacrifice an artifact.
this.getSpellAbility().addCost(new SacrificeTargetCost(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT_AN));
// Create two tapped Powerstone tokens. If the sacrificed artifact was legendary, draw a card.
this.getSpellAbility().addEffect(new CreateTokenEffect(new PowerstoneToken(), 2, false));
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new DrawCardSourceControllerEffect(1), SplittingThePowerstoneCondition.instance,
"If the sacrificed artifact was legendary, draw a card"
));
}
private SplittingThePowerstone(final SplittingThePowerstone card) {
super(card);
}
@Override
public SplittingThePowerstone copy() {
return new SplittingThePowerstone(this);
}
}
enum SplittingThePowerstoneCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
return CardUtil
.castStream(source.getCosts().stream(), SacrificeTargetCost.class)
.map(SacrificeTargetCost::getPermanents)
.flatMap(Collection::stream)
.filter(Objects::nonNull)
.anyMatch(MageObject::isLegendary);
}
}

View file

@ -47,9 +47,9 @@ public final class UrzaPowerstoneProdigy extends CardImpl {
this.addAbility(ability);
// Whenever you discard one or more artifact cards, create a tapped Powerstone token. This ability triggers only once each turn.
this.addAbility(new DiscardCardControllerTriggeredAbility(new CreateTokenEffect(
new PowerstoneToken(), 1, true, false
), false, filter).setTriggersOnce(true));
this.addAbility(new DiscardCardControllerTriggeredAbility(
new CreateTokenEffect(new PowerstoneToken(), 1, true), false, filter
).setTriggersOnce(true));
}
private UrzaPowerstoneProdigy(final UrzaPowerstoneProdigy card) {

View file

@ -36,6 +36,7 @@ public final class TheBrothersWar extends ExpansionSet {
cards.add(new SetCardInfo("Queen Kayla bin-Kroog", 218, Rarity.RARE, mage.cards.q.QueenKaylaBinKroog.class));
cards.add(new SetCardInfo("Recruitment Officer", 23, Rarity.UNCOMMON, mage.cards.r.RecruitmentOfficer.class));
cards.add(new SetCardInfo("Scrapwork Cohort", 37, Rarity.COMMON, mage.cards.s.ScrapworkCohort.class));
cards.add(new SetCardInfo("Splitting the Powerstone", 63, Rarity.UNCOMMON, mage.cards.s.SplittingThePowerstone.class));
cards.add(new SetCardInfo("Surge Engine", 81, Rarity.MYTHIC, mage.cards.s.SurgeEngine.class));
cards.add(new SetCardInfo("Swamp", 282, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("The Mightstone and Weakstone", "238a", Rarity.RARE, mage.cards.t.TheMightstoneAndWeakstone.class));

View file

@ -43,6 +43,10 @@ public class CreateTokenEffect extends OneShotEffect {
this(token, amount, false, false);
}
public CreateTokenEffect(Token token, int amount, boolean tapped) {
this(token, amount, tapped, false);
}
public CreateTokenEffect(Token token, int amount, boolean tapped, boolean attacking) {
this(token, StaticValue.get(amount), tapped, attacking);
}