diff --git a/Mage.Sets/src/mage/sets/magic2015/HornetNest.java b/Mage.Sets/src/mage/sets/magic2015/HornetNest.java new file mode 100644 index 0000000000..6093d44701 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2015/HornetNest.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.magic2015; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealtDamageToSourceTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.keyword.DeathtouchAbility; +import mage.abilities.keyword.DefenderAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.token.Token; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class HornetNest extends CardImpl { + + public HornetNest(UUID ownerId) { + super(ownerId, 177, "Hornet Nest", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{G}"); + this.expansionSetCode = "M15"; + this.subtype.add("Insect"); + + this.color.setGreen(true); + this.power = new MageInt(0); + this.toughness = new MageInt(2); + + // Defender + this.addAbility(DefenderAbility.getInstance()); + // Whenever Hornet Nest is dealt damage, put that many 1/1 green Insect creature tokens with flying and deathtouch onto the battlefield. + this.addAbility(new DealtDamageToSourceTriggeredAbility(Zone.BATTLEFIELD, new HornetNestDealDamageEffect(), false)); + } + + public HornetNest(final HornetNest card) { + super(card); + } + + @Override + public HornetNest copy() { + return new HornetNest(this); + } +} + +class HornetNestDealDamageEffect extends OneShotEffect { + + public HornetNestDealDamageEffect() { + super(Outcome.Damage); + this.staticText = "put that many 1/1 green Insect creature tokens with flying and deathtouch onto the battlefield"; + } + + public HornetNestDealDamageEffect(final HornetNestDealDamageEffect effect) { + super(effect); + } + + @Override + public HornetNestDealDamageEffect copy() { + return new HornetNestDealDamageEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int amount = (Integer) getValue("damage"); + if (amount > 0) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + return new CreateTokenEffect(new HornetNestInsectToken(), amount).apply(game, source); + } + } + return false; + } +} + +class HornetNestInsectToken extends Token { + + public HornetNestInsectToken() { + super("Insect", "1/1 green Insect creature tokens with flying and deathtouch"); + setOriginalExpansionSetCode("M15"); + cardType.add(CardType.CREATURE); + color.setGreen(true); + subtype.add("Insect"); + power = new MageInt(1); + toughness = new MageInt(1); + + this.addAbility(FlyingAbility.getInstance()); + this.addAbility(DeathtouchAbility.getInstance()); + } +} diff --git a/Mage.Sets/src/mage/sets/magic2015/KalonianTwingrove.java b/Mage.Sets/src/mage/sets/magic2015/KalonianTwingrove.java new file mode 100644 index 0000000000..64531f2b6e --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2015/KalonianTwingrove.java @@ -0,0 +1,103 @@ +/* + * 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.magic2015; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.permanent.token.Token; +import static mage.sets.magic2015.KalonianTwingrove.filterLands; + +/** + * + * @author LevelX2 + */ +public class KalonianTwingrove extends CardImpl { + + final static FilterControlledPermanent filterLands = new FilterControlledPermanent("Forests you control"); + + static { + filterLands.add(new SubtypePredicate("Forest")); + } + + public KalonianTwingrove(UUID ownerId) { + super(ownerId, 182, "Kalonian Twingrove", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{G}"); + this.expansionSetCode = "M15"; + this.subtype.add("Treefolk"); + this.subtype.add("Warrior"); + + this.color.setGreen(true); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Kalonian Twingrove's power and toughness are each equal to the number of Forests you control. + this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(filterLands), Duration.EndOfGame))); + // When Kalonian Twingrove enters the battlefield, put a green Treefolk Warrior creature token onto the battlefield with "This creature's power and toughness are each equal to the number of Forests you control." + Effect effect = new CreateTokenEffect(new KalonianTwingroveTreefolkWarriorToken()); + effect.setText("put a green Treefolk Warrior creature token onto the battlefield with \"This creature's power and toughness are each equal to the number of Forests you control.\""); + this.addAbility(new EntersBattlefieldTriggeredAbility(effect,false)); + } + + public KalonianTwingrove(final KalonianTwingrove card) { + super(card); + } + + @Override + public KalonianTwingrove copy() { + return new KalonianTwingrove(this); + } +} + +class KalonianTwingroveTreefolkWarriorToken extends Token { + + public KalonianTwingroveTreefolkWarriorToken() { + super("Treefolk Warrior", "green Treefolk Warrior creature token onto the battlefield with \"This creature's power and toughness are each equal to the number of Forests you control.\""); + this.setOriginalExpansionSetCode("M15"); + cardType.add(CardType.CREATURE); + color = ObjectColor.GREEN; + subtype.add("Treefolk"); + subtype.add("Warrior"); + power = new MageInt(0); + toughness = new MageInt(0); + + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(filterLands), Duration.WhileOnBattlefield))); + } +} diff --git a/Mage.Sets/src/mage/sets/magic2015/NissaWorldwaker.java b/Mage.Sets/src/mage/sets/magic2015/NissaWorldwaker.java index 36d72125e6..474a1ff20d 100644 --- a/Mage.Sets/src/mage/sets/magic2015/NissaWorldwaker.java +++ b/Mage.Sets/src/mage/sets/magic2015/NissaWorldwaker.java @@ -31,10 +31,12 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; +import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.UntapTargetEffect; import mage.abilities.effects.common.continious.BecomesCreatureTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.Card; import mage.cards.CardImpl; @@ -44,6 +46,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.TargetController; import mage.constants.Zone; +import mage.counters.CounterType; import mage.filter.FilterPermanent; import mage.filter.common.FilterBasicLandCard; import mage.filter.common.FilterLandPermanent; @@ -52,11 +55,10 @@ import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.permanent.token.Token; import mage.players.Player; -import mage.target.Target; import mage.target.TargetPermanent; import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetLandPermanent; -import mage.target.targetpointer.TargetPointer; +import mage.target.targetpointer.FixedTarget; /** * @@ -79,8 +81,10 @@ public class NissaWorldwaker extends CardImpl { this.color.setGreen(true); + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false)); + // +1: Target land you control becomes a 4/4 Elemental creature with trample. It's still a land. - LoyaltyAbility ability = new LoyaltyAbility(new BecomesCreatureTargetEffect(new NissaWorldwakerToken(), "land", Duration.EndOfTurn), 1); + LoyaltyAbility ability = new LoyaltyAbility(new BecomesCreatureTargetEffect(new NissaWorldwakerToken(), "land", Duration.Custom), 1); ability.addTarget(new TargetLandPermanent(filter)); this.addAbility(ability); @@ -131,16 +135,16 @@ class NissaWorldwakerSearchEffect extends OneShotEffect { for (UUID cardId: target.getTargets()) { Card card = player.getLibrary().getCard(cardId, game); if (card != null) { - player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId()); + if (player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId())) { + ContinuousEffect effect = new BecomesCreatureTargetEffect(new NissaWorldwakerToken(), "land", Duration.Custom); + effect.setTargetPointer(new FixedTarget(card.getId())); + game.addEffect(effect, source); + } } } } } player.shuffleLibrary(game); - - ContinuousEffect effect = new BecomesCreatureTargetEffect(new NissaWorldwakerToken(), "land", Duration.EndOfGame); - game.addEffect(effect, source); - return true; } } diff --git a/Mage.Sets/src/mage/sets/magic2015/ParagonOfEternalWilds.java b/Mage.Sets/src/mage/sets/magic2015/ParagonOfEternalWilds.java new file mode 100644 index 0000000000..3df71173ac --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2015/ParagonOfEternalWilds.java @@ -0,0 +1,97 @@ +/* + * 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.magic2015; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continious.BoostAllEffect; +import mage.abilities.effects.common.continious.GainAbilityTargetEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class ParagonOfEternalWilds extends CardImpl { + + private static final FilterCreaturePermanent filterGreen = new FilterCreaturePermanent("green creatures you control"); + private static final FilterControlledCreaturePermanent filterGreen2 = new FilterControlledCreaturePermanent("another target green creature you control"); + + static { + filterGreen.add(new ColorPredicate(ObjectColor.GREEN)); + filterGreen.add(new ControllerPredicate(TargetController.YOU)); + filterGreen2.add(new ColorPredicate(ObjectColor.GREEN)); + filterGreen2.add(new AnotherPredicate()); + } + + public ParagonOfEternalWilds(UUID ownerId) { + super(ownerId, 190, "Paragon of Eternal Wilds", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{G}"); + this.expansionSetCode = "M15"; + this.subtype.add("Human"); + this.subtype.add("Druid"); + + this.color.setGreen(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Other green creatures you control get +1/+1. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filterGreen, true))); + // {G}, {t}: Another target green creature you control gains trample until end of turn. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityTargetEffect(TrampleAbility.getInstance(),Duration.EndOfTurn), new ManaCostsImpl("{G}")); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetControlledCreaturePermanent(filterGreen2)); + this.addAbility(ability); + } + + public ParagonOfEternalWilds(final ParagonOfEternalWilds card) { + super(card); + } + + @Override + public ParagonOfEternalWilds copy() { + return new ParagonOfEternalWilds(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magic2015/Phytotitan.java b/Mage.Sets/src/mage/sets/magic2015/Phytotitan.java new file mode 100644 index 0000000000..e67d56c425 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2015/Phytotitan.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.magic2015; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.common.delayed.AtTheBeginOfNextUpkeepDelayedTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.game.Game; + +/** + * + * @author LevelX2 + */ +public class Phytotitan extends CardImpl { + + public Phytotitan(UUID ownerId) { + super(ownerId, 191, "Phytotitan", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{G}{G}"); + this.expansionSetCode = "M15"; + this.subtype.add("Plant"); + this.subtype.add("Elemental"); + + this.color.setGreen(true); + this.power = new MageInt(7); + this.toughness = new MageInt(2); + + // When Phytotitan dies, return it to the battlefield tapped under its owner's control at the beginning of his or her next upkeep. + this.addAbility(new DiesTriggeredAbility(new PhytotitanEffect())); + } + + public Phytotitan(final Phytotitan card) { + super(card); + } + + @Override + public Phytotitan copy() { + return new Phytotitan(this); + } +} + +class PhytotitanEffect extends OneShotEffect { + + private static final String effectText = "return it to the battlefield tapped under its owner's control at the beginning of his or her next upkeep"; + + PhytotitanEffect ( ) { + super(Outcome.Benefit); + staticText = effectText; + } + + PhytotitanEffect(PhytotitanEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + //create delayed triggered ability + Effect effect = new ReturnSourceFromGraveyardToBattlefieldEffect(true, true); + effect.setText(staticText); + AtTheBeginOfNextUpkeepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(effect); + delayedAbility.setSourceId(source.getSourceId()); + delayedAbility.setControllerId(source.getControllerId()); + game.addDelayedTriggeredAbility(delayedAbility); + return true; + } + + @Override + public PhytotitanEffect copy() { + return new PhytotitanEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/magic2015/YisanTheWandererBard.java b/Mage.Sets/src/mage/sets/magic2015/YisanTheWandererBard.java new file mode 100644 index 0000000000..3d578f6938 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2015/YisanTheWandererBard.java @@ -0,0 +1,128 @@ +/* + * 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.magic2015; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.PutCountersSourceCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.Counter; +import mage.filter.Filter; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author LevelX2 + */ +public class YisanTheWandererBard extends CardImpl { + + public YisanTheWandererBard(UUID ownerId) { + super(ownerId, 209, "Yisan, the Wanderer Bard", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{G}"); + this.expansionSetCode = "M15"; + this.supertype.add("Legendary"); + this.subtype.add("Human"); + this.subtype.add("Rogue"); + + this.color.setGreen(true); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // {2}{G}, {T}, Put a verse counter on Yisan, the Wanderer Bard: Search your library for a creature card with converted mana cost equal to the number of verse counters on Yisan, put it onto the battlefield, then shuffle your library. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new YisanTheWandererBardEffect(), new ManaCostsImpl("{2}{G}")); + ability.addCost(new TapSourceCost()); + ability.addCost(new PutCountersSourceCost(new Counter("verse"))); + this.addAbility(ability); + } + + public YisanTheWandererBard(final YisanTheWandererBard card) { + super(card); + } + + @Override + public YisanTheWandererBard copy() { + return new YisanTheWandererBard(this); + } +} + +class YisanTheWandererBardEffect extends OneShotEffect { + + public YisanTheWandererBardEffect() { + super(Outcome.Benefit); + this.staticText = "Search your library for a creature card with converted mana cost equal to the number of verse counters on {this}, put it onto the battlefield, then shuffle your library"; + } + + public YisanTheWandererBardEffect(final YisanTheWandererBardEffect effect) { + super(effect); + } + + @Override + public YisanTheWandererBardEffect copy() { + return new YisanTheWandererBardEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (sourcePermanent != null && player != null) { + int newConvertedCost = sourcePermanent.getCounters().getCount("verse"); + FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost); + filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, newConvertedCost)); + filter.add(new CardTypePredicate(CardType.CREATURE)); + TargetCardInLibrary target = new TargetCardInLibrary(filter); + if (player.searchLibrary(target, game)) { + for (UUID cardId : target.getTargets()) { + Card card = player.getLibrary().getCard(cardId, game); + if (card != null) { + player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId()); + } + } + } + player.shuffleLibrary(game); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/newphyrexia/BirthingPod.java b/Mage.Sets/src/mage/sets/newphyrexia/BirthingPod.java index d9740b4895..2b02d1f589 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/BirthingPod.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/BirthingPod.java @@ -113,7 +113,7 @@ class BirthingPodEffect extends OneShotEffect { for (UUID cardId : target.getTargets()) { Card card = player.getLibrary().getCard(cardId, game); if (card != null) { - card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId()); + player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId()); } } } diff --git a/Mage.Sets/src/mage/sets/ravnika/Overwhelm.java b/Mage.Sets/src/mage/sets/ravnika/Overwhelm.java index f34c68bda5..d9410dc22b 100644 --- a/Mage.Sets/src/mage/sets/ravnika/Overwhelm.java +++ b/Mage.Sets/src/mage/sets/ravnika/Overwhelm.java @@ -42,9 +42,11 @@ import mage.cards.CardImpl; public class Overwhelm extends CardImpl { public Overwhelm(UUID ownerId) { - super(ownerId, 175, "Overwhelm", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{5}{G}{G}"); + super(ownerId, 175, "Overwhelm", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{5}{G}{G}"); this.expansionSetCode = "RAV"; + this.color.setGreen(true); + // Convoke (Each creature you tap while casting this spell reduces its cost by {1} or by one mana of that creature's color.) this.addAbility(new ConvokeAbility()); diff --git a/Mage/src/mage/abilities/costs/common/PutCountersSourceCost.java b/Mage/src/mage/abilities/costs/common/PutCountersSourceCost.java index 45b8669df5..bad1712585 100644 --- a/Mage/src/mage/abilities/costs/common/PutCountersSourceCost.java +++ b/Mage/src/mage/abilities/costs/common/PutCountersSourceCost.java @@ -42,9 +42,9 @@ import mage.util.CardUtil; */ public class PutCountersSourceCost extends CostImpl { - private int amount; - private String name; - private Counter counter; + private final int amount; + private final String name; + private final Counter counter; public PutCountersSourceCost(Counter counter) { this.counter = counter.copy(); diff --git a/Mage/src/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java b/Mage/src/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java index 53030516d8..f5ef7cf47c 100644 --- a/Mage/src/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java +++ b/Mage/src/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java @@ -34,7 +34,6 @@ import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.game.Game; -import mage.game.permanent.Permanent; import mage.players.Player; /** @@ -44,6 +43,7 @@ import mage.players.Player; public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect { private boolean tapped; + private boolean ownerControl; public ReturnSourceFromGraveyardToBattlefieldEffect() { this(false); @@ -54,10 +54,17 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect this.tapped = tapped; setText(); } + public ReturnSourceFromGraveyardToBattlefieldEffect(boolean tapped, boolean ownerControl) { + super(Outcome.PutCreatureInPlay); + this.tapped = tapped; + this.ownerControl = ownerControl; + setText(); + } public ReturnSourceFromGraveyardToBattlefieldEffect(final ReturnSourceFromGraveyardToBattlefieldEffect effect) { super(effect); this.tapped = effect.tapped; + this.ownerControl = effect.ownerControl; } @Override @@ -67,22 +74,36 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - Card card = player.getGraveyard().get(source.getSourceId(), game); - if (card != null) { - if(card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId(), tapped)) - { - return true; - } + if (!game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)) { + return false; + } + Card card = game.getCard(source.getSourceId()); + if (card == null) { + return false; } - return false; + + Player player; + if (ownerControl) { + player = game.getPlayer(card.getOwnerId()); + } else { + player = game.getPlayer(source.getControllerId()); + } + if (player == null) { + return false; + } + + return player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId(), tapped); } private void setText() { - if (tapped) - staticText = "Return {this} from your graveyard to the battlefield tapped"; - else - staticText = "Return {this} from your graveyard to the battlefield"; + StringBuilder sb = new StringBuilder("Return {this} from your graveyard to the battlefield"); + if (tapped) { + sb.append(" tapped"); + } + if (ownerControl) { + sb.append(" under its owner's control"); + } + staticText = sb.toString(); } } diff --git a/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureTargetEffect.java index 4c258a621f..3aad7027b4 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureTargetEffect.java @@ -120,8 +120,11 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { permanent.getPower().setValue(token.getPower().getValue()); } } + result = true; } - result |= true; + } + if (!result && this.duration.equals(Duration.Custom) ) { + this.discard(); } return result; } diff --git a/Mage/src/mage/abilities/effects/common/continious/GainAbilityTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/GainAbilityTargetEffect.java index 77671d34f8..c36f35ee6e 100644 --- a/Mage/src/mage/abilities/effects/common/continious/GainAbilityTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/GainAbilityTargetEffect.java @@ -164,7 +164,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl { } sb.append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName()).append(" gain "); } else { - if (!target.getTargetName().startsWith("another")) { + if (!target.getTargetName().toUpperCase().startsWith("ANOTHER")) { sb.append("Target "); } sb.append(target.getTargetName()).append(" gains ");