From c239cefc7a8df4e1a24271cb590abd4e48f36f3a Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 13 Oct 2015 17:11:10 +0200 Subject: [PATCH] Added 5 older cards. --- .../mage/sets/planarchaos/BrainGorgers.java | 114 ++++++++++++++++ .../src/mage/sets/planarchaos/DashHopes.java | 110 ++++++++++++++++ .../sets/planarchaos/Phantasmagorian.java | 19 +-- .../sets/planarchaos/TemporalExtortion.java | 104 +++++++++++++++ .../src/mage/sets/prophecy/AvatarOfMight.java | 122 ++++++++++++++++++ .../src/mage/sets/prophecy/AvatarOfWill.java | 120 +++++++++++++++++ .../mage/sets/tenthedition/AvatarOfMight.java | 52 ++++++++ 7 files changed, 633 insertions(+), 8 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/planarchaos/BrainGorgers.java create mode 100644 Mage.Sets/src/mage/sets/planarchaos/DashHopes.java create mode 100644 Mage.Sets/src/mage/sets/planarchaos/TemporalExtortion.java create mode 100644 Mage.Sets/src/mage/sets/prophecy/AvatarOfMight.java create mode 100644 Mage.Sets/src/mage/sets/prophecy/AvatarOfWill.java create mode 100644 Mage.Sets/src/mage/sets/tenthedition/AvatarOfMight.java diff --git a/Mage.Sets/src/mage/sets/planarchaos/BrainGorgers.java b/Mage.Sets/src/mage/sets/planarchaos/BrainGorgers.java new file mode 100644 index 0000000000..9ba3c089df --- /dev/null +++ b/Mage.Sets/src/mage/sets/planarchaos/BrainGorgers.java @@ -0,0 +1,114 @@ +/* + * 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.planarchaos; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CastSourceTriggeredAbility; +import mage.abilities.keyword.MadnessAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.players.Player; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class BrainGorgers extends CardImpl { + + public BrainGorgers(UUID ownerId) { + super(ownerId, 65, "Brain Gorgers", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{B}"); + this.expansionSetCode = "PLC"; + this.subtype.add("Zombie"); + this.power = new MageInt(4); + this.toughness = new MageInt(2); + + // When you cast Brain Gorgers, any player may sacrifice a creature. If a player does, counter Brain Gorgers. + this.addAbility(new CastSourceTriggeredAbility(new BrainGorgersCounterSourceEffect())); + + // Madness {1}{B} + this.addAbility(new MadnessAbility(this, new ManaCostsImpl<>("{1}{B}"))); + } + + public BrainGorgers(final BrainGorgers card) { + super(card); + } + + @Override + public BrainGorgers copy() { + return new BrainGorgers(this); + } +} + +class BrainGorgersCounterSourceEffect extends OneShotEffect { + + public BrainGorgersCounterSourceEffect() { + super(Outcome.AIDontUseIt); + staticText = "any player may sacrifice a creature. If a player does, counter {source}"; + } + + public BrainGorgersCounterSourceEffect(final BrainGorgersCounterSourceEffect effect) { + super(effect); + } + + @Override + public BrainGorgersCounterSourceEffect copy() { + return new BrainGorgersCounterSourceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Spell spell = game.getStack().getSpell(source.getSourceId()); + if (spell != null) { + SacrificeTargetCost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent()); + for (UUID playerId : game.getState().getPlayerList(source.getControllerId())) { + cost.clearPaid(); + Player player = game.getPlayer(playerId); + if (cost.canPay(source, source.getSourceId(), player.getId(), game) + && player.chooseUse(outcome, "Sacrifice a creature to counter " + spell.getIdName() + "?", source, game)) { + if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + game.informPlayers(player.getLogName() + " sacrifices a creature to counter " + spell.getIdName() + "."); + game.getStack().counter(spell.getId(), source.getSourceId(), game); + } + } + } + return true; + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/planarchaos/DashHopes.java b/Mage.Sets/src/mage/sets/planarchaos/DashHopes.java new file mode 100644 index 0000000000..561fbbc9e8 --- /dev/null +++ b/Mage.Sets/src/mage/sets/planarchaos/DashHopes.java @@ -0,0 +1,110 @@ +/* + * 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.planarchaos; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.costs.common.PayLifeCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CastSourceTriggeredAbility; +import mage.abilities.effects.common.CounterTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.players.Player; +import mage.target.TargetSpell; + +/** + * + * @author LevelX2 + */ +public class DashHopes extends CardImpl { + + public DashHopes(UUID ownerId) { + super(ownerId, 68, "Dash Hopes", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{B}{B}"); + this.expansionSetCode = "PLC"; + + // When you cast Dash Hopes, any player may pay 5 life. If a player does, counter Dash Hopes. + this.addAbility(new CastSourceTriggeredAbility(new DashHopesCounterSourceEffect())); + + // Counter target spell. + this.getSpellAbility().addEffect(new CounterTargetEffect()); + this.getSpellAbility().addTarget(new TargetSpell()); + } + + public DashHopes(final DashHopes card) { + super(card); + } + + @Override + public DashHopes copy() { + return new DashHopes(this); + } +} + +class DashHopesCounterSourceEffect extends OneShotEffect { + + public DashHopesCounterSourceEffect() { + super(Outcome.AIDontUseIt); + staticText = "any player may pay 5 life. If a player does, counter {source}"; + } + + public DashHopesCounterSourceEffect(final DashHopesCounterSourceEffect effect) { + super(effect); + } + + @Override + public DashHopesCounterSourceEffect copy() { + return new DashHopesCounterSourceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Spell spell = game.getStack().getSpell(source.getSourceId()); + if (spell != null) { + PayLifeCost cost = new PayLifeCost(5); + for (UUID playerId : game.getState().getPlayerList(source.getControllerId())) { + Player player = game.getPlayer(playerId); + cost.clearPaid(); + if (cost.canPay(source, source.getSourceId(), player.getId(), game) + && player.chooseUse(outcome, "Pay 5 life to counter " + spell.getIdName() + "?", source, game)) { + if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + game.informPlayers(player.getLogName() + " pays 5 life to counter " + spell.getIdName() + "."); + game.getStack().counter(spell.getId(), source.getSourceId(), game); + } + } + } + return true; + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/planarchaos/Phantasmagorian.java b/Mage.Sets/src/mage/sets/planarchaos/Phantasmagorian.java index e8e99f9eb6..966f1d2a12 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/Phantasmagorian.java +++ b/Mage.Sets/src/mage/sets/planarchaos/Phantasmagorian.java @@ -95,19 +95,22 @@ class CounterSourceEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - + StackObject spell = null; - for(StackObject objet : game.getStack()){ - if(objet instanceof Spell && objet.getSourceId().equals(source.getSourceId())){ + for (StackObject objet : game.getStack()) { + if (objet instanceof Spell && objet.getSourceId().equals(source.getSourceId())) { spell = objet; } } - if(spell != null){ - for(UUID uuid : game.getPlayerList()){ + if (spell != null) { + DiscardTargetCost cost = new DiscardTargetCost(new TargetCardInHand(3, 3, new FilterCard())); + for (UUID uuid : game.getPlayerList()) { Player player = game.getPlayer(uuid); - if(player.chooseUse(Outcome.Detriment, "Discard three cards to counter " + spell.getName() + "?", source, game)){ - DiscardTargetCost cost = new DiscardTargetCost(new TargetCardInHand(3, 3, new FilterCard())); - if(cost.pay(source, game, source.getSourceId(), uuid, false)){ + cost.clearPaid(); + if (cost.canPay(source, source.getSourceId(), player.getId(), game) + && player.chooseUse(Outcome.Detriment, "Discard three cards to counter " + spell.getName() + "?", source, game)) { + + if (cost.pay(source, game, source.getSourceId(), uuid, false)) { game.informPlayers(player.getLogName() + " discards 3 cards to counter " + spell.getName() + "."); game.getStack().counter(spell.getId(), source.getSourceId(), game); return true; diff --git a/Mage.Sets/src/mage/sets/planarchaos/TemporalExtortion.java b/Mage.Sets/src/mage/sets/planarchaos/TemporalExtortion.java new file mode 100644 index 0000000000..ea806b6198 --- /dev/null +++ b/Mage.Sets/src/mage/sets/planarchaos/TemporalExtortion.java @@ -0,0 +1,104 @@ +/* + * 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.planarchaos; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CastSourceTriggeredAbility; +import mage.abilities.effects.common.turn.AddExtraTurnControllerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class TemporalExtortion extends CardImpl { + + public TemporalExtortion(UUID ownerId) { + super(ownerId, 81, "Temporal Extortion", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{B}{B}{B}{B}"); + this.expansionSetCode = "PLC"; + + // When you cast Temporal Extortion, any player may pay half his or her life, rounded up. If a player does, counter Temporal Extortion. + this.addAbility(new CastSourceTriggeredAbility(new TemporalExtortionCounterSourceEffect())); + + // Take an extra turn after this one. + this.getSpellAbility().addEffect(new AddExtraTurnControllerEffect()); + } + + public TemporalExtortion(final TemporalExtortion card) { + super(card); + } + + @Override + public TemporalExtortion copy() { + return new TemporalExtortion(this); + } +} + +class TemporalExtortionCounterSourceEffect extends OneShotEffect { + + public TemporalExtortionCounterSourceEffect() { + super(Outcome.AIDontUseIt); + staticText = "any player may pay half his or her life, rounded up. If a player does, counter {source}"; + } + + public TemporalExtortionCounterSourceEffect(final TemporalExtortionCounterSourceEffect effect) { + super(effect); + } + + @Override + public TemporalExtortionCounterSourceEffect copy() { + return new TemporalExtortionCounterSourceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Spell spell = game.getStack().getSpell(source.getSourceId()); + if (spell != null) { + for (UUID playerId : game.getState().getPlayerList(source.getControllerId())) { + Player player = game.getPlayer(playerId); + if (player.chooseUse(outcome, "Pay half your life, rounded up to counter " + spell.getIdName() + "?", source, game)) { + Integer amount = (int) Math.ceil(player.getLife() / 2f); + player.loseLife(amount, game); + game.informPlayers(player.getLogName() + " pays half his or her life, rounded up to counter " + spell.getIdName() + "."); + game.getStack().counter(spell.getId(), source.getSourceId(), game); + } + } + return true; + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/prophecy/AvatarOfMight.java b/Mage.Sets/src/mage/sets/prophecy/AvatarOfMight.java new file mode 100644 index 0000000000..8008f96f3d --- /dev/null +++ b/Mage.Sets/src/mage/sets/prophecy/AvatarOfMight.java @@ -0,0 +1,122 @@ +/* + * 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.prophecy; + +import java.util.UUID; +import mage.MageInt; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.SpellAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.cost.CostModificationEffectImpl; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.CostModificationType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class AvatarOfMight extends CardImpl { + + public AvatarOfMight(UUID ownerId) { + super(ownerId, 109, "Avatar of Might", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{6}{G}{G}"); + this.expansionSetCode = "PCY"; + this.subtype.add("Avatar"); + this.power = new MageInt(8); + this.toughness = new MageInt(8); + + // If an opponent controls at least four more creatures than you, Avatar of Might costs {6} less to cast. + this.addAbility(new SimpleStaticAbility(Zone.STACK, new AvatarOfMightCostReductionEffect())); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + } + + public AvatarOfMight(final AvatarOfMight card) { + super(card); + } + + @Override + public AvatarOfMight copy() { + return new AvatarOfMight(this); + } +} + +class AvatarOfMightCostReductionEffect extends CostModificationEffectImpl { + + AvatarOfMightCostReductionEffect() { + super(Duration.Custom, Outcome.Benefit, CostModificationType.REDUCE_COST); + staticText = "If an opponent controls at least four more creatures than you, {this} will costs {6} less to cast"; + } + + AvatarOfMightCostReductionEffect(final AvatarOfMightCostReductionEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source, Ability abilityToModify) { + SpellAbility spellAbility = (SpellAbility) abilityToModify; + Mana mana = spellAbility.getManaCostsToPay().getMana(); + if (mana.getColorless() > 0) { + int newCount = mana.getColorless() - 6; + if (newCount < 0) { + newCount = 0; + } + mana.setColorless(newCount); + spellAbility.getManaCostsToPay().load(mana.toString()); + return true; + } + return false; + } + + @Override + public boolean applies(Ability abilityToModify, Ability source, Game game) { + int creatures = game.getBattlefield().countAll(new FilterCreaturePermanent(), source.getControllerId(), game); + for (UUID playerId : game.getOpponents(source.getControllerId())) { + Player opponent = game.getPlayer(playerId); + if (opponent != null && game.getBattlefield().countAll(new FilterCreaturePermanent(), opponent.getId(), game) >= creatures + 4) { + return true; + } + } + return false; + } + + @Override + public AvatarOfMightCostReductionEffect copy() { + return new AvatarOfMightCostReductionEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/prophecy/AvatarOfWill.java b/Mage.Sets/src/mage/sets/prophecy/AvatarOfWill.java new file mode 100644 index 0000000000..2dbd76b18b --- /dev/null +++ b/Mage.Sets/src/mage/sets/prophecy/AvatarOfWill.java @@ -0,0 +1,120 @@ +/* + * 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.prophecy; + +import java.util.UUID; +import mage.MageInt; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.SpellAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.cost.CostModificationEffectImpl; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.CostModificationType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class AvatarOfWill extends CardImpl { + + public AvatarOfWill(UUID ownerId) { + super(ownerId, 30, "Avatar of Will", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{6}{U}{U}"); + this.expansionSetCode = "PCY"; + this.subtype.add("Avatar"); + this.power = new MageInt(5); + this.toughness = new MageInt(6); + + // If an opponent has no cards in hand, Avatar of Will costs {6} less to cast. + this.addAbility(new SimpleStaticAbility(Zone.STACK, new AvatarOfWillCostReductionEffect())); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + } + + public AvatarOfWill(final AvatarOfWill card) { + super(card); + } + + @Override + public AvatarOfWill copy() { + return new AvatarOfWill(this); + } +} + +class AvatarOfWillCostReductionEffect extends CostModificationEffectImpl { + + AvatarOfWillCostReductionEffect() { + super(Duration.Custom, Outcome.Benefit, CostModificationType.REDUCE_COST); + staticText = "If an opponent has no cards in hand, {this} will costs {6} less to cast"; + } + + AvatarOfWillCostReductionEffect(final AvatarOfWillCostReductionEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source, Ability abilityToModify) { + SpellAbility spellAbility = (SpellAbility) abilityToModify; + Mana mana = spellAbility.getManaCostsToPay().getMana(); + if (mana.getColorless() > 0) { + int newCount = mana.getColorless() - 6; + if (newCount < 0) { + newCount = 0; + } + mana.setColorless(newCount); + spellAbility.getManaCostsToPay().load(mana.toString()); + return true; + } + return false; + } + + @Override + public boolean applies(Ability abilityToModify, Ability source, Game game) { + for (UUID playerId : game.getOpponents(source.getControllerId())) { + Player opponent = game.getPlayer(playerId); + if (opponent != null && opponent.getHand().isEmpty()) { + return true; + } + } + return false; + } + + @Override + public AvatarOfWillCostReductionEffect copy() { + return new AvatarOfWillCostReductionEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tenthedition/AvatarOfMight.java b/Mage.Sets/src/mage/sets/tenthedition/AvatarOfMight.java new file mode 100644 index 0000000000..3fb391e281 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tenthedition/AvatarOfMight.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.tenthedition; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class AvatarOfMight extends mage.sets.prophecy.AvatarOfMight { + + public AvatarOfMight(UUID ownerId) { + super(ownerId); + this.cardNumber = 251; + this.expansionSetCode = "10E"; + } + + public AvatarOfMight(final AvatarOfMight card) { + super(card); + } + + @Override + public AvatarOfMight copy() { + return new AvatarOfMight(this); + } +}