From 6cce155252534be78ea69f55232ecd10529499c3 Mon Sep 17 00:00:00 2001 From: Loki Date: Sun, 21 Apr 2013 15:03:24 +1200 Subject: [PATCH] Graveborn Muse --- .../src/mage/sets/legions/GravebornMuse.java | 52 ++++++++++++ .../src/mage/sets/tenth/GravebornMuse.java | 80 +++++++++++++++++++ .../effects/common/LoseLifeSourceEffect.java | 31 +++++-- 3 files changed, 155 insertions(+), 8 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/legions/GravebornMuse.java create mode 100644 Mage.Sets/src/mage/sets/tenth/GravebornMuse.java diff --git a/Mage.Sets/src/mage/sets/legions/GravebornMuse.java b/Mage.Sets/src/mage/sets/legions/GravebornMuse.java new file mode 100644 index 00000000000..a96e6f1a6ca --- /dev/null +++ b/Mage.Sets/src/mage/sets/legions/GravebornMuse.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.legions; + +import java.util.UUID; + +/** + * + * @author Loki + */ +public class GravebornMuse extends mage.sets.tenth.GravebornMuse { + + public GravebornMuse(UUID ownerId) { + super(ownerId); + this.cardNumber = 73; + this.expansionSetCode = "LGN"; + } + + public GravebornMuse(final GravebornMuse card) { + super(card); + } + + @Override + public GravebornMuse copy() { + return new GravebornMuse(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tenth/GravebornMuse.java b/Mage.Sets/src/mage/sets/tenth/GravebornMuse.java new file mode 100644 index 00000000000..1ef1a2e758b --- /dev/null +++ b/Mage.Sets/src/mage/sets/tenth/GravebornMuse.java @@ -0,0 +1,80 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.tenth; + +import java.util.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.DrawCardControllerEffect; +import mage.abilities.effects.common.LoseLifeSourceEffect; +import mage.cards.CardImpl; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; + +/** + * + * @author Loki + */ +public class GravebornMuse extends CardImpl { + private static FilterControlledPermanent filter = new FilterControlledPermanent("Zombie you control"); + + static { + filter.add(new SubtypePredicate("Zombie")); + } + + public GravebornMuse(UUID ownerId) { + super(ownerId, 145, "Graveborn Muse", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{B}{B}"); + this.expansionSetCode = "10E"; + this.subtype.add("Zombie"); + this.subtype.add("Spirit"); + + this.color.setBlack(true); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // At the beginning of your upkeep, you draw X cards and you lose X life, where X is the number of Zombies you control. + Ability ability = new BeginningOfUpkeepTriggeredAbility(new DrawCardControllerEffect(new PermanentsOnBattlefieldCount(filter)), Constants.TargetController.YOU, false); + ability.addEffect(new LoseLifeSourceEffect(new PermanentsOnBattlefieldCount(filter))); + this.addAbility(ability); + } + + public GravebornMuse(final GravebornMuse card) { + super(card); + } + + @Override + public GravebornMuse copy() { + return new GravebornMuse(this); + } +} diff --git a/Mage/src/mage/abilities/effects/common/LoseLifeSourceEffect.java b/Mage/src/mage/abilities/effects/common/LoseLifeSourceEffect.java index 959ad61c40c..5ac552f0012 100644 --- a/Mage/src/mage/abilities/effects/common/LoseLifeSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/LoseLifeSourceEffect.java @@ -30,9 +30,13 @@ package mage.abilities.effects.common; import mage.Constants.Outcome; import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; import mage.game.Game; import mage.players.Player; +import mage.util.CardUtil; /** * @@ -40,21 +44,21 @@ import mage.players.Player; */ public class LoseLifeSourceEffect extends OneShotEffect { - protected int amount; + protected DynamicValue amount; public LoseLifeSourceEffect(int amount) { - super(Outcome.Damage); - this.amount = amount; - staticText = "You lose " + Integer.toString(amount) + " life"; + this(new StaticValue(amount)); } - public int getAmount() { - return amount; + public LoseLifeSourceEffect(DynamicValue amount) { + super(Outcome.Damage); + this.amount = amount; + setText(); } public LoseLifeSourceEffect(final LoseLifeSourceEffect effect) { super(effect); - this.amount = effect.amount; + this.amount = effect.amount.copy(); } @Override @@ -66,10 +70,21 @@ public class LoseLifeSourceEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.loseLife(amount, game); + player.loseLife(amount.calculate(game, source), game); return true; } return false; } + private void setText() { + StringBuilder sb = new StringBuilder(); + sb.append("You lose ").append(CardUtil.numberToText(amount.toString())).append(" life"); + String message = amount.getMessage(); + if (message.length() > 0) { + sb.append(" for each "); + } + sb.append(message); + staticText = sb.toString(); + } + }