From 3348a29b1a1939bb1292cd03131dddd166f60ec0 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Sat, 7 Apr 2012 11:06:02 +0400 Subject: [PATCH] [ROE] Mul Daya Channelers (by jeffwadsworth2010) --- .../riseoftheeldrazi/MulDayaChannelers.java | 89 +++++++++++++++++++ .../common/TopLibraryCardTypeCondition.java | 69 ++++++++++++++ .../common/AddManaOfAnyColorEffect.java | 83 +++++++++-------- 3 files changed, 202 insertions(+), 39 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/riseoftheeldrazi/MulDayaChannelers.java create mode 100644 Mage/src/mage/abilities/condition/common/TopLibraryCardTypeCondition.java diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/MulDayaChannelers.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/MulDayaChannelers.java new file mode 100644 index 00000000000..60faa14c90b --- /dev/null +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/MulDayaChannelers.java @@ -0,0 +1,89 @@ +/* + * 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.riseoftheeldrazi; + +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.Constants.Zone; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.continious.PlayWithTheTopCardRevealedEffect; +import mage.cards.CardImpl; +import mage.abilities.effects.common.continious.BoostSourceEffect; +import mage.abilities.decorator.ConditionalContinousEffect; +import mage.abilities.condition.common.TopLibraryCardTypeCondition; +import mage.abilities.decorator.ConditionalActivatedAbility; +import static mage.abilities.condition.common.TopLibraryCardTypeCondition.CheckType.*; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.AddManaOfAnyColorEffect; +import mage.choices.ChoiceColor; + +/** + * + * @author jeffwadsworth + */ +public class MulDayaChannelers extends CardImpl { + + private static final String rule1 = "As long as the top card of your library is a creature card, {this} gets +3/+3"; + private static final String rule2 = "As long as the top card of your library is a land card, {this} has T: Add two mana of any one color to your mana pool."; + + public MulDayaChannelers(UUID ownerId) { + super(ownerId, 198, "Mul Daya Channelers", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{G}{G}"); + this.expansionSetCode = "ROE"; + this.subtype.add("Elf"); + this.subtype.add("Druid"); + this.subtype.add("Shaman"); + + this.color.setGreen(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Play with the top card of your library revealed. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayWithTheTopCardRevealedEffect())); + + // As long as the top card of your library is a creature card, Mul Daya Channelers gets +3/+3. + ConditionalContinousEffect effect = new ConditionalContinousEffect(new BoostSourceEffect(3, 3, Constants.Duration.WhileOnBattlefield), new TopLibraryCardTypeCondition(CREATURE), rule1); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, effect)); + + // As long as the top card of your library is a land card, Mul Daya Channelers has "T: Add two mana of any one color to your mana pool." + ConditionalActivatedAbility ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(2), new TapSourceCost(), new TopLibraryCardTypeCondition(LAND), rule2); + ability.addChoice(new ChoiceColor()); + this.addAbility(ability); + } + + public MulDayaChannelers(final MulDayaChannelers card) { + super(card); + } + + @Override + public MulDayaChannelers copy() { + return new MulDayaChannelers(this); + } +} \ No newline at end of file diff --git a/Mage/src/mage/abilities/condition/common/TopLibraryCardTypeCondition.java b/Mage/src/mage/abilities/condition/common/TopLibraryCardTypeCondition.java new file mode 100644 index 00000000000..f28bf095b41 --- /dev/null +++ b/Mage/src/mage/abilities/condition/common/TopLibraryCardTypeCondition.java @@ -0,0 +1,69 @@ +/* + * 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.abilities.condition.common; + +import mage.Constants.CardType; +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.game.Game; + +/** + * @author jeffwadsworth + */ +public class TopLibraryCardTypeCondition implements Condition { + + public static enum CheckType {CREATURE, LAND, SORCERY, INSTANT} + + ; + + private TopLibraryCardTypeCondition.CheckType type; + + public TopLibraryCardTypeCondition(TopLibraryCardTypeCondition.CheckType type) { + this.type = type; + } + + @Override + public boolean apply(Game game, Ability source) { + boolean conditionApplies = false; + switch (this.type) { + case CREATURE: + conditionApplies |= game.getPlayer(source.getControllerId()).getLibrary().getFromTop(game).getCardType().contains(CardType.CREATURE); + break; + case LAND: + conditionApplies |= game.getPlayer(source.getControllerId()).getLibrary().getFromTop(game).getCardType().contains(CardType.LAND); + break; + case SORCERY: + conditionApplies |= game.getPlayer(source.getControllerId()).getLibrary().getFromTop(game).getCardType().contains(CardType.SORCERY); + break; + case INSTANT: + conditionApplies |= game.getPlayer(source.getControllerId()).getLibrary().getFromTop(game).getCardType().contains(CardType.INSTANT); + break; + } + return conditionApplies; + } +} diff --git a/Mage/src/mage/abilities/effects/common/AddManaOfAnyColorEffect.java b/Mage/src/mage/abilities/effects/common/AddManaOfAnyColorEffect.java index 6e88fda0cd2..74e68caeebf 100644 --- a/Mage/src/mage/abilities/effects/common/AddManaOfAnyColorEffect.java +++ b/Mage/src/mage/abilities/effects/common/AddManaOfAnyColorEffect.java @@ -35,50 +35,55 @@ import mage.game.Game; import mage.players.Player; /** - * * @author BetaSteward_at_googlemail.com */ public class AddManaOfAnyColorEffect extends ManaEffect { - public AddManaOfAnyColorEffect() { - super(); - staticText = "add one mana of any color to your mana pool"; - } + protected int amount; - public AddManaOfAnyColorEffect(final AddManaOfAnyColorEffect effect) { - super(effect); - } + public AddManaOfAnyColorEffect() { + super(); + this.amount = 1; + staticText = "add one mana of any color to your mana pool"; + } - @Override - public AddManaOfAnyColorEffect copy() { - return new AddManaOfAnyColorEffect(this); - } + public AddManaOfAnyColorEffect(final int amount) { + super(); + this.amount = amount; + } - @Override - public boolean apply(Game game, Ability source) { - ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); - Player player = game.getPlayer(source.getControllerId()); - if (choice.getColor().isBlack()) { - player.getManaPool().addMana(Mana.BlackMana, game, source); - return true; - } - else if (choice.getColor().isBlue()) { - player.getManaPool().addMana(Mana.BlueMana, game, source); - return true; - } - else if (choice.getColor().isRed()) { - player.getManaPool().addMana(Mana.RedMana, game, source); - return true; - } - else if (choice.getColor().isGreen()) { - player.getManaPool().addMana(Mana.GreenMana, game, source); - return true; - } - else if (choice.getColor().isWhite()) { - player.getManaPool().addMana(Mana.WhiteMana, game, source); - return true; - } - return false; - } + public AddManaOfAnyColorEffect(final AddManaOfAnyColorEffect effect) { + super(effect); + this.amount = effect.amount; + } -} + @Override + public AddManaOfAnyColorEffect copy() { + return new AddManaOfAnyColorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); + Player player = game.getPlayer(source.getControllerId()); + + if (choice.getColor().isBlack()) { + player.getManaPool().addMana(Mana.BlackMana(amount), game, source); + return true; + } else if (choice.getColor().isBlue()) { + player.getManaPool().addMana(Mana.BlueMana(amount), game, source); + return true; + } else if (choice.getColor().isRed()) { + player.getManaPool().addMana(Mana.RedMana(amount), game, source); + return true; + } else if (choice.getColor().isGreen()) { + player.getManaPool().addMana(Mana.GreenMana(amount), game, source); + return true; + } else if (choice.getColor().isWhite()) { + player.getManaPool().addMana(Mana.WhiteMana(amount), game, source); + return true; + } + return false; + } + +} \ No newline at end of file