From 93267f71320bd1249821e1da030c03b517de0d88 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Wed, 29 Dec 2010 14:41:03 +0300 Subject: [PATCH 1/2] More counter types (level,quest,charge,time,fade,...). Moved to common package. --- .../src/mage/sets/magic2010/ProteanHydra.java | 3 +- .../sets/zendikar/OranRiefTheVastwood.java | 2 +- .../AddPlusOneCountersAttachedEffect.java | 2 +- .../AddPlusOneCountersControlledEffect.java | 2 +- .../AddPlusOneCountersSourceEffect.java | 2 +- Mage/src/mage/counters/CounterType.java | 30 +++++++++++- .../counters/common/ArrowheadCounter.java | 49 +++++++++++++++++++ .../mage/counters/common/ChargeCounter.java | 49 +++++++++++++++++++ Mage/src/mage/counters/common/EonCounter.java | 49 +++++++++++++++++++ .../src/mage/counters/common/FadeCounter.java | 49 +++++++++++++++++++ .../mage/counters/common/FeatherCounter.java | 49 +++++++++++++++++++ .../mage/counters/common/LevelCounter.java | 49 +++++++++++++++++++ .../{ => common}/MinusOneCounter.java | 4 +- .../counters/{ => common}/PlusOneCounter.java | 4 +- .../counters/{ => common}/PoisonCounter.java | 4 +- .../mage/counters/common/QuestCounter.java | 49 +++++++++++++++++++ .../src/mage/counters/common/TimeCounter.java | 49 +++++++++++++++++++ .../mage/game/permanent/PermanentImpl.java | 3 +- Mage/src/mage/players/PlayerImpl.java | 1 - 19 files changed, 435 insertions(+), 14 deletions(-) create mode 100644 Mage/src/mage/counters/common/ArrowheadCounter.java create mode 100644 Mage/src/mage/counters/common/ChargeCounter.java create mode 100644 Mage/src/mage/counters/common/EonCounter.java create mode 100644 Mage/src/mage/counters/common/FadeCounter.java create mode 100644 Mage/src/mage/counters/common/FeatherCounter.java create mode 100644 Mage/src/mage/counters/common/LevelCounter.java rename Mage/src/mage/counters/{ => common}/MinusOneCounter.java (96%) rename Mage/src/mage/counters/{ => common}/PlusOneCounter.java (96%) rename Mage/src/mage/counters/{ => common}/PoisonCounter.java (94%) create mode 100644 Mage/src/mage/counters/common/QuestCounter.java create mode 100644 Mage/src/mage/counters/common/TimeCounter.java diff --git a/Mage.Sets/src/mage/sets/magic2010/ProteanHydra.java b/Mage.Sets/src/mage/sets/magic2010/ProteanHydra.java index f0a6917bb3b..3363f91a653 100644 --- a/Mage.Sets/src/mage/sets/magic2010/ProteanHydra.java +++ b/Mage.Sets/src/mage/sets/magic2010/ProteanHydra.java @@ -42,11 +42,10 @@ import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.PreventionEffectImpl; -import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.AddPlusOneCountersSourceEffect; import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; import mage.cards.CardImpl; -import mage.counters.PlusOneCounter; +import mage.counters.common.PlusOneCounter; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; diff --git a/Mage.Sets/src/mage/sets/zendikar/OranRiefTheVastwood.java b/Mage.Sets/src/mage/sets/zendikar/OranRiefTheVastwood.java index 640a2a21b9c..2aed5cfeb64 100644 --- a/Mage.Sets/src/mage/sets/zendikar/OranRiefTheVastwood.java +++ b/Mage.Sets/src/mage/sets/zendikar/OranRiefTheVastwood.java @@ -40,7 +40,7 @@ import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.OneShotEffect; import mage.abilities.mana.GreenManaAbility; import mage.cards.CardImpl; -import mage.counters.PlusOneCounter; +import mage.counters.common.PlusOneCounter; import mage.filter.FilterPermanent; import mage.game.Game; import mage.game.permanent.Permanent; diff --git a/Mage/src/mage/abilities/effects/common/AddPlusOneCountersAttachedEffect.java b/Mage/src/mage/abilities/effects/common/AddPlusOneCountersAttachedEffect.java index e8d55b02577..2b17b1b4c07 100644 --- a/Mage/src/mage/abilities/effects/common/AddPlusOneCountersAttachedEffect.java +++ b/Mage/src/mage/abilities/effects/common/AddPlusOneCountersAttachedEffect.java @@ -31,7 +31,7 @@ package mage.abilities.effects.common; import mage.Constants.Outcome; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; -import mage.counters.PlusOneCounter; +import mage.counters.common.PlusOneCounter; import mage.game.Game; import mage.game.permanent.Permanent; diff --git a/Mage/src/mage/abilities/effects/common/AddPlusOneCountersControlledEffect.java b/Mage/src/mage/abilities/effects/common/AddPlusOneCountersControlledEffect.java index 4d0a4e24ac6..b427b6cad14 100644 --- a/Mage/src/mage/abilities/effects/common/AddPlusOneCountersControlledEffect.java +++ b/Mage/src/mage/abilities/effects/common/AddPlusOneCountersControlledEffect.java @@ -31,7 +31,7 @@ package mage.abilities.effects.common; import mage.Constants.Outcome; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; -import mage.counters.PlusOneCounter; +import mage.counters.common.PlusOneCounter; import mage.filter.FilterPermanent; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; diff --git a/Mage/src/mage/abilities/effects/common/AddPlusOneCountersSourceEffect.java b/Mage/src/mage/abilities/effects/common/AddPlusOneCountersSourceEffect.java index 27d80dc0d32..2a8c8586f4c 100644 --- a/Mage/src/mage/abilities/effects/common/AddPlusOneCountersSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/AddPlusOneCountersSourceEffect.java @@ -31,7 +31,7 @@ package mage.abilities.effects.common; import mage.Constants.Outcome; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; -import mage.counters.PlusOneCounter; +import mage.counters.common.PlusOneCounter; import mage.game.Game; import mage.game.permanent.Permanent; diff --git a/Mage/src/mage/counters/CounterType.java b/Mage/src/mage/counters/CounterType.java index 8adf29dd815..418c1b4a186 100644 --- a/Mage/src/mage/counters/CounterType.java +++ b/Mage/src/mage/counters/CounterType.java @@ -28,6 +28,8 @@ package mage.counters; +import mage.counters.common.*; + /** * Enum for counters, names and instances. * @@ -36,7 +38,15 @@ package mage.counters; public enum CounterType { P1P1(new PlusOneCounter().name), M1M1(new MinusOneCounter().name), - POISON(new PoisonCounter().name); + POISON(new PoisonCounter().name), + CHARGE(new ChargeCounter().name), + LEVEL(new LevelCounter().name), + TIME(new TimeCounter().name), + FADE(new FadeCounter().name), + FEATHER(new FeatherCounter().name), + QUEST(new QuestCounter().name), + ARROWHEAD(new ArrowheadCounter().name), + EON(new EonCounter().name); private String name; @@ -63,7 +73,7 @@ public enum CounterType { } /** - * Get instance of counter type with defined amount of the given type. + * Get instance of counter type with defined amount of counters of the given type. * * @param amount amount of counters of the given type. * @return @@ -76,6 +86,22 @@ public enum CounterType { return new MinusOneCounter(amount); case POISON: return new PoisonCounter(amount); + case CHARGE: + return new ChargeCounter(amount); + case LEVEL: + return new LevelCounter(amount); + case TIME: + return new TimeCounter(amount); + case FADE: + return new FadeCounter(amount); + case FEATHER: + return new FeatherCounter(amount); + case QUEST: + return new QuestCounter(amount); + case ARROWHEAD: + return new ArrowheadCounter(amount); + case EON: + return new EonCounter(amount); } return null; } diff --git a/Mage/src/mage/counters/common/ArrowheadCounter.java b/Mage/src/mage/counters/common/ArrowheadCounter.java new file mode 100644 index 00000000000..c6972f11832 --- /dev/null +++ b/Mage/src/mage/counters/common/ArrowheadCounter.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; + +/** + * Arrowhead counter. + * + * @author nantuko + */ +public class ArrowheadCounter extends Counter { + + public ArrowheadCounter() { + super("Arrowhead"); + this.count = 1; + } + + public ArrowheadCounter(int amount) { + super("Arrowhead"); + this.count = amount; + } +} diff --git a/Mage/src/mage/counters/common/ChargeCounter.java b/Mage/src/mage/counters/common/ChargeCounter.java new file mode 100644 index 00000000000..474355e52a2 --- /dev/null +++ b/Mage/src/mage/counters/common/ChargeCounter.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; + +/** + * Charge counter. + * + * @author nantuko + */ +public class ChargeCounter extends Counter { + + public ChargeCounter() { + super("Charge"); + this.count = 1; + } + + public ChargeCounter(int amount) { + super("Charge"); + this.count = amount; + } +} \ No newline at end of file diff --git a/Mage/src/mage/counters/common/EonCounter.java b/Mage/src/mage/counters/common/EonCounter.java new file mode 100644 index 00000000000..fb3df296712 --- /dev/null +++ b/Mage/src/mage/counters/common/EonCounter.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; + +/** + * Eon counter. + * + * @author nantuko + */ +public class EonCounter extends Counter { + + public EonCounter() { + super("Eon"); + this.count = 1; + } + + public EonCounter(int amount) { + super("Eon"); + this.count = amount; + } +} diff --git a/Mage/src/mage/counters/common/FadeCounter.java b/Mage/src/mage/counters/common/FadeCounter.java new file mode 100644 index 00000000000..5684054fb05 --- /dev/null +++ b/Mage/src/mage/counters/common/FadeCounter.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; + +/** + * Fade counter. + * + * @author nantuko + */ +public class FadeCounter extends Counter { + + public FadeCounter() { + super("Fade"); + this.count = 1; + } + + public FadeCounter(int amount) { + super("Fade"); + this.count = amount; + } +} diff --git a/Mage/src/mage/counters/common/FeatherCounter.java b/Mage/src/mage/counters/common/FeatherCounter.java new file mode 100644 index 00000000000..3face1d12e3 --- /dev/null +++ b/Mage/src/mage/counters/common/FeatherCounter.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; + +/** + * Feather counter. + * + * @author nantuko + */ +public class FeatherCounter extends Counter { + + public FeatherCounter() { + super("Feather"); + this.count = 1; + } + + public FeatherCounter(int amount) { + super("Feather"); + this.count = amount; + } +} diff --git a/Mage/src/mage/counters/common/LevelCounter.java b/Mage/src/mage/counters/common/LevelCounter.java new file mode 100644 index 00000000000..16282b063c7 --- /dev/null +++ b/Mage/src/mage/counters/common/LevelCounter.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; + +/** + * Level counter. + * + * @author nantuko + */ +public class LevelCounter extends Counter { + + public LevelCounter() { + super("Level"); + this.count = 1; + } + + public LevelCounter(int amount) { + super("Level"); + this.count = amount; + } +} diff --git a/Mage/src/mage/counters/MinusOneCounter.java b/Mage/src/mage/counters/common/MinusOneCounter.java similarity index 96% rename from Mage/src/mage/counters/MinusOneCounter.java rename to Mage/src/mage/counters/common/MinusOneCounter.java index ccaaef28055..0e8e4a842bc 100644 --- a/Mage/src/mage/counters/MinusOneCounter.java +++ b/Mage/src/mage/counters/common/MinusOneCounter.java @@ -26,7 +26,9 @@ * or implied, of BetaSteward_at_googlemail.com. */ -package mage.counters; +package mage.counters.common; + +import mage.counters.BoostCounter; /** * diff --git a/Mage/src/mage/counters/PlusOneCounter.java b/Mage/src/mage/counters/common/PlusOneCounter.java similarity index 96% rename from Mage/src/mage/counters/PlusOneCounter.java rename to Mage/src/mage/counters/common/PlusOneCounter.java index 1e1844c7c79..6fb6c72c358 100644 --- a/Mage/src/mage/counters/PlusOneCounter.java +++ b/Mage/src/mage/counters/common/PlusOneCounter.java @@ -26,7 +26,9 @@ * or implied, of BetaSteward_at_googlemail.com. */ -package mage.counters; +package mage.counters.common; + +import mage.counters.BoostCounter; /** * diff --git a/Mage/src/mage/counters/PoisonCounter.java b/Mage/src/mage/counters/common/PoisonCounter.java similarity index 94% rename from Mage/src/mage/counters/PoisonCounter.java rename to Mage/src/mage/counters/common/PoisonCounter.java index bbcf8dab39b..70e3a22740a 100644 --- a/Mage/src/mage/counters/PoisonCounter.java +++ b/Mage/src/mage/counters/common/PoisonCounter.java @@ -26,7 +26,9 @@ * or implied, of BetaSteward_at_googlemail.com. */ -package mage.counters; +package mage.counters.common; + +import mage.counters.Counter; /** * Poison counter. diff --git a/Mage/src/mage/counters/common/QuestCounter.java b/Mage/src/mage/counters/common/QuestCounter.java new file mode 100644 index 00000000000..18c3dc0dd95 --- /dev/null +++ b/Mage/src/mage/counters/common/QuestCounter.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; + +/** + * Quest counter. + * + * @author nantuko + */ +public class QuestCounter extends Counter { + + public QuestCounter() { + super("Quest"); + this.count = 1; + } + + public QuestCounter(int amount) { + super("Quest"); + this.count = amount; + } +} diff --git a/Mage/src/mage/counters/common/TimeCounter.java b/Mage/src/mage/counters/common/TimeCounter.java new file mode 100644 index 00000000000..040294a7522 --- /dev/null +++ b/Mage/src/mage/counters/common/TimeCounter.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; + +/** + * Time counter. + * + * @author nantuko + */ +public class TimeCounter extends Counter { + + public TimeCounter() { + super("Time"); + this.count = 1; + } + + public TimeCounter(int amount) { + super("Time"); + this.count = amount; + } +} \ No newline at end of file diff --git a/Mage/src/mage/game/permanent/PermanentImpl.java b/Mage/src/mage/game/permanent/PermanentImpl.java index 53dd3b887a5..722ad28129f 100644 --- a/Mage/src/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/mage/game/permanent/PermanentImpl.java @@ -35,14 +35,13 @@ import mage.Constants.CardType; import mage.Constants.Zone; import mage.MageObject; import mage.abilities.Ability; -import mage.abilities.EvasionAbility; import mage.abilities.TriggeredAbility; import mage.abilities.effects.RestrictionEffect; import mage.abilities.keyword.*; import mage.cards.CardImpl; import mage.counters.Counter; import mage.counters.Counters; -import mage.counters.MinusOneCounter; +import mage.counters.common.MinusOneCounter; import mage.game.Game; import mage.game.events.DamageCreatureEvent; import mage.game.events.DamagePlaneswalkerEvent; diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index 774993df9ff..bd381ef8bf9 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -61,7 +61,6 @@ import mage.cards.CardsImpl; import mage.cards.decks.Deck; import mage.counters.CounterType; import mage.counters.Counters; -import mage.counters.MinusOneCounter; import mage.filter.FilterAbility; import mage.filter.common.FilterCreatureForAttack; import mage.filter.common.FilterCreatureForCombat; From a4f3e4f97c0d27374888540b50fdf78fa6dc9481 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Wed, 29 Dec 2010 14:41:12 +0300 Subject: [PATCH 2/2] Refactored cards with charge counters. --- Mage.Sets/src/mage/sets/scarsofmirrodin/LuxCannon.java | 5 +++-- Mage.Sets/src/mage/sets/worldwake/EverflowingChalice.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/LuxCannon.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/LuxCannon.java index 78f1095b1d7..dba7f75735a 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/LuxCannon.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/LuxCannon.java @@ -38,6 +38,7 @@ import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.AddCountersSourceEffect; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; +import mage.counters.CounterType; import mage.target.TargetPermanent; import java.util.UUID; @@ -51,9 +52,9 @@ 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("charge", 1), new TapSourceCost())); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.getName(), 1), new TapSourceCost())); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new TapSourceCost()); - ability.addCost(new RemoveCountersSourceCost("charge", 3)); + ability.addCost(new RemoveCountersSourceCost(CounterType.CHARGE.getName(), 3)); ability.addTarget(new TargetPermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/worldwake/EverflowingChalice.java b/Mage.Sets/src/mage/sets/worldwake/EverflowingChalice.java index 23dabfcfff7..c503a68de3f 100644 --- a/Mage.Sets/src/mage/sets/worldwake/EverflowingChalice.java +++ b/Mage.Sets/src/mage/sets/worldwake/EverflowingChalice.java @@ -41,6 +41,7 @@ import mage.abilities.effects.common.ManaEffect; import mage.abilities.keyword.MultikickerAbility; import mage.abilities.mana.ManaAbility; import mage.cards.CardImpl; +import mage.counters.CounterType; import mage.game.Game; /** @@ -52,7 +53,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"; - MultikickerAbility ability = new MultikickerAbility(new AddCountersSourceEffect("charge", 1), false); + MultikickerAbility ability = new MultikickerAbility(new AddCountersSourceEffect(CounterType.CHARGE.getName(), 1), false); ability.addManaCost(new GenericManaCost(2)); this.addAbility(ability); this.addAbility(new EverflowingChaliceAbility()); @@ -116,7 +117,7 @@ class EverflowingChaliceEffect extends ManaEffect { @Override public boolean apply(Game game, Ability source) { this.mana.clear(); - this.mana.setColorless(game.getPermanent(source.getSourceId()).getCounters().getCount("charge")); + this.mana.setColorless(game.getPermanent(source.getSourceId()).getCounters().getCount(CounterType.CHARGE)); return super.apply(game, source); }