From 273ab90154925b9f31c10b9b9ebbf6f0b4101bbc Mon Sep 17 00:00:00 2001 From: North Date: Fri, 24 Jun 2011 00:28:07 +0300 Subject: [PATCH] Added ChokingFumes card Added AddCountersAllEffect Refactoring and fixes for Counter adding effects --- .../mage/sets/guildpact/GodlessShrine.java | 2 - .../mage/sets/magic2010/AjaniGoldmane.java | 7 +- .../mage/sets/magic2011/PhylacteryLich.java | 3 +- .../mage/sets/magic2011/SteelOverseer.java | 9 +- .../sets/mirrodinbesieged/ChokingFumes.java | 63 +++++++++++++ .../mage/sets/scarsofmirrodin/LuxCannon.java | 3 +- .../scarsofmirrodin/TrigonofCorruption.java | 3 +- .../scarsofmirrodin/TrigonofInfestation.java | 3 +- .../sets/scarsofmirrodin/TrigonofMending.java | 3 +- .../sets/scarsofmirrodin/TrigonofRage.java | 3 +- .../sets/scarsofmirrodin/TrigonofThought.java | 3 +- .../sets/worldwake/AvengerofZendikar.java | 15 +-- .../sets/worldwake/EverflowingChalice.java | 3 +- .../sets/zendikar/BeastmasterAscension.java | 3 +- .../sets/zendikar/KhalniHeartExpedition.java | 3 +- .../sets/zendikar/SunspringExpedition.java | 3 +- .../common/counter/AddCountersAllEffect.java | 94 +++++++++++++++++++ .../counter/AddCountersSourceEffect.java | 20 +--- .../counter/AddCountersTargetEffect.java | 15 +-- .../AddPlusOneCountersControlledEffect.java | 87 ----------------- .../abilities/keyword/LevelUpAbility.java | 3 +- Mage/src/mage/counters/Counter.java | 6 ++ Utils/cardclass.tmpl | 2 +- 23 files changed, 213 insertions(+), 143 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/mirrodinbesieged/ChokingFumes.java create mode 100644 Mage/src/mage/abilities/effects/common/counter/AddCountersAllEffect.java delete mode 100644 Mage/src/mage/abilities/effects/common/counter/AddPlusOneCountersControlledEffect.java diff --git a/Mage.Sets/src/mage/sets/guildpact/GodlessShrine.java b/Mage.Sets/src/mage/sets/guildpact/GodlessShrine.java index 40be7f3fe4..13f4b54e41 100644 --- a/Mage.Sets/src/mage/sets/guildpact/GodlessShrine.java +++ b/Mage.Sets/src/mage/sets/guildpact/GodlessShrine.java @@ -30,9 +30,7 @@ package mage.sets.guildpact; import java.util.UUID; import mage.Constants.CardType; -import mage.Constants.Duration; import mage.Constants.Rarity; -import mage.Constants.Zone; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.common.TapSourceUnlessPaysEffect; diff --git a/Mage.Sets/src/mage/sets/magic2010/AjaniGoldmane.java b/Mage.Sets/src/mage/sets/magic2010/AjaniGoldmane.java index 8f6adf0bf1..c6902b3331 100644 --- a/Mage.Sets/src/mage/sets/magic2010/AjaniGoldmane.java +++ b/Mage.Sets/src/mage/sets/magic2010/AjaniGoldmane.java @@ -36,22 +36,21 @@ import mage.Constants.Outcome; import mage.Constants.Rarity; import mage.Constants.SubLayer; import mage.Constants.Zone; -import mage.MageInt; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.common.EntersBattlefieldAbility; -import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.Effects; import mage.abilities.effects.common.continious.GainAbilityControlledEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; -import mage.abilities.effects.common.counter.AddPlusOneCountersControlledEffect; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.counter.AddCountersAllEffect; import mage.abilities.keyword.VigilanceAbility; import mage.cards.CardImpl; import mage.counters.CounterType; +import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; @@ -74,7 +73,7 @@ public class AjaniGoldmane extends CardImpl { this.addAbility(new LoyaltyAbility(new GainLifeEffect(2), 1)); Effects effects1 = new Effects(); - effects1.add(new AddPlusOneCountersControlledEffect(1)); + effects1.add(new AddCountersAllEffect(CounterType.P1P1.createInstance(), new FilterControlledCreaturePermanent())); effects1.add(new GainAbilityControlledEffect(VigilanceAbility.getInstance(), Duration.EndOfTurn, FilterCreaturePermanent.getDefault())); this.addAbility(new LoyaltyAbility(effects1, -1)); diff --git a/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java b/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java index 386155d62e..dcef0bb88c 100644 --- a/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java +++ b/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java @@ -41,6 +41,7 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.keyword.IndestructibleAbility; import mage.cards.CardImpl; +import mage.counters.Counter; import mage.filter.Filter.ComparisonScope; import mage.filter.common.FilterControlledPermanent; import mage.game.Game; @@ -138,7 +139,7 @@ class PhylacteryLichEffect extends OneShotEffect { if (player.choose(Outcome.Neutral, target, game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.addCounters("phylactery", 1); + permanent.addCounters(new Counter("phylactery")); } } } diff --git a/Mage.Sets/src/mage/sets/magic2011/SteelOverseer.java b/Mage.Sets/src/mage/sets/magic2011/SteelOverseer.java index 76be1af8e3..f0d6f064d1 100644 --- a/Mage.Sets/src/mage/sets/magic2011/SteelOverseer.java +++ b/Mage.Sets/src/mage/sets/magic2011/SteelOverseer.java @@ -31,12 +31,14 @@ package mage.sets.magic2011; import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; +import mage.Constants.TargetController; import mage.Constants.Zone; import mage.MageInt; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.counter.AddPlusOneCountersControlledEffect; +import mage.abilities.effects.common.counter.AddCountersAllEffect; import mage.cards.CardImpl; +import mage.counters.CounterType; import mage.filter.Filter.ComparisonScope; import mage.filter.FilterPermanent; @@ -46,12 +48,13 @@ import mage.filter.FilterPermanent; */ public class SteelOverseer extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact creature"); + private static final FilterPermanent filter = new FilterPermanent("artifact creature you control"); static { filter.getCardType().add(CardType.ARTIFACT); filter.getCardType().add(CardType.CREATURE); filter.setScopeCardType(ComparisonScope.All); + filter.setTargetController(TargetController.YOU); } public SteelOverseer(UUID ownerId) { @@ -61,7 +64,7 @@ public class SteelOverseer extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(1); - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddPlusOneCountersControlledEffect(1, filter), new TapSourceCost())); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersAllEffect(CounterType.P1P1.createInstance(), filter), new TapSourceCost())); } public SteelOverseer(final SteelOverseer card) { diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/ChokingFumes.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/ChokingFumes.java new file mode 100644 index 0000000000..b3bea10769 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/ChokingFumes.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.mirrodinbesieged; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.effects.common.counter.AddCountersAllEffect; +import mage.cards.CardImpl; +import mage.counters.CounterType; +import mage.filter.common.FilterAttackingCreature; + +/** + * + * @author North + */ +public class ChokingFumes extends CardImpl { + + private static final FilterAttackingCreature filter = new FilterAttackingCreature(); + + public ChokingFumes(UUID ownerId) { + super(ownerId, 4, "Choking Fumes", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{W}"); + this.expansionSetCode = "MBS"; + + this.color.setWhite(true); + + this.getSpellAbility().addEffect(new AddCountersAllEffect(CounterType.M1M1.createInstance(), filter)); + } + + public ChokingFumes(final ChokingFumes card) { + super(card); + } + + @Override + public ChokingFumes copy() { + return new ChokingFumes(this); + } +} diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/LuxCannon.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/LuxCannon.java index 798d0fa78d..3cd041857b 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/LuxCannon.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/LuxCannon.java @@ -42,6 +42,7 @@ import mage.counters.CounterType; import mage.target.TargetPermanent; import java.util.UUID; +import mage.counters.common.ChargeCounter; /** * @@ -52,7 +53,7 @@ public class LuxCannon extends CardImpl { public LuxCannon (UUID ownerId) { super(ownerId, 173, "Lux Cannon", Rarity.MYTHIC, new CardType[]{CardType.ARTIFACT}, "{4}"); this.expansionSetCode = "SOM"; - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.getName(), 1), new TapSourceCost())); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(new ChargeCounter()), new TapSourceCost())); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new TapSourceCost()); ability.addCost(new RemoveCountersSourceCost(CounterType.CHARGE.getName(), 3)); ability.addTarget(new TargetPermanent()); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofCorruption.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofCorruption.java index c893380d14..8416158090 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofCorruption.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofCorruption.java @@ -45,6 +45,7 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.cards.CardImpl; import mage.counters.CounterType; +import mage.counters.common.ChargeCounter; import mage.target.Target; import mage.target.common.TargetCreaturePermanent; @@ -58,7 +59,7 @@ public class TrigonofCorruption extends CardImpl { super(ownerId, 213, "Trigon of Corruption", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{4}"); this.expansionSetCode = "SOM"; - this.addAbility(new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(CounterType.CHARGE.getName(), 3))); + this.addAbility(new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(new ChargeCounter(3)))); Costs costs = new CostsImpl(); costs.add(new ManaCostsImpl("{2}")); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofInfestation.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofInfestation.java index 9960c14b86..fddfa53a7f 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofInfestation.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofInfestation.java @@ -45,6 +45,7 @@ import mage.counters.CounterType; import mage.game.permanent.token.InsectInfectToken; import java.util.UUID; +import mage.counters.common.ChargeCounter; /** * @author nantuko @@ -57,7 +58,7 @@ public class TrigonofInfestation extends CardImpl { super(ownerId, 214, "Trigon of Infestation", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{4}"); this.expansionSetCode = "SOM"; - this.addAbility(new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(CounterType.CHARGE.getName(), 3))); + this.addAbility(new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(new ChargeCounter(3)))); Costs costs = new CostsImpl(); costs.add(new ManaCostsImpl("{2}")); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofMending.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofMending.java index 25864082de..2dfba9646d 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofMending.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofMending.java @@ -44,6 +44,7 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; import mage.counters.CounterType; +import mage.counters.common.ChargeCounter; /** * @author nantuko @@ -54,7 +55,7 @@ public class TrigonofMending extends CardImpl { super(ownerId, 215, "Trigon of Mending", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}"); this.expansionSetCode = "SOM"; - this.addAbility(new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(CounterType.CHARGE.getName(), 3))); + this.addAbility(new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(new ChargeCounter(3)))); Costs costs = new CostsImpl(); costs.add(new ManaCostsImpl("{2}")); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofRage.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofRage.java index dce29c4cd3..98d6512d6e 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofRage.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofRage.java @@ -47,6 +47,7 @@ import mage.abilities.effects.common.continious.BoostTargetEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.counters.CounterType; +import mage.counters.common.ChargeCounter; import mage.target.Target; import mage.target.common.TargetCreaturePermanent; @@ -59,7 +60,7 @@ public class TrigonofRage extends CardImpl { super(ownerId, 216, "Trigon of Rage", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}"); this.expansionSetCode = "SOM"; - this.addAbility(new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(CounterType.CHARGE.getName(), 3))); + this.addAbility(new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(new ChargeCounter(3)))); Costs costs = new CostsImpl(); costs.add(new ManaCostsImpl("{2}")); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofThought.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofThought.java index 940845e8a8..5a2cd03696 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofThought.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/TrigonofThought.java @@ -44,6 +44,7 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.DrawCardControllerEffect; import mage.cards.CardImpl; import mage.counters.CounterType; +import mage.counters.common.ChargeCounter; /** * @author nantuko @@ -54,7 +55,7 @@ public class TrigonofThought extends CardImpl { super(ownerId, 217, "Trigon of Thought", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{5}"); this.expansionSetCode = "SOM"; - this.addAbility(new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(CounterType.CHARGE.getName(), 3))); + this.addAbility(new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(new ChargeCounter(3)))); Costs costs = new CostsImpl(); costs.add(new ManaCostsImpl("{2}")); diff --git a/Mage.Sets/src/mage/sets/worldwake/AvengerofZendikar.java b/Mage.Sets/src/mage/sets/worldwake/AvengerofZendikar.java index 36c1a45508..03b26a7820 100644 --- a/Mage.Sets/src/mage/sets/worldwake/AvengerofZendikar.java +++ b/Mage.Sets/src/mage/sets/worldwake/AvengerofZendikar.java @@ -33,33 +33,34 @@ import java.util.UUID; import mage.Constants; import mage.Constants.CardType; import mage.Constants.Rarity; -import mage.Constants.TargetController; +import mage.Constants.TargetController; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.LandfallAbility; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.counter.AddPlusOneCountersControlledEffect; +import mage.abilities.effects.common.counter.AddCountersAllEffect; import mage.cards.CardImpl; +import mage.counters.CounterType; import mage.filter.Filter.ComparisonScope; import mage.filter.FilterPermanent; -import mage.filter.common.FilterControlledPermanent; import mage.game.Game; import mage.game.permanent.token.PlantToken; import mage.game.permanent.token.Token; /** * - * @author Loki, nantuko + * @author Loki, nantuko, North */ public class AvengerofZendikar extends CardImpl { - private static FilterPermanent filter = new FilterPermanent("Plant creature"); + private static final FilterPermanent filter = new FilterPermanent("Plant creature you control"); static { filter.getCardType().add(CardType.CREATURE); filter.setScopeCardType(ComparisonScope.Any); filter.getSubtype().add("Plant"); filter.setScopeSubtype(ComparisonScope.Any); + filter.setTargetController(TargetController.YOU); } public AvengerofZendikar (UUID ownerId) { @@ -70,7 +71,7 @@ public class AvengerofZendikar extends CardImpl { this.power = new MageInt(5); this.toughness = new MageInt(5); this.addAbility(new EntersBattlefieldAbility(new AvengerofZendikarTokensCreateEffect(), "put a 0/1 green Plant creature token onto the battlefield for each land you control")); - this.addAbility(new LandfallAbility(new AddPlusOneCountersControlledEffect(1, filter), false)); + this.addAbility(new LandfallAbility(new AddCountersAllEffect(CounterType.P1P1.createInstance(), filter), false)); } public AvengerofZendikar (final AvengerofZendikar card) { @@ -84,7 +85,7 @@ public class AvengerofZendikar extends CardImpl { } class AvengerofZendikarTokensCreateEffect extends OneShotEffect { - private static FilterPermanent filter = new FilterPermanent(); + private static final FilterPermanent filter = new FilterPermanent(); private Token token = new PlantToken(); static { diff --git a/Mage.Sets/src/mage/sets/worldwake/EverflowingChalice.java b/Mage.Sets/src/mage/sets/worldwake/EverflowingChalice.java index 2382023551..8237c07878 100644 --- a/Mage.Sets/src/mage/sets/worldwake/EverflowingChalice.java +++ b/Mage.Sets/src/mage/sets/worldwake/EverflowingChalice.java @@ -45,6 +45,7 @@ import mage.abilities.keyword.MultikickerAbility; import mage.abilities.mana.ManaAbility; import mage.cards.CardImpl; import mage.counters.CounterType; +import mage.counters.common.ChargeCounter; import mage.game.Game; /** @@ -56,7 +57,7 @@ public class EverflowingChalice extends CardImpl { public EverflowingChalice(UUID ownerId) { super(ownerId, 123, "Everflowing Chalice", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{0}"); this.expansionSetCode = "WWK"; - Ability ability1 = new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(CounterType.CHARGE.getName(), 1)); + Ability ability1 = new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(new ChargeCounter())); MultikickerAbility ability = new MultikickerAbility(new GainAbilitySourceEffect(ability1, Duration.WhileOnBattlefield), false); ability.addManaCost(new GenericManaCost(2)); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/sets/zendikar/BeastmasterAscension.java b/Mage.Sets/src/mage/sets/zendikar/BeastmasterAscension.java index 1f5c252464..533739eeef 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BeastmasterAscension.java +++ b/Mage.Sets/src/mage/sets/zendikar/BeastmasterAscension.java @@ -39,6 +39,7 @@ import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.continious.BoostControlledEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.counters.common.QuestCounter; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -73,7 +74,7 @@ public class BeastmasterAscension extends CardImpl { class BeastmasterAscensionAbility extends TriggeredAbilityImpl { public BeastmasterAscensionAbility() { - super(Zone.BATTLEFIELD, new AddCountersSourceEffect("quest", 1), true); + super(Zone.BATTLEFIELD, new AddCountersSourceEffect(new QuestCounter()), true); } public BeastmasterAscensionAbility(final BeastmasterAscensionAbility ability) { diff --git a/Mage.Sets/src/mage/sets/zendikar/KhalniHeartExpedition.java b/Mage.Sets/src/mage/sets/zendikar/KhalniHeartExpedition.java index 795e70fccf..ea0a56d596 100644 --- a/Mage.Sets/src/mage/sets/zendikar/KhalniHeartExpedition.java +++ b/Mage.Sets/src/mage/sets/zendikar/KhalniHeartExpedition.java @@ -42,6 +42,7 @@ import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; import mage.cards.CardImpl; +import mage.counters.common.QuestCounter; import mage.filter.common.FilterBasicLandCard; import mage.target.common.TargetCardInLibrary; @@ -56,7 +57,7 @@ public class KhalniHeartExpedition extends CardImpl { this.expansionSetCode = "ZEN"; this.color.setGreen(true); - this.addAbility(new LandfallAbility(new AddCountersSourceEffect("quest", 1), true)); + this.addAbility(new LandfallAbility(new AddCountersSourceEffect(new QuestCounter()), true)); this.addAbility(new KhalniHeartExpeditionAbility()); } diff --git a/Mage.Sets/src/mage/sets/zendikar/SunspringExpedition.java b/Mage.Sets/src/mage/sets/zendikar/SunspringExpedition.java index 74425f9859..f717ccb0c1 100644 --- a/Mage.Sets/src/mage/sets/zendikar/SunspringExpedition.java +++ b/Mage.Sets/src/mage/sets/zendikar/SunspringExpedition.java @@ -42,6 +42,7 @@ import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; +import mage.counters.common.QuestCounter; /** * @@ -54,7 +55,7 @@ public class SunspringExpedition extends CardImpl { this.expansionSetCode = "ZEN"; this.color.setWhite(true); - this.addAbility(new LandfallAbility(new AddCountersSourceEffect("quest", 1), true)); + this.addAbility(new LandfallAbility(new AddCountersSourceEffect(new QuestCounter()), true)); Costs costs = new CostsImpl(); costs.add(new RemoveCountersSourceCost("quest", 3)); costs.add(new SacrificeSourceCost()); diff --git a/Mage/src/mage/abilities/effects/common/counter/AddCountersAllEffect.java b/Mage/src/mage/abilities/effects/common/counter/AddCountersAllEffect.java new file mode 100644 index 0000000000..832a071e58 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/counter/AddCountersAllEffect.java @@ -0,0 +1,94 @@ +/* + * 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.counter; + +import java.util.List; +import java.util.UUID; +import mage.Constants.Outcome; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.counters.Counter; +import mage.filter.FilterPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author North + */ +public class AddCountersAllEffect extends OneShotEffect { + + private Counter counter; + private FilterPermanent filter; + + public AddCountersAllEffect(Counter counter, FilterPermanent filter) { + super(Outcome.Benefit); + this.counter = counter; + this.filter = filter; + } + + public AddCountersAllEffect(final AddCountersAllEffect effect) { + super(effect); + this.counter = effect.counter.copy(); + this.filter = effect.filter.copy(); + } + + @Override + public boolean apply(Game game, Ability source) { + boolean applied = false; + if (counter != null) { + UUID controllerId = source.getControllerId(); + List permanents = game.getBattlefield().getAllActivePermanents(); + for (Permanent permanent : permanents) { + if (filter.match(permanent, controllerId, game)) { + permanent.addCounters(counter); + applied = true; + } + } + } + return applied; + } + + @Override + public String getText(Ability source) { + StringBuilder sb = new StringBuilder(); + sb.append("put "); + if (counter.getCount() > 1) { + sb.append(Integer.toString(counter.getCount())).append(" ").append(counter.getName()).append(" counters on each "); + } else { + sb.append("a ").append(counter.getName()).append(" counter on each "); + } + sb.append(filter.getMessage()); + return sb.toString(); + } + + @Override + public AddCountersAllEffect copy() { + return new AddCountersAllEffect(this); + } +} diff --git a/Mage/src/mage/abilities/effects/common/counter/AddCountersSourceEffect.java b/Mage/src/mage/abilities/effects/common/counter/AddCountersSourceEffect.java index af8599bcc5..e4ebf9798f 100644 --- a/Mage/src/mage/abilities/effects/common/counter/AddCountersSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/counter/AddCountersSourceEffect.java @@ -40,27 +40,15 @@ import mage.game.permanent.Permanent; */ public class AddCountersSourceEffect extends OneShotEffect { - private int amount; - private String name; private Counter counter; - public AddCountersSourceEffect(String name, int amount) { - super(Outcome.Benefit); - this.name = name; - this.amount = amount; - } - public AddCountersSourceEffect(Counter counter) { super(Outcome.Benefit); - this.name = counter.getName(); this.counter = counter.copy(); - this.amount = counter.getCount(); } public AddCountersSourceEffect(final AddCountersSourceEffect effect) { super(effect); - this.amount = effect.amount; - this.name = effect.name; if (effect.counter != null) this.counter = effect.counter.copy(); } @@ -71,8 +59,6 @@ public class AddCountersSourceEffect extends OneShotEffect 1) { + if (counter.getCount() > 1) { StringBuilder sb = new StringBuilder(); - sb.append("put ").append(Integer.toString(amount)).append(" ").append(name).append(" counters on {this}"); + sb.append("put ").append(Integer.toString(counter.getCount())).append(" ").append(counter.getName()).append(" counters on {this}"); return sb.toString(); } else - return "put a " + name + " counter on {this}"; + return "put a " + counter.getName() + " counter on {this}"; } @Override diff --git a/Mage/src/mage/abilities/effects/common/counter/AddCountersTargetEffect.java b/Mage/src/mage/abilities/effects/common/counter/AddCountersTargetEffect.java index 5478b9568f..2511c85993 100644 --- a/Mage/src/mage/abilities/effects/common/counter/AddCountersTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/counter/AddCountersTargetEffect.java @@ -44,20 +44,15 @@ import java.util.UUID; */ public class AddCountersTargetEffect extends OneShotEffect { - private int amount; - private String name; private Counter counter; public AddCountersTargetEffect(Counter counter) { super(Outcome.Benefit); - this.name = counter.getName(); this.counter = counter; } public AddCountersTargetEffect(final AddCountersTargetEffect effect) { super(effect); - this.amount = effect.amount; - this.name = effect.name; this.counter = effect.counter.copy(); } @@ -69,13 +64,13 @@ public class AddCountersTargetEffect extends OneShotEffect 1) { - sb.append(Integer.toString(amount)).append(" ").append(name).append(" counters on "); + if (counter.getCount() > 1) { + sb.append(Integer.toString(counter.getCount())).append(" ").append(counter.getName()).append(" counters on target "); } else { - sb.append("a ").append(name).append(" counter on target "); + sb.append("a ").append(counter.getName()).append(" counter on target "); } sb.append(source.getTargets().get(0).getTargetName()); return sb.toString(); diff --git a/Mage/src/mage/abilities/effects/common/counter/AddPlusOneCountersControlledEffect.java b/Mage/src/mage/abilities/effects/common/counter/AddPlusOneCountersControlledEffect.java deleted file mode 100644 index 97d622b57e..0000000000 --- a/Mage/src/mage/abilities/effects/common/counter/AddPlusOneCountersControlledEffect.java +++ /dev/null @@ -1,87 +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.effects.common.counter; - -import mage.Constants.Outcome; -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; -import mage.counters.common.PlusOneCounter; -import mage.filter.FilterPermanent; -import mage.filter.common.FilterCreaturePermanent; -import mage.game.Game; -import mage.game.permanent.Permanent; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class AddPlusOneCountersControlledEffect extends OneShotEffect { - - private int amount; - private FilterPermanent filter; - - public AddPlusOneCountersControlledEffect(int amount) { - this(amount, FilterCreaturePermanent.getDefault()); - } - - public AddPlusOneCountersControlledEffect(int amount, FilterPermanent filter) { - super(Outcome.Benefit); - this.amount = amount; - this.filter = filter; - } - - public AddPlusOneCountersControlledEffect(final AddPlusOneCountersControlledEffect effect) { - super(effect); - this.amount = effect.amount; - this.filter = effect.filter.copy(); - } - - @Override - public AddPlusOneCountersControlledEffect copy() { - return new AddPlusOneCountersControlledEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId())) { - perm.getCounters().addCounter(new PlusOneCounter(amount)); } - return true; - } - - @Override - public String getText(Ability source) { - StringBuilder sb = new StringBuilder(); - sb.append("Put ").append(amount).append(" +1/+1 counter"); - if (amount > 1) - sb.append("s"); - sb.append(" on each ").append(filter.getName()).append(" you control"); - return sb.toString(); - } - -} diff --git a/Mage/src/mage/abilities/keyword/LevelUpAbility.java b/Mage/src/mage/abilities/keyword/LevelUpAbility.java index 9aade4ebcf..f39e2a9745 100644 --- a/Mage/src/mage/abilities/keyword/LevelUpAbility.java +++ b/Mage/src/mage/abilities/keyword/LevelUpAbility.java @@ -33,6 +33,7 @@ import mage.Constants.Zone; import mage.abilities.ActivatedAbilityImpl; import mage.abilities.costs.mana.ManaCosts; import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.counters.common.LevelCounter; /** * @@ -41,7 +42,7 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect; public class LevelUpAbility extends ActivatedAbilityImpl { public LevelUpAbility(ManaCosts costs) { - super(Zone.BATTLEFIELD, new AddCountersSourceEffect("Level", 1), costs); + super(Zone.BATTLEFIELD, new AddCountersSourceEffect(new LevelCounter()), costs); this.timing = TimingRule.SORCERY; } diff --git a/Mage/src/mage/counters/Counter.java b/Mage/src/mage/counters/Counter.java index 392fa8e99d..f1acdd3be8 100644 --- a/Mage/src/mage/counters/Counter.java +++ b/Mage/src/mage/counters/Counter.java @@ -41,8 +41,14 @@ public class Counter> implements Serializable { public Counter(String name) { this.name = name; + this.count = 1; } + public Counter(String name, int count) { + this.name = name; + this.count = count; + } + public Counter(Counter counter) { this.name = counter.name; this.count = counter.count; diff --git a/Utils/cardclass.tmpl b/Utils/cardclass.tmpl index f0e6171d8b..7d3d3bafef 100644 --- a/Utils/cardclass.tmpl +++ b/Utils/cardclass.tmpl @@ -35,7 +35,7 @@ import mage.cards.CardImpl; /** * - * @author Loki + * @author North */ public class [=$classname=] extends CardImpl<[=$classname=]> {