From 9ca40cf38ddf36ce600fb0ce75a9fea165962d2c Mon Sep 17 00:00:00 2001 From: LoneFox Date: Thu, 25 Jun 2015 20:42:02 +0300 Subject: [PATCH] Implement card: Story Circle --- .../mage/sets/eighthedition/StoryCircle.java | 55 +++++++++++ .../sets/mercadianmasques/StoryCircle.java | 98 +++++++++++++++++++ .../mage/sets/ninthedition/StoryCircle.java | 55 +++++++++++ .../mage/sets/tenthedition/StoryCircle.java | 55 +++++++++++ ...NextDamageFromChosenSourceToYouEffect.java | 14 +-- 5 files changed, 270 insertions(+), 7 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/eighthedition/StoryCircle.java create mode 100644 Mage.Sets/src/mage/sets/mercadianmasques/StoryCircle.java create mode 100644 Mage.Sets/src/mage/sets/ninthedition/StoryCircle.java create mode 100644 Mage.Sets/src/mage/sets/tenthedition/StoryCircle.java diff --git a/Mage.Sets/src/mage/sets/eighthedition/StoryCircle.java b/Mage.Sets/src/mage/sets/eighthedition/StoryCircle.java new file mode 100644 index 00000000000..6331bbeded8 --- /dev/null +++ b/Mage.Sets/src/mage/sets/eighthedition/StoryCircle.java @@ -0,0 +1,55 @@ +/* + * 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.eighthedition; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + + */ +public class StoryCircle extends mage.sets.mercadianmasques.StoryCircle { + + public StoryCircle(UUID ownerId) { + super(ownerId); + this.cardNumber = 50; + this.expansionSetCode = "8ED"; + this.rarity = Rarity.RARE; + } + + public StoryCircle(final StoryCircle card) { + super(card); + } + + @Override + public StoryCircle copy() { + return new StoryCircle(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/StoryCircle.java b/Mage.Sets/src/mage/sets/mercadianmasques/StoryCircle.java new file mode 100644 index 00000000000..7d0c8149b5b --- /dev/null +++ b/Mage.Sets/src/mage/sets/mercadianmasques/StoryCircle.java @@ -0,0 +1,98 @@ +/* + * 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.mercadianmasques; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.ChooseColorEffect; +import mage.abilities.effects.common.PreventNextDamageFromChosenSourceToYouEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterObject; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.game.Game; + +/** + * + * @author LoneFox + + */ +public class StoryCircle extends CardImpl { + + public StoryCircle(UUID ownerId) { + super(ownerId, 51, "Story Circle", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{W}"); + this.expansionSetCode = "MMQ"; + + // As Story Circle enters the battlefield, choose a color. + this.addAbility(new EntersBattlefieldAbility(new ChooseColorEffect(Outcome.Neutral))); + // {W}: The next time a source of your choice of the chosen color would deal damage to you this turn, prevent that damage. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new StoryCircleEffect(), new ManaCostsImpl("{W}"))); + } + + public StoryCircle(final StoryCircle card) { + super(card); + } + + @Override + public StoryCircle copy() { + return new StoryCircle(this); + } +} + +class StoryCircleEffect extends PreventNextDamageFromChosenSourceToYouEffect { + + public StoryCircleEffect() { + super(Duration.EndOfTurn); + staticText = "The next time a source of your choice of the chosen color would deal damage to you this turn, prevent that damage."; + } + + @Override + public void init(Ability source, Game game) { + FilterObject filter = targetSource.getFilter(); + filter.add(new ColorPredicate((ObjectColor) game.getState().getValue(source.getSourceId() + "_color"))); + super.init(source, game); + } + + public StoryCircleEffect(StoryCircleEffect effect) { + super(effect); + } + + @Override + public StoryCircleEffect copy() { + return new StoryCircleEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/ninthedition/StoryCircle.java b/Mage.Sets/src/mage/sets/ninthedition/StoryCircle.java new file mode 100644 index 00000000000..7e68854b836 --- /dev/null +++ b/Mage.Sets/src/mage/sets/ninthedition/StoryCircle.java @@ -0,0 +1,55 @@ +/* + * 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.ninthedition; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + + */ +public class StoryCircle extends mage.sets.mercadianmasques.StoryCircle { + + public StoryCircle(UUID ownerId) { + super(ownerId); + this.cardNumber = 48; + this.expansionSetCode = "9ED"; + this.rarity = Rarity.RARE; + } + + public StoryCircle(final StoryCircle card) { + super(card); + } + + @Override + public StoryCircle copy() { + return new StoryCircle(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tenthedition/StoryCircle.java b/Mage.Sets/src/mage/sets/tenthedition/StoryCircle.java new file mode 100644 index 00000000000..eec832a8e97 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tenthedition/StoryCircle.java @@ -0,0 +1,55 @@ +/* + * 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.tenthedition; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + + */ +public class StoryCircle extends mage.sets.mercadianmasques.StoryCircle { + + public StoryCircle(UUID ownerId) { + super(ownerId); + this.cardNumber = 49; + this.expansionSetCode = "10E"; + this.rarity = Rarity.RARE; + } + + public StoryCircle(final StoryCircle card) { + super(card); + } + + @Override + public StoryCircle copy() { + return new StoryCircle(this); + } +} diff --git a/Mage/src/mage/abilities/effects/common/PreventNextDamageFromChosenSourceToYouEffect.java b/Mage/src/mage/abilities/effects/common/PreventNextDamageFromChosenSourceToYouEffect.java index cd0466a16ba..f33f75a9122 100644 --- a/Mage/src/mage/abilities/effects/common/PreventNextDamageFromChosenSourceToYouEffect.java +++ b/Mage/src/mage/abilities/effects/common/PreventNextDamageFromChosenSourceToYouEffect.java @@ -19,27 +19,27 @@ import mage.target.TargetSource; */ public class PreventNextDamageFromChosenSourceToYouEffect extends PreventionEffectImpl { - private final TargetSource targetSource; - + protected final TargetSource targetSource; + public PreventNextDamageFromChosenSourceToYouEffect(Duration duration) { this(duration, new FilterObject("source")); } - + public PreventNextDamageFromChosenSourceToYouEffect(Duration duration, FilterObject filter) { this(duration, filter, false); } - + public PreventNextDamageFromChosenSourceToYouEffect(Duration duration, FilterObject filter, boolean onlyCombat) { super(duration, Integer.MAX_VALUE, onlyCombat); this.targetSource = new TargetSource(filter); this.staticText = setText(); } - + public PreventNextDamageFromChosenSourceToYouEffect(final PreventNextDamageFromChosenSourceToYouEffect effect) { super(effect); this.targetSource = effect.targetSource.copy(); } - + @Override public PreventNextDamageFromChosenSourceToYouEffect copy() { return new PreventNextDamageFromChosenSourceToYouEffect(this); @@ -76,5 +76,5 @@ public class PreventNextDamageFromChosenSourceToYouEffect extends PreventionEffe sb.append(", prevent that damage"); return sb.toString(); } - + }