diff --git a/Mage.Sets/src/mage/cards/s/SisayWeatherlightCaptain.java b/Mage.Sets/src/mage/cards/s/SisayWeatherlightCaptain.java new file mode 100644 index 00000000000..7ab3e5f2c96 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SisayWeatherlightCaptain.java @@ -0,0 +1,124 @@ +package mage.cards.s; + +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.common.FilterPermanentCard; +import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; +import mage.filter.predicate.mageobject.SupertypePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCardInLibrary; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SisayWeatherlightCaptain extends CardImpl { + + public SisayWeatherlightCaptain(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SOLDIER); + + // Sisay, Weatherlight Captain gets +1/+1 for each color among other legendary permanents you control. + this.addAbility(new SimpleStaticAbility(new BoostSourceEffect( + SisayWeatherlightCaptainValue.instance, + SisayWeatherlightCaptainValue.instance, + Duration.WhileOnBattlefield + ))); + + // {W}{U}{B}{R}{G}: Search your library for a legendary permanent card with converted mana cost less than Sisay's power, put that card onto the battlefield, then shuffle your library. + this.addAbility(new SimpleActivatedAbility( + new SisayWeatherlightCaptainEffect(), + new ManaCostsImpl("{W}{U}{B}{R}{G}") + )); + } + + private SisayWeatherlightCaptain(final SisayWeatherlightCaptain card) { + super(card); + } + + @Override + public SisayWeatherlightCaptain copy() { + return new SisayWeatherlightCaptain(this); + } +} + +enum SisayWeatherlightCaptainValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + ObjectColor color = new ObjectColor(); + for (Permanent permanent : game.getBattlefield().getAllActivePermanents( + StaticFilters.FILTER_PERMANENT_LEGENDARY, sourceAbility.getControllerId(), game + )) { + if (permanent != null && !permanent.getId().equals(sourceAbility.getSourceId())) { + color.addColor(permanent.getColor(game)); + } + } + return color.getColorCount(); + } + + @Override + public DynamicValue copy() { + return instance; + } + + @Override + public String getMessage() { + return "color among other legendary permanents you control"; + } + + @Override + public String toString() { + return "1"; + } +} + +class SisayWeatherlightCaptainEffect extends OneShotEffect { + + SisayWeatherlightCaptainEffect() { + super(Outcome.Benefit); + staticText = "Search your library for a legendary permanent card with converted mana cost " + + "less than {this}'s power, put that card onto the battlefield, then shuffle your library."; + } + + private SisayWeatherlightCaptainEffect(final SisayWeatherlightCaptainEffect effect) { + super(effect); + } + + @Override + public SisayWeatherlightCaptainEffect copy() { + return new SisayWeatherlightCaptainEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (permanent == null) { + return false; + } + int power = permanent.getPower().getValue(); + FilterCard filter = new FilterPermanentCard("permanent card with converted mana cost less than " + power); + filter.add(new SupertypePredicate(SuperType.LEGENDARY)); + filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, power)); + return new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)).apply(game, source); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ModernHorizons.java b/Mage.Sets/src/mage/sets/ModernHorizons.java index 2a05e69bb65..3877c062a88 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons.java @@ -71,6 +71,7 @@ public final class ModernHorizons extends ExpansionSet { cards.add(new SetCardInfo("Seasoned Pyromancer", 145, Rarity.MYTHIC, mage.cards.s.SeasonedPyromancer.class)); cards.add(new SetCardInfo("Serra the Benevolent", 26, Rarity.MYTHIC, mage.cards.s.SerraTheBenevolent.class)); cards.add(new SetCardInfo("Silent Clearing", 246, Rarity.RARE, mage.cards.s.SilentClearing.class)); + cards.add(new SetCardInfo("Sisay, Weatherlight Captain", 29, Rarity.RARE, mage.cards.s.SisayWeatherlightCaptain.class)); cards.add(new SetCardInfo("Snow-Covered Forest", 254, Rarity.LAND, mage.cards.s.SnowCoveredForest.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Snow-Covered Island", 251, Rarity.LAND, mage.cards.s.SnowCoveredIsland.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Snow-Covered Mountain", 253, Rarity.LAND, mage.cards.s.SnowCoveredMountain.class, FULL_ART_BFZ_VARIOUS));