From cc475db3c16fdde6789cae0ab9f4d62fe9eca5d7 Mon Sep 17 00:00:00 2001 From: Daniele Rosolen Date: Fri, 18 Mar 2016 22:25:40 +0100 Subject: [PATCH 1/5] Add mage.choiches.ChoiceLandType -The CoiceLandType gives the possibility to choose between any of the Land Types (Desert, Forest, Gate, Island, Lair, Locus, Mine, Mountain, Plains, Power-Plant, Swamp, Tower, and Urza's -- as defined by rule 205.3i) --- .../java/mage/choices/ChoiceLandType.java | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Mage/src/main/java/mage/choices/ChoiceLandType.java diff --git a/Mage/src/main/java/mage/choices/ChoiceLandType.java b/Mage/src/main/java/mage/choices/ChoiceLandType.java new file mode 100644 index 0000000000..0f9e5c49f6 --- /dev/null +++ b/Mage/src/main/java/mage/choices/ChoiceLandType.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.choices; + +/** + * + * @author tre3qwerty + */ +public class ChoiceLandType extends ChoiceImpl { + + public ChoiceLandType() { + super(true); + this.choices.add("Forest"); + this.choices.add("Island"); + this.choices.add("Mountain"); + this.choices.add("Plains"); + this.choices.add("Swamp"); + this.choices.add("Desert"); + this.choices.add("Gate"); + this.choices.add("Lair"); + this.choices.add("Locus"); + this.choices.add("Urza's"); + this.choices.add("Mine"); + this.choices.add("Power-Plant"); + this.choices.add("Tower"); + this.message = "Choose a land type"; + } + + public ChoiceLandType(final ChoiceLandType choice) { + super(choice); + } + + @Override + public ChoiceLandType copy() { + return new ChoiceLandType(this); + } + +} From f07cc676cd7cd1f42f45b3ecdf13259958766353 Mon Sep 17 00:00:00 2001 From: Daniele Rosolen Date: Fri, 18 Mar 2016 22:32:29 +0100 Subject: [PATCH 2/5] Implement VisionCharm -The first two effects use already existing effects, while the third one uses a custom effect (VisionCharmEffect) to transform every land of the given type currently on the battlefield to a land of the given Basic Land Type until the end of the turn. Any existing subtype or ability is temporarily removed and substituted with the Basic Land's subtype and mana ability --- .../src/mage/sets/visions/VisionCharm.java | 172 ++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/visions/VisionCharm.java diff --git a/Mage.Sets/src/mage/sets/visions/VisionCharm.java b/Mage.Sets/src/mage/sets/visions/VisionCharm.java new file mode 100644 index 0000000000..ff52862073 --- /dev/null +++ b/Mage.Sets/src/mage/sets/visions/VisionCharm.java @@ -0,0 +1,172 @@ +/* + * 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.visions; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.PhaseOutTargetEffect; +import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; +import mage.abilities.mana.BlackManaAbility; +import mage.abilities.mana.BlueManaAbility; +import mage.abilities.mana.GreenManaAbility; +import mage.abilities.mana.RedManaAbility; +import mage.abilities.mana.WhiteManaAbility; +import mage.cards.CardImpl; +import mage.choices.Choice; +import mage.choices.ChoiceLandType; +import mage.choices.ChoiceBasicLandType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SubLayer; +import mage.filter.common.FilterLandPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.target.common.TargetArtifactPermanent; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; + +/** + * + * @author tre3qwerty + */ +public class VisionCharm extends CardImpl { + + public VisionCharm(UUID ownerId) { + super(ownerId, 49, "Vision Charm", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{U}"); + this.expansionSetCode = "VIS"; + + + // Choose one - Phase target artifact + this.getSpellAbility().addEffect(new PhaseOutTargetEffect()); + this.getSpellAbility().addTarget(new TargetArtifactPermanent()); + // or Target player puts the top four cards of his or her library into his or her graveyard. + Mode mode = new Mode(); + mode.getEffects().add(new PutLibraryIntoGraveTargetEffect(4)); + mode.getTargets().add(new TargetPlayer()); + this.getSpellAbility().addMode(mode); + // or choose a land type and a basic land type. Each land of the first chosen type becomes the second chosen type until end of turn. + mode = new Mode(); + mode.getEffects().add(new VisionCharmEffect()); + this.getSpellAbility().addMode(mode); + } + + public VisionCharm(final VisionCharm card) { + super(card); + } + + @Override + public VisionCharm copy() { + return new VisionCharm(this); + } +} + +class VisionCharmEffect extends ContinuousEffectImpl { + private String targetLandType; + private String targetBasicLandType; + + public VisionCharmEffect() { + super(Duration.EndOfTurn, Outcome.Neutral); + staticText = "Choose a land type and a basic land type. Each land of the first chosen type becomes the second chosen type until end of turn."; + } + + public VisionCharmEffect(final VisionCharmEffect effect) { + super(effect); + } + + @Override + public VisionCharmEffect copy() { + return new VisionCharmEffect(this); + } + + @Override + public void init(Ability source, Game game) { + Player controller = game.getPlayer(source.getControllerId()); + if(controller != null) { + Choice choice = new ChoiceLandType(); + controller.choose(outcome, choice, game); + targetLandType = choice.getChoice(); + + choice = new ChoiceBasicLandType(); + controller.choose(outcome, choice, game); + targetBasicLandType = choice.getChoice(); + } + else { + this.discard(); + } + } + + @Override + public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { + FilterPermanent filter = new FilterLandPermanent(); + filter.add(new SubtypePredicate(targetLandType)); + for (Permanent land : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { + //Remove all existing subtypes and replace them with the selected Basic Land Type + land.getSubtype().removeAll(land.getSubtype()); + land.getSubtype().add(targetBasicLandType); + + /* Remove the existing abilities and replace them with the ability + of the chosen basic land */ + land.removeAllAbilities(source.getId(), game); + switch(targetBasicLandType) { + case "Swamp": + land.addAbility(new BlackManaAbility(), source.getSourceId(), game); + break; + case "Mountain": + land.addAbility(new RedManaAbility(), source.getSourceId(), game); + break; + case "Forest": + land.addAbility(new GreenManaAbility(), source.getSourceId(), game); + break; + case "Island": + land.addAbility(new BlueManaAbility(), source.getSourceId(), game); + break; + case "Plains": + land.addAbility(new WhiteManaAbility(), source.getSourceId(), game); + break; + } + } + return true; + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } + + @Override + public boolean hasLayer(Layer layer) { + return layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.TypeChangingEffects_4; + } +} From 4971c7d5fe2de4a6c2a3e5ecab0873fbeae975dd Mon Sep 17 00:00:00 2001 From: Daniele Rosolen Date: Sat, 19 Mar 2016 14:37:59 +0100 Subject: [PATCH 3/5] Modified ChoiceLandType to use CardRepository -ChoiceLandType now generates the land types list using CardRepository.getLandTypes() instead of using a statically typed list. --- .../main/java/mage/choices/ChoiceLandType.java | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/Mage/src/main/java/mage/choices/ChoiceLandType.java b/Mage/src/main/java/mage/choices/ChoiceLandType.java index 0f9e5c49f6..f9a3e74085 100644 --- a/Mage/src/main/java/mage/choices/ChoiceLandType.java +++ b/Mage/src/main/java/mage/choices/ChoiceLandType.java @@ -28,6 +28,8 @@ package mage.choices; +import mage.cards.repository.CardRepository; + /** * * @author tre3qwerty @@ -36,19 +38,7 @@ public class ChoiceLandType extends ChoiceImpl { public ChoiceLandType() { super(true); - this.choices.add("Forest"); - this.choices.add("Island"); - this.choices.add("Mountain"); - this.choices.add("Plains"); - this.choices.add("Swamp"); - this.choices.add("Desert"); - this.choices.add("Gate"); - this.choices.add("Lair"); - this.choices.add("Locus"); - this.choices.add("Urza's"); - this.choices.add("Mine"); - this.choices.add("Power-Plant"); - this.choices.add("Tower"); + this.setChoices(CardRepository.instance.getLandTypes()); this.message = "Choose a land type"; } From d7c1ba2514d7e429e8cb736491eb3d6c4e6252d5 Mon Sep 17 00:00:00 2001 From: DjB Date: Sat, 19 Mar 2016 13:37:38 -0500 Subject: [PATCH 4/5] Create OrdruunCommando.java --- .../mage/sets/ravnica/OrdruunCommando.java | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/ravnica/OrdruunCommando.java diff --git a/Mage.Sets/src/mage/sets/ravnica/OrdruunCommando.java b/Mage.Sets/src/mage/sets/ravnica/OrdruunCommando.java new file mode 100644 index 0000000000..2082f2c4d0 --- /dev/null +++ b/Mage.Sets/src/mage/sets/ravnica/OrdruunCommando.java @@ -0,0 +1,67 @@ +/* + * 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.ravnica; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.PreventDamageToSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author djbrez + */ +public class OrdruunCommando extends CardImpl { + + public OrdruunCommando(UUID ownerId) { + super(ownerId, 137, "Ordruun Commando", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{R}"); + this.expansionSetCode = "RAV"; + this.subtype.add("Minotaur"); + this.subtype.add("Soldier"); + this.power = new MageInt(4); + this.toughness = new MageInt(1); + + // {W}: Prevent the next 1 damage that would be dealt to Ordruun Commando this turn. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToSourceEffect(Duration.EndOfTurn, 1), new ManaCostsImpl("{W}"))); + } + + public OrdruunCommando(final OrdruunCommando card) { + super(card); + } + + @Override + public OrdruunCommando copy() { + return new OrdruunCommando(this); + } +} From 0a7c8decddeb38cff0d41625fbb53f7cf990d506 Mon Sep 17 00:00:00 2001 From: spjspj Date: Sun, 20 Mar 2016 20:41:32 +1100 Subject: [PATCH 5/5] spjspj - Implement Thran Turbine (USG) --- .../src/mage/sets/urzassaga/ThranTurbine.java | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/urzassaga/ThranTurbine.java diff --git a/Mage.Sets/src/mage/sets/urzassaga/ThranTurbine.java b/Mage.Sets/src/mage/sets/urzassaga/ThranTurbine.java new file mode 100644 index 0000000000..a86b668e62 --- /dev/null +++ b/Mage.Sets/src/mage/sets/urzassaga/ThranTurbine.java @@ -0,0 +1,160 @@ +/* + * 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.urzassaga; + +import java.util.HashSet; +import java.util.UUID; +import mage.ConditionalMana; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.ActivatedAbility; +import mage.abilities.SpellAbility; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.costs.Cost; +import mage.abilities.costs.mana.ManaCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.AddConditionalColorlessManaEffect; +import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.abilities.mana.conditional.ManaCondition; +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.TargetController; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author spjspjs + */ +public class ThranTurbine extends CardImpl { + + public ThranTurbine(UUID ownerId) { + super(ownerId, 311, "Thran Turbine", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{1}"); + this.expansionSetCode = "USG"; + + // At the beginning of your upkeep, you may add {C} or {C}{C} to your mana pool. You can't spend this mana to cast spells. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new ThranTurbineEffect(), TargetController.YOU, true)); + } + + public ThranTurbine(final ThranTurbine card) { + super(card); + } + + @Override + public ThranTurbine copy() { + return new ThranTurbine(this); + } +} + +class ThranTurbineEffect extends OneShotEffect { + + public ThranTurbineEffect() { + super(Outcome.Benefit); + staticText = "add {C} or {C}{C} to your mana pool. You can't spend this mana to cast spells"; + } + + public ThranTurbineEffect(final ThranTurbineEffect effect) { + super(effect); + } + + @Override + public ThranTurbineEffect copy() { + return new ThranTurbineEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(targetPointer.getFirst(game, source)); + + if (player != null) { + Choice numberChoice = new ChoiceImpl(); + HashSet numbers = new HashSet(); + numbers.add(Integer.toString(1)); + numbers.add(Integer.toString(2)); + numberChoice.setChoices(numbers); + numberChoice.setMessage("Choose the amount of {C} mana to add"); + + while (!player.choose(Outcome.Benefit, numberChoice, game)) { + if (!player.canRespond()) { + return false; + } + } + + int count = Integer.parseInt(numberChoice.getChoice()); + new AddConditionalColorlessManaEffect(count, new ThranTurbineManaBuilder()).apply(game, source); + return true; + } + return false; + } +} + +class ThranTurbineManaBuilder extends ConditionalManaBuilder { + + @Override + public ConditionalMana build(Object... options) { + return new ThranTurbineConditionalMana(this.mana); + } + + @Override + public String getRule() { + return "You can't spend this mana to cast spells"; + } +} + +class ThranTurbineConditionalMana extends ConditionalMana { + + public ThranTurbineConditionalMana(Mana mana) { + super(mana); + staticText = "You can't spend this mana to cast spells"; + addCondition(new ThranTurbineManaCondition()); + } +} + +class ThranTurbineManaCondition extends ManaCondition implements Condition { + + @Override + public boolean apply(Game game, Ability source, UUID originalId, Cost costToPay) { + if (!(source instanceof SpellAbility)) { + Permanent object = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (object != null && object.getColor(game).isColorless()) { + return true; + } + } + if (costToPay instanceof ManaCost) { + return ((ManaCost) costToPay).getText().contains("{C}"); + } + return false; + } +}