From 351cf9b34ee5d18f6120c30dd44b5391b70349c0 Mon Sep 17 00:00:00 2001 From: emerald000 <emerald000@hotmail.com> Date: Thu, 11 Sep 2014 20:41:15 -0400 Subject: [PATCH] [KTK] Added 3 cards + fixes. --- .../khansoftarkir/BloodsoakedChampion.java | 82 +++++++++++++ .../sets/khansoftarkir/HowlOfTheHorde.java | 112 ++++++++++++++++++ .../sets/khansoftarkir/MarduHeartPiercer.java | 9 +- .../sets/khansoftarkir/MarduSkullhunter.java | 10 +- .../sets/khansoftarkir/MarduWarshrieker.java | 8 +- .../sets/khansoftarkir/PearlLakeAncient.java | 2 +- .../sets/khansoftarkir/WarNameAspirant.java | 89 ++++++++++++++ .../mage/sets/khansoftarkir/WingmateRoc.java | 10 +- .../abilities/abilityword/RaidAbility.java | 81 ------------- .../condition/common/RaidCondition.java | 6 +- 10 files changed, 313 insertions(+), 96 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/khansoftarkir/BloodsoakedChampion.java create mode 100644 Mage.Sets/src/mage/sets/khansoftarkir/HowlOfTheHorde.java create mode 100644 Mage.Sets/src/mage/sets/khansoftarkir/WarNameAspirant.java delete mode 100644 Mage/src/mage/abilities/abilityword/RaidAbility.java diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/BloodsoakedChampion.java b/Mage.Sets/src/mage/sets/khansoftarkir/BloodsoakedChampion.java new file mode 100644 index 0000000000..2b4f191c85 --- /dev/null +++ b/Mage.Sets/src/mage/sets/khansoftarkir/BloodsoakedChampion.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.khansoftarkir; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.CantBlockAbility; +import mage.abilities.condition.common.RaidCondition; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.decorator.ConditionalActivatedAbility; +import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.watchers.common.PlayerAttackedWatcher; + +/** + * + * @author emerald000 + */ +public class BloodsoakedChampion extends CardImpl { + + public BloodsoakedChampion(UUID ownerId) { + super(ownerId, 66, "Bloodsoaked Champion", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{B}"); + this.expansionSetCode = "KTK"; + this.subtype.add("Human"); + this.subtype.add("Warrior"); + + this.color.setBlack(true); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Bloodstained Brave can't block. + this.addAbility(new CantBlockAbility()); + + // <i>Raid</i> - {1}{B}: Return Bloodstained Brave from your graveyard to the battlefield. Activate this ability only if you attacked with a creature this turn. + Ability ability = new ConditionalActivatedAbility( + Zone.GRAVEYARD, + new ReturnSourceFromGraveyardToBattlefieldEffect(), + new ManaCostsImpl<>("{1}{B}"), + RaidCondition.getInstance(), + "<i>Raid</i> - {1}{B}: Return Bloodstained Brave from your graveyard to the battlefield. Activate this ability only if you attacked with a creature this turn"); + this.addAbility(ability); + this.addWatcher(new PlayerAttackedWatcher()); + } + + public BloodsoakedChampion(final BloodsoakedChampion card) { + super(card); + } + + @Override + public BloodsoakedChampion copy() { + return new BloodsoakedChampion(this); + } +} diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/HowlOfTheHorde.java b/Mage.Sets/src/mage/sets/khansoftarkir/HowlOfTheHorde.java new file mode 100644 index 0000000000..e469a856a5 --- /dev/null +++ b/Mage.Sets/src/mage/sets/khansoftarkir/HowlOfTheHorde.java @@ -0,0 +1,112 @@ +/* + * 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.khansoftarkir; + +import java.util.UUID; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.condition.common.RaidCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CopyTargetSpellEffect; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.stack.Spell; +import mage.target.targetpointer.FixedTarget; +import mage.watchers.common.PlayerAttackedWatcher; + +/** + * + * @author emerald000 + */ +public class HowlOfTheHorde extends CardImpl { + + public HowlOfTheHorde(UUID ownerId) { + super(ownerId, 112, "Howl of the Horde", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{R}"); + this.expansionSetCode = "KTK"; + + this.color.setRed(true); + + // When you cast your next instant or sorcery spell this turn, copy that spell. You may choose new targets for the copy. + Effect effect = new CreateDelayedTriggeredAbilityEffect(new HowlOfTheHordeDelayedTriggeredAbility()); + effect.setText("When you cast your next instant or sorcery spell this turn, copy that spell. You may choose new targets for the copy."); + this.getSpellAbility().addEffect(effect); + + // <i>Raid</i> - If you attacked with a creature this turn, when you cast your next instant or sorcery spell this turn, copy that spell an additional time. You may choose new targets for the copy. + this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new CreateDelayedTriggeredAbilityEffect(new HowlOfTheHordeDelayedTriggeredAbility()), RaidCondition.getInstance(), "<br><br><i>Raid</i> - If you attacked with a creature this turn, when you cast your next instant or sorcery spell this turn, copy that spell an additional time. You may choose new targets for the copy.")); + this.addWatcher(new PlayerAttackedWatcher()); + } + + public HowlOfTheHorde(final HowlOfTheHorde card) { + super(card); + } + + @Override + public HowlOfTheHorde copy() { + return new HowlOfTheHorde(this); + } +} + +class HowlOfTheHordeDelayedTriggeredAbility extends DelayedTriggeredAbility { + + HowlOfTheHordeDelayedTriggeredAbility() { + super(new CopyTargetSpellEffect(), Duration.EndOfTurn); + } + + HowlOfTheHordeDelayedTriggeredAbility(final HowlOfTheHordeDelayedTriggeredAbility ability) { + super(ability); + } + + @Override + public HowlOfTheHordeDelayedTriggeredAbility copy() { + return new HowlOfTheHordeDelayedTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(this.getControllerId())) { + Spell spell = game.getStack().getSpell(event.getTargetId()); + if (spell != null && (spell.getCardType().contains(CardType.INSTANT) || spell.getCardType().contains(CardType.SORCERY))) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); + } + return true; + } + } + return false; + } + + @Override + public String getRule() { + return "When you cast your next instant or sorcery spell this turn, copy that spell. You may choose new targets for the copy."; + } +} diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/MarduHeartPiercer.java b/Mage.Sets/src/mage/sets/khansoftarkir/MarduHeartPiercer.java index 939452d4d0..97b1a84640 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/MarduHeartPiercer.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/MarduHeartPiercer.java @@ -30,12 +30,15 @@ package mage.sets.khansoftarkir; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.abilityword.RaidAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.RaidCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.target.common.TargetCreatureOrPlayer; +import mage.watchers.common.PlayerAttackedWatcher; /** * @@ -54,10 +57,10 @@ public class MarduHeartPiercer extends CardImpl { this.toughness = new MageInt(3); // <em>Raid</em> - When Mardu Heart-Piercer enters the battlefield, if you attacked with a creature this turn, Mardu Heart-Piercer deals 2 damage to target creature or player. - Ability ability = new RaidAbility(this, new DamageTargetEffect(2)); + Ability ability = new EntersBattlefieldTriggeredAbility(new ConditionalOneShotEffect(new DamageTargetEffect(2), RaidCondition.getInstance(), "if you attacked with a creature this turn, {this} deals 2 damage to target creature or player")); ability.addTarget(new TargetCreatureOrPlayer()); this.addAbility(ability); - + this.addWatcher(new PlayerAttackedWatcher()); } public MarduHeartPiercer(final MarduHeartPiercer card) { diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/MarduSkullhunter.java b/Mage.Sets/src/mage/sets/khansoftarkir/MarduSkullhunter.java index 2bfd8dbd23..c393c9e406 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/MarduSkullhunter.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/MarduSkullhunter.java @@ -30,13 +30,16 @@ package mage.sets.khansoftarkir; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.abilityword.RaidAbility; import mage.abilities.common.EntersBattlefieldTappedAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.RaidCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.target.common.TargetOpponent; +import mage.watchers.common.PlayerAttackedWatcher; /** * @@ -56,11 +59,12 @@ public class MarduSkullhunter extends CardImpl { // Mardu Skullhunter enters the battlefield tapped. this.addAbility(new EntersBattlefieldTappedAbility()); + // <em>Raid</em> - When Mardu Skullhunter enters the battlefield, if you attacked with a creature this turn, target opponent discards a card. - Ability ability = new RaidAbility(this, new DiscardTargetEffect(1), false); + Ability ability = new EntersBattlefieldTriggeredAbility(new ConditionalOneShotEffect(new DiscardTargetEffect(1), RaidCondition.getInstance(), "if you attacked with a creature this turn, target opponent discards a card")); ability.addTarget(new TargetOpponent()); this.addAbility(ability); - + this.addWatcher(new PlayerAttackedWatcher()); } public MarduSkullhunter(final MarduSkullhunter card) { diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/MarduWarshrieker.java b/Mage.Sets/src/mage/sets/khansoftarkir/MarduWarshrieker.java index 2f5170d35f..edd5d0a121 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/MarduWarshrieker.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/MarduWarshrieker.java @@ -30,11 +30,14 @@ package mage.sets.khansoftarkir; import java.util.UUID; import mage.MageInt; import mage.Mana; -import mage.abilities.abilityword.RaidAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.RaidCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.AddManaToControllersManaPoolEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; +import mage.watchers.common.PlayerAttackedWatcher; /** * @@ -53,7 +56,8 @@ public class MarduWarshrieker extends CardImpl { this.toughness = new MageInt(3); // <em>Raid</em> - When Mardu Warshrieker enters the battlefield, if you attacked with a creature this turn, add {R}{W}{B} to your mana pool. - this.addAbility(new RaidAbility(this, new AddManaToControllersManaPoolEffect(new Mana(1,0,0,1,1,0,0)))); + this.addAbility(new EntersBattlefieldTriggeredAbility(new ConditionalOneShotEffect(new AddManaToControllersManaPoolEffect(new Mana(1,0,0,1,1,0,0)), RaidCondition.getInstance(), "if you attacked with a creature this turn, add {R}{W}{B} to your mana pool"))); + this.addWatcher(new PlayerAttackedWatcher()); } public MarduWarshrieker(final MarduWarshrieker card) { diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/PearlLakeAncient.java b/Mage.Sets/src/mage/sets/khansoftarkir/PearlLakeAncient.java index 797b3a3ae6..f0933c8568 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/PearlLakeAncient.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/PearlLakeAncient.java @@ -67,7 +67,7 @@ public class PearlLakeAncient extends CardImpl { this.addAbility(new ProwessAbility()); // Return three lands you control to their owner's hand: Return Pearl Lake Ancient to its owner's hand. - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(), + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(true), new ReturnToHandTargetCost(new TargetControlledPermanent(3, 3, new FilterControlledLandPermanent("lands"), true)))); } diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/WarNameAspirant.java b/Mage.Sets/src/mage/sets/khansoftarkir/WarNameAspirant.java new file mode 100644 index 0000000000..af213b941d --- /dev/null +++ b/Mage.Sets/src/mage/sets/khansoftarkir/WarNameAspirant.java @@ -0,0 +1,89 @@ +/* + * 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.khansoftarkir; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.RaidCondition; +import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.Filter; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.PowerPredicate; +import mage.watchers.common.PlayerAttackedWatcher; + +/** + * + * @author emerald000 + */ +public class WarNameAspirant extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures with power 1 or less"); + static { + filter.add(new PowerPredicate(Filter.ComparisonType.LessThan, 2)); + } + + public WarNameAspirant(UUID ownerId) { + super(ownerId, 126, "War-Name Aspirant", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{R}"); + this.expansionSetCode = "KTK"; + this.subtype.add("Human"); + this.subtype.add("Warrior"); + + this.color.setRed(true); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // <i>Raid</i> - War-Name Aspirant enters the battlefield with a +1/+1 counter on it if you attacked with a creature this turn. + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(1), false), + RaidCondition.getInstance(), + true, + "<i>Raid</i> - {this} enters the battlefield with a +1/+1 counter on it if you attacked with a creature this turn", + "{this} enters the battlefield with a +1/+1 counter")); + this.addWatcher(new PlayerAttackedWatcher()); + + // War-Name Aspirant can't be blocked by creatures with power 1 or less. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield))); + } + + public WarNameAspirant(final WarNameAspirant card) { + super(card); + } + + @Override + public WarNameAspirant copy() { + return new WarNameAspirant(this); + } +} diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/WingmateRoc.java b/Mage.Sets/src/mage/sets/khansoftarkir/WingmateRoc.java index 156cc933b8..9ffdb05ec3 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/WingmateRoc.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/WingmateRoc.java @@ -29,8 +29,10 @@ package mage.sets.khansoftarkir; import java.util.UUID; import mage.MageInt; -import mage.abilities.abilityword.RaidAbility; import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.RaidCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.dynamicvalue.common.AttackingCreatureCount; import mage.abilities.effects.Effect; import mage.abilities.effects.common.CreateTokenEffect; @@ -40,6 +42,7 @@ import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.game.permanent.token.Token; +import mage.watchers.common.PlayerAttackedWatcher; /** * @@ -60,8 +63,9 @@ public class WingmateRoc extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // <em>Raid</em> - When Wingmate Roc enters the battlefield, if you attacked with a creature this turn, put a 3/4 white Bird creature token with flying onto the battlefield. - this.addAbility(new RaidAbility(this, new CreateTokenEffect(new WingmateRocToken()))); - + this.addAbility(new EntersBattlefieldTriggeredAbility(new ConditionalOneShotEffect(new CreateTokenEffect(new WingmateRocToken()), RaidCondition.getInstance(), "if you attacked with a creature this turn, put a 3/4 white Bird creature token with flying onto the battlefield"))); + this.addWatcher(new PlayerAttackedWatcher()); + // Whenever Wingmate Roc attacks, you gain 1 life for each attacking creature. Effect effect = new GainLifeEffect(new AttackingCreatureCount()); effect.setText("you gain 1 life for each attacking creature"); diff --git a/Mage/src/mage/abilities/abilityword/RaidAbility.java b/Mage/src/mage/abilities/abilityword/RaidAbility.java deleted file mode 100644 index d57acfbf08..0000000000 --- a/Mage/src/mage/abilities/abilityword/RaidAbility.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.abilityword; - -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.effects.Effect; -import mage.cards.Card; -import mage.constants.Zone; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; -import mage.watchers.common.PlayerAttackedWatcher; - -/** - * - * @author LevelX2 - */ -public class RaidAbility extends TriggeredAbilityImpl { - - public RaidAbility(Card card, Effect effect) { - this(card, effect, false); - } - - public RaidAbility(Card card, Effect effect, boolean optional) { - super(Zone.BATTLEFIELD, effect, optional); - card.addWatcher(new PlayerAttackedWatcher()); - // this.setAbilityWord(AbilityWord.RAID); // not supported yet for rule generation - } - - public RaidAbility(final RaidAbility ability) { - super(ability); - } - - @Override - public RaidAbility copy() { - return new RaidAbility(this); - } - - @Override - public boolean checkInterveningIfClause(Game game) { - // seems unneccessary to check twice because condition can't change until effect resolves, but who knows what the future brings - PlayerAttackedWatcher watcher = (PlayerAttackedWatcher) game.getState().getWatchers().get("PlayerAttackedWatcher"); - return watcher != null && watcher.getNumberOfAttackersCurrentTurn(getControllerId()) > 0; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - return EventType.ENTERS_THE_BATTLEFIELD.equals(event.getType()) && getSourceId().equals(event.getTargetId()); - } - - @Override - public String getRule() { - return "<i>Raid</i> - When {this} enters the battlefield, if you attacked with a creature this turn, " + super.getRule(); - } -} diff --git a/Mage/src/mage/abilities/condition/common/RaidCondition.java b/Mage/src/mage/abilities/condition/common/RaidCondition.java index be43e40035..66ab8242b1 100644 --- a/Mage/src/mage/abilities/condition/common/RaidCondition.java +++ b/Mage/src/mage/abilities/condition/common/RaidCondition.java @@ -41,8 +41,6 @@ public class RaidCondition implements Condition { private static RaidCondition fInstance = null; - private RaidCondition() {} - public static Condition getInstance() { if (fInstance == null) { fInstance = new RaidCondition(); @@ -50,9 +48,11 @@ public class RaidCondition implements Condition { return fInstance; } + private RaidCondition() {} + @Override public boolean apply(Game game, Ability source) { PlayerAttackedWatcher watcher = (PlayerAttackedWatcher) game.getState().getWatchers().get("PlayerAttackedWatcher"); - return watcher != null && watcher.getNumberOfAttackersCurrentTurn(source.getSourceId()) > 0; + return watcher != null && watcher.getNumberOfAttackersCurrentTurn(source.getControllerId()) > 0; } }