From 4b91b6d4bb9bc96f9ffd00f803c28c28c4e1a0c4 Mon Sep 17 00:00:00 2001 From: Loki Date: Wed, 4 Jul 2012 18:28:18 +1200 Subject: [PATCH] 2 USG --- .../src/mage/sets/planechase/Congregate.java | 52 ++++++++++++ .../mage/sets/urzassaga/BrilliantHalo.java | 79 +++++++++++++++++++ .../src/mage/sets/urzassaga/Congregate.java | 64 +++++++++++++++ .../effects/common/GainLifeTargetEffect.java | 28 ++++++- 4 files changed, 220 insertions(+), 3 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/planechase/Congregate.java create mode 100644 Mage.Sets/src/mage/sets/urzassaga/BrilliantHalo.java create mode 100644 Mage.Sets/src/mage/sets/urzassaga/Congregate.java diff --git a/Mage.Sets/src/mage/sets/planechase/Congregate.java b/Mage.Sets/src/mage/sets/planechase/Congregate.java new file mode 100644 index 00000000000..9c0a1f01c9e --- /dev/null +++ b/Mage.Sets/src/mage/sets/planechase/Congregate.java @@ -0,0 +1,52 @@ +/* + * 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.planechase; + +import java.util.UUID; + +/** + * + * @author anonymous + */ +public class Congregate extends mage.sets.urzassaga.Congregate { + + public Congregate(UUID ownerId) { + super(ownerId); + this.cardNumber = 2; + this.expansionSetCode = "HOP"; + } + + public Congregate(final Congregate card) { + super(card); + } + + @Override + public Congregate copy() { + return new Congregate(this); + } +} diff --git a/Mage.Sets/src/mage/sets/urzassaga/BrilliantHalo.java b/Mage.Sets/src/mage/sets/urzassaga/BrilliantHalo.java new file mode 100644 index 00000000000..c637f1a7bed --- /dev/null +++ b/Mage.Sets/src/mage/sets/urzassaga/BrilliantHalo.java @@ -0,0 +1,79 @@ +/* + * 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.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.ReturnToHandSourceEffect; +import mage.abilities.effects.common.continious.BoostEnchantedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author Loki + */ +public class BrilliantHalo extends CardImpl { + + public BrilliantHalo(UUID ownerId) { + super(ownerId, 5, "Brilliant Halo", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); + this.expansionSetCode = "USG"; + this.subtype.add("Aura"); + + this.color.setWhite(true); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Constants.Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + // Enchanted creature gets +1/+2. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostEnchantedEffect(1, 2, Constants.Duration.WhileOnBattlefield))); + // When Brilliant Halo is put into a graveyard from the battlefield, return Brilliant Halo to its owner's hand. + this.addAbility(new DiesTriggeredAbility(new ReturnToHandSourceEffect())); + } + + public BrilliantHalo(final BrilliantHalo card) { + super(card); + } + + @Override + public BrilliantHalo copy() { + return new BrilliantHalo(this); + } +} diff --git a/Mage.Sets/src/mage/sets/urzassaga/Congregate.java b/Mage.Sets/src/mage/sets/urzassaga/Congregate.java new file mode 100644 index 00000000000..c2c7daa2306 --- /dev/null +++ b/Mage.Sets/src/mage/sets/urzassaga/Congregate.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.sets.urzassaga; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.GainLifeTargetEffect; +import mage.cards.CardImpl; +import mage.filter.common.FilterCreaturePermanent; +import mage.target.TargetPlayer; + +/** + * + * @author Loki + */ +public class Congregate extends CardImpl { + + public Congregate(UUID ownerId) { + super(ownerId, 8, "Congregate", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{3}{W}"); + this.expansionSetCode = "USG"; + + this.color.setWhite(true); + + // Target player gains 2 life for each creature on the battlefield. + this.getSpellAbility().addEffect(new GainLifeTargetEffect(new PermanentsOnBattlefieldCount(new FilterCreaturePermanent(), 2))); + this.getSpellAbility().addTarget(new TargetPlayer()); + } + + public Congregate(final Congregate card) { + super(card); + } + + @Override + public Congregate copy() { + return new Congregate(this); + } +} diff --git a/Mage/src/mage/abilities/effects/common/GainLifeTargetEffect.java b/Mage/src/mage/abilities/effects/common/GainLifeTargetEffect.java index adb81b947bc..cd0aac520ad 100644 --- a/Mage/src/mage/abilities/effects/common/GainLifeTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/GainLifeTargetEffect.java @@ -31,6 +31,8 @@ package mage.abilities.effects.common; import java.util.UUID; import mage.Constants.Outcome; import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; import mage.game.Game; import mage.players.Player; @@ -41,12 +43,16 @@ import mage.players.Player; */ public class GainLifeTargetEffect extends OneShotEffect { - private int life; + private DynamicValue life; public GainLifeTargetEffect(int life) { + this(new StaticValue(life)); + } + + public GainLifeTargetEffect(DynamicValue life) { super(Outcome.GainLife); this.life = life; - staticText = "target players each gain " + Integer.toString(life) + " life"; + setText(); } public GainLifeTargetEffect(final GainLifeTargetEffect effect) { @@ -64,10 +70,26 @@ public class GainLifeTargetEffect extends OneShotEffect { for (UUID playerId: targetPointer.getTargets(game, source)) { Player player = game.getPlayer(playerId); if (player != null) { - player.gainLife(life, game); + player.gainLife(life.calculate(game, source), game); } } return true; } + private void setText() { + StringBuilder sb = new StringBuilder(); + String message = life.getMessage(); + + sb.append("target players each gain "); + if (message.isEmpty() || !message.equals("1")) { + sb.append(life).append(" "); + } + sb.append("life"); + if (message.length() > 0) { + sb.append(message.equals("1") ? " equal to the number of " : " for each "); + sb.append(message); + } + staticText = sb.toString(); + } + }