Implemented Sisay, Weatherlight Captain

This commit is contained in:
Evan Kranzler 2019-05-23 17:30:52 -04:00
parent 76fd36456c
commit 3374b1bb30
2 changed files with 125 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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));