From fde9ae68dc0cb099b4876b2a8a73e3371d76ec93 Mon Sep 17 00:00:00 2001 From: LoneFox Date: Fri, 6 Nov 2015 09:19:47 +0200 Subject: [PATCH] Extract DestroyTargetAtBeginningOfNextEndStepEffect from Stone Giant to its own file. Implement cards: Blood Frenzy, Flowstone Sculpture, Imps' Taunt, and Mogg Cannon --- .../src/mage/sets/magic2010/StoneGiant.java | 45 +----- .../src/mage/sets/tempest/BloodFrenzy.java | 119 +++++++++++++++ .../mage/sets/tempest/FlowstoneSculpture.java | 52 +++++++ .../src/mage/sets/tempest/ImpsTaunt.java | 64 ++++++++ .../src/mage/sets/tempest/MoggCannon.java | 76 +++++++++ .../vintagemasters/FlowstoneSculpture.java | 144 ++++++++++++++++++ ...yTargetAtBeginningOfNextEndStepEffect.java | 69 +++++++++ 7 files changed, 530 insertions(+), 39 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/tempest/BloodFrenzy.java create mode 100644 Mage.Sets/src/mage/sets/tempest/FlowstoneSculpture.java create mode 100644 Mage.Sets/src/mage/sets/tempest/ImpsTaunt.java create mode 100644 Mage.Sets/src/mage/sets/tempest/MoggCannon.java create mode 100644 Mage.Sets/src/mage/sets/vintagemasters/FlowstoneSculpture.java create mode 100644 Mage/src/mage/abilities/effects/common/DestroyTargetAtBeginningOfNextEndStepEffect.java diff --git a/Mage.Sets/src/mage/sets/magic2010/StoneGiant.java b/Mage.Sets/src/mage/sets/magic2010/StoneGiant.java index c43cc027e9..f377e69b98 100644 --- a/Mage.Sets/src/mage/sets/magic2010/StoneGiant.java +++ b/Mage.Sets/src/mage/sets/magic2010/StoneGiant.java @@ -28,26 +28,22 @@ package mage.sets.magic2010; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.DestroyTargetAtBeginningOfNextEndStepEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; -import mage.target.targetpointer.FixedTarget; /** * @@ -68,7 +64,7 @@ public class StoneGiant extends CardImpl { new TapSourceCost()); ability.addTarget(new StoneGiantTarget()); // Destroy that creature at the beginning of the next end step. - ability.addEffect(new StoneGiantEffect()); + ability.addEffect(new DestroyTargetAtBeginningOfNextEndStepEffect()); this.addAbility(ability); } @@ -109,32 +105,3 @@ class StoneGiantTarget extends TargetPermanent { return false; } } - -class StoneGiantEffect extends OneShotEffect { - - public StoneGiantEffect() { - super(Outcome.Detriment); - this.staticText = "Destroy that creature at the beginning of the next end step"; - } - - public StoneGiantEffect(final StoneGiantEffect effect) { - super(effect); - } - - @Override - public StoneGiantEffect copy() { - return new StoneGiantEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - DestroyTargetEffect effect = new DestroyTargetEffect(); - effect.setTargetPointer(new FixedTarget(source.getFirstTarget())); - AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect); - delayedAbility.setSourceId(source.getSourceId()); - delayedAbility.setControllerId(source.getControllerId()); - delayedAbility.setSourceObject(source.getSourceObject(game), game); - game.addDelayedTriggeredAbility(delayedAbility); - return true; - } -} diff --git a/Mage.Sets/src/mage/sets/tempest/BloodFrenzy.java b/Mage.Sets/src/mage/sets/tempest/BloodFrenzy.java new file mode 100644 index 0000000000..1409650117 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/BloodFrenzy.java @@ -0,0 +1,119 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.abilities.effects.common.DestroyTargetAtBeginningOfNextEndStepEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.PhaseStep; +import mage.constants.Rarity; +import mage.constants.TurnPhase; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.target.common.TargetAttackingOrBlockingCreature; + +/** + * + * @author LoneFox + */ +public class BloodFrenzy extends CardImpl { + + public BloodFrenzy(UUID ownerId) { + super(ownerId, 164, "Blood Frenzy", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{R}"); + this.expansionSetCode = "TMP"; + + // Cast Blood Frenzy only before the combat damage step. + Ability ability = new SimpleStaticAbility(Zone.ALL, new BloodFrenzyCastRestriction()); + ability.setRuleAtTheTop(true); + this.addAbility(ability); + // Target attacking or blocking creature gets +4/+0 until end of turn. Destroy that creature at the beginning of the next end step. + this.getSpellAbility().addEffect(new BoostTargetEffect(4, 0, Duration.EndOfTurn)); + this.getSpellAbility().addEffect(new DestroyTargetAtBeginningOfNextEndStepEffect()); + this.getSpellAbility().addTarget(new TargetAttackingOrBlockingCreature()); + } + + public BloodFrenzy(final BloodFrenzy card) { + super(card); + } + + @Override + public BloodFrenzy copy() { + return new BloodFrenzy(this); + } +} + + +class BloodFrenzyCastRestriction extends ContinuousRuleModifyingEffectImpl { + + BloodFrenzyCastRestriction() { + super(Duration.EndOfGame, Outcome.Detriment); + staticText = "Cast {this} only before the combat damage step"; + } + + BloodFrenzyCastRestriction(final BloodFrenzyCastRestriction effect) { + super(effect); + } + + @Override + public BloodFrenzyCastRestriction copy() { + return new BloodFrenzyCastRestriction(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType().equals(GameEvent.EventType.CAST_SPELL); + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if(event.getSourceId().equals(source.getSourceId())) { + if(game.getPhase().getType().equals(TurnPhase.COMBAT) + // There cannot be a legal target before declare attackers, + // so in practice it is limited to these two steps. + && (game.getStep().getType().equals(PhaseStep.DECLARE_ATTACKERS) + || game.getStep().getType().equals(PhaseStep.DECLARE_BLOCKERS))) { + return false; + } + return true; + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/FlowstoneSculpture.java b/Mage.Sets/src/mage/sets/tempest/FlowstoneSculpture.java new file mode 100644 index 0000000000..cc468438c4 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/FlowstoneSculpture.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.tempest; + +import java.util.UUID; + +/** + * + * @author LoneFox + */ +public class FlowstoneSculpture extends mage.sets.vintagemasters.FlowstoneSculpture { + + public FlowstoneSculpture(UUID ownerId) { + super(ownerId); + this.cardNumber = 278; + this.expansionSetCode = "TMP"; + } + + public FlowstoneSculpture(final FlowstoneSculpture card) { + super(card); + } + + @Override + public FlowstoneSculpture copy() { + return new FlowstoneSculpture(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/ImpsTaunt.java b/Mage.Sets/src/mage/sets/tempest/ImpsTaunt.java new file mode 100644 index 0000000000..19e76245e1 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/ImpsTaunt.java @@ -0,0 +1,64 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.abilities.effects.common.combat.AttacksIfAbleTargetEffect; +import mage.abilities.keyword.BuybackAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class ImpsTaunt extends CardImpl { + + public ImpsTaunt(UUID ownerId) { + super(ownerId, 32, "Imps' Taunt", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{B}"); + this.expansionSetCode = "TMP"; + + // Buyback {3} + this.addAbility(new BuybackAbility("{3}")); + // Target creature attacks this turn if able. + this.getSpellAbility().addEffect(new AttacksIfAbleTargetEffect(Duration.EndOfTurn)); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + } + + public ImpsTaunt(final ImpsTaunt card) { + super(card); + } + + @Override + public ImpsTaunt copy() { + return new ImpsTaunt(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/MoggCannon.java b/Mage.Sets/src/mage/sets/tempest/MoggCannon.java new file mode 100644 index 0000000000..45a20e8f8f --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/MoggCannon.java @@ -0,0 +1,76 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DestroyTargetAtBeginningOfNextEndStepEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class MoggCannon extends CardImpl { + + public MoggCannon(UUID ownerId) { + super(ownerId, 288, "Mogg Cannon", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}"); + this.expansionSetCode = "TMP"; + + // {tap}: Target creature you control gets +1/+0 and gains flying until end of turn. Destroy that creature at the beginning of the next end step. + Effect effect = new BoostTargetEffect(1, 0, Duration.EndOfTurn); + effect.setText("target creature you control gets +1/+0"); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new TapSourceCost()); + effect = new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn); + effect.setText("and gains flying until end of turn"); + ability.addEffect(effect); + ability.addEffect(new DestroyTargetAtBeginningOfNextEndStepEffect()); + ability.addTarget(new TargetControlledCreaturePermanent()); + this.addAbility(ability); + } + + public MoggCannon(final MoggCannon card) { + super(card); + } + + @Override + public MoggCannon copy() { + return new MoggCannon(this); + } +} diff --git a/Mage.Sets/src/mage/sets/vintagemasters/FlowstoneSculpture.java b/Mage.Sets/src/mage/sets/vintagemasters/FlowstoneSculpture.java new file mode 100644 index 0000000000..6d67f89d7a --- /dev/null +++ b/Mage.Sets/src/mage/sets/vintagemasters/FlowstoneSculpture.java @@ -0,0 +1,144 @@ +/* + * 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.vintagemasters; + +import java.util.HashSet; +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.DiscardCardCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FirstStrikeAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.choices.Choice; +import mage.choices.ChoiceImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author LoneFox + */ +public class FlowstoneSculpture extends CardImpl { + + public FlowstoneSculpture(UUID ownerId) { + super(ownerId, 268, "Flowstone Sculpture", Rarity.RARE, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{6}"); + this.expansionSetCode = "VMA"; + this.subtype.add("Shapeshifter"); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // {2}, Discard a card: Put a +1/+1 counter on Flowstone Sculpture or Flowstone Sculpture gains flying, first strike, or trample. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new FlowstoneSculptureEffect(), new ManaCostsImpl("{2}")); + ability.addCost(new DiscardCardCost()); + this.addAbility(ability); + } + + public FlowstoneSculpture(final FlowstoneSculpture card) { + super(card); + } + + @Override + public FlowstoneSculpture copy() { + return new FlowstoneSculpture(this); + } +} + +class FlowstoneSculptureEffect extends OneShotEffect { + + private static final HashSet choices = new HashSet<>(); + + static { + choices.add("+1/+1 counter"); + choices.add("Flying"); + choices.add("First Strike"); + choices.add("Trample"); + } + + public FlowstoneSculptureEffect() { + super(Outcome.Benefit); + staticText = "Put a +1/+1 counter on {this} or {this} gains flying, first strike, or trample."; + } + + public FlowstoneSculptureEffect(final FlowstoneSculptureEffect effect) { + super(effect); + } + + @Override + public FlowstoneSculptureEffect copy() { + return new FlowstoneSculptureEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if(controller != null) { + Choice choice = new ChoiceImpl(true); + choice.setMessage("Choose ability to add"); + choice.setChoices(choices); + while(!controller.choose(outcome, choice, game)) { + if(controller.canRespond()) { + return false; + } + } + + String chosen = choice.getChoice(); + if(chosen.equals("+1/+1 counter")) { + return new AddCountersSourceEffect(CounterType.P1P1.createInstance()).apply(game, source); + } + else { + Ability gainedAbility; + if(chosen.equals("Flying")) { + gainedAbility = FlyingAbility.getInstance(); + } + else if(chosen.equals("First strike")) { + gainedAbility = FirstStrikeAbility.getInstance(); + } + else { + gainedAbility = TrampleAbility.getInstance(); + } + game.addEffect(new GainAbilitySourceEffect(gainedAbility, Duration.WhileOnBattlefield), source); + return true; + } + + } + return false; + } +} diff --git a/Mage/src/mage/abilities/effects/common/DestroyTargetAtBeginningOfNextEndStepEffect.java b/Mage/src/mage/abilities/effects/common/DestroyTargetAtBeginningOfNextEndStepEffect.java new file mode 100644 index 0000000000..02bb996773 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/DestroyTargetAtBeginningOfNextEndStepEffect.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.effects.common; + +import mage.abilities.Ability; +import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.constants.Outcome; +import mage.game.Game; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author LoneFox + */ +public class DestroyTargetAtBeginningOfNextEndStepEffect extends OneShotEffect { + + public DestroyTargetAtBeginningOfNextEndStepEffect() { + super(Outcome.Detriment); + this.staticText = "Destroy that creature at the beginning of the next end step"; + } + + public DestroyTargetAtBeginningOfNextEndStepEffect(final DestroyTargetAtBeginningOfNextEndStepEffect effect) { + super(effect); + } + + @Override + public DestroyTargetAtBeginningOfNextEndStepEffect copy() { + return new DestroyTargetAtBeginningOfNextEndStepEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + DestroyTargetEffect effect = new DestroyTargetEffect(); + effect.setTargetPointer(new FixedTarget(source.getFirstTarget())); + AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect); + delayedAbility.setSourceId(source.getSourceId()); + delayedAbility.setControllerId(source.getControllerId()); + delayedAbility.setSourceObject(source.getSourceObject(game), game); + game.addDelayedTriggeredAbility(delayedAbility); + return true; + } +}