Implemented Flawless Maneuver

This commit is contained in:
Evan Kranzler 2020-04-04 19:31:45 -04:00
parent 3019fb30d4
commit 5b58e6df0c
3 changed files with 76 additions and 0 deletions

View file

@ -0,0 +1,40 @@
package mage.cards.f;
import mage.abilities.condition.common.ControlACommanderCondition;
import mage.abilities.costs.AlternativeCostSourceAbility;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class FlawlessManeuver extends CardImpl {
public FlawlessManeuver(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}");
// If you control a commander, you may cast this spell without paying its mana cost.
this.addAbility(new AlternativeCostSourceAbility(null, ControlACommanderCondition.instance));
// Creatures you control gain indestructible until end of turn.
this.getSpellAbility().addEffect(new GainAbilityControlledEffect(
IndestructibleAbility.getInstance(), Duration.EndOfTurn
));
}
private FlawlessManeuver(final FlawlessManeuver card) {
super(card);
}
@Override
public FlawlessManeuver copy() {
return new FlawlessManeuver(this);
}
}
// outstanding move!

View file

@ -26,6 +26,7 @@ public final class Commander2020Edition extends ExpansionSet {
cards.add(new SetCardInfo("Brallin, Skyshark Rider", 4, Rarity.MYTHIC, mage.cards.b.BrallinSkysharkRider.class));
cards.add(new SetCardInfo("Crop Rotation", 169, Rarity.COMMON, mage.cards.c.CropRotation.class));
cards.add(new SetCardInfo("Curious Herd", 59, Rarity.RARE, mage.cards.c.CuriousHerd.class));
cards.add(new SetCardInfo("Flawless Maneuver", 26, Rarity.RARE, mage.cards.f.FlawlessManeuver.class));
cards.add(new SetCardInfo("Lifecrafter's Bestiary", 244, Rarity.RARE, mage.cards.l.LifecraftersBestiary.class));
cards.add(new SetCardInfo("Netherborn Altar", 45, Rarity.RARE, mage.cards.n.NetherbornAltar.class));
cards.add(new SetCardInfo("Rashmi, Eternities Crafter", 229, Rarity.RARE, mage.cards.r.RashmiEternitiesCrafter.class));

View file

@ -0,0 +1,35 @@
package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.constants.CommanderCardType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.Collection;
import java.util.Objects;
/**
* @author TheElk801
*/
public enum ControlACommanderCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
return game.getPlayerList()
.stream()
.map(game::getPlayer)
.filter(Objects::nonNull)
.map(player -> game.getCommandersIds(player, CommanderCardType.COMMANDER_OR_OATHBREAKER))
.flatMap(Collection::stream)
.map(game::getPermanent)
.map(Permanent::getControllerId)
.anyMatch(source.getControllerId()::equals);
}
@Override
public String toString() {
return "If you control a commander";
}
}