mirror of
https://github.com/correl/mage.git
synced 2025-01-13 03:00:10 +00:00
[MID] Implemented Sigarda's Splendor
This commit is contained in:
parent
10c85e40eb
commit
2c8314932e
2 changed files with 142 additions and 0 deletions
141
Mage.Sets/src/mage/cards/s/SigardasSplendor.java
Normal file
141
Mage.Sets/src/mage/cards/s/SigardasSplendor.java
Normal file
|
@ -0,0 +1,141 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SigardasSplendor extends CardImpl {
|
||||
|
||||
private static final FilterSpell filter = new FilterSpell("a white spell");
|
||||
|
||||
static {
|
||||
filter.add(new ColorPredicate(ObjectColor.WHITE));
|
||||
}
|
||||
|
||||
public SigardasSplendor(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}");
|
||||
|
||||
// As Sigarda's Splendor enters the battlefield, note your life total.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new SigardasSplendorNoteEffect()));
|
||||
|
||||
// At the beginning of your upkeep, draw a card if your life total is greater than or equal to the last noted life total for Sigarda's Splendor. Then note your life total.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
|
||||
new SigardasSplendorDrawEffect(), TargetController.YOU, false
|
||||
).addHint(SigardasSplendorHint.instance));
|
||||
|
||||
// Whenever you cast a white spell, you gain 1 life.
|
||||
this.addAbility(new SpellCastControllerTriggeredAbility(new GainLifeEffect(1), filter, false));
|
||||
}
|
||||
|
||||
private SigardasSplendor(final SigardasSplendor card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SigardasSplendor copy() {
|
||||
return new SigardasSplendor(this);
|
||||
}
|
||||
|
||||
static String getKey(Ability source, int offset) {
|
||||
return "SigardasSplendor_" + source.getControllerId() + "_" + source.getSourceId()
|
||||
+ "_" + (source.getSourceObjectZoneChangeCounter() + offset);
|
||||
}
|
||||
}
|
||||
|
||||
enum SigardasSplendorHint implements Hint {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public String getText(Game game, Ability ability) {
|
||||
if (ability.getSourcePermanentIfItStillExists(game) == null) {
|
||||
return null;
|
||||
}
|
||||
Object object = game.getState().getValue(SigardasSplendor.getKey(ability, 0));
|
||||
return "Last noted life total: " + (object != null ? (Integer) object : "None");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SigardasSplendorHint copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
class SigardasSplendorNoteEffect extends OneShotEffect {
|
||||
|
||||
SigardasSplendorNoteEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "note your life total";
|
||||
}
|
||||
|
||||
private SigardasSplendorNoteEffect(final SigardasSplendorNoteEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SigardasSplendorNoteEffect copy() {
|
||||
return new SigardasSplendorNoteEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
game.getState().setValue(SigardasSplendor.getKey(source, -1), player.getLife());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class SigardasSplendorDrawEffect extends OneShotEffect {
|
||||
|
||||
SigardasSplendorDrawEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "draw a card if your life total is greater than or equal " +
|
||||
"to the last noted life total for {this}. Then note your life total";
|
||||
}
|
||||
|
||||
private SigardasSplendorDrawEffect(final SigardasSplendorDrawEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SigardasSplendorDrawEffect copy() {
|
||||
return new SigardasSplendorDrawEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
String key = SigardasSplendor.getKey(source, 0);
|
||||
Object object = game.getState().getValue(key);
|
||||
int notedLife = object instanceof Integer ? (Integer) object : Integer.MIN_VALUE;
|
||||
if (player.getLife() >= notedLife) {
|
||||
player.drawCards(1, source, game);
|
||||
}
|
||||
game.getState().setValue(key, player.getLife());
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -270,6 +270,7 @@ public final class InnistradMidnightHunt extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Shipwreck Marsh", 267, Rarity.RARE, mage.cards.s.ShipwreckMarsh.class));
|
||||
cards.add(new SetCardInfo("Shipwreck Sifters", 74, Rarity.COMMON, mage.cards.s.ShipwreckSifters.class));
|
||||
cards.add(new SetCardInfo("Siege Zombie", 121, Rarity.COMMON, mage.cards.s.SiegeZombie.class));
|
||||
cards.add(new SetCardInfo("Sigarda's Splendor", 33, Rarity.RARE, mage.cards.s.SigardasSplendor.class));
|
||||
cards.add(new SetCardInfo("Sigarda, Champion of Light", 240, Rarity.MYTHIC, mage.cards.s.SigardaChampionOfLight.class));
|
||||
cards.add(new SetCardInfo("Sigardian Savior", 34, Rarity.MYTHIC, mage.cards.s.SigardianSavior.class));
|
||||
cards.add(new SetCardInfo("Silver Bolt", 258, Rarity.COMMON, mage.cards.s.SilverBolt.class));
|
||||
|
|
Loading…
Reference in a new issue