From e9f0ad3f7df2b2c2c635d379e580da01b407a604 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 5 Sep 2013 17:14:10 +0200 Subject: [PATCH] [THS] Added Glare of Heresy and Gods Willing. --- .../src/mage/sets/theros/GlareOfHeresy.java | 72 +++++++++++++++++++ .../src/mage/sets/theros/GodsWilling.java | 69 ++++++++++++++++++ .../GainProtectionFromColorTargetEffect.java | 7 +- 3 files changed, 143 insertions(+), 5 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/theros/GlareOfHeresy.java create mode 100644 Mage.Sets/src/mage/sets/theros/GodsWilling.java diff --git a/Mage.Sets/src/mage/sets/theros/GlareOfHeresy.java b/Mage.Sets/src/mage/sets/theros/GlareOfHeresy.java new file mode 100644 index 0000000000..807e737e21 --- /dev/null +++ b/Mage.Sets/src/mage/sets/theros/GlareOfHeresy.java @@ -0,0 +1,72 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.theros; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.target.Target; +import mage.target.TargetPermanent; + +/** + * + * @author LevelX2 + */ +public class GlareOfHeresy extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("white permanent"); + static { + filter.add(new ColorPredicate(ObjectColor.WHITE)); + } + public GlareOfHeresy(UUID ownerId) { + super(ownerId, 15, "Glare of Heresy", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{1}{W}"); + this.expansionSetCode = "THS"; + + this.color.setWhite(true); + + // Exile target white permanent. + this.getSpellAbility().addEffect(new ExileTargetEffect()); + Target target = new TargetPermanent(filter); + target.setRequired(true); + this.getSpellAbility().addTarget(target); + } + + public GlareOfHeresy(final GlareOfHeresy card) { + super(card); + } + + @Override + public GlareOfHeresy copy() { + return new GlareOfHeresy(this); + } +} diff --git a/Mage.Sets/src/mage/sets/theros/GodsWilling.java b/Mage.Sets/src/mage/sets/theros/GodsWilling.java new file mode 100644 index 0000000000..5202eccbd7 --- /dev/null +++ b/Mage.Sets/src/mage/sets/theros/GodsWilling.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.sets.theros; + +import java.util.UUID; +import mage.abilities.effects.common.ScryEffect; +import mage.abilities.effects.common.continious.GainProtectionFromColorTargetEffect; +import mage.cards.CardImpl; +import mage.choices.Choice; +import mage.choices.ChoiceColor; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class GodsWilling extends CardImpl { + + public GodsWilling(UUID ownerId) { + super(ownerId, 16, "Gods Willing", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{W}"); + this.expansionSetCode = "THS"; + + this.color.setWhite(true); + + // Target creature you control gains protection from the color of your choice until end of turn. Scry 1. + this.getSpellAbility().addEffect(new GainProtectionFromColorTargetEffect(Duration.EndOfTurn)); + Choice colorChoice = new ChoiceColor(); + this.getSpellAbility().addChoice(colorChoice); + this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(true)); + this.getSpellAbility().addEffect(new ScryEffect(1)); + } + + public GodsWilling(final GodsWilling card) { + super(card); + } + + @Override + public GodsWilling copy() { + return new GodsWilling(this); + } +} diff --git a/Mage/src/mage/abilities/effects/common/continious/GainProtectionFromColorTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/GainProtectionFromColorTargetEffect.java index 2fe8370f2e..9797189489 100644 --- a/Mage/src/mage/abilities/effects/common/continious/GainProtectionFromColorTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/GainProtectionFromColorTargetEffect.java @@ -44,16 +44,12 @@ import mage.game.permanent.Permanent; */ public class GainProtectionFromColorTargetEffect extends GainAbilityTargetEffect { - FilterCard protectionFilter; - public GainProtectionFromColorTargetEffect(Duration duration) { super(new ProtectionAbility(new FilterCard()), duration); - protectionFilter = (FilterCard)((ProtectionAbility)ability).getFilter(); } public GainProtectionFromColorTargetEffect(final GainProtectionFromColorTargetEffect effect) { super(effect); - this.protectionFilter = effect.protectionFilter.copy(); } @Override @@ -66,10 +62,11 @@ public class GainProtectionFromColorTargetEffect extends GainAbilityTargetEffect Permanent creature = game.getPermanent(source.getFirstTarget()); if (creature != null) { ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); + FilterCard protectionFilter = (FilterCard)((ProtectionAbility)ability).getFilter(); protectionFilter.add(new ColorPredicate(choice.getColor())); protectionFilter.setMessage(choice.getChoice()); ((ProtectionAbility)ability).setFilter(protectionFilter); - creature.addAbility(ability, game); + creature.addAbility(ability, source.getSourceId(), game); return true; } return false;