From a98d32895a3234511b55871dfebe98fd3ccdfb69 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 12 Dec 2014 14:25:52 +0100 Subject: [PATCH] [SOK] Added 5 green cards. --- .../ArashiTheSkyAsunder.java | 88 +++++++ .../DescendantOfMasumaro.java | 111 ++++++++ .../SasayaOrochiAscendant.java | 238 ++++++++++++++++++ .../sets/saviorsofkamigawa/SeedTheLand.java | 65 +++++ .../saviorsofkamigawa/SekkiSeasonsGuide.java | 143 +++++++++++ .../RevealHandSourceControllerCost.java | 72 ++++++ 6 files changed, 717 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/saviorsofkamigawa/ArashiTheSkyAsunder.java create mode 100644 Mage.Sets/src/mage/sets/saviorsofkamigawa/DescendantOfMasumaro.java create mode 100644 Mage.Sets/src/mage/sets/saviorsofkamigawa/SasayaOrochiAscendant.java create mode 100644 Mage.Sets/src/mage/sets/saviorsofkamigawa/SeedTheLand.java create mode 100644 Mage.Sets/src/mage/sets/saviorsofkamigawa/SekkiSeasonsGuide.java create mode 100644 Mage/src/mage/abilities/costs/common/RevealHandSourceControllerCost.java diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/ArashiTheSkyAsunder.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/ArashiTheSkyAsunder.java new file mode 100644 index 00000000000..e1f1eef450f --- /dev/null +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/ArashiTheSkyAsunder.java @@ -0,0 +1,88 @@ +/* + * 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.saviorsofkamigawa; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.common.DamageAllEffect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.keyword.ChannelAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.target.TargetPermanent; + +/** + * + * @author LevelX2 + */ +public class ArashiTheSkyAsunder extends CardImpl { + + static final private FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying"); + + static { + filter.add(new AbilityPredicate(FlyingAbility.class)); + } + + public ArashiTheSkyAsunder(UUID ownerId) { + super(ownerId, 121, "Arashi, the Sky Asunder", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{G}{G}"); + this.expansionSetCode = "SOK"; + this.supertype.add("Legendary"); + this.subtype.add("Spirit"); + + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // {X}{G}, {tap}: Arashi, the Sky Asunder deals X damage to target creature with flying. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(new ManacostVariableValue()), new ManaCostsImpl("{X}{G}")); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetPermanent(filter)); + this.addAbility(ability); + + // Channel - {X}{G}{G}, Discard Arashi: Arashi deals X damage to each creature with flying. + this.addAbility(new ChannelAbility("{X}{G}{G}", new DamageAllEffect(new ManacostVariableValue(), filter))); + } + + public ArashiTheSkyAsunder(final ArashiTheSkyAsunder card) { + super(card); + } + + @Override + public ArashiTheSkyAsunder copy() { + return new ArashiTheSkyAsunder(this); + } +} diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/DescendantOfMasumaro.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/DescendantOfMasumaro.java new file mode 100644 index 00000000000..1e21e307d31 --- /dev/null +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/DescendantOfMasumaro.java @@ -0,0 +1,111 @@ +/* + * 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.saviorsofkamigawa; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetOpponent; + +/** + * + * @author LevelX2 + */ +public class DescendantOfMasumaro extends CardImpl { + + public DescendantOfMasumaro(UUID ownerId) { + super(ownerId, 126, "Descendant of Masumaro", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{G}"); + this.expansionSetCode = "SOK"; + this.subtype.add("Human"); + this.subtype.add("Monk"); + + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // At the beginning of your upkeep, put a +1/+1 counter on Descendant of Masumaro for each card in your hand, then remove a +1/+1 counter from Descendant of Masumaro for each card in target opponent's hand. + Ability ability = new BeginningOfUpkeepTriggeredAbility(new DescendantOfMasumaroEffect(), TargetController.YOU, false); + ability.addTarget(new TargetOpponent()); + this.addAbility(ability); + } + + public DescendantOfMasumaro(final DescendantOfMasumaro card) { + super(card); + } + + @Override + public DescendantOfMasumaro copy() { + return new DescendantOfMasumaro(this); + } +} + +class DescendantOfMasumaroEffect extends OneShotEffect { + + public DescendantOfMasumaroEffect() { + super(Outcome.Benefit); + this.staticText = "put a +1/+1 counter on {this} for each card in your hand, then remove a +1/+1 counter from {this} for each card in target opponent's hand"; + } + + public DescendantOfMasumaroEffect(final DescendantOfMasumaroEffect effect) { + super(effect); + } + + @Override + public DescendantOfMasumaroEffect copy() { + return new DescendantOfMasumaroEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent sourcePermanent = game.getPermanent(source.getSourceId()); + if (controller != null && sourcePermanent != null) { + if (controller.getHand().size() > 0) { + new AddCountersSourceEffect(CounterType.P1P1.createInstance(controller.getHand().size()), true).apply(game, source); + } + Player targetOpponent = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (targetOpponent != null && targetOpponent.getHand().size() > 0) { + sourcePermanent.getCounters().removeCounter(CounterType.P1P1, targetOpponent.getHand().size()); + game.informPlayers(controller.getName() + " removes " + targetOpponent.getHand().size() + " +1/+1 counters from " + sourcePermanent.getLogName()); + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/SasayaOrochiAscendant.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/SasayaOrochiAscendant.java new file mode 100644 index 00000000000..1692019dc10 --- /dev/null +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/SasayaOrochiAscendant.java @@ -0,0 +1,238 @@ +/* + * 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.saviorsofkamigawa; + +import java.util.UUID; +import mage.MageInt; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.TapForManaAllTriggeredManaAbility; +import mage.abilities.costs.common.RevealHandSourceControllerCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.FlipSourceEffect; +import mage.abilities.effects.common.ManaEffect; +import mage.cards.CardImpl; +import mage.choices.Choice; +import mage.choices.ChoiceImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SetTargetPointer; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledLandPermanent; +import mage.filter.common.FilterLandCard; +import mage.filter.common.FilterLandPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.filter.predicate.permanent.PermanentIdPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.Token; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class SasayaOrochiAscendant extends CardImpl { + + public SasayaOrochiAscendant(UUID ownerId) { + super(ownerId, 145, "Sasaya, Orochi Ascendant", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{G}{G}"); + this.expansionSetCode = "SOK"; + this.supertype.add("Legendary"); + this.subtype.add("Snake"); + this.subtype.add("Monk"); + + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + this.flipCard = true; + this.flipCardName = "Sasaya's Essence"; + + // Reveal your hand: If you have seven or more land cards in your hand, flip Sasaya, Orochi Ascendant. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SasayaOrochiAscendantFlipEffect(), new RevealHandSourceControllerCost() )); + } + + public SasayaOrochiAscendant(final SasayaOrochiAscendant card) { + super(card); + } + + @Override + public SasayaOrochiAscendant copy() { + return new SasayaOrochiAscendant(this); + } +} + +class SasayaOrochiAscendantFlipEffect extends OneShotEffect { + + public SasayaOrochiAscendantFlipEffect() { + super(Outcome.Benefit); + this.staticText = "If you have seven or more land cards in your hand, flip {this}"; + } + + public SasayaOrochiAscendantFlipEffect(final SasayaOrochiAscendantFlipEffect effect) { + super(effect); + } + + @Override + public SasayaOrochiAscendantFlipEffect copy() { + return new SasayaOrochiAscendantFlipEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + if (controller.getHand().count(new FilterLandCard(), game) > 6) { + new FlipSourceEffect(new SasayasEssence()).apply(game, source); + } + return true; + } + return false; + } +} + +class SasayasEssence extends Token { + + SasayasEssence () { + super("Sasaya's Essence", ""); + supertype.add("Legendary"); + cardType.add(CardType.ENCHANTMENT); + + color.setGreen(true); + + // Whenever a land you control is tapped for mana, for each other land you control with the same name, add one mana to your mana pool of any type that land produced. + this.addAbility(new TapForManaAllTriggeredManaAbility( + new SasayasEssenceManaEffectEffect(), + new FilterControlledLandPermanent(), SetTargetPointer.PERMANENT)); + } +} + +class SasayasEssenceManaEffectEffect extends ManaEffect { + + public SasayasEssenceManaEffectEffect() { + super(); + this.staticText = "for each other land you control with the same name, add one mana to your mana pool of any type that land produced"; + } + + public SasayasEssenceManaEffectEffect(final SasayasEssenceManaEffectEffect effect) { + super(effect); + } + + @Override + public SasayasEssenceManaEffectEffect copy() { + return new SasayasEssenceManaEffectEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Mana mana = (Mana) this.getValue("mana"); + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (controller != null && mana != null && permanent != null) { + FilterPermanent filter = new FilterLandPermanent(); + filter.add(Predicates.not(new PermanentIdPredicate(permanent.getId()))); + filter.add(new NamePredicate(permanent.getName())); + int count = game.getBattlefield().countAll(filter, controller.getId(), game); + if (count > 0) { + Choice choice = new ChoiceImpl(true); + choice.setMessage("Pick the type of mana to produce"); + if (mana.getBlack() > 0) { + choice.getChoices().add("Black"); + } + if (mana.getRed() > 0) { + choice.getChoices().add("Red"); + } + if (mana.getBlue() > 0) { + choice.getChoices().add("Blue"); + } + if (mana.getGreen() > 0) { + choice.getChoices().add("Green"); + } + if (mana.getWhite() > 0) { + choice.getChoices().add("White"); + } + if (mana.getColorless() > 0) { + choice.getChoices().add("Colorless"); + } + + if (choice.getChoices().size() > 0) { + Mana newMana = new Mana(); + for (int i = 0; i < count; i++) { + choice.clearChoice(); + if (choice.getChoices().size() == 1) { + choice.setChoice(choice.getChoices().iterator().next()); + } else { + while(!choice.isChosen()) { + controller.choose(outcome, choice, game); + if (!controller.isInGame()) { + return false; + } + } + } + if (choice.getChoice() == null) { + return false; + } + switch (choice.getChoice()) { + case "Black": + newMana.addBlack(); + break; + case "Blue": + newMana.addBlue(); + break; + case "Red": + newMana.addRed(); + break; + case "Green": + newMana.addGreen(); + break; + case "White": + newMana.addWhite(); + break; + case "Colorless": + newMana.addColorless(); + break; + } + } + controller.getManaPool().addMana(newMana, game, source); + checkToFirePossibleEvents(newMana, game, source); + } + } + return true; + } + return false; + } + + @Override + public Mana getMana(Game game, Ability source) { + return null; + } + +} diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/SeedTheLand.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/SeedTheLand.java new file mode 100644 index 00000000000..a18a70a23c9 --- /dev/null +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/SeedTheLand.java @@ -0,0 +1,65 @@ +/* + * 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.saviorsofkamigawa; + +import java.util.UUID; +import mage.abilities.common.EntersBattlefieldAllTriggeredAbility; +import mage.abilities.effects.common.CreateTokenTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.SetTargetPointer; +import mage.constants.Zone; +import mage.filter.common.FilterLandPermanent; +import mage.game.permanent.token.SnakeToken; + +/** + * + * @author LevelX2 + */ +public class SeedTheLand extends CardImpl { + + public SeedTheLand(UUID ownerId) { + super(ownerId, 146, "Seed the Land", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}{G}"); + this.expansionSetCode = "SOK"; + + // Whenever a land enters the battlefield, its controller puts a 1/1 green Snake creature token onto the battlefield. + this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, + new CreateTokenTargetEffect(new SnakeToken()), new FilterLandPermanent(), false, SetTargetPointer.PLAYER, + "Whenever a land enters the battlefield, its controller puts a 1/1 green Snake creature token onto the battlefield.")); + } + + public SeedTheLand(final SeedTheLand card) { + super(card); + } + + @Override + public SeedTheLand copy() { + return new SeedTheLand(this); + } +} diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/SekkiSeasonsGuide.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/SekkiSeasonsGuide.java new file mode 100644 index 00000000000..b7fa2a18ead --- /dev/null +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/SekkiSeasonsGuide.java @@ -0,0 +1,143 @@ +/* + * 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.saviorsofkamigawa; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.SpiritToken; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author LevelX2 + */ +public class SekkiSeasonsGuide extends CardImpl { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("eight Spirits"); + + static { + filter.add(new SubtypePredicate("Spirit")); + } + + public SekkiSeasonsGuide(UUID ownerId) { + super(ownerId, 148, "Sekki, Seasons' Guide", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{G}{G}{G}"); + this.expansionSetCode = "SOK"; + this.supertype.add("Legendary"); + this.subtype.add("Spirit"); + + this.color.setGreen(true); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Sekki, Seasons' Guide enters the battlefield with eight +1/+1 counters on it. + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(8)), "with eight +1/+1 counters on it")); + + // If damage would be dealt to Sekki, prevent that damage, remove that many +1/+1 counters from Sekki, and put that many 1/1 colorless Spirit creature tokens onto the battlefield. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SekkiSeasonsGuideEffect())); + + // Sacrifice eight Spirits: Return Sekki from your graveyard to the battlefield. + this.addAbility(new SimpleActivatedAbility( + Zone.BATTLEFIELD, + new ReturnSourceFromGraveyardToHandEffect(), + new SacrificeTargetCost(new TargetControlledPermanent(8,8,filter, true)))); + } + + public SekkiSeasonsGuide(final SekkiSeasonsGuide card) { + super(card); + } + + @Override + public SekkiSeasonsGuide copy() { + return new SekkiSeasonsGuide(this); + } +} + +class SekkiSeasonsGuideEffect extends PreventionEffectImpl { + + public SekkiSeasonsGuideEffect() { + super(Duration.WhileOnBattlefield, Integer.MAX_VALUE, false, false); + staticText = "If damage would be dealt to {this}, prevent that damage, remove that many +1/+1 counters from {this}, and put that many 1/1 colorless Spirit creature tokens onto the battlefield"; + } + + public SekkiSeasonsGuideEffect(final SekkiSeasonsGuideEffect effect) { + super(effect); + } + + @Override + public SekkiSeasonsGuideEffect copy() { + return new SekkiSeasonsGuideEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + int damage = event.getAmount(); + preventDamageAction(event, source, game); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + permanent.removeCounters(CounterType.P1P1.createInstance(damage), game); + } + new CreateTokenEffect(new SpiritToken(), damage).apply(game, source); + return true; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (super.applies(event, source, game)) { + if (event.getTargetId().equals(source.getSourceId())) { + return true; + } + } + return false; + } + + } \ No newline at end of file diff --git a/Mage/src/mage/abilities/costs/common/RevealHandSourceControllerCost.java b/Mage/src/mage/abilities/costs/common/RevealHandSourceControllerCost.java new file mode 100644 index 00000000000..9afc3c2af2b --- /dev/null +++ b/Mage/src/mage/abilities/costs/common/RevealHandSourceControllerCost.java @@ -0,0 +1,72 @@ +/* + * 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.costs.common; + +import java.util.UUID; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.costs.CostImpl; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ + +public class RevealHandSourceControllerCost extends CostImpl { + + public RevealHandSourceControllerCost() { + this.text = "reveal your hand"; + } + + public RevealHandSourceControllerCost(RevealHandSourceControllerCost cost) { + super(cost); + } + + @Override + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + Player controller = game.getPlayer(controllerId); + MageObject sourceObject = game.getObject(sourceId); + if (controller != null && sourceObject != null) { + controller.revealCards(sourceObject.getLogName(), controller.getHand(), game); + paid = true; + } + return paid; + } + + @Override + public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + return true; + } + + @Override + public RevealHandSourceControllerCost copy() { + return new RevealHandSourceControllerCost(this); + } +} \ No newline at end of file