diff --git a/Mage.Sets/src/mage/cards/s/SwordCoastSerpent.java b/Mage.Sets/src/mage/cards/s/SwordCoastSerpent.java new file mode 100644 index 0000000000..9249ffee50 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SwordCoastSerpent.java @@ -0,0 +1,73 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalRestrictionEffect; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect; +import mage.cards.AdventureCard; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.target.common.TargetCreaturePermanent; +import mage.watchers.common.SpellsCastWatcher; + +import java.util.List; +import java.util.Objects; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SwordCoastSerpent extends AdventureCard { + + public SwordCoastSerpent(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, new CardType[]{CardType.INSTANT}, "{5}{U}{U}", "Capsizing Wave", "{1}{U}"); + + this.subtype.add(SubType.SERPENT); + this.subtype.add(SubType.DRAGON); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // Sword Coast Serpent can't be blocked as long as you've cast a noncreature spell this turn. + this.addAbility(new SimpleStaticAbility(new ConditionalRestrictionEffect( + new CantBeBlockedSourceEffect(), SwordCoastSerpentCondition.instance, + "{this} can't be blocked as long as you've cast a noncreature spell this turn" + )), new SpellsCastWatcher()); + + // Capsizing Wave + // Return target creature to its owner's hand. + this.getSpellCard().getSpellAbility().addEffect(new ReturnToHandTargetEffect()); + this.getSpellCard().getSpellAbility().addTarget(new TargetCreaturePermanent()); + } + + private SwordCoastSerpent(final SwordCoastSerpent card) { + super(card); + } + + @Override + public SwordCoastSerpent copy() { + return new SwordCoastSerpent(this); + } +} + +enum SwordCoastSerpentCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + SpellsCastWatcher watcher = game.getState().getWatcher(SpellsCastWatcher.class); + if (watcher == null) { + return false; + } + List spells = watcher.getSpellsCastThisTurn(source.getControllerId()); + return spells != null && spells + .stream() + .filter(Objects::nonNull) + .anyMatch(spell -> !spell.isCreature(game)); + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index 98c2acb3ae..93dd72760b 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -256,6 +256,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Swamp", 459, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Swiftfoot Boots", 339, Rarity.UNCOMMON, mage.cards.s.SwiftfootBoots.class)); cards.add(new SetCardInfo("Sword Coast Sailor", 98, Rarity.UNCOMMON, mage.cards.s.SwordCoastSailor.class)); + cards.add(new SetCardInfo("Sword Coast Serpent", 99, Rarity.COMMON, mage.cards.s.SwordCoastSerpent.class)); cards.add(new SetCardInfo("Tabaxi Toucaneers", 46, Rarity.COMMON, mage.cards.t.TabaxiToucaneers.class)); cards.add(new SetCardInfo("Tasha, the Witch Queen", 294, Rarity.MYTHIC, mage.cards.t.TashaTheWitchQueen.class)); cards.add(new SetCardInfo("Taunting Kobold", 199, Rarity.UNCOMMON, mage.cards.t.TauntingKobold.class));