From 25b596bff796d533fb4d9f32b179936d69b6357f Mon Sep 17 00:00:00 2001 From: Loki Date: Thu, 5 Jul 2012 10:53:36 +1200 Subject: [PATCH] 2 USG --- .../mage/sets/eighthedition/EliteArchers.java | 52 +++++++++ .../src/mage/sets/planechase/Congregate.java | 2 +- .../src/mage/sets/urzassaga/EliteArchers.java | 74 ++++++++++++ .../src/mage/sets/urzassaga/SerraAvatar.java | 108 ++++++++++++++++++ .../common/ControllerLifeCount.java | 27 +++++ 5 files changed, 262 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/sets/eighthedition/EliteArchers.java create mode 100644 Mage.Sets/src/mage/sets/urzassaga/EliteArchers.java create mode 100644 Mage.Sets/src/mage/sets/urzassaga/SerraAvatar.java create mode 100644 Mage/src/mage/abilities/dynamicvalue/common/ControllerLifeCount.java diff --git a/Mage.Sets/src/mage/sets/eighthedition/EliteArchers.java b/Mage.Sets/src/mage/sets/eighthedition/EliteArchers.java new file mode 100644 index 00000000000..95225f9c115 --- /dev/null +++ b/Mage.Sets/src/mage/sets/eighthedition/EliteArchers.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.eighthedition; + +import java.util.UUID; + +/** + * + * @author Loki + */ +public class EliteArchers extends mage.sets.urzassaga.EliteArchers { + + public EliteArchers(UUID ownerId) { + super(ownerId); + this.cardNumber = 18; + this.expansionSetCode = "8ED"; + } + + public EliteArchers(final EliteArchers card) { + super(card); + } + + @Override + public EliteArchers copy() { + return new EliteArchers(this); + } +} diff --git a/Mage.Sets/src/mage/sets/planechase/Congregate.java b/Mage.Sets/src/mage/sets/planechase/Congregate.java index 9c0a1f01c9e..beb65c603a2 100644 --- a/Mage.Sets/src/mage/sets/planechase/Congregate.java +++ b/Mage.Sets/src/mage/sets/planechase/Congregate.java @@ -31,7 +31,7 @@ import java.util.UUID; /** * - * @author anonymous + * @author Loki */ public class Congregate extends mage.sets.urzassaga.Congregate { diff --git a/Mage.Sets/src/mage/sets/urzassaga/EliteArchers.java b/Mage.Sets/src/mage/sets/urzassaga/EliteArchers.java new file mode 100644 index 00000000000..f251e4d6d53 --- /dev/null +++ b/Mage.Sets/src/mage/sets/urzassaga/EliteArchers.java @@ -0,0 +1,74 @@ +/* + * 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.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.cards.CardImpl; +import mage.target.common.TargetAttackingOrBlockingCreature; + +/** + * + * @author Loki + */ +public class EliteArchers extends CardImpl { + + public EliteArchers(UUID ownerId) { + super(ownerId, 13, "Elite Archers", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{W}"); + this.expansionSetCode = "USG"; + this.subtype.add("Human"); + this.subtype.add("Soldier"); + this.subtype.add("Archer"); + + this.color.setWhite(true); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // {tap}: Elite Archers deals 3 damage to target attacking or blocking creature. + Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new DamageTargetEffect(3), new TapSourceCost()); + ability.addTarget(new TargetAttackingOrBlockingCreature()); + this.addAbility(ability); + } + + public EliteArchers(final EliteArchers card) { + super(card); + } + + @Override + public EliteArchers copy() { + return new EliteArchers(this); + } +} diff --git a/Mage.Sets/src/mage/sets/urzassaga/SerraAvatar.java b/Mage.Sets/src/mage/sets/urzassaga/SerraAvatar.java new file mode 100644 index 00000000000..d7ae85ebab2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/urzassaga/SerraAvatar.java @@ -0,0 +1,108 @@ +/* + * 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.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.PutIntoGraveFromAnywhereTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.common.ControllerLifeCount; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author Loki + */ +public class SerraAvatar extends CardImpl { + + public SerraAvatar(UUID ownerId) { + super(ownerId, 45, "Serra Avatar", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{W}{W}{W}"); + this.expansionSetCode = "USG"; + this.subtype.add("Avatar"); + + this.color.setWhite(true); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Serra Avatar's power and toughness are each equal to your life total. + this.addAbility(new SimpleStaticAbility(Constants.Zone.ALL, new SetPowerToughnessSourceEffect(new ControllerLifeCount(), Constants.Duration.EndOfGame))); + // When Serra Avatar is put into a graveyard from anywhere, shuffle it into its owner's library. + this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new SerraAvatarEffect())); + } + + public SerraAvatar(final SerraAvatar card) { + super(card); + } + + @Override + public SerraAvatar copy() { + return new SerraAvatar(this); + } +} + +class SerraAvatarEffect extends OneShotEffect { + SerraAvatarEffect() { + super(Constants.Outcome.ReturnToHand); + staticText = "shuffle it into its owner's library"; + } + + SerraAvatarEffect(final SerraAvatarEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + Card c = player.getGraveyard().get(source.getSourceId(), game); + if (c != null) { + player.getGraveyard().remove(c); + player.getLibrary().putOnTop(c, game); + player.getLibrary().shuffle(); + return true; + } + + } + return false; + } + + @Override + public SerraAvatarEffect copy() { + return new SerraAvatarEffect(this); + } +} diff --git a/Mage/src/mage/abilities/dynamicvalue/common/ControllerLifeCount.java b/Mage/src/mage/abilities/dynamicvalue/common/ControllerLifeCount.java new file mode 100644 index 00000000000..89278f0164d --- /dev/null +++ b/Mage/src/mage/abilities/dynamicvalue/common/ControllerLifeCount.java @@ -0,0 +1,27 @@ +package mage.abilities.dynamicvalue.common; + +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.game.Game; +import mage.players.Player; + +public class ControllerLifeCount implements DynamicValue { + @Override + public int calculate(Game game, Ability sourceAbility) { + Player p = game.getPlayer(sourceAbility.getControllerId()); + if (p != null) { + return p.getLife(); + } + return 0; + } + + @Override + public DynamicValue clone() { + return new ControllerLifeCount(); + } + + @Override + public String getMessage() { + return "your life total"; + } +}