diff --git a/Mage.Sets/src/mage/cards/b/BalduvianFallen.java b/Mage.Sets/src/mage/cards/b/BalduvianFallen.java new file mode 100644 index 0000000000..6191b9cf44 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BalduvianFallen.java @@ -0,0 +1,89 @@ +package mage.cards.b; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.keyword.CumulativeUpkeepAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ManaEvent; + +/** + * + * @author noahg + */ +public final class BalduvianFallen extends CardImpl { + + public BalduvianFallen(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}"); + + this.subtype.add(SubType.ZOMBIE); + this.power = new MageInt(3); + this.toughness = new MageInt(5); + + // Cumulative upkeep {1} + this.addAbility(new CumulativeUpkeepAbility(new ManaCostsImpl("{1}"))); + + // Whenever Balduvian Fallen's cumulative upkeep is paid, it gets +1/+0 until end of turn for each {B} or {R} spent this way. + this.addAbility(new BalduvianFallenAbility()); + } + + public BalduvianFallen(final BalduvianFallen card) { + super(card); + } + + @Override + public BalduvianFallen copy() { + return new BalduvianFallen(this); + } +} + +class BalduvianFallenAbility extends TriggeredAbilityImpl { + + public BalduvianFallenAbility() { + super(Zone.BATTLEFIELD, null, false); + } + + public BalduvianFallenAbility(final BalduvianFallenAbility ability) { + super(ability); + } + + @Override + public BalduvianFallenAbility copy() { + return new BalduvianFallenAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.PAID_CUMULATIVE_UPKEEP; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + this.getEffects().clear(); + if(event.getSourceId() != null && event.getSourceId().equals(this.getSourceId()) && event instanceof ManaEvent) { + ManaEvent manaEvent = (ManaEvent) event; + int total = manaEvent.getMana().getBlack() + manaEvent.getMana().getRed(); + if (total > 0) { + this.getEffects().add(new BoostSourceEffect(total, 0, Duration.EndOfTurn)); + } + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever {this}'s cumulative upkeep is paid, it gets +1/+0 until end of turn for each {B} or {R} spent this way"; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Coldsnap.java b/Mage.Sets/src/mage/sets/Coldsnap.java index a0f628dcc9..ea3035a01e 100644 --- a/Mage.Sets/src/mage/sets/Coldsnap.java +++ b/Mage.Sets/src/mage/sets/Coldsnap.java @@ -35,6 +35,7 @@ public final class Coldsnap extends ExpansionSet { cards.add(new SetCardInfo("Arctic Nishoba", 102, Rarity.UNCOMMON, mage.cards.a.ArcticNishoba.class)); cards.add(new SetCardInfo("Arcum Dagsson", 27, Rarity.RARE, mage.cards.a.ArcumDagsson.class)); cards.add(new SetCardInfo("Aurochs Herd", 103, Rarity.COMMON, mage.cards.a.AurochsHerd.class)); + cards.add(new SetCardInfo("Balduvian Fallen", 51, Rarity.UNCOMMON, mage.cards.b.BalduvianFallen.class)); cards.add(new SetCardInfo("Balduvian Frostwaker", 28, Rarity.UNCOMMON, mage.cards.b.BalduvianFrostwaker.class)); cards.add(new SetCardInfo("Balduvian Rage", 76, Rarity.UNCOMMON, mage.cards.b.BalduvianRage.class)); cards.add(new SetCardInfo("Balduvian Warlord", 77, Rarity.UNCOMMON, mage.cards.b.BalduvianWarlord.class)); diff --git a/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java b/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java index f7622a0981..546de34cf2 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java @@ -16,6 +16,7 @@ import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; +import mage.game.events.ManaEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -84,7 +85,7 @@ class CumulativeUpkeepEffect extends OneShotEffect { if (player.chooseUse(Outcome.Benefit, "Pay " + totalCost.getText() + '?', source, game)) { totalCost.clearPaid(); if (totalCost.payOrRollback(source, game, source.getSourceId(), source.getControllerId())) { - game.fireEvent(new GameEvent(EventType.PAID_CUMULATIVE_UPKEEP, permanent.getId(), permanent.getId(), player.getId(), ageCounter, false)); + game.fireEvent(new ManaEvent(EventType.PAID_CUMULATIVE_UPKEEP, permanent.getId(), permanent.getId(), player.getId(), totalCost.getUsedManaToPay())); return true; } }