[BLB] Implement Star Charter

This commit is contained in:
theelk801 2024-07-17 10:19:13 -04:00
parent 835e9abea4
commit f7eeb75545
3 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,56 @@
package mage.cards.s;
import mage.MageInt;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.common.YouGainedOrLostLifeCondition;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.watchers.common.PlayerGainedLifeWatcher;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class StarCharter extends CardImpl {
private static final FilterCard filter = new FilterCreatureCard("a creature card with power 3 or less");
static {
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, 4));
}
public StarCharter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.subtype.add(SubType.BAT);
this.subtype.add(SubType.CLERIC);
this.power = new MageInt(3);
this.toughness = new MageInt(1);
// Flying
this.addAbility(FlyingAbility.getInstance());
// At the beginning of your end step, if you gained or lost life this turn, look at the top four cards of your library. You may reveal a creature card with power 3 or less from among them and put it into your hand. Put the rest on the bottom of your library in a random order.
this.addAbility(new BeginningOfEndStepTriggeredAbility(
new LookLibraryAndPickControllerEffect(
4, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM
), TargetController.YOU, YouGainedOrLostLifeCondition.instance, false
), new PlayerGainedLifeWatcher());
}
private StarCharter(final StarCharter card) {
super(card);
}
@Override
public StarCharter copy() {
return new StarCharter(this);
}
}

View file

@ -140,6 +140,7 @@ public final class Bloomburrow extends ExpansionSet {
cards.add(new SetCardInfo("Shrike Force", 31, Rarity.UNCOMMON, mage.cards.s.ShrikeForce.class));
cards.add(new SetCardInfo("Sinister Monolith", 113, Rarity.UNCOMMON, mage.cards.s.SinisterMonolith.class));
cards.add(new SetCardInfo("Splash Lasher", 73, Rarity.UNCOMMON, mage.cards.s.SplashLasher.class));
cards.add(new SetCardInfo("Star Charter", 33, Rarity.UNCOMMON, mage.cards.s.StarCharter.class));
cards.add(new SetCardInfo("Stargaze", 114, Rarity.UNCOMMON, mage.cards.s.Stargaze.class));
cards.add(new SetCardInfo("Starscape Cleric", 116, Rarity.UNCOMMON, mage.cards.s.StarscapeCleric.class));
cards.add(new SetCardInfo("Starseer Mentor", 233, Rarity.UNCOMMON, mage.cards.s.StarseerMentor.class));

View file

@ -0,0 +1,33 @@
package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Game;
import mage.watchers.common.PlayerGainedLifeWatcher;
import mage.watchers.common.PlayerLostLifeWatcher;
/**
* Needs PlayerGainedLifeWatcher to work
*
* @author TheElk801
*/
public enum YouGainedOrLostLifeCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
return game
.getState()
.getWatcher(PlayerGainedLifeWatcher.class)
.getLifeGained(source.getControllerId()) > 0
|| game
.getState()
.getWatcher(PlayerLostLifeWatcher.class)
.getLifeLost(source.getControllerId()) > 0;
}
@Override
public String toString() {
return "you gained or lost life this turn";
}
}