From 275142a1438018d47dbf1d1c989e6e6c163cf852 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Fri, 18 May 2012 00:19:43 +0400 Subject: [PATCH] [AVR] 32 cards. Tests. Common effects. Fixes. --- .../sets/avacynrestored/AbundantGrowth.java | 83 ++++++++++ .../sets/avacynrestored/AngelicArmaments.java | 74 +++++++++ .../avacynrestored/AvacynAngelOfHope.java | 74 +++++++++ .../sets/avacynrestored/BladedBracers.java | 78 +++++++++ .../sets/avacynrestored/BuildersBlessing.java | 63 ++++++++ .../mage/sets/avacynrestored/Cloudshift.java | 12 +- .../sets/avacynrestored/CorpseTraders.java | 75 +++++++++ .../sets/avacynrestored/DarkImpostor.java | 124 +++++++++++++++ .../sets/avacynrestored/DeadeyeNavigator.java | 79 ++++++++++ .../src/mage/sets/avacynrestored/Defang.java | 126 +++++++++++++++ .../sets/avacynrestored/DemonicRising.java | 84 ++++++++++ .../avacynrestored/DescentIntoMadness.java | 148 ++++++++++++++++++ .../sets/avacynrestored/DiregrafEscort.java | 82 ++++++++++ .../mage/sets/avacynrestored/DreadSlaver.java | 66 ++++++++ .../sets/avacynrestored/ExquisiteBlood.java | 96 ++++++++++++ .../sets/avacynrestored/FerventCathar.java | 75 +++++++++ .../mage/sets/avacynrestored/Fettergeist.java | 4 + .../avacynrestored/FloweringLumberknot.java | 113 +++++++++++++ .../sets/avacynrestored/GangOfDevils.java | 71 +++++++++ .../sets/avacynrestored/GhostlyTouch.java | 81 ++++++++++ .../sets/avacynrestored/GloomSurgeon.java | 132 ++++++++++++++++ .../avacynrestored/GoldnightRedeemer.java | 78 +++++++++ .../mage/sets/avacynrestored/GuiseOfFire.java | 78 +++++++++ .../sets/avacynrestored/JointAssault.java | 127 +++++++++++++++ .../sets/avacynrestored/MaliciousIntent.java | 83 ++++++++++ .../sets/avacynrestored/RighteousBlow.java | 62 ++++++++ .../mage/sets/avacynrestored/SternMentor.java | 80 ++++++++++ .../mage/sets/avacynrestored/Stonewright.java | 78 +++++++++ .../sets/avacynrestored/TandemLookout.java | 77 +++++++++ .../avacynrestored/TormentorsTrident.java | 71 +++++++++ .../avacynrestored/TreacherousPitDweller.java | 120 ++++++++++++++ .../sets/avacynrestored/TriumphOfCruelty.java | 74 +++++++++ .../sets/avacynrestored/UnhallowedPact.java | 75 +++++++++ .../sets/avacynrestored/VanguardsShield.java | 122 +++++++++++++++ .../championsofkamigawa/HeWhoHungers.java | 55 +------ .../mage/sets/magic2010/HypnoticSpecter.java | 80 +--------- .../src/mage/sets/magic2011/JinxedIdol.java | 13 +- .../src/mage/sets/tenth/SengirVampire.java | 2 +- .../keywords/SoulbondKeywordTest.java | 6 + .../TargetOpponentGainsControlTest.java | 52 ++++++ .../test/cards/single/ExquisiteBloodTest.java | 44 ++++++ .../BeginningOfUpkeepTriggeredAbility.java | 13 +- ...ndDealtDamageThisTurnTriggeredAbility.java | 9 +- .../common/DiesAttachedTriggeredAbility.java | 6 +- ...ontrolsBiggestOrTiedCreatureCondition.java | 67 ++++++++ .../common/EquippedHasSubtypeCondition.java | 21 ++- .../common/NoControlledCreatureCondition.java | 52 ++++++ .../common/PermanentsOnBattlefieldCount.java | 2 +- ...DealsDamageToOpponentTriggeredAbility.java | 71 +++++++++ .../effects/common/ExileTargetEffect.java | 14 +- .../effects/common/ImprintTargetEffect.java | 80 ++++++++++ ...lefieldUnderYourControlAttachedEffect.java | 75 +++++++++ ...ttlefieldUnderYourControlSourceEffect.java | 70 +++++++++ ...ttlefieldUnderYourControlTargetEffect.java | 70 +++++++++ .../effects/common/TapTargetEffect.java | 84 +++++----- ...cardCardYouChooseTargetOpponentEffect.java | 79 ++++++++++ Mage/src/mage/counters/CounterType.java | 5 +- .../mage/counters/common/DespairCounter.java | 49 ++++++ .../filter/common/FilterUntappedCreature.java | 55 +++++++ Mage/src/mage/game/permanent/Battlefield.java | 34 ++-- .../mage/target/common/TargetOpponent.java | 12 +- 61 files changed, 3773 insertions(+), 212 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/AbundantGrowth.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/AngelicArmaments.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/AvacynAngelOfHope.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/BladedBracers.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/BuildersBlessing.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/CorpseTraders.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/DarkImpostor.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/DeadeyeNavigator.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/Defang.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/DemonicRising.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/DiregrafEscort.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/DreadSlaver.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/ExquisiteBlood.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/FerventCathar.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/FloweringLumberknot.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/GangOfDevils.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/GhostlyTouch.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/GloomSurgeon.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/GoldnightRedeemer.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/GuiseOfFire.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/JointAssault.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/MaliciousIntent.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/RighteousBlow.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/SternMentor.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/Stonewright.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/TandemLookout.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/TormentorsTrident.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/TreacherousPitDweller.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/TriumphOfCruelty.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/UnhallowedPact.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/VanguardsShield.java create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/control/TargetOpponentGainsControlTest.java create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/ExquisiteBloodTest.java create mode 100644 Mage/src/mage/abilities/condition/common/ControlsBiggestOrTiedCreatureCondition.java create mode 100644 Mage/src/mage/abilities/condition/common/NoControlledCreatureCondition.java create mode 100644 Mage/src/mage/abilities/effects/common/DealsDamageToOpponentTriggeredAbility.java create mode 100644 Mage/src/mage/abilities/effects/common/ImprintTargetEffect.java create mode 100644 Mage/src/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlAttachedEffect.java create mode 100644 Mage/src/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlSourceEffect.java create mode 100644 Mage/src/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlTargetEffect.java create mode 100644 Mage/src/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetOpponentEffect.java create mode 100644 Mage/src/mage/counters/common/DespairCounter.java create mode 100644 Mage/src/mage/filter/common/FilterUntappedCreature.java diff --git a/Mage.Sets/src/mage/sets/avacynrestored/AbundantGrowth.java b/Mage.Sets/src/mage/sets/avacynrestored/AbundantGrowth.java new file mode 100644 index 0000000000..2b157c382d --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/AbundantGrowth.java @@ -0,0 +1,83 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.DrawCardControllerEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.mana.AnyColorManaAbility; +import mage.cards.CardImpl; +import mage.target.TargetPermanent; +import mage.target.common.TargetLandPermanent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class AbundantGrowth extends CardImpl { + + public AbundantGrowth(UUID ownerId) { + super(ownerId, 167, "Abundant Growth", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{G}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Aura"); + + this.color.setGreen(true); + + // Enchant land + TargetPermanent auraTarget = new TargetLandPermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Constants.Outcome.Detriment)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // When Abundant Growth enters the battlefield, draw a card. + this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardControllerEffect(1), false)); + + // Enchanted land has "{tap}: Add one mana of any color to your mana pool." + Ability gainedAbility = new AnyColorManaAbility(new TapSourceCost()); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(gainedAbility, Constants.AttachmentType.AURA))); + } + + public AbundantGrowth(final AbundantGrowth card) { + super(card); + } + + @Override + public AbundantGrowth copy() { + return new AbundantGrowth(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/AngelicArmaments.java b/Mage.Sets/src/mage/sets/avacynrestored/AngelicArmaments.java new file mode 100644 index 0000000000..7c383ff54c --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/AngelicArmaments.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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.ObjectColor; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.continious.AddCardColorAttachedEffect; +import mage.abilities.effects.common.continious.AddCardSubtypeAttachedEffect; +import mage.abilities.effects.common.continious.BoostEquippedEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; + +import java.util.UUID; + +/** + * @author noxx + */ +public class AngelicArmaments extends CardImpl { + + public AngelicArmaments(UUID ownerId) { + super(ownerId, 212, "Angelic Armaments", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{3}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Equipment"); + + // Equipped creature gets +2/+2, has flying, and is a white Angel in addition to its other colors and types. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostEquippedEffect(2, 2))); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FlyingAbility.getInstance(), Constants.AttachmentType.EQUIPMENT))); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new AddCardColorAttachedEffect(ObjectColor.WHITE, Constants.Duration.WhileOnBattlefield, Constants.AttachmentType.EQUIPMENT))); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new AddCardSubtypeAttachedEffect("Angel", Constants.Duration.WhileOnBattlefield, Constants.AttachmentType.EQUIPMENT))); + + // Equip {4} + this.addAbility(new EquipAbility(Constants.Outcome.BoostCreature, new GenericManaCost(4))); + } + + public AngelicArmaments(final AngelicArmaments card) { + super(card); + } + + @Override + public AngelicArmaments copy() { + return new AngelicArmaments(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/AvacynAngelOfHope.java b/Mage.Sets/src/mage/sets/avacynrestored/AvacynAngelOfHope.java new file mode 100644 index 0000000000..55da4f3753 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/AvacynAngelOfHope.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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.continious.GainAbilityAllEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.IndestructibleAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.filter.common.FilterControlledPermanent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class AvacynAngelOfHope extends CardImpl { + + public AvacynAngelOfHope(UUID ownerId) { + super(ownerId, 6, "Avacyn, Angel of Hope", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{5}{W}{W}{W}"); + this.expansionSetCode = "AVR"; + this.supertype.add("Legendary"); + this.subtype.add("Angel"); + + this.color.setWhite(true); + this.power = new MageInt(8); + this.toughness = new MageInt(8); + + this.addAbility(FlyingAbility.getInstance()); + this.addAbility(VigilanceAbility.getInstance()); + + // Avacyn, Angel of Hope and other permanents you control are indestructible. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAllEffect(IndestructibleAbility.getInstance(), Constants.Duration.WhileInGraveyard, new FilterControlledPermanent()))); + } + + public AvacynAngelOfHope(final AvacynAngelOfHope card) { + super(card); + } + + @Override + public AvacynAngelOfHope copy() { + return new AvacynAngelOfHope(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/BladedBracers.java b/Mage.Sets/src/mage/sets/avacynrestored/BladedBracers.java new file mode 100644 index 0000000000..406fa3daf6 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/BladedBracers.java @@ -0,0 +1,78 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.EquippedHasSubtypeCondition; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.decorator.ConditionalContinousEffect; +import mage.abilities.effects.common.continious.BoostEquippedEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; + +import java.util.UUID; + +/** + * @author noxx + */ +public class BladedBracers extends CardImpl { + + private static final String ruleText = "As long as equipped creature is a Human or an Angel, it has vigilance"; + + public BladedBracers(UUID ownerId) { + super(ownerId, 213, "Bladed Bracers", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{1}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Equipment"); + + // Equipped creature gets +1/+1. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostEquippedEffect(1, 1))); + + // As long as equipped creature is a Human or an Angel, it has vigilance. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, + new ConditionalContinousEffect( + new GainAbilityAttachedEffect(VigilanceAbility.getInstance(), Constants.AttachmentType.EQUIPMENT), + new EquippedHasSubtypeCondition("Human", "Angel"), ruleText))); + + // Equip {2} + this.addAbility(new EquipAbility(Constants.Outcome.BoostCreature, new GenericManaCost(2))); + } + + public BladedBracers(final BladedBracers card) { + super(card); + } + + @Override + public BladedBracers copy() { + return new BladedBracers(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/BuildersBlessing.java b/Mage.Sets/src/mage/sets/avacynrestored/BuildersBlessing.java new file mode 100644 index 0000000000..c2147c5de0 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/BuildersBlessing.java @@ -0,0 +1,63 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.continious.BoostControlledEffect; +import mage.cards.CardImpl; +import mage.filter.common.FilterUntappedCreature; + +import java.util.UUID; + +/** + * @author noxx + */ +public class BuildersBlessing extends CardImpl { + + public BuildersBlessing(UUID ownerId) { + super(ownerId, 8, "Builder's Blessing", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}"); + this.expansionSetCode = "AVR"; + + this.color.setWhite(true); + + // Untapped creatures you control get +0/+2. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostControlledEffect(0, 2, Constants.Duration.WhileOnBattlefield, new FilterUntappedCreature()))); + } + + public BuildersBlessing(final BuildersBlessing card) { + super(card); + } + + @Override + public BuildersBlessing copy() { + return new BuildersBlessing(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/Cloudshift.java b/Mage.Sets/src/mage/sets/avacynrestored/Cloudshift.java index c624a2551b..dd8a461dce 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/Cloudshift.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/Cloudshift.java @@ -27,18 +27,18 @@ */ package mage.sets.avacynrestored; -import mage.Constants.Zone; -import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; +import mage.abilities.effects.common.ExileTargetForSourceEffect; +import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect; import mage.cards.CardImpl; import mage.target.common.TargetControlledCreaturePermanent; -import mage.abilities.effects.common.ExileTargetForSourceEffect; -import mage.abilities.effects.common.ReturnFromExileForSourceEffect; + +import java.util.UUID; /** * - * @author jeffwadsworth + * @author noxx */ public class Cloudshift extends CardImpl { @@ -51,7 +51,7 @@ public class Cloudshift extends CardImpl { // Exile target creature you control, then return that card to the battlefield under your control. this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); this.getSpellAbility().addEffect(new ExileTargetForSourceEffect("Cloudshift exile")); - this.getSpellAbility().addEffect(new ReturnFromExileForSourceEffect(Zone.BATTLEFIELD)); + this.getSpellAbility().addEffect(new ReturnToBattlefieldUnderYourControlTargetEffect()); } public Cloudshift(final Cloudshift card) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/CorpseTraders.java b/Mage.Sets/src/mage/sets/avacynrestored/CorpseTraders.java new file mode 100644 index 0000000000..3f05949600 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/CorpseTraders.java @@ -0,0 +1,75 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.ActivateAsSorceryActivatedAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetOpponentEffect; +import mage.cards.CardImpl; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetOpponent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class CorpseTraders extends CardImpl { + + public CorpseTraders(UUID ownerId) { + super(ownerId, 90, "Corpse Traders", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{B}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Human"); + this.subtype.add("Rogue"); + + this.color.setBlack(true); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // {2}{B}, Sacrifice a creature: Target opponent reveals his or her hand. You choose a card from it. That player discards that card. Activate this ability only any time you could cast a sorcery. + Ability ability = new ActivateAsSorceryActivatedAbility(Constants.Zone.BATTLEFIELD, new DiscardCardYouChooseTargetOpponentEffect(), new ManaCostsImpl("{2}{B}")); + ability.addTarget(new TargetOpponent(true)); + ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent())); + this.addAbility(ability); + } + + public CorpseTraders(final CorpseTraders card) { + super(card); + } + + @Override + public CorpseTraders copy() { + return new CorpseTraders(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DarkImpostor.java b/Mage.Sets/src/mage/sets/avacynrestored/DarkImpostor.java new file mode 100644 index 0000000000..61d44fd433 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/DarkImpostor.java @@ -0,0 +1,124 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.ActivatedAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.abilities.effects.common.ImprintTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * + * @author noxx + + */ +public class DarkImpostor extends CardImpl { + + public DarkImpostor(UUID ownerId) { + super(ownerId, 92, "Dark Impostor", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{B}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Vampire"); + this.subtype.add("Assassin"); + + this.color.setBlack(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // {4}{B}{B}: Exile target creature and put a +1/+1 counter on Dark Impostor.\ + Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new ImprintTargetEffect(), new ManaCostsImpl("{4}{B}{B}")); + ability.addEffect(new ExileTargetEffect(null, "Dark Impostor")); + ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance())); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + + // Dark Impostor has all activated abilities of all creature cards exiled with it. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new DarkImpostorContinuousEffect())); + } + + public DarkImpostor(final DarkImpostor card) { + super(card); + } + + @Override + public DarkImpostor copy() { + return new DarkImpostor(this); + } +} + +class DarkImpostorContinuousEffect extends ContinuousEffectImpl { + + public DarkImpostorContinuousEffect() { + super(Constants.Duration.WhileOnBattlefield, Constants.Layer.AbilityAddingRemovingEffects_6, Constants.SubLayer.NA, Constants.Outcome.AddAbility); + staticText = "{this} has all activated abilities of all creature cards exiled with it"; + } + + public DarkImpostorContinuousEffect(final DarkImpostorContinuousEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent perm = game.getPermanent(source.getSourceId()); + if (perm != null) { + for (UUID imprintedId: perm.getImprinted()) { + Card card = game.getCard(imprintedId); + if (card != null) { + for (Ability ability: card.getAbilities()) { + if (ability instanceof ActivatedAbility) { + perm.addAbility(ability, game); + } + } + } + } + } + return true; + } + + @Override + public DarkImpostorContinuousEffect copy() { + return new DarkImpostorContinuousEffect(this); + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DeadeyeNavigator.java b/Mage.Sets/src/mage/sets/avacynrestored/DeadeyeNavigator.java new file mode 100644 index 0000000000..4e84f6750c --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/DeadeyeNavigator.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.avacynrestored; + +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.common.SimpleStaticAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.ExileSourceEffect; +import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlSourceEffect; +import mage.abilities.effects.common.continious.GainAbilityPairedEffect; +import mage.abilities.keyword.SoulbondAbility; +import mage.cards.CardImpl; + +import java.util.UUID; + +/** + * @author noxx + */ +public class DeadeyeNavigator extends CardImpl { + + private static final String ruleText = "As long as {this} is paired with another creature, each of those creatures has \"{1}{U}: Exile this creature, then return it to the battlefield under your control.\""; + + public DeadeyeNavigator(UUID ownerId) { + super(ownerId, 47, "Deadeye Navigator", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{U}{U}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Spirit"); + + this.color.setBlue(true); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // Soulbond + this.addAbility(SoulbondAbility.getInstance()); + + // As long as Deadeye Navigator is paired with another creature, each of those creatures has "{1}{U}: Exile this creature, then return it to the battlefield under your control." + Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new ExileSourceEffect(), new ManaCostsImpl("{1}{U}")); + ability.addEffect(new ReturnToBattlefieldUnderYourControlSourceEffect()); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityPairedEffect(ability, ruleText))); + } + + public DeadeyeNavigator(final DeadeyeNavigator card) { + super(card); + } + + @Override + public DeadeyeNavigator copy() { + return new DeadeyeNavigator(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/Defang.java b/Mage.Sets/src/mage/sets/avacynrestored/Defang.java new file mode 100644 index 0000000000..27b2994525 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/Defang.java @@ -0,0 +1,126 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.DamageEvent; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class Defang extends CardImpl { + + public Defang(UUID ownerId) { + super(ownerId, 15, "Defang", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); + this.expansionSetCode = "AVR"; + 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.AddAbility)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Prevent all damage that would be dealt by enchanted creature. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new DefangEffect())); + } + + public Defang(final Defang card) { + super(card); + } + + @Override + public Defang copy() { + return new Defang(this); + } +} + +class DefangEffect extends PreventionEffectImpl { + + public DefangEffect() { + super(Constants.Duration.WhileOnBattlefield); + staticText = "Prevent all damage that would be dealt by enchanted creature"; + } + + public DefangEffect(final DefangEffect effect) { + super(effect); + } + + @Override + public DefangEffect copy() { + return new DefangEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), event.getAmount(), false); + if (!game.replaceEvent(preventEvent)) { + int damage = event.getAmount(); + event.setAmount(0); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), damage)); + } + return false; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (super.applies(event, source, game) && event instanceof DamageEvent) { + Permanent aura = game.getPermanent(source.getSourceId()); + if (aura != null && aura.getAttachedTo() != null) { + if (event.getSourceId().equals(aura.getAttachedTo())) { + return true; + } + } + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DemonicRising.java b/Mage.Sets/src/mage/sets/avacynrestored/DemonicRising.java new file mode 100644 index 0000000000..f08ae0551e --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/DemonicRising.java @@ -0,0 +1,84 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.TriggeredAbility; +import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility; +import mage.abilities.condition.common.OneControlledCreatureCondition; +import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.game.permanent.token.Token; + +import java.util.UUID; + +/** + * @author noxx + */ +public class DemonicRising extends CardImpl { + + private static final String ruleText = "At the beginning of your end step, if you control exactly one creature, put a 5/5 black Demon creature token with flying onto the battlefield"; + + public DemonicRising(UUID ownerId) { + super(ownerId, 94, "Demonic Rising", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}{B}"); + this.expansionSetCode = "AVR"; + + this.color.setBlack(true); + + // At the beginning of your end step, if you control exactly one creature, put a 5/5 black Demon creature token with flying onto the battlefield. + TriggeredAbility ability = new BeginningOfYourEndStepTriggeredAbility(new CreateTokenEffect(new DemonToken()), false); + this.addAbility(new ConditionalTriggeredAbility(ability, OneControlledCreatureCondition.getInstance(), ruleText)); + } + + public DemonicRising(final DemonicRising card) { + super(card); + } + + @Override + public DemonicRising copy() { + return new DemonicRising(this); + } +} + +class DemonToken extends Token { + public DemonToken() { + super("Demon", "a 5/5 black Demon creature token with flying"); + cardType.add(Constants.CardType.CREATURE); + color = ObjectColor.BLACK; + subtype.add("Demon"); + power = new MageInt(5); + toughness = new MageInt(5); + addAbility(FlyingAbility.getInstance()); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java b/Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java new file mode 100644 index 0000000000..c9fc9f5a0e --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java @@ -0,0 +1,148 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.counters.CounterType; +import mage.filter.FilterCard; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.Target; +import mage.target.TargetCard; +import mage.target.common.TargetControlledPermanent; + +import java.util.UUID; + +/** + * + * @author noxx + */ +public class DescentIntoMadness extends CardImpl { + + public DescentIntoMadness(UUID ownerId) { + super(ownerId, 97, "Descent into Madness", Rarity.MYTHIC, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}{B}"); + this.expansionSetCode = "AVR"; + + this.color.setBlack(true); + + // At the beginning of your upkeep, put a despair counter on Descent into Madness, then each player exiles X permanents he or she controls and/or cards from his or her hand, where X is the number of despair counters on Descent into Madness. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new DescentIntoMadnessEffect(), Constants.TargetController.YOU, false)); + } + + public DescentIntoMadness(final DescentIntoMadness card) { + super(card); + } + + @Override + public DescentIntoMadness copy() { + return new DescentIntoMadness(this); + } +} + +class DescentIntoMadnessEffect extends OneShotEffect { + + private static final FilterCard filterInHand = new FilterCard(); + private static final FilterControlledPermanent filter = new FilterControlledPermanent(); + + public DescentIntoMadnessEffect() { + super(Constants.Outcome.Sacrifice); + this.staticText = "put a despair counter on {this}, then each player exiles X permanents he or she controls and/or cards from his or her hand, where X is the number of despair counters on {this}"; + } + + public DescentIntoMadnessEffect(final DescentIntoMadnessEffect effect) { + super(effect); + } + + @Override + public DescentIntoMadnessEffect copy() { + return new DescentIntoMadnessEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + permanent.addCounters(CounterType.DESPAIR.createInstance(), game); + int count = permanent.getCounters().getCount(CounterType.DESPAIR); + if (count > 0) { + + Player controller = game.getPlayer(permanent.getControllerId()); + if (controller != null) { + for (UUID playerId : controller.getInRange()) { + Player player = game.getPlayer(playerId); + if (player != null) { + exileCards(player, count, source, game); + } + } + } + } + } + return false; + } + + private void exileCards(Player player, int count, Ability source, Game game) { + int amount = Math.min(count, player.getHand().size() + game.getBattlefield().getAllActivePermanents(player.getId()).size()); + + while (amount > 0) { + Target target = new TargetControlledPermanent(0, 1, filter, true); + if (target.canChoose(player.getId(), game) + && player.choose(Constants.Outcome.Exile, target, source.getSourceId(), game)) { + + for (UUID targetId : target.getTargets()) { + Permanent chosen = game.getPermanent(targetId); + if (chosen != null) { + chosen.moveToExile(source.getId(), "Descent into Madness", source.getSourceId(), game); + amount--; + } + } + } + + if (amount > 0) { + TargetCard targetInHand = new TargetCard(Constants.Zone.HAND, filterInHand); + if (targetInHand.canChoose(player.getId(), game) && + player.choose(Constants.Outcome.Exile, player.getHand(), targetInHand, game)) { + + Card card = player.getHand().get(targetInHand.getFirstTarget(), game); + if (card != null) { + card.moveToExile(source.getId(), "Descent into Madness", source.getSourceId(), game); + amount--; + } + } + } + } + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DiregrafEscort.java b/Mage.Sets/src/mage/sets/avacynrestored/DiregrafEscort.java new file mode 100644 index 0000000000..4391325f2a --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/DiregrafEscort.java @@ -0,0 +1,82 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.continious.GainAbilityPairedEffect; +import mage.abilities.keyword.ProtectionAbility; +import mage.abilities.keyword.SoulbondAbility; +import mage.cards.CardImpl; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class DiregrafEscort extends CardImpl { + + private static final String ruleText = "As long as {this} is paired with another creature, both creatures have protection from Zombies"; + + private static final FilterPermanent filter = new FilterCreaturePermanent("Zombies"); + + static { + filter.getSubtype().add("Zombie"); + } + + public DiregrafEscort(UUID ownerId) { + super(ownerId, 174, "Diregraf Escort", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{G}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Human"); + this.subtype.add("Cleric"); + + this.color.setGreen(true); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Soulbond + this.addAbility(SoulbondAbility.getInstance()); + + // As long as Diregraf Escort is paired with another creature, both creatures have protection from Zombies. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityPairedEffect(new ProtectionAbility(filter), ruleText))); + } + + public DiregrafEscort(final DiregrafEscort card) { + super(card); + } + + @Override + public DiregrafEscort copy() { + return new DiregrafEscort(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DreadSlaver.java b/Mage.Sets/src/mage/sets/avacynrestored/DreadSlaver.java new file mode 100644 index 0000000000..c2ffe1b270 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/DreadSlaver.java @@ -0,0 +1,66 @@ +/* + * 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.avacynrestored; + +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.common.DiesAndDealtDamageThisTurnTriggeredAbility; +import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect; +import mage.cards.CardImpl; + +import java.util.UUID; + +/** + * @author noxx + */ +public class DreadSlaver extends CardImpl { + + public DreadSlaver(UUID ownerId) { + super(ownerId, 98, "Dread Slaver", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{B}{B}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Zombie"); + this.subtype.add("Horror"); + + this.color.setBlack(true); + this.power = new MageInt(3); + this.toughness = new MageInt(5); + + // Whenever a creature dealt damage by Dread Slaver this turn dies, return it to the battlefield under your control. That creature is a black Zombie in addition to its other colors and types. + this.addAbility(new DiesAndDealtDamageThisTurnTriggeredAbility(new ReturnToBattlefieldUnderYourControlTargetEffect(), false)); + } + + public DreadSlaver(final DreadSlaver card) { + super(card); + } + + @Override + public DreadSlaver copy() { + return new DreadSlaver(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/ExquisiteBlood.java b/Mage.Sets/src/mage/sets/avacynrestored/ExquisiteBlood.java new file mode 100644 index 0000000000..176e7e88c6 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/ExquisiteBlood.java @@ -0,0 +1,96 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.GainLifeEffect; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class ExquisiteBlood extends CardImpl { + + public ExquisiteBlood(UUID ownerId) { + super(ownerId, 102, "Exquisite Blood", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{B}"); + this.expansionSetCode = "AVR"; + + this.color.setBlack(true); + + // Whenever an opponent loses life, you gain that much life. + ExquisiteBloodTriggeredAbility ability = new ExquisiteBloodTriggeredAbility(); + this.addAbility(ability); + } + + public ExquisiteBlood(final ExquisiteBlood card) { + super(card); + } + + @Override + public ExquisiteBlood copy() { + return new ExquisiteBlood(this); + } +} + +class ExquisiteBloodTriggeredAbility extends TriggeredAbilityImpl { + + public ExquisiteBloodTriggeredAbility() { + super(Constants.Zone.BATTLEFIELD, null); + } + + public ExquisiteBloodTriggeredAbility(final ExquisiteBloodTriggeredAbility ability) { + super(ability); + } + + @Override + public ExquisiteBloodTriggeredAbility copy() { + return new ExquisiteBloodTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.LOST_LIFE && game.getOpponents(this.controllerId).contains(event.getPlayerId())) { + this.getEffects().clear(); + this.addEffect(new GainLifeEffect(event.getAmount())); + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever an opponent loses life, you gain that much life."; + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/FerventCathar.java b/Mage.Sets/src/mage/sets/avacynrestored/FerventCathar.java new file mode 100644 index 0000000000..74389ecb7d --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/FerventCathar.java @@ -0,0 +1,75 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.CantBlockAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.continious.GainAbilityTargetEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class FerventCathar extends CardImpl { + + public FerventCathar(UUID ownerId) { + super(ownerId, 135, "Fervent Cathar", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{R}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Human"); + this.subtype.add("Knight"); + + this.color.setRed(true); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + this.addAbility(HasteAbility.getInstance()); + + // When Fervent Cathar enters the battlefield, target creature can't block this turn. + Ability ability = new EntersBattlefieldTriggeredAbility(new GainAbilityTargetEffect(CantBlockAbility.getInstance(), Constants.Duration.EndOfTurn)); + ability.addTarget(new TargetCreaturePermanent(true)); + this.addAbility(ability); + } + + public FerventCathar(final FerventCathar card) { + super(card); + } + + @Override + public FerventCathar copy() { + return new FerventCathar(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/Fettergeist.java b/Mage.Sets/src/mage/sets/avacynrestored/Fettergeist.java index 0961cbac39..d0dbce4320 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/Fettergeist.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/Fettergeist.java @@ -81,6 +81,10 @@ class FettergeistUnlessPaysEffect extends OneShotEffect { + + public FloweringLumberknot(UUID ownerId) { + super(ownerId, 178, "Flowering Lumberknot", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{G}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Treefolk"); + + this.color.setGreen(true); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // Flowering Lumberknot can't attack or block unless it's paired with a creature with soulbond. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new FloweringLumberknotEffect())); + } + + public FloweringLumberknot(final FloweringLumberknot card) { + super(card); + } + + @Override + public FloweringLumberknot copy() { + return new FloweringLumberknot(this); + } +} + +class FloweringLumberknotEffect extends RestrictionEffect { + + public FloweringLumberknotEffect() { + super(Constants.Duration.WhileOnBattlefield); + staticText = "{this} can't attack or block unless it's paired with a creature with soulbond"; + } + + public FloweringLumberknotEffect(final FloweringLumberknotEffect effect) { + super(effect); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + if (permanent.getId().equals(source.getSourceId())) { + if (permanent.getPairedCard() == null) { + return true; // not paired => can't attack or block + } + Permanent paired = game.getPermanent(permanent.getPairedCard()); + if (paired != null && paired.getAbilities().contains(SoulbondAbility.getInstance())) { + return false; // paired => can attack or block + } + // can't attack or block otherwise + return true; + } + return false; + } + + @Override + public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) { + return false; + } + + @Override + public boolean canAttack(Game game) { + return false; + } + + @Override + public FloweringLumberknotEffect copy() { + return new FloweringLumberknotEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/GangOfDevils.java b/Mage.Sets/src/mage/sets/avacynrestored/GangOfDevils.java new file mode 100644 index 0000000000..354660f666 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/GangOfDevils.java @@ -0,0 +1,71 @@ +/* + * 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.avacynrestored; + +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.effects.common.DamageMultiEffect; +import mage.cards.CardImpl; +import mage.target.common.TargetCreatureOrPlayerAmount; + +import java.util.UUID; + +/** + * + * @author noxx + + */ +public class GangOfDevils extends CardImpl { + + public GangOfDevils(UUID ownerId) { + super(ownerId, 136, "Gang of Devils", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{5}{R}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Devil"); + + this.color.setRed(true); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // When Gang of Devils dies, it deals 3 damage divided as you choose among one, two, or three target creatures and/or players. + Ability ability = new DiesTriggeredAbility(new DamageMultiEffect(3)); + ability.addTarget(new TargetCreatureOrPlayerAmount(3)); + this.addAbility(ability); + } + + public GangOfDevils(final GangOfDevils card) { + super(card); + } + + @Override + public GangOfDevils copy() { + return new GangOfDevils(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/GhostlyTouch.java b/Mage.Sets/src/mage/sets/avacynrestored/GhostlyTouch.java new file mode 100644 index 0000000000..427ce08ab6 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/GhostlyTouch.java @@ -0,0 +1,81 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.MayTapOrUntapTargetEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * + * @author noxx + + */ +public class GhostlyTouch extends CardImpl { + + public GhostlyTouch(UUID ownerId) { + super(ownerId, 58, "Ghostly Touch", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Aura"); + + this.color.setBlue(true); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Constants.Outcome.AddAbility)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature has "Whenever this creature attacks, you may tap or untap target permanent." + Ability gainedAbility = new AttacksTriggeredAbility(new MayTapOrUntapTargetEffect(), true); + gainedAbility.addTarget(new TargetPermanent()); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(gainedAbility, Constants.AttachmentType.AURA))); + } + + public GhostlyTouch(final GhostlyTouch card) { + super(card); + } + + @Override + public GhostlyTouch copy() { + return new GhostlyTouch(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/GloomSurgeon.java b/Mage.Sets/src/mage/sets/avacynrestored/GloomSurgeon.java new file mode 100644 index 0000000000..27a83908da --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/GloomSurgeon.java @@ -0,0 +1,132 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.DamageCreatureEvent; +import mage.game.events.GameEvent; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author noxx + */ +public class GloomSurgeon extends CardImpl { + + public GloomSurgeon(UUID ownerId) { + super(ownerId, 104, "Gloom Surgeon", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{B}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Spirit"); + + this.color.setBlack(true); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // If combat damage would be dealt to Gloom Surgeon, prevent that damage and exile that many cards from the top of your library. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GloomSurgeonEffect())); + } + + public GloomSurgeon(final GloomSurgeon card) { + super(card); + } + + @Override + public GloomSurgeon copy() { + return new GloomSurgeon(this); + } +} + +class GloomSurgeonEffect extends ReplacementEffectImpl { + + GloomSurgeonEffect() { + super(Constants.Duration.WhileOnBattlefield, Constants.Outcome.Exile); + staticText = "If combat damage would be dealt to {this}, prevent that damage and exile that many cards from the top of your library"; + } + + GloomSurgeonEffect(final GloomSurgeonEffect effect) { + super(effect); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), event.getAmount(), false); + if (!game.replaceEvent(preventEvent)) { + int preventedDamage = event.getAmount(); + event.setAmount(0); + + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + int cardsCount = Math.min(preventedDamage, player.getLibrary().size()); + for (int i = 0; i < cardsCount; i++) { + Card card = player.getLibrary().removeFromTop(game); + if (card != null) { + card.moveToExile(source.getId(), "Gloom Surgeon", source.getSourceId(), game); + } else { + break; + } + } + } + + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), preventedDamage)); + return true; + } + + return false; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE && event.getTargetId().equals(source.getSourceId())) { + DamageCreatureEvent damageEvent = (DamageCreatureEvent) event; + if (damageEvent.isCombatDamage()) { + return true; + } + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public GloomSurgeonEffect copy() { + return new GloomSurgeonEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/GoldnightRedeemer.java b/Mage.Sets/src/mage/sets/avacynrestored/GoldnightRedeemer.java new file mode 100644 index 0000000000..cab90a8401 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/GoldnightRedeemer.java @@ -0,0 +1,78 @@ +/* + * 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.avacynrestored; + +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.filter.common.FilterControlledCreaturePermanent; + +import java.util.UUID; + +/** + * + * @author noxx + + */ +public class GoldnightRedeemer extends CardImpl { + + private static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("other creature you control"); + + static { + filter.setAnother(true); + } + + public GoldnightRedeemer(UUID ownerId) { + super(ownerId, 23, "Goldnight Redeemer", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{W}{W}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Angel"); + + this.color.setWhite(true); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + this.addAbility(FlyingAbility.getInstance()); + + // When Goldnight Redeemer enters the battlefield, you gain 2 life for each other creature you control. + this.addAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(new PermanentsOnBattlefieldCount(filter, 2)), false)); + } + + public GoldnightRedeemer(final GoldnightRedeemer card) { + super(card); + } + + @Override + public GoldnightRedeemer copy() { + return new GoldnightRedeemer(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/GuiseOfFire.java b/Mage.Sets/src/mage/sets/avacynrestored/GuiseOfFire.java new file mode 100644 index 0000000000..f6ad6608cd --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/GuiseOfFire.java @@ -0,0 +1,78 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.AttacksEachTurnStaticAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continious.BoostEnchantedEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class GuiseOfFire extends CardImpl { + + public GuiseOfFire(UUID ownerId) { + super(ownerId, 137, "Guise of Fire", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{R}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Aura"); + + this.color.setRed(true); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Constants.Outcome.AddAbility)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature gets +1/-1 and attacks each turn if able. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostEnchantedEffect(1, -1, Constants.Duration.WhileOnBattlefield))); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(new AttacksEachTurnStaticAbility(), Constants.AttachmentType.AURA))); + } + + public GuiseOfFire(final GuiseOfFire card) { + super(card); + } + + @Override + public GuiseOfFire copy() { + return new GuiseOfFire(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/JointAssault.java b/Mage.Sets/src/mage/sets/avacynrestored/JointAssault.java new file mode 100644 index 0000000000..af6eb8dda5 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/JointAssault.java @@ -0,0 +1,127 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class JointAssault extends CardImpl { + + public JointAssault(UUID ownerId) { + super(ownerId, 183, "Joint Assault", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{G}"); + this.expansionSetCode = "AVR"; + + this.color.setGreen(true); + + // Target creature gets +2/+2 until end of turn. If it's paired with a creature, that creature also gets +2/+2 until end of turn. + this.getSpellAbility().addEffect(new JointAssaultBoostTargetEffect(2, 2, Constants.Duration.EndOfTurn)); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + } + + public JointAssault(final JointAssault card) { + super(card); + } + + @Override + public JointAssault copy() { + return new JointAssault(this); + } +} + +class JointAssaultBoostTargetEffect extends ContinuousEffectImpl { + + private int power; + private int toughness; + private UUID paired; + + public JointAssaultBoostTargetEffect(int power, int toughness, Constants.Duration duration) { + super(duration, Constants.Layer.PTChangingEffects_7, Constants.SubLayer.ModifyPT_7c, Constants.Outcome.BoostCreature); + this.power = power; + this.toughness = toughness; + staticText = "Target creature gets +2/+2 until end of turn. If it's paired with a creature, that creature also gets +2/+2 until end of turn"; + } + + public JointAssaultBoostTargetEffect(final JointAssaultBoostTargetEffect effect) { + super(effect); + this.power = effect.power; + this.toughness = effect.toughness; + } + + @Override + public JointAssaultBoostTargetEffect copy() { + return new JointAssaultBoostTargetEffect(this); + } + + @Override + public void init(Ability source, Game game) { + super.init(source, game); + UUID permanentId = targetPointer.getFirst(source); + Permanent target = game.getPermanent(permanentId); + if (target != null) { + if (target.getPairedCard() != null) { + this.paired = target.getPairedCard(); + } + } + } + + @Override + public boolean apply(Game game, Ability source) { + int affectedTargets = 0; + UUID permanentId = targetPointer.getFirst(source); + + Permanent target = game.getPermanent(permanentId); + if (target != null) { + target.addPower(power); + target.addToughness(toughness); + affectedTargets++; + } + + if (this.paired != null) { + Permanent paired = game.getPermanent(this.paired); + if (paired != null) { + paired.addPower(power); + paired.addToughness(toughness); + affectedTargets++; + } + } + + return affectedTargets > 0; + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/MaliciousIntent.java b/Mage.Sets/src/mage/sets/avacynrestored/MaliciousIntent.java new file mode 100644 index 0000000000..2a578f6c10 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/MaliciousIntent.java @@ -0,0 +1,83 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.CantBlockAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.effects.common.continious.GainAbilityTargetEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * + * @author noxx + + */ +public class MaliciousIntent extends CardImpl { + + public MaliciousIntent(UUID ownerId) { + super(ownerId, 147, "Malicious Intent", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Aura"); + + this.color.setRed(true); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Constants.Outcome.AddAbility)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature has "{tap}: Target creature can't block this turn." + Ability gainedAbility = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GainAbilityTargetEffect(CantBlockAbility.getInstance(), Constants.Duration.EndOfTurn), new TapSourceCost()); + gainedAbility.addTarget(new TargetCreaturePermanent()); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(gainedAbility, Constants.AttachmentType.AURA))); + } + + public MaliciousIntent(final MaliciousIntent card) { + super(card); + } + + @Override + public MaliciousIntent copy() { + return new MaliciousIntent(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/RighteousBlow.java b/Mage.Sets/src/mage/sets/avacynrestored/RighteousBlow.java new file mode 100644 index 0000000000..71aa3c7acf --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/RighteousBlow.java @@ -0,0 +1,62 @@ +/* + * 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.avacynrestored; + +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.cards.CardImpl; +import mage.target.common.TargetAttackingOrBlockingCreature; + +import java.util.UUID; + +/** + * @author noxx + */ +public class RighteousBlow extends CardImpl { + + public RighteousBlow(UUID ownerId) { + super(ownerId, 34, "Righteous Blow", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{W}"); + this.expansionSetCode = "AVR"; + + this.color.setWhite(true); + + // Righteous Blow deals 2 damage to target attacking or blocking creature. + this.getSpellAbility().addTarget(new TargetAttackingOrBlockingCreature()); + this.getSpellAbility().addEffect(new DamageTargetEffect(2)); + } + + public RighteousBlow(final RighteousBlow card) { + super(card); + } + + @Override + public RighteousBlow copy() { + return new RighteousBlow(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/SternMentor.java b/Mage.Sets/src/mage/sets/avacynrestored/SternMentor.java new file mode 100644 index 0000000000..5fcc664417 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/SternMentor.java @@ -0,0 +1,80 @@ +/* + * 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.avacynrestored; + +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.common.SimpleStaticAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; +import mage.abilities.effects.common.continious.GainAbilityPairedEffect; +import mage.abilities.keyword.SoulbondAbility; +import mage.cards.CardImpl; +import mage.target.TargetPlayer; + +import java.util.UUID; + +/** + * @author noxx + */ +public class SternMentor extends CardImpl { + + private static final String ruleText = "As long as {this} is paired with another creature, each of those creatures has \"{tap}: Target player puts the top two cards of his or her library into his or her graveyard.\""; + + public SternMentor(UUID ownerId) { + super(ownerId, 77, "Stern Mentor", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{U}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Human"); + this.subtype.add("Wizard"); + + this.color.setBlue(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Soulbond + this.addAbility(SoulbondAbility.getInstance()); + + // As long as Stern Mentor is paired with another creature, each of those creatures has "{tap}: Target player puts the top two cards of his or her library into his or her graveyard." + Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new PutLibraryIntoGraveTargetEffect(2), new TapSourceCost()); + ability.addTarget(new TargetPlayer()); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityPairedEffect(ability, ruleText))); + } + + public SternMentor(final SternMentor card) { + super(card); + } + + @Override + public SternMentor copy() { + return new SternMentor(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/Stonewright.java b/Mage.Sets/src/mage/sets/avacynrestored/Stonewright.java new file mode 100644 index 0000000000..1444ddc38a --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/Stonewright.java @@ -0,0 +1,78 @@ +/* + * 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.avacynrestored; + +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.common.SimpleStaticAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continious.BoostSourceEffect; +import mage.abilities.effects.common.continious.GainAbilityPairedEffect; +import mage.abilities.keyword.SoulbondAbility; +import mage.cards.CardImpl; + +import java.util.UUID; + +/** + * @author noxx + */ +public class Stonewright extends CardImpl { + + private static final String ruleText = "As long as {this} is paired with another creature, each of those creatures has \"{R}: This creature gets +1/+0 until end of turn.\""; + + public Stonewright(UUID ownerId) { + super(ownerId, 157, "Stonewright", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{R}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Human"); + this.subtype.add("Shaman"); + + this.color.setRed(true); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Soulbond + this.addAbility(SoulbondAbility.getInstance()); + + // As long as Stonewright is paired with another creature, each of those creatures has "{R}: This creature gets +1/+0 until end of turn." + Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Constants.Duration.EndOfTurn), new ManaCostsImpl("{R}")); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityPairedEffect(ability, ruleText))); + } + + public Stonewright(final Stonewright card) { + super(card); + } + + @Override + public Stonewright copy() { + return new Stonewright(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/TandemLookout.java b/Mage.Sets/src/mage/sets/avacynrestored/TandemLookout.java new file mode 100644 index 0000000000..111a4d1fc8 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/TandemLookout.java @@ -0,0 +1,77 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; +import mage.abilities.effects.common.DrawCardControllerEffect; +import mage.abilities.effects.common.continious.GainAbilityPairedEffect; +import mage.abilities.keyword.SoulbondAbility; +import mage.cards.CardImpl; + +import java.util.UUID; + +/** + * @author noxx + */ +public class TandemLookout extends CardImpl { + + private static final String ruleText = "As long as {this} is paired with another creature, each of those creatures has \"Whenever this creature deals damage to an opponent, draw a card.\""; + + public TandemLookout(UUID ownerId) { + super(ownerId, 80, "Tandem Lookout", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{U}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Human"); + this.subtype.add("Scout"); + + this.color.setBlue(true); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Soulbond + this.addAbility(SoulbondAbility.getInstance()); + + // As long as Tandem Lookout is paired with another creature, each of those creatures has "Whenever this creature deals damage to an opponent, draw a card." + Ability ability = new DealsDamageToOpponentTriggeredAbility(new DrawCardControllerEffect(1)); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityPairedEffect(ability, ruleText))); + } + + public TandemLookout(final TandemLookout card) { + super(card); + } + + @Override + public TandemLookout copy() { + return new TandemLookout(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/TormentorsTrident.java b/Mage.Sets/src/mage/sets/avacynrestored/TormentorsTrident.java new file mode 100644 index 0000000000..2e0e252dd6 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/TormentorsTrident.java @@ -0,0 +1,71 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.common.AttacksEachTurnStaticAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.continious.BoostEquippedEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.cards.CardImpl; + +import java.util.UUID; + +/** + * + * @author noxx + + */ +public class TormentorsTrident extends CardImpl { + + public TormentorsTrident(UUID ownerId) { + super(ownerId, 222, "Tormentor's Trident", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Equipment"); + + // Equipped creature gets +3/+0 and attacks each turn if able. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostEquippedEffect(3, 0))); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(new AttacksEachTurnStaticAbility(), Constants.AttachmentType.EQUIPMENT))); + + // Equip {3} + this.addAbility(new EquipAbility(Constants.Outcome.AddAbility, new GenericManaCost(3))); + } + + public TormentorsTrident(final TormentorsTrident card) { + super(card); + } + + @Override + public TormentorsTrident copy() { + return new TormentorsTrident(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/TreacherousPitDweller.java b/Mage.Sets/src/mage/sets/avacynrestored/TreacherousPitDweller.java new file mode 100644 index 0000000000..41fd3d62b4 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/TreacherousPitDweller.java @@ -0,0 +1,120 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.ZoneChangeTriggeredAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.keyword.UndyingAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetOpponent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class TreacherousPitDweller extends CardImpl { + + public TreacherousPitDweller(UUID ownerId) { + super(ownerId, 121, "Treacherous Pit-Dweller", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{B}{B}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Demon"); + + this.color.setBlack(true); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // Undying + this.addAbility(new UndyingAbility()); + + // When Treacherous Pit-Dweller enters the battlefield from a graveyard, target opponent gains control of it. + this.addAbility(new TreacherousPitDwellerTriggeredAbility()); + } + + public TreacherousPitDweller(final TreacherousPitDweller card) { + super(card); + } + + @Override + public TreacherousPitDweller copy() { + return new TreacherousPitDweller(this); + } +} + +class TreacherousPitDwellerTriggeredAbility extends ZoneChangeTriggeredAbility { + + private static final String ruleText = "When {this} enters the battlefield from a graveyard, "; + + public TreacherousPitDwellerTriggeredAbility() { + super(Constants.Zone.GRAVEYARD, Constants.Zone.BATTLEFIELD, new TreacherousPitDwellerEffect(), ruleText, false); + addTarget(new TargetOpponent(true)); + } + + public TreacherousPitDwellerTriggeredAbility(final TreacherousPitDwellerTriggeredAbility ability) { + super(ability); + } + + @Override + public TreacherousPitDwellerTriggeredAbility copy() { + return new TreacherousPitDwellerTriggeredAbility(this); + } +} + +class TreacherousPitDwellerEffect extends ContinuousEffectImpl { + + public TreacherousPitDwellerEffect() { + super(Constants.Duration.Custom, Constants.Layer.ControlChangingEffects_2, Constants.SubLayer.NA, Constants.Outcome.GainControl); + staticText = "Target opponent gains control of {this}"; + } + + public TreacherousPitDwellerEffect(final TreacherousPitDwellerEffect effect) { + super(effect); + } + + @Override + public TreacherousPitDwellerEffect copy() { + return new TreacherousPitDwellerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + return permanent.changeControllerId(source.getFirstTarget(), game); + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/TriumphOfCruelty.java b/Mage.Sets/src/mage/sets/avacynrestored/TriumphOfCruelty.java new file mode 100644 index 0000000000..0bf96eda57 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/TriumphOfCruelty.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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.TriggeredAbility; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.condition.common.ControlsBiggestOrTiedCreatureCondition; +import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.effects.common.DiscardTargetEffect; +import mage.cards.CardImpl; +import mage.target.Target; +import mage.target.common.TargetOpponent; + +import java.util.UUID; + +/** + * + * @author noxx + */ +public class TriumphOfCruelty extends CardImpl { + + private static final String ruleText = "target opponent discards a card if you control the creature with the greatest power or tied for the greatest power"; + + public TriumphOfCruelty(UUID ownerId) { + super(ownerId, 122, "Triumph of Cruelty", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}"); + this.expansionSetCode = "AVR"; + + this.color.setBlack(true); + + // At the beginning of your upkeep, target opponent discards a card if you control the creature with the greatest power or tied for the greatest power. + TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new DiscardTargetEffect(1), Constants.TargetController.YOU, false); + Target target = new TargetOpponent(); + target.setRequired(true); + ability.addTarget(target); + this.addAbility(new ConditionalTriggeredAbility(ability, ControlsBiggestOrTiedCreatureCondition.getInstance(), ruleText)); + } + + public TriumphOfCruelty(final TriumphOfCruelty card) { + super(card); + } + + @Override + public TriumphOfCruelty copy() { + return new TriumphOfCruelty(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/UnhallowedPact.java b/Mage.Sets/src/mage/sets/avacynrestored/UnhallowedPact.java new file mode 100644 index 0000000000..bef99954e2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/UnhallowedPact.java @@ -0,0 +1,75 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.DiesAttachedTriggeredAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class UnhallowedPact extends CardImpl { + + public UnhallowedPact(UUID ownerId) { + super(ownerId, 124, "Unhallowed Pact", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Aura"); + + this.color.setBlack(true); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Constants.Outcome.Detriment)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // When enchanted creature dies, return that card to the battlefield under your control. + this.addAbility(new DiesAttachedTriggeredAbility(new ReturnToBattlefieldUnderYourControlAttachedEffect(), "enchanted creature")); + } + + public UnhallowedPact(final UnhallowedPact card) { + super(card); + } + + @Override + public UnhallowedPact copy() { + return new UnhallowedPact(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/VanguardsShield.java b/Mage.Sets/src/mage/sets/avacynrestored/VanguardsShield.java new file mode 100644 index 0000000000..b523a4d9ae --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/VanguardsShield.java @@ -0,0 +1,122 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.continious.BoostEquippedEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class VanguardsShield extends CardImpl { + + public VanguardsShield(UUID ownerId) { + super(ownerId, 223, "Vanguard's Shield", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{2}"); + this.expansionSetCode = "AVR"; + this.subtype.add("Equipment"); + + // Equipped creature gets +0/+3 and can block an additional creature. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostEquippedEffect(0, 3))); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect( + new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new VanguardsShieldEffect()), + Constants.AttachmentType.EQUIPMENT))); + + // Equip {3} + this.addAbility(new EquipAbility(Constants.Outcome.AddAbility, new GenericManaCost(3))); + } + + public VanguardsShield(final VanguardsShield card) { + super(card); + } + + @Override + public VanguardsShield copy() { + return new VanguardsShield(this); + } +} + +class VanguardsShieldEffect extends ContinuousEffectImpl { + + public VanguardsShieldEffect() { + super(Constants.Duration.WhileOnBattlefield, Constants.Outcome.Benefit); + staticText = "Equipped creature can block an additional creature"; + } + + public VanguardsShieldEffect(final VanguardsShieldEffect effect) { + super(effect); + } + + @Override + public VanguardsShieldEffect copy() { + return new VanguardsShieldEffect(this); + } + + @Override + public boolean apply(Constants.Layer layer, Constants.SubLayer sublayer, Ability source, Game game) { + Permanent perm = game.getPermanent(source.getSourceId()); + if (perm != null && perm.getAttachedTo() != null) { + Permanent equipped = game.getPermanent(perm.getAttachedTo()); + if (equipped != null) { + switch (layer) { + case RulesEffects: + // maxBlocks = 0 equals to "can block any number of creatures" + if (equipped.getMaxBlocks() > 0) { + equipped.setMaxBlocks(equipped.getMaxBlocks() + 1); + } + break; + } + return true; + } + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } + + @Override + public boolean hasLayer(Constants.Layer layer) { + return layer == Constants.Layer.RulesEffects; + } + +} diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/HeWhoHungers.java b/Mage.Sets/src/mage/sets/championsofkamigawa/HeWhoHungers.java index 44c7645e18..38d201096a 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/HeWhoHungers.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/HeWhoHungers.java @@ -33,10 +33,6 @@ package mage.sets.championsofkamigawa; */ -import java.util.UUID; - - -import mage.Constants; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.Constants.Zone; @@ -45,20 +41,17 @@ import mage.abilities.Ability; import mage.abilities.common.ActivateAsSorceryActivatedAbility; import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetOpponentEffect; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.SoulshiftAbility; -import mage.cards.Card; import mage.cards.CardImpl; import mage.filter.Filter; -import mage.filter.FilterCard; import mage.filter.common.FilterControlledPermanent; -import mage.game.Game; -import mage.players.Player; -import mage.target.TargetCard; import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetOpponent; +import java.util.UUID; + /** * @author LevelX */ @@ -85,8 +78,8 @@ public class HeWhoHungers extends CardImpl { /* {1}, Sacrifice a Spirit: Target opponent reveals his or her hand. You choose a card from it. * That player discards that card. Activate this ability only any time you could cast a sorcery. */ - Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new HeWhoHungersEffect(), new ManaCostsImpl("{1}")); - ability.addTarget(new TargetOpponent()); + Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new DiscardCardYouChooseTargetOpponentEffect(), new ManaCostsImpl("{1}")); + ability.addTarget(new TargetOpponent(true)); ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); this.addAbility(ability); @@ -103,42 +96,4 @@ public class HeWhoHungers extends CardImpl { return new HeWhoHungers(this); } -} - -class HeWhoHungersEffect extends OneShotEffect { - - public HeWhoHungersEffect() { - super(Constants.Outcome.Discard); - staticText = "Target opponent reveals his or her hand. You choose a card from it. That player discards that card"; - } - - public HeWhoHungersEffect(final HeWhoHungersEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getFirstTarget()); - if (player != null) { - player.revealCards("He Who Hungers", player.getHand(), game); - Player you = game.getPlayer(source.getControllerId()); - if (you != null) { - TargetCard target = new TargetCard(Constants.Zone.PICK, new FilterCard()); - target.setRequired(true); - if (you.choose(Constants.Outcome.Benefit, player.getHand(), target, game)) { - Card card = player.getHand().get(target.getFirstTarget(), game); - if (card != null) { - return player.discard(card, source, game); - } - } - } - } - return false; - } - - @Override - public HeWhoHungersEffect copy() { - return new HeWhoHungersEffect(this); - } - } \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/magic2010/HypnoticSpecter.java b/Mage.Sets/src/mage/sets/magic2010/HypnoticSpecter.java index dab620de1d..e02e030854 100644 --- a/Mage.Sets/src/mage/sets/magic2010/HypnoticSpecter.java +++ b/Mage.Sets/src/mage/sets/magic2010/HypnoticSpecter.java @@ -27,22 +27,15 @@ */ package mage.sets.magic2010; -import java.util.UUID; import mage.Constants.CardType; -import mage.Constants.Outcome; import mage.Constants.Rarity; -import mage.Constants.Zone; import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; +import mage.abilities.effects.common.DiscardTargetEffect; import mage.abilities.keyword.FlyingAbility; -import mage.cards.Card; import mage.cards.CardImpl; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.players.Player; -import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; /** * @@ -60,8 +53,9 @@ public class HypnoticSpecter extends CardImpl { this.toughness = new MageInt(2); this.addAbility(FlyingAbility.getInstance()); + // Whenever Hypnotic Specter deals damage to an opponent, that player discards a card at random. - this.addAbility(new HypnoticSpecterTriggeredAbility()); + this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardTargetEffect(1, true))); } public HypnoticSpecter(final HypnoticSpecter card) { @@ -72,64 +66,4 @@ public class HypnoticSpecter extends CardImpl { public HypnoticSpecter copy() { return new HypnoticSpecter(this); } -} - -class HypnoticSpecterTriggeredAbility extends TriggeredAbilityImpl { - - public HypnoticSpecterTriggeredAbility() { - super(Zone.BATTLEFIELD, new HypnoticSpecterEffect()); - } - - public HypnoticSpecterTriggeredAbility(final HypnoticSpecterTriggeredAbility ability) { - super(ability); - } - - @Override - public HypnoticSpecterTriggeredAbility copy() { - return new HypnoticSpecterTriggeredAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId) - && game.getOpponents(this.getControllerId()).contains(event.getTargetId())) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId())); - return true; - } - return false; - } - - @Override - public String getRule() { - return "Whenever {this} deals damage to an opponent, that player discards a card at random."; - } -} - -class HypnoticSpecterEffect extends OneShotEffect { - - public HypnoticSpecterEffect() { - super(Outcome.Discard); - } - - public HypnoticSpecterEffect(final HypnoticSpecterEffect effect) { - super(effect); - } - - @Override - public HypnoticSpecterEffect copy() { - return new HypnoticSpecterEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(targetPointer.getFirst(source)); - if (player != null && !player.getHand().isEmpty()) { - Card card = player.getHand().getRandom(game); - if (card != null) { - player.discard(card, source, game); - return true; - } - } - return false; - } -} +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/magic2011/JinxedIdol.java b/Mage.Sets/src/mage/sets/magic2011/JinxedIdol.java index febff6d077..19f4415a0b 100644 --- a/Mage.Sets/src/mage/sets/magic2011/JinxedIdol.java +++ b/Mage.Sets/src/mage/sets/magic2011/JinxedIdol.java @@ -28,14 +28,7 @@ package mage.sets.magic2011; -import java.util.UUID; -import mage.Constants.CardType; -import mage.Constants.Duration; -import mage.Constants.Layer; -import mage.Constants.Outcome; -import mage.Constants.Rarity; -import mage.Constants.SubLayer; -import mage.Constants.Zone; +import mage.Constants.*; import mage.abilities.Ability; import mage.abilities.common.OnEventTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; @@ -49,6 +42,8 @@ import mage.game.permanent.Permanent; import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetOpponent; +import java.util.UUID; + /** * * @author BetaSteward_at_googlemail.com @@ -78,7 +73,7 @@ public class JinxedIdol extends CardImpl { class JinxedIdolEffect extends ContinuousEffectImpl { public JinxedIdolEffect() { - super(Duration.WhileOnBattlefield, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl); + super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl); staticText = "Target opponent gains control of {this}"; } diff --git a/Mage.Sets/src/mage/sets/tenth/SengirVampire.java b/Mage.Sets/src/mage/sets/tenth/SengirVampire.java index f9d3c0c2cf..9f90e33762 100644 --- a/Mage.Sets/src/mage/sets/tenth/SengirVampire.java +++ b/Mage.Sets/src/mage/sets/tenth/SengirVampire.java @@ -55,7 +55,7 @@ public class SengirVampire extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // Whenever a creature dealt damage by Sengir Vampire this turn dies, put a +1/+1 counter on Sengir Vampire. - this.addAbility(new DiesAndDealtDamageThisTurnTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()))); + this.addAbility(new DiesAndDealtDamageThisTurnTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false)); } public SengirVampire(final SengirVampire card) { diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SoulbondKeywordTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SoulbondKeywordTest.java index ddaabe8cd8..b1112ddf85 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SoulbondKeywordTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SoulbondKeywordTest.java @@ -5,6 +5,7 @@ import mage.abilities.Abilities; import mage.abilities.AbilitiesImpl; import mage.abilities.keyword.LifelinkAbility; import mage.filter.Filter; +import org.junit.Assert; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -348,4 +349,9 @@ public class SoulbondKeywordTest extends CardTestPlayerBase { assertAbilities(playerA, "Nearheath Pilgrim", abilities); assertAbilities(playerA, "Elite Vanguard", abilities); } + + public void testExileAndReturnBack() { + //TODO: Soulbond + Soulshift + Assert.assertTrue(false); + } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/control/TargetOpponentGainsControlTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/control/TargetOpponentGainsControlTest.java new file mode 100644 index 0000000000..cfbd11a38c --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/control/TargetOpponentGainsControlTest.java @@ -0,0 +1,52 @@ +package org.mage.test.cards.control; + +import mage.Constants; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * Tests the effect: + * - Target opponent gains control of {this} + * + * @author noxx + */ +public class TargetOpponentGainsControlTest extends CardTestPlayerBase { + + @Test + public void testPermanentControlEffect() { + addCard(Constants.Zone.HAND, playerA, "Lightning Bolt", 3); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Treacherous Pit-Dweller"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 3); + + castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Treacherous Pit-Dweller"); + + setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT); + execute(); + + // under opponent's control + assertPermanentCount(playerB, "Treacherous Pit-Dweller", 1); + } + + @Test + public void testChangeControlEffectFromTwoCards() { + addCard(Constants.Zone.HAND, playerA, "Lightning Bolt", 3); + addCard(Constants.Zone.HAND, playerA, "Unhallowed Pact", 3); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Treacherous Pit-Dweller"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 5); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp", 1); + + castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Treacherous Pit-Dweller"); + castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Unhallowed Pact", "Treacherous Pit-Dweller"); + castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "Treacherous Pit-Dweller"); + castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "Treacherous Pit-Dweller"); + + setStopAt(1, Constants.PhaseStep.END_TURN); + execute(); + + // went to graveyard + assertGraveyardCount(playerA, "Unhallowed Pact", 1); + + // returned back + assertPermanentCount(playerA, "Treacherous Pit-Dweller", 1); + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/ExquisiteBloodTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/ExquisiteBloodTest.java new file mode 100644 index 0000000000..faaf7b120b --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/ExquisiteBloodTest.java @@ -0,0 +1,44 @@ +package org.mage.test.cards.single; + +import mage.Constants; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author noxx + */ +public class ExquisiteBloodTest extends CardTestPlayerBase { + + @Test + public void testCard() { + addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 1); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp", 1); + + // card we test + addCard(Constants.Zone.BATTLEFIELD, playerA, "Exquisite Blood", 1); + + addCard(Constants.Zone.HAND, playerA, "Lightning Bolt"); + addCard(Constants.Zone.HAND, playerA, "Bump in the Night"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Raging Goblin", 2); + + addCard(Constants.Zone.BATTLEFIELD, playerB, "Mountain", 1); + addCard(Constants.Zone.HAND, playerB, "Shock"); + + + castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB); + castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Bump in the Night", playerB); + + attack(1, playerA, "Raging Goblin"); + attack(1, playerA, "Raging Goblin"); + + castSpell(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "Shock", playerA); + + setStopAt(2, Constants.PhaseStep.BEGIN_COMBAT); + execute(); + + assertLife(playerB, 12); + assertLife(playerA, 26); + } + +} diff --git a/Mage/src/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java b/Mage/src/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java index 5dc9e91ecc..0c12f4c082 100644 --- a/Mage/src/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java +++ b/Mage/src/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java @@ -5,6 +5,7 @@ import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.game.Game; import mage.game.events.GameEvent; +import mage.target.targetpointer.FirstTargetPointer; import mage.target.targetpointer.FixedTarget; public class BeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl { @@ -37,21 +38,27 @@ public class BeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl { public DiesAndDealtDamageThisTurnTriggeredAbility(Effect effect) { - super(Constants.Zone.ALL, effect); + this(effect, false); } public DiesAndDealtDamageThisTurnTriggeredAbility(Effect effect, boolean optional) { - super(Constants.Zone.ALL, effect, true); + super(Constants.Zone.ALL, effect, optional); } public DiesAndDealtDamageThisTurnTriggeredAbility(final DiesAndDealtDamageThisTurnTriggeredAbility ability) { @@ -34,6 +34,9 @@ public class DiesAndDealtDamageThisTurnTriggeredAbility extends TriggeredAbility if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) { MageObject object = game.getLastKnownInformation(event.getTargetId(), Constants.Zone.BATTLEFIELD); if (object instanceof Permanent && ((Permanent)object).getDealtDamageByThisTurn().contains(this.sourceId)) { + for (Effect effect : getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); + } return true; } } diff --git a/Mage/src/mage/abilities/common/DiesAttachedTriggeredAbility.java b/Mage/src/mage/abilities/common/DiesAttachedTriggeredAbility.java index 2295902ea8..c876119b93 100644 --- a/Mage/src/mage/abilities/common/DiesAttachedTriggeredAbility.java +++ b/Mage/src/mage/abilities/common/DiesAttachedTriggeredAbility.java @@ -34,8 +34,12 @@ public class DiesAttachedTriggeredAbility extends TriggeredAbilityImpl controllers = new HashSet(); + int maxPower = -1; + for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) { + if (maxPower == -1 || permanent.getPower().getValue() >= maxPower) { + controllers.add(permanent.getControllerId()); + } + } + return controllers.contains(source.getControllerId()); + } +} diff --git a/Mage/src/mage/abilities/condition/common/EquippedHasSubtypeCondition.java b/Mage/src/mage/abilities/condition/common/EquippedHasSubtypeCondition.java index c77e455770..53c6ce3d55 100644 --- a/Mage/src/mage/abilities/condition/common/EquippedHasSubtypeCondition.java +++ b/Mage/src/mage/abilities/condition/common/EquippedHasSubtypeCondition.java @@ -32,8 +32,6 @@ import mage.abilities.condition.Condition; import mage.game.Game; import mage.game.permanent.Permanent; -import java.util.UUID; - /** * Describes condition when equipped permanent has subType * @@ -42,20 +40,33 @@ import java.util.UUID; public class EquippedHasSubtypeCondition implements Condition { private String subType; + private String[] subTypes; // scope = Any public EquippedHasSubtypeCondition(String subType) { this.subType = subType; } + public EquippedHasSubtypeCondition(String... subTypes) { + this.subTypes = subTypes; + } + @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId()); if (permanent != null && permanent.getAttachedTo() != null) { Permanent attachedTo = game.getBattlefield().getPermanent(permanent.getAttachedTo()); if (attachedTo != null) { - if (attachedTo.hasSubtype(this.subType)) { - return true; - } + if (subType != null) { + if (attachedTo.hasSubtype(this.subType)) { + return true; + } + } else { + for (String s : subTypes) { + if (attachedTo.hasSubtype(s)) { + return true; + } + } + } } } return false; diff --git a/Mage/src/mage/abilities/condition/common/NoControlledCreatureCondition.java b/Mage/src/mage/abilities/condition/common/NoControlledCreatureCondition.java new file mode 100644 index 0000000000..4754537170 --- /dev/null +++ b/Mage/src/mage/abilities/condition/common/NoControlledCreatureCondition.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.abilities.condition.common; + +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; + +/** + * @author noxx + */ +public class NoControlledCreatureCondition implements Condition { + + private static NoControlledCreatureCondition fInstance = new NoControlledCreatureCondition(); + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); + + public static Condition getInstance() { + return fInstance; + } + + @Override + public boolean apply(Game game, Ability source) { + return game.getBattlefield().countAll(filter, source.getControllerId()) == 0; + } +} diff --git a/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java b/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java index dd45063449..905f9d0e87 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java @@ -34,7 +34,7 @@ public class PermanentsOnBattlefieldCount implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility) { - return amount * game.getBattlefield().count(filter, sourceAbility.getControllerId(), game); + return amount * game.getBattlefield().count(filter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game); } @Override diff --git a/Mage/src/mage/abilities/effects/common/DealsDamageToOpponentTriggeredAbility.java b/Mage/src/mage/abilities/effects/common/DealsDamageToOpponentTriggeredAbility.java new file mode 100644 index 0000000000..32342988c9 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/DealsDamageToOpponentTriggeredAbility.java @@ -0,0 +1,71 @@ +/* + * 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.abilities.effects.common; + +import mage.Constants; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.target.targetpointer.FixedTarget; + +/** + * @author noxx + */ +public class DealsDamageToOpponentTriggeredAbility extends TriggeredAbilityImpl { + + public DealsDamageToOpponentTriggeredAbility(Effect effect) { + super(Constants.Zone.BATTLEFIELD, effect); + } + + public DealsDamageToOpponentTriggeredAbility(final DealsDamageToOpponentTriggeredAbility ability) { + super(ability); + } + + @Override + public DealsDamageToOpponentTriggeredAbility copy() { + return new DealsDamageToOpponentTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId) + && game.getOpponents(this.getControllerId()).contains(event.getTargetId())) { + for (Effect effect : getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); + } + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever {this} deals damage to an opponent, " + super.getRule(); + } +} \ No newline at end of file diff --git a/Mage/src/mage/abilities/effects/common/ExileTargetEffect.java b/Mage/src/mage/abilities/effects/common/ExileTargetEffect.java index a322210898..8b34da40c9 100644 --- a/Mage/src/mage/abilities/effects/common/ExileTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/ExileTargetEffect.java @@ -28,7 +28,6 @@ package mage.abilities.effects.common; -import java.util.UUID; import mage.Constants.Outcome; import mage.abilities.Ability; import mage.abilities.Mode; @@ -37,6 +36,8 @@ import mage.cards.Card; import mage.game.Game; import mage.game.permanent.Permanent; +import java.util.UUID; + /** * * @author BetaSteward_at_googlemail.com @@ -62,7 +63,7 @@ public class ExileTargetEffect extends OneShotEffect { this.exileId = effect.exileId; } - @Override + @Override public ExileTargetEffect copy() { return new ExileTargetEffect(this); } @@ -70,12 +71,17 @@ public class ExileTargetEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(targetPointer.getFirst(source)); + + if (exileId == null) { + exileId = getId(); + } + if (permanent != null) { - return permanent.moveToExile(exileId, exileZone, source.getId(), game); + return permanent.moveToExile(exileId, exileZone, source.getSourceId(), game); } else { Card card = game.getCard(targetPointer.getFirst(source)); if (card != null) { - return card.moveToExile(exileId, exileZone, source.getId(), game); + return card.moveToExile(exileId, exileZone, source.getSourceId(), game); } } return false; diff --git a/Mage/src/mage/abilities/effects/common/ImprintTargetEffect.java b/Mage/src/mage/abilities/effects/common/ImprintTargetEffect.java new file mode 100644 index 0000000000..7dad292f47 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/ImprintTargetEffect.java @@ -0,0 +1,80 @@ +/* +* 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.abilities.effects.common; + +import mage.Constants.Outcome; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author noxx + */ +public class ImprintTargetEffect extends OneShotEffect { + + public ImprintTargetEffect() { + super(Outcome.Neutral); + } + + public ImprintTargetEffect(final ImprintTargetEffect effect) { + super(effect); + } + + @Override + public ImprintTargetEffect copy() { + return new ImprintTargetEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent sourcePermanent = game.getPermanent(source.getSourceId()); + if (sourcePermanent != null) { + Permanent permanent = game.getPermanent(targetPointer.getFirst(source)); + if (permanent != null) { + sourcePermanent.imprint(permanent.getId(), game); + } else { + Card card = game.getCard(targetPointer.getFirst(source)); + if (card != null) { + sourcePermanent.imprint(card.getId(), game); + } + } + } + + return true; + } + + @Override + public String getText(Mode mode) { + return null; + } +} diff --git a/Mage/src/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlAttachedEffect.java b/Mage/src/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlAttachedEffect.java new file mode 100644 index 0000000000..d2a9539a38 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlAttachedEffect.java @@ -0,0 +1,75 @@ +/* + * 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.abilities.effects.common; + +import mage.Constants.Outcome; +import mage.Constants.Zone; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author noxx + */ +public class ReturnToBattlefieldUnderYourControlAttachedEffect extends OneShotEffect { + + public ReturnToBattlefieldUnderYourControlAttachedEffect() { + super(Outcome.Benefit); + staticText = "return that card to the battlefield under your control"; + } + + public ReturnToBattlefieldUnderYourControlAttachedEffect(final ReturnToBattlefieldUnderYourControlAttachedEffect effect) { + super(effect); + } + + @Override + public ReturnToBattlefieldUnderYourControlAttachedEffect copy() { + return new ReturnToBattlefieldUnderYourControlAttachedEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Object object = getValue("attachedTo"); + if (object != null && object instanceof Permanent) { + Card card = game.getCard(((Permanent)object).getId()); + if (card != null) { + Zone currentZone = game.getState().getZone(card.getId()); + if (card.putOntoBattlefield(game, currentZone, source.getId(), source.getControllerId())) { + return true; + } + } + } + + return false; + } + +} diff --git a/Mage/src/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlSourceEffect.java b/Mage/src/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlSourceEffect.java new file mode 100644 index 0000000000..f72da05632 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlSourceEffect.java @@ -0,0 +1,70 @@ +/* + * 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.abilities.effects.common; + +import mage.Constants.Outcome; +import mage.Constants.Zone; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.game.Game; + +/** + * + * @author noxx + */ +public class ReturnToBattlefieldUnderYourControlSourceEffect extends OneShotEffect { + + public ReturnToBattlefieldUnderYourControlSourceEffect() { + super(Outcome.Benefit); + staticText = "return that card to the battlefield under your control"; + } + + public ReturnToBattlefieldUnderYourControlSourceEffect(final ReturnToBattlefieldUnderYourControlSourceEffect effect) { + super(effect); + } + + @Override + public ReturnToBattlefieldUnderYourControlSourceEffect copy() { + return new ReturnToBattlefieldUnderYourControlSourceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Card card = game.getCard(source.getSourceId()); + if (card != null) { + Zone currentZone = game.getState().getZone(card.getId()); + if (card.putOntoBattlefield(game, currentZone, source.getId(), source.getControllerId())) { + return true; + } + } + return false; + } + +} diff --git a/Mage/src/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlTargetEffect.java b/Mage/src/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlTargetEffect.java new file mode 100644 index 0000000000..be9a21677e --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlTargetEffect.java @@ -0,0 +1,70 @@ +/* + * 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.abilities.effects.common; + +import mage.Constants.Outcome; +import mage.Constants.Zone; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.game.Game; + +/** + * + * @author noxx + */ +public class ReturnToBattlefieldUnderYourControlTargetEffect extends OneShotEffect { + + public ReturnToBattlefieldUnderYourControlTargetEffect() { + super(Outcome.Benefit); + staticText = "return that card to the battlefield under your control"; + } + + public ReturnToBattlefieldUnderYourControlTargetEffect(final ReturnToBattlefieldUnderYourControlTargetEffect effect) { + super(effect); + } + + @Override + public ReturnToBattlefieldUnderYourControlTargetEffect copy() { + return new ReturnToBattlefieldUnderYourControlTargetEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Card card = game.getCard(targetPointer.getFirst(source)); + if (card != null) { + Zone currentZone = game.getState().getZone(card.getId()); + if (card.putOntoBattlefield(game, currentZone, source.getId(), source.getControllerId())) { + return true; + } + } + return false; + } + +} diff --git a/Mage/src/mage/abilities/effects/common/TapTargetEffect.java b/Mage/src/mage/abilities/effects/common/TapTargetEffect.java index 30acdaf498..094ac46332 100644 --- a/Mage/src/mage/abilities/effects/common/TapTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/TapTargetEffect.java @@ -28,7 +28,6 @@ package mage.abilities.effects.common; -import java.util.UUID; import mage.Constants.Outcome; import mage.abilities.Ability; import mage.abilities.Mode; @@ -37,56 +36,57 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.Target; +import java.util.UUID; + /** - * * @author BetaSteward_at_googlemail.com */ public class TapTargetEffect extends OneShotEffect { - public TapTargetEffect() { - super(Outcome.Tap); - } + public TapTargetEffect() { + super(Outcome.Tap); + } - public TapTargetEffect(String text) { - this(); - this.staticText = text; - } + public TapTargetEffect(String text) { + this(); + this.staticText = text; + } - public TapTargetEffect(final TapTargetEffect effect) { - super(effect); - } + public TapTargetEffect(final TapTargetEffect effect) { + super(effect); + } - @Override - public TapTargetEffect copy() { - return new TapTargetEffect(this); - } + @Override + public TapTargetEffect copy() { + return new TapTargetEffect(this); + } - @Override - public boolean apply(Game game, Ability source) { - for (UUID target: targetPointer.getTargets(source)) { - Permanent permanent = game.getPermanent(target); - if (permanent != null) { - permanent.tap(game); - } else { - return false; - } - } - return true; - } + @Override + public boolean apply(Game game, Ability source) { + for (UUID target : targetPointer.getTargets(source)) { + Permanent permanent = game.getPermanent(target); + if (permanent != null) { + permanent.tap(game); + } else { + return false; + } + } + return true; + } - @Override - public String getText(Mode mode) { - if (staticText.length() > 0) - return "tap " + staticText; - - Target target = mode.getTargets().get(0); - if (target.getMaxNumberOfTargets() > 1) - if (target.getMaxNumberOfTargets() == target.getNumberOfTargets()) - return "tap " + target.getNumberOfTargets() + " target " + target.getTargetName() + "s"; - else - return "tap up to " + target.getMaxNumberOfTargets() + " target " + target.getTargetName() + "s"; - else - return "tap target " + mode.getTargets().get(0).getTargetName(); - } + @Override + public String getText(Mode mode) { + if (staticText.length() > 0) + return "tap " + staticText; + + Target target = mode.getTargets().get(0); + if (target.getMaxNumberOfTargets() > 1) + if (target.getMaxNumberOfTargets() == target.getNumberOfTargets()) + return "tap " + target.getNumberOfTargets() + " target " + target.getTargetName() + "s"; + else + return "tap up to " + target.getMaxNumberOfTargets() + " target " + target.getTargetName() + "s"; + else + return "tap target " + mode.getTargets().get(0).getTargetName(); + } } diff --git a/Mage/src/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetOpponentEffect.java b/Mage/src/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetOpponentEffect.java new file mode 100644 index 0000000000..8146326238 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetOpponentEffect.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.abilities.effects.common.discard; + +import mage.Constants; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; + +/** + * + * @author noxx + */ +public class DiscardCardYouChooseTargetOpponentEffect extends OneShotEffect { + + public DiscardCardYouChooseTargetOpponentEffect() { + super(Constants.Outcome.Discard); + staticText = "Target opponent reveals his or her hand. You choose a card from it. That player discards that card"; + } + + public DiscardCardYouChooseTargetOpponentEffect(final DiscardCardYouChooseTargetOpponentEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getFirstTarget()); + if (player != null) { + player.revealCards("Discard", player.getHand(), game); + Player you = game.getPlayer(source.getControllerId()); + if (you != null) { + TargetCard target = new TargetCard(Constants.Zone.PICK, new FilterCard()); + target.setRequired(true); + if (you.choose(Constants.Outcome.Benefit, player.getHand(), target, game)) { + Card card = player.getHand().get(target.getFirstTarget(), game); + if (card != null) { + return player.discard(card, source, game); + } + } + } + } + return false; + } + + @Override + public DiscardCardYouChooseTargetOpponentEffect copy() { + return new DiscardCardYouChooseTargetOpponentEffect(this); + } + +} \ No newline at end of file diff --git a/Mage/src/mage/counters/CounterType.java b/Mage/src/mage/counters/CounterType.java index 972f33003f..58bd1f9792 100644 --- a/Mage/src/mage/counters/CounterType.java +++ b/Mage/src/mage/counters/CounterType.java @@ -63,7 +63,8 @@ public enum CounterType { STUDY(new StudyCounter().name), EYEBALL(new EyeballCounter().name), ELIXIR(new ElixirCounter().name), - PAIN(new PainCounter().name); + PAIN(new PainCounter().name), + DESPAIR(new DespairCounter().name); private String name; @@ -153,6 +154,8 @@ public enum CounterType { return new ElixirCounter(amount); case PAIN: return new PainCounter(amount); + case DESPAIR: + return new DespairCounter(amount); } return null; } diff --git a/Mage/src/mage/counters/common/DespairCounter.java b/Mage/src/mage/counters/common/DespairCounter.java new file mode 100644 index 0000000000..5f74d9cedf --- /dev/null +++ b/Mage/src/mage/counters/common/DespairCounter.java @@ -0,0 +1,49 @@ +/* +* 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.counters.common; + +import mage.counters.Counter; + +/** + * Despair counter. + * + * @author noxx + */ +public class DespairCounter extends Counter { + + public DespairCounter() { + super("Despair"); + this.count = 1; + } + + public DespairCounter(int amount) { + super("Despair"); + this.count = amount; + } +} \ No newline at end of file diff --git a/Mage/src/mage/filter/common/FilterUntappedCreature.java b/Mage/src/mage/filter/common/FilterUntappedCreature.java new file mode 100644 index 0000000000..6bdeca3357 --- /dev/null +++ b/Mage/src/mage/filter/common/FilterUntappedCreature.java @@ -0,0 +1,55 @@ +/* +* 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.filter.common; + +/** + * + * @author noxx + */ +public class FilterUntappedCreature extends FilterCreaturePermanent { + + public FilterUntappedCreature() { + this("untapped creature"); + } + + public FilterUntappedCreature(String name) { + super(name); + this.tapped = false; + this.useTapped = true; + } + + public FilterUntappedCreature(final FilterUntappedCreature filter) { + super(filter); + } + + @Override + public FilterUntappedCreature copy() { + return new FilterUntappedCreature(this); + } +} diff --git a/Mage/src/mage/game/permanent/Battlefield.java b/Mage/src/mage/game/permanent/Battlefield.java index deeeb3a004..d4cfe4c781 100644 --- a/Mage/src/mage/game/permanent/Battlefield.java +++ b/Mage/src/mage/game/permanent/Battlefield.java @@ -28,21 +28,15 @@ package mage.game.permanent; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.UUID; import mage.Constants.CardType; import mage.Constants.RangeOfInfluence; import mage.abilities.keyword.PhasingAbility; import mage.filter.FilterPermanent; import mage.game.Game; -import mage.game.events.GameEvent; + +import java.io.Serializable; +import java.util.*; +import java.util.Map.Entry; /** * @@ -138,6 +132,26 @@ public class Battlefield implements Serializable { return count; } + public int count(FilterPermanent filter, UUID sourceId, UUID sourcePlayerId, Game game) { + int count = 0; + if (game.getRangeOfInfluence() == RangeOfInfluence.ALL) { + for (Permanent permanent: field.values()) { + if (filter.match(permanent, sourceId, sourcePlayerId, game)) { + count++; + } + } + } + else { + Set range = game.getPlayer(sourcePlayerId).getInRange(); + for (Permanent permanent: field.values()) { + if (range.contains(permanent.getControllerId()) && filter.match(permanent, sourceId, sourcePlayerId, game)) { + count++; + } + } + } + return count; + } + /** * Returns true if the battlefield contains at least 1 {@link Permanent} * that matches the filter. diff --git a/Mage/src/mage/target/common/TargetOpponent.java b/Mage/src/mage/target/common/TargetOpponent.java index e40612386d..010f0d5bb5 100644 --- a/Mage/src/mage/target/common/TargetOpponent.java +++ b/Mage/src/mage/target/common/TargetOpponent.java @@ -28,11 +28,12 @@ package mage.target.common; -import java.util.UUID; import mage.abilities.Ability; import mage.game.Game; import mage.target.TargetPlayer; +import java.util.UUID; + /** * * @author BetaSteward_at_googlemail.com @@ -40,10 +41,15 @@ import mage.target.TargetPlayer; public class TargetOpponent extends TargetPlayer { public TargetOpponent() { - super(); - this.targetName = "opponent"; + this(false); } + public TargetOpponent(boolean required) { + super(); + this.targetName = "opponent"; + setRequired(required); + } + public TargetOpponent(final TargetOpponent target) { super(target); }