From 645a4ec062d500431abc456e9cf1ebb6b858661c Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 7 May 2017 16:24:01 +0200 Subject: [PATCH] * Ravnica: City of Guilds - Added 3 cards. --- Mage.Sets/src/mage/cards/e/Excruciator.java | 97 +++++++++++++++ .../src/mage/cards/g/GazeOfTheGorgon.java | 115 ++++++++++++++++++ Mage.Sets/src/mage/cards/i/IndenturedOaf.java | 99 +++++++++++++++ .../src/mage/sets/RavnicaCityOfGuilds.java | 3 + .../common/TargetCreaturePermanent.java | 6 +- 5 files changed, 317 insertions(+), 3 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/e/Excruciator.java create mode 100644 Mage.Sets/src/mage/cards/g/GazeOfTheGorgon.java create mode 100644 Mage.Sets/src/mage/cards/i/IndenturedOaf.java diff --git a/Mage.Sets/src/mage/cards/e/Excruciator.java b/Mage.Sets/src/mage/cards/e/Excruciator.java new file mode 100644 index 0000000000..3c691afa1b --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/Excruciator.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.cards.e; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; + +/** + * + * @author LevelX2 + */ +public class Excruciator extends CardImpl { + + public Excruciator(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}{R}{R}"); + + this.subtype.add("Avatar"); + this.power = new MageInt(7); + this.toughness = new MageInt(7); + + // Damage that would be dealt by Excruciator can't be prevented. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ExcruciatorEffect())); + } + + public Excruciator(final Excruciator card) { + super(card); + } + + @Override + public Excruciator copy() { + return new Excruciator(this); + } +} + +class ExcruciatorEffect extends ContinuousRuleModifyingEffectImpl { + + public ExcruciatorEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit); + staticText = "Damage that would be dealt by {this} can't be prevented"; + } + + public ExcruciatorEffect(final ExcruciatorEffect effect) { + super(effect); + } + + @Override + public ExcruciatorEffect copy() { + return new ExcruciatorEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.PREVENT_DAMAGE; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return event.getSourceId().equals(source.getSourceId()); + } + +} diff --git a/Mage.Sets/src/mage/cards/g/GazeOfTheGorgon.java b/Mage.Sets/src/mage/cards/g/GazeOfTheGorgon.java new file mode 100644 index 0000000000..574af0a47a --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GazeOfTheGorgon.java @@ -0,0 +1,115 @@ +/* + * 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.cards.g; + +import java.util.ArrayList; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.RegenerateTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; +import mage.watchers.common.BlockedAttackerWatcher; + +/** + * + * @author LevelX2 + */ +public class GazeOfTheGorgon extends CardImpl { + + public GazeOfTheGorgon(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{B/G}"); + + // ({BG} can be paid with either {B} or {G}.) + // Regenerate target creature. At end of combat, destroy all creatures that blocked or were blocked by that creature this turn. + this.getSpellAbility().addEffect(new RegenerateTargetEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect( + new AtTheEndOfCombatDelayedTriggeredAbility(new GazeOfTheGorgonEffect()))); + this.getSpellAbility().addWatcher(new BlockedAttackerWatcher()); + } + + public GazeOfTheGorgon(final GazeOfTheGorgon card) { + super(card); + } + + @Override + public GazeOfTheGorgon copy() { + return new GazeOfTheGorgon(this); + } +} + +class GazeOfTheGorgonEffect extends OneShotEffect { + + public GazeOfTheGorgonEffect() { + super(Outcome.DestroyPermanent); + this.staticText = "destroy all creatures that blocked or were blocked by that creature this turn"; + } + + public GazeOfTheGorgonEffect(final GazeOfTheGorgonEffect effect) { + super(effect); + } + + @Override + public GazeOfTheGorgonEffect copy() { + return new GazeOfTheGorgonEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent targetCreature = game.getPermanentOrLKIBattlefield(source.getTargets().getFirstTarget()); + if (controller != null && targetCreature != null) { + BlockedAttackerWatcher watcher = (BlockedAttackerWatcher) game.getState().getWatchers().get(BlockedAttackerWatcher.class.getSimpleName()); + if (watcher != null) { + ArrayList toDestroy = new ArrayList<>(); + for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) { + if (!creature.getId().equals(targetCreature.getId())) { + if (watcher.creatureHasBlockedAttacker(creature, targetCreature, game) || watcher.creatureHasBlockedAttacker(targetCreature, creature, game)) { + toDestroy.add(creature); + } + } + } + for (Permanent creature : toDestroy) { + creature.destroy(source.getSourceId(), game, false); + } + return true; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/i/IndenturedOaf.java b/Mage.Sets/src/mage/cards/i/IndenturedOaf.java new file mode 100644 index 0000000000..d023f950f7 --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/IndenturedOaf.java @@ -0,0 +1,99 @@ +/* + * 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.cards.i; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.PreventionEffectImpl; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; + +/** + * + * @author LevelX2 + */ +public class IndenturedOaf extends CardImpl { + + public IndenturedOaf(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); + + this.subtype.add("Ogre"); + this.subtype.add("Warrior"); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // Prevent all damage that Indentured Oaf would deal to red creatures. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new IndenturedOafPreventEffectEffect(Duration.WhileOnBattlefield))); + } + + public IndenturedOaf(final IndenturedOaf card) { + super(card); + } + + @Override + public IndenturedOaf copy() { + return new IndenturedOaf(this); + } +} + +class IndenturedOafPreventEffectEffect extends PreventionEffectImpl { + + public IndenturedOafPreventEffectEffect(Duration duration) { + super(duration, Integer.MAX_VALUE, false); + staticText = "Prevent all damage that {this} would deal to red creatures"; + } + + public IndenturedOafPreventEffectEffect(final IndenturedOafPreventEffectEffect effect) { + super(effect); + } + + @Override + public IndenturedOafPreventEffectEffect copy() { + return new IndenturedOafPreventEffectEffect(this); + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (super.applies(event, source, game)) { + if (event.getSourceId().equals(source.getSourceId())) { + Permanent damageTo = game.getPermanent(event.getTargetId()); + return damageTo != null && damageTo.getColor(game).isRed(); + } + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/RavnicaCityOfGuilds.java b/Mage.Sets/src/mage/sets/RavnicaCityOfGuilds.java index b1f2c909c2..77dc17d40f 100644 --- a/Mage.Sets/src/mage/sets/RavnicaCityOfGuilds.java +++ b/Mage.Sets/src/mage/sets/RavnicaCityOfGuilds.java @@ -134,6 +134,7 @@ public class RavnicaCityOfGuilds extends ExpansionSet { cards.add(new SetCardInfo("Elvish Skysweeper", 162, Rarity.COMMON, mage.cards.e.ElvishSkysweeper.class)); cards.add(new SetCardInfo("Empty the Catacombs", 86, Rarity.RARE, mage.cards.e.EmptyTheCatacombs.class)); cards.add(new SetCardInfo("Ethereal Usher", 47, Rarity.UNCOMMON, mage.cards.e.EtherealUsher.class)); + cards.add(new SetCardInfo("Excruciator", 121, Rarity.RARE, mage.cards.e.Excruciator.class)); cards.add(new SetCardInfo("Eye of the Storm", 48, Rarity.RARE, mage.cards.e.EyeOfTheStorm.class)); cards.add(new SetCardInfo("Faith's Fetters", 16, Rarity.COMMON, mage.cards.f.FaithsFetters.class)); cards.add(new SetCardInfo("Farseek", 163, Rarity.COMMON, mage.cards.f.Farseek.class)); @@ -156,6 +157,7 @@ public class RavnicaCityOfGuilds extends ExpansionSet { cards.add(new SetCardInfo("Galvanic Arc", 126, Rarity.COMMON, mage.cards.g.GalvanicArc.class)); cards.add(new SetCardInfo("Gate Hound", 19, Rarity.COMMON, mage.cards.g.GateHound.class)); cards.add(new SetCardInfo("Gather Courage", 165, Rarity.COMMON, mage.cards.g.GatherCourage.class)); + cards.add(new SetCardInfo("Gaze of the Gorgon", 246, Rarity.COMMON, mage.cards.g.GazeOfTheGorgon.class)); cards.add(new SetCardInfo("Ghosts of the Innocent", 20, Rarity.RARE, mage.cards.g.GhostsOfTheInnocent.class)); cards.add(new SetCardInfo("Glare of Subdual", 207, Rarity.RARE, mage.cards.g.GlareOfSubdual.class)); cards.add(new SetCardInfo("Glass Golem", 261, Rarity.UNCOMMON, mage.cards.g.GlassGolem.class)); @@ -190,6 +192,7 @@ public class RavnicaCityOfGuilds extends ExpansionSet { cards.add(new SetCardInfo("Hunted Phantasm", 55, Rarity.RARE, mage.cards.h.HuntedPhantasm.class)); cards.add(new SetCardInfo("Hunted Troll", 170, Rarity.RARE, mage.cards.h.HuntedTroll.class)); cards.add(new SetCardInfo("Incite Hysteria", 132, Rarity.COMMON, mage.cards.i.InciteHysteria.class)); + cards.add(new SetCardInfo("Indentured Oaf", 133, Rarity.UNCOMMON, mage.cards.i.IndenturedOaf.class)); cards.add(new SetCardInfo("Induce Paranoia", 56, Rarity.COMMON, mage.cards.i.InduceParanoia.class)); cards.add(new SetCardInfo("Infectious Host", 91, Rarity.COMMON, mage.cards.i.InfectiousHost.class)); cards.add(new SetCardInfo("Instill Furor", 134, Rarity.UNCOMMON, mage.cards.i.InstillFuror.class)); diff --git a/Mage/src/main/java/mage/target/common/TargetCreaturePermanent.java b/Mage/src/main/java/mage/target/common/TargetCreaturePermanent.java index c842fdce4d..d32c695481 100644 --- a/Mage/src/main/java/mage/target/common/TargetCreaturePermanent.java +++ b/Mage/src/main/java/mage/target/common/TargetCreaturePermanent.java @@ -24,10 +24,10 @@ * 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.target.common; +import static mage.filter.StaticFilters.FILTER_PERMANENT_CREATURE; import mage.filter.common.FilterCreaturePermanent; import mage.target.TargetPermanent; @@ -38,7 +38,7 @@ import mage.target.TargetPermanent; public class TargetCreaturePermanent extends TargetPermanent { public TargetCreaturePermanent() { - this(1, 1, new FilterCreaturePermanent(), false); + this(1, 1, FILTER_PERMANENT_CREATURE, false); } public TargetCreaturePermanent(FilterCreaturePermanent filter) {