From 11ea72beb76b9d14c481a4ef6ad62d749b25cab0 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 4 Jun 2013 00:56:15 +0200 Subject: [PATCH] Added Runed Halo and Vela, the Night Clad. --- .../sets/planechase2012/VelaTheNightClad.java | 95 +++++++++++++ .../src/mage/sets/shadowmoor/RunedHalo.java | 129 ++++++++++++++++++ 2 files changed, 224 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/planechase2012/VelaTheNightClad.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/RunedHalo.java diff --git a/Mage.Sets/src/mage/sets/planechase2012/VelaTheNightClad.java b/Mage.Sets/src/mage/sets/planechase2012/VelaTheNightClad.java new file mode 100644 index 0000000000..74886c296f --- /dev/null +++ b/Mage.Sets/src/mage/sets/planechase2012/VelaTheNightClad.java @@ -0,0 +1,95 @@ +/* + * 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.planechase2012; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Duration; +import mage.Constants.Rarity; +import mage.Constants.TargetController; +import mage.Constants.Zone; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.common.ZoneChangeAllTriggeredAbility; +import mage.abilities.effects.common.LoseLifeOpponentsEffect; +import mage.abilities.effects.common.continious.GainAbilityControlledEffect; +import mage.abilities.keyword.IntimidateAbility; +import mage.cards.CardImpl; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerPredicate; + +/** + * + * @author LevelX2 + */ +public class VelaTheNightClad extends CardImpl { + + private final static String rule = "Whenever {this} or another creature you control leaves the battlefield, "; + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls"); + static { + filter.add(new ControllerPredicate(TargetController.YOU)); + } + + public VelaTheNightClad(UUID ownerId) { + super(ownerId, 107, "Vela the Night-Clad", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{4}{U}{B}"); + this.expansionSetCode = "PC2"; + this.supertype.add("Legendary"); + this.subtype.add("Human"); + this.subtype.add("Wizard"); + + this.color.setBlue(true); + this.color.setBlack(true); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Intimidate + this.addAbility(IntimidateAbility.getInstance()); + // Other creatures you control have intimidate. + this.addAbility(new SimpleStaticAbility( + Zone.BATTLEFIELD, + new GainAbilityControlledEffect(IntimidateAbility.getInstance(), + Duration.WhileOnBattlefield, new FilterCreaturePermanent("Other creatures you control"), true ))); + // Whenever Vela the Night-Clad or another creature you control leaves the battlefield, each opponent loses 1 life. + Ability ability = new ZoneChangeAllTriggeredAbility( + Zone.BATTLEFIELD, + Zone.BATTLEFIELD, null, + new LoseLifeOpponentsEffect(1), + filter, rule, false); + this.addAbility(ability); + } + + public VelaTheNightClad(final VelaTheNightClad card) { + super(card); + } + + @Override + public VelaTheNightClad copy() { + return new VelaTheNightClad(this); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/RunedHalo.java b/Mage.Sets/src/mage/sets/shadowmoor/RunedHalo.java new file mode 100644 index 0000000000..edd6a56397 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/RunedHalo.java @@ -0,0 +1,129 @@ +/* + * 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.shadowmoor; + +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.abilities.Ability; +import mage.abilities.common.AsEntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continious.GainAbilityControllerEffect; +import mage.abilities.keyword.ProtectionAbility; +import mage.cards.CardImpl; +import mage.cards.repository.CardRepository; +import mage.choices.Choice; +import mage.choices.ChoiceImpl; +import mage.filter.FilterCard; +import mage.filter.FilterObject; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class RunedHalo extends CardImpl { + + public RunedHalo(UUID ownerId) { + super(ownerId, 21, "Runed Halo", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{W}{W}"); + this.expansionSetCode = "SHM"; + + this.color.setWhite(true); + + // As Runed Halo enters the battlefield, name a card. + this.addAbility(new AsEntersBattlefieldAbility(new NameCard())); + + // You have protection from the chosen name. + Effect effect = new GainAbilityControllerEffect(new ProtectionAbility(new FilterObject("empty"))); + effect.setText("You have protection from the chosen name (You can't be targeted, dealt damage, or enchanted by anything with that name.)"); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); + + } + + public RunedHalo(final RunedHalo card) { + super(card); + } + + @Override + public RunedHalo copy() { + return new RunedHalo(this); + } +} + +class NameCard extends OneShotEffect { + + public NameCard() { + super(Constants.Outcome.Detriment); + staticText = "name a card"; + } + + public NameCard(final NameCard effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Choice cardChoice = new ChoiceImpl(); + cardChoice.setChoices(CardRepository.instance.getNames()); + cardChoice.clearChoice(); + while (!controller.choose(Constants.Outcome.Detriment, cardChoice, game)) { + game.debugMessage("player canceled choosing name. retrying."); + } + String cardName = cardChoice.getChoice(); + game.informPlayers("Runed Halo, named card: [" + cardName + "]"); + FilterCard filter = new FilterCard(cardName); + filter.add(new NamePredicate(cardName)); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + for (Ability ability : permanent.getAbilities()) { + if (ability instanceof ProtectionAbility) { + ((ProtectionAbility) ability).setFilter(filter); + } + } + } + permanent.addInfo("Named card", new StringBuilder("[Named card: ").append(cardName).append("]").toString()); + + } + return false; + } + + @Override + public NameCard copy() { + return new NameCard(this); + } + +}