diff --git a/Mage.Sets/src/mage/cards/s/SokkaSwordmaster.java b/Mage.Sets/src/mage/cards/s/SokkaSwordmaster.java new file mode 100644 index 00000000000..ef87f0e83d3 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SokkaSwordmaster.java @@ -0,0 +1,97 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.SpellAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.cost.CostModificationEffectImpl; +import mage.abilities.keyword.VigilanceAbility; +import mage.abilities.triggers.BeginningOfCombatTriggeredAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.target.TargetPermanent; +import mage.util.CardUtil; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SokkaSwordmaster extends CardImpl { + + public SokkaSwordmaster(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WARRIOR); + this.subtype.add(SubType.ALLY); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // Equipment spells you cast cost {1} less to cast for each Ally you control. + this.addAbility(new SimpleStaticAbility(new SokkaSwordmasterEffect()).addHint(AffinityType.ALLIES.getHint())); + + // At the beginning of combat on your turn, attach up to one target Equipment you control to Sokka. + Ability ability = new BeginningOfCombatTriggeredAbility( + new AttachEffect(Outcome.BoostCreature, "attach up to one target Equipment you control to {this}" + )); + ability.addTarget(new TargetPermanent( + 0, 1, StaticFilters.FILTER_CONTROLLED_PERMANENT_EQUIPMENT + )); + this.addAbility(ability); + } + + private SokkaSwordmaster(final SokkaSwordmaster card) { + super(card); + } + + @Override + public SokkaSwordmaster copy() { + return new SokkaSwordmaster(this); + } +} + +class SokkaSwordmasterEffect extends CostModificationEffectImpl { + + SokkaSwordmasterEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST); + staticText = "Equipment spells you cast cost {1} less to cast for each Ally you control"; + } + + private SokkaSwordmasterEffect(final SokkaSwordmasterEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source, Ability abilityToModify) { + CardUtil.reduceCost(abilityToModify, game.getBattlefield().count(AffinityType.ALLIES.getFilter(), source.getControllerId(), source, game)); + return true; + } + + @Override + public boolean applies(Ability abilityToModify, Ability source, Game game) { + return Optional + .ofNullable(abilityToModify) + .filter(SpellAbility.class::isInstance) + .filter(spellAbility -> spellAbility.isControlledBy(source.getControllerId())) + .map(SpellAbility.class::cast) + .map(spellAbility -> spellAbility.getCharacteristics(game)) + .filter(card -> card.hasSubtype(SubType.EQUIPMENT, game)) + .isPresent(); + } + + @Override + public SokkaSwordmasterEffect copy() { + return new SokkaSwordmasterEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/AvatarTheLastAirbenderEternal.java b/Mage.Sets/src/mage/sets/AvatarTheLastAirbenderEternal.java index f44f7fefa36..7e30d559048 100644 --- a/Mage.Sets/src/mage/sets/AvatarTheLastAirbenderEternal.java +++ b/Mage.Sets/src/mage/sets/AvatarTheLastAirbenderEternal.java @@ -247,6 +247,8 @@ public final class AvatarTheLastAirbenderEternal extends ExpansionSet { cards.add(new SetCardInfo("Sokka and Suki", 71, Rarity.RARE, mage.cards.s.SokkaAndSuki.class)); cards.add(new SetCardInfo("Sokka's Charge", 66, Rarity.RARE, mage.cards.s.SokkasCharge.class)); cards.add(new SetCardInfo("Sokka's Sword Training", 84, Rarity.COMMON, mage.cards.s.SokkasSwordTraining.class)); + cards.add(new SetCardInfo("Sokka, Swordmaster", 174, Rarity.MYTHIC, mage.cards.s.SokkaSwordmaster.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Sokka, Swordmaster", 83, Rarity.MYTHIC, mage.cards.s.SokkaSwordmaster.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Sokka, Wolf Cove's Protector", 219, Rarity.UNCOMMON, mage.cards.s.SokkaWolfCovesProtector.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Sokka, Wolf Cove's Protector", 274, Rarity.UNCOMMON, mage.cards.s.SokkaWolfCovesProtector.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Sol Ring", 316, Rarity.RARE, mage.cards.s.SolRing.class));