From a7b9809396804204239879f9e8a54723868f62fc Mon Sep 17 00:00:00 2001 From: Matt Oslan Date: Wed, 31 Aug 2016 13:30:40 -0400 Subject: [PATCH 01/20] Implement Scarred Puma --- .../src/mage/sets/invasion/ScarredPuma.java | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/invasion/ScarredPuma.java diff --git a/Mage.Sets/src/mage/sets/invasion/ScarredPuma.java b/Mage.Sets/src/mage/sets/invasion/ScarredPuma.java new file mode 100644 index 0000000000..d956aa3142 --- /dev/null +++ b/Mage.Sets/src/mage/sets/invasion/ScarredPuma.java @@ -0,0 +1,111 @@ +/* + * 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.invasion; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.RestrictionEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterAttackingCreature; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author Derpthemeus + */ +public class ScarredPuma extends CardImpl { + + public ScarredPuma(UUID ownerId) { + super(ownerId, 163, "Scarred Puma", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{R}"); + this.expansionSetCode = "INV"; + this.subtype.add("Cat"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Scarred Puma can't attack unless a black or green creature also attacks. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ScarredPumaEffect())); + } + + public ScarredPuma(final ScarredPuma card) { + super(card); + } + + @Override + public ScarredPuma copy() { + return new ScarredPuma(this); + } + + class ScarredPumaEffect extends RestrictionEffect { + + private final FilterAttackingCreature filter = new FilterAttackingCreature(); + + public ScarredPumaEffect() { + super(Duration.WhileOnBattlefield); + staticText = "{this} can't attack unless a black or green creature also attacks"; + } + + public ScarredPumaEffect(final ScarredPumaEffect effect) { + super(effect); + } + + @Override + public ScarredPumaEffect copy() { + return new ScarredPumaEffect(this); + } + + @Override + public boolean canAttackCheckAfter(int numberOfAttackers, Ability source, Game game) { + return false; + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + if (permanent.getId().equals(source.getSourceId())) { + for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { + //excludes itself (http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=23067) + if (creature.getId() != source.getSourceId()) { + ObjectColor color = creature.getColor(game); + if (color.isBlack() || color.isGreen()) { + return false; + } + } + } + return true; + } + return false; + } + } +} From 67105ce3a09c284610046725fb0287cedbc1aea8 Mon Sep 17 00:00:00 2001 From: Matt Oslan Date: Wed, 31 Aug 2016 13:31:48 -0400 Subject: [PATCH 02/20] Implement Disarm --- Mage.Sets/src/mage/sets/mirrodin/Disarm.java | 104 +++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/mirrodin/Disarm.java diff --git a/Mage.Sets/src/mage/sets/mirrodin/Disarm.java b/Mage.Sets/src/mage/sets/mirrodin/Disarm.java new file mode 100644 index 0000000000..e73dd79aaa --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodin/Disarm.java @@ -0,0 +1,104 @@ +/* + * 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.mirrodin; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.permanent.AttachedToPredicate; +import mage.filter.predicate.permanent.PermanentIdPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author Derpthemeus + */ +public class Disarm extends CardImpl { + + public Disarm(UUID ownerId) { + super(ownerId, 32, "Disarm", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{U}"); + this.expansionSetCode = "MRD"; + + // Unattach all Equipment from target creature. + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new DisarmEffect()); + } + + public Disarm(final Disarm card) { + super(card); + } + + @java.lang.Override + public Disarm copy() { + return new Disarm(this); + } + + class DisarmEffect extends OneShotEffect { + + public DisarmEffect() { + super(Outcome.UnboostCreature); + this.staticText = "Unattach all Equipment from target creature"; + } + + public DisarmEffect(final DisarmEffect effect) { + super(effect); + } + + @java.lang.Override + public DisarmEffect copy() { + return new DisarmEffect(this); + } + + @java.lang.Override + public boolean apply(Game game, Ability source) { + Permanent creature = game.getPermanent(targetPointer.getFirst(game, source)); + if (creature != null) { + FilterPermanent creatureFilter = new FilterPermanent(); + creatureFilter.add(new PermanentIdPredicate(creature.getId())); + + FilterPermanent equipmentFilter = new FilterPermanent(); + equipmentFilter.add(new AttachedToPredicate(creatureFilter)); + equipmentFilter.add(new SubtypePredicate("Equipment")); + + for (Permanent equipment : game.getBattlefield().getAllActivePermanents(equipmentFilter, game)) { + creature.removeAttachment(equipment.getId(), game); + } + return true; + } + return false; + } + } +} From 93bdb89d444d5bada21a76d27db6489d6f459e34 Mon Sep 17 00:00:00 2001 From: Matt Oslan Date: Wed, 31 Aug 2016 18:42:30 -0400 Subject: [PATCH 03/20] Implement Defiling Tears --- .../src/mage/sets/invasion/DefilingTears.java | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/invasion/DefilingTears.java diff --git a/Mage.Sets/src/mage/sets/invasion/DefilingTears.java b/Mage.Sets/src/mage/sets/invasion/DefilingTears.java new file mode 100644 index 0000000000..48e83daa97 --- /dev/null +++ b/Mage.Sets/src/mage/sets/invasion/DefilingTears.java @@ -0,0 +1,80 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.invasion; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.RegenerateSourceEffect; +import mage.abilities.effects.common.continuous.BecomesColorTargetEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author Derpthemeus + */ +public class DefilingTears extends CardImpl { + + public DefilingTears(UUID ownerId) { + super(ownerId, 99, "Defiling Tears", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{B}"); + this.expansionSetCode = "INV"; + + // Until end of turn, target creature becomes black, gets +1/-1, and gains "{B}: Regenerate this creature." + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + + Effect effect = new BecomesColorTargetEffect(ObjectColor.BLACK, Duration.EndOfTurn); + effect.setText("Until end of turn, target creature becomes black"); + this.getSpellAbility().addEffect(effect); + + effect = new BoostTargetEffect(1, -1, Duration.EndOfTurn); + effect.setText(", gets +1/-1"); + this.getSpellAbility().addEffect(effect); + + effect = new GainAbilityTargetEffect(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{B}")), Duration.EndOfTurn); + effect.setText(", and gains \"{B}: Regenerate this creature.\""); + this.getSpellAbility().addEffect(effect); + } + + public DefilingTears(final DefilingTears card) { + super(card); + } + + @Override + public DefilingTears copy() { + return new DefilingTears(this); + } +} From 4669b4224a299aff46b1d132a4772a019d47cdec Mon Sep 17 00:00:00 2001 From: Matt Oslan Date: Wed, 31 Aug 2016 19:05:45 -0400 Subject: [PATCH 04/20] Implement Rooting Kavu --- .../src/mage/sets/invasion/RootingKavu.java | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/invasion/RootingKavu.java diff --git a/Mage.Sets/src/mage/sets/invasion/RootingKavu.java b/Mage.Sets/src/mage/sets/invasion/RootingKavu.java new file mode 100644 index 0000000000..a896e66273 --- /dev/null +++ b/Mage.Sets/src/mage/sets/invasion/RootingKavu.java @@ -0,0 +1,102 @@ +/* + * 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.invasion; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.costs.common.ExileSourceFromGraveCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DoIfCostPaid; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author Derpthemeus + */ +public class RootingKavu extends CardImpl { + + public RootingKavu(UUID ownerId) { + super(ownerId, 207, "Rooting Kavu", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{G}{G}"); + this.expansionSetCode = "INV"; + this.subtype.add("Kavu"); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // When Rooting Kavu dies, you may exile it. If you do, shuffle all creature cards from your graveyard into your library. + this.addAbility(new DiesTriggeredAbility(new DoIfCostPaid(new RootingKavuEffect(), new ExileSourceFromGraveCost()))); + } + + public RootingKavu(final RootingKavu card) { + super(card); + } + + @Override + public RootingKavu copy() { + return new RootingKavu(this); + } + + class RootingKavuEffect extends OneShotEffect { + + public RootingKavuEffect() { + super(Outcome.Benefit); + this.staticText = "shuffle all creature cards from your graveyard into your library."; + } + + public RootingKavuEffect(final RootingKavuEffect effect) { + super(effect); + } + + @Override + public RootingKavuEffect copy() { + return new RootingKavuEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Cards cards = new CardsImpl(); + cards.addAll(controller.getGraveyard().getCards(new FilterCreatureCard(), game)); + controller.putCardsOnTopOfLibrary(cards, game, source, false); + controller.shuffleLibrary(source, game); + return true; + } + return false; + } + } +} From 3c6f2430a9f6c9ee64b526c0567056ba102ed243 Mon Sep 17 00:00:00 2001 From: Matt Oslan Date: Fri, 2 Sep 2016 18:59:49 -0400 Subject: [PATCH 05/20] Implement Minions' Murmurs --- .../mage/sets/futuresight/MinionsMurmurs.java | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/futuresight/MinionsMurmurs.java diff --git a/Mage.Sets/src/mage/sets/futuresight/MinionsMurmurs.java b/Mage.Sets/src/mage/sets/futuresight/MinionsMurmurs.java new file mode 100644 index 0000000000..5831196415 --- /dev/null +++ b/Mage.Sets/src/mage/sets/futuresight/MinionsMurmurs.java @@ -0,0 +1,92 @@ +/* + * 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.futuresight; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author Derpthemeus + */ +public class MinionsMurmurs extends CardImpl { + + public MinionsMurmurs(UUID ownerId) { + super(ownerId, 71, "Minions' Murmurs", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{B}{B}"); + this.expansionSetCode = "FUT"; + + // You draw X cards and you lose X life, where X is the number of creatures you control. + this.getSpellAbility().addEffect(new MinionsMurmursEffect()); + } + + public MinionsMurmurs(final MinionsMurmurs card) { + super(card); + } + + @Override + public MinionsMurmurs copy() { + return new MinionsMurmurs(this); + } + + class MinionsMurmursEffect extends OneShotEffect { + + public MinionsMurmursEffect() { + super(Outcome.DrawCard); + this.staticText = "You draw X cards and you lose X life, where X is the number of creatures you control"; + } + + public MinionsMurmursEffect(final MinionsMurmursEffect effect) { + super(effect); + } + + @Override + public MinionsMurmursEffect copy() { + return new MinionsMurmursEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int creaturesControlled = game.getBattlefield().countAll(new FilterCreaturePermanent(), controller.getId(), game); + controller.drawCards(creaturesControlled, game); + controller.damage(creaturesControlled, source.getId(), game, false, true); + return true; + } + return false; + } + } +} From 0960a54998d57cd4acb749190ece89df42703d61 Mon Sep 17 00:00:00 2001 From: Matt Oslan Date: Fri, 2 Sep 2016 19:17:09 -0400 Subject: [PATCH 06/20] Implement Wirecat --- .../src/mage/sets/urzassaga/Wirecat.java | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/urzassaga/Wirecat.java diff --git a/Mage.Sets/src/mage/sets/urzassaga/Wirecat.java b/Mage.Sets/src/mage/sets/urzassaga/Wirecat.java new file mode 100644 index 0000000000..d69736110f --- /dev/null +++ b/Mage.Sets/src/mage/sets/urzassaga/Wirecat.java @@ -0,0 +1,105 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.urzassaga; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.RestrictionEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterEnchantmentPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author Derpthemeus + */ +public class Wirecat extends CardImpl { + + public Wirecat(UUID ownerId) { + super(ownerId, 317, "Wirecat", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}"); + this.expansionSetCode = "USG"; + this.subtype.add("Cat"); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // Wirecat can't attack or block if an enchantment is on the battlefield. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new WirecatEffect())); + } + + public Wirecat(final Wirecat card) { + super(card); + } + + @Override + public Wirecat copy() { + return new Wirecat(this); + } + + class WirecatEffect extends RestrictionEffect { + + public WirecatEffect() { + super(Duration.WhileOnBattlefield); + staticText = "{this} can't attack or block if an enchantment is on the battlefield"; + } + + public WirecatEffect(final WirecatEffect effect) { + super(effect); + } + + @Override + public WirecatEffect copy() { + return new WirecatEffect(this); + } + + @Override + public boolean canAttackCheckAfter(int numberOfAttackers, Ability source, Game game) { + return false; + } + + @Override + public boolean canBlockCheckAfter(Ability source, Game game) { + return false; + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + if (permanent.getId().equals(source.getSourceId())) { + FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent(); + return game.getBattlefield().contains(filter, 1, game); + } + return false; + } + } +} From d65bb6bec5a3eed0f41c311689a16a58f4db61c1 Mon Sep 17 00:00:00 2001 From: Max Lebedev Date: Sat, 3 Sep 2016 07:45:50 -0400 Subject: [PATCH 07/20] added the Heaven's Gate, Dwarven Song, SeaKing's Blessing, Sylvan Paradise, and Touch of Darkness cards based mostly on Sway of Illusion --- .../src/mage/sets/legends/DwarvenSong.java | 70 ++++++++++++++++++ .../src/mage/sets/legends/HeavensGate.java | 71 +++++++++++++++++++ .../mage/sets/legends/SeaKingsBlessing.java | 71 +++++++++++++++++++ .../src/mage/sets/legends/SylvanParadise.java | 70 ++++++++++++++++++ .../mage/sets/legends/TouchOfDarkness.java | 71 +++++++++++++++++++ 5 files changed, 353 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/legends/DwarvenSong.java create mode 100644 Mage.Sets/src/mage/sets/legends/HeavensGate.java create mode 100644 Mage.Sets/src/mage/sets/legends/SeaKingsBlessing.java create mode 100644 Mage.Sets/src/mage/sets/legends/SylvanParadise.java create mode 100644 Mage.Sets/src/mage/sets/legends/TouchOfDarkness.java diff --git a/Mage.Sets/src/mage/sets/legends/DwarvenSong.java b/Mage.Sets/src/mage/sets/legends/DwarvenSong.java new file mode 100644 index 0000000000..2eba79dbf6 --- /dev/null +++ b/Mage.Sets/src/mage/sets/legends/DwarvenSong.java @@ -0,0 +1,70 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.sets.legends; + + import java.util.UUID; + + import mage.ObjectColor; + import mage.abilities.effects.Effect; + import mage.abilities.effects.common.continuous.BecomesColorTargetEffect; + import mage.cards.CardImpl; + import mage.constants.CardType; + import mage.constants.Duration; + import mage.constants.Rarity; + import mage.filter.common.FilterCreaturePermanent; + import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author maxlebedev + */ +public class DwarvenSong extends CardImpl { + + public DwarvenSong(UUID ownerId) { + super(ownerId, 141, "Dwarven Song", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{R}"); + this.expansionSetCode = "LEG"; + + // Any number of target creatures become red until end of turn. + Effect effect = new BecomesColorTargetEffect(ObjectColor.RED, Duration.EndOfTurn); + effect.setText("Any number of target creatures become red until end of turn"); + this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE, new FilterCreaturePermanent(), false)); + + } + + public DwarvenSong(final DwarvenSong card) { + super(card); + } + + @Override + public DwarvenSong copy() { + return new DwarvenSong(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/legends/HeavensGate.java b/Mage.Sets/src/mage/sets/legends/HeavensGate.java new file mode 100644 index 0000000000..f899e815c1 --- /dev/null +++ b/Mage.Sets/src/mage/sets/legends/HeavensGate.java @@ -0,0 +1,71 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.sets.legends; + +import java.util.UUID; + +import mage.ObjectColor; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BecomesColorTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author maxlebedev + */ +public class HeavensGate extends CardImpl { + + public HeavensGate(UUID ownerId) { + super(ownerId, 188, "Heaven's Gate", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{W}"); + this.expansionSetCode = "LEG"; + + // Any number of target creatures become white until end of turn. + Effect effect = new BecomesColorTargetEffect(ObjectColor.WHITE, Duration.EndOfTurn); + effect.setText("Any number of target creatures become white until end of turn"); + this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE, new FilterCreaturePermanent(), false)); + + } + + public HeavensGate(final HeavensGate card) { + super(card); + } + + @Override + public HeavensGate copy() { + return new HeavensGate(this); + } + +} + diff --git a/Mage.Sets/src/mage/sets/legends/SeaKingsBlessing.java b/Mage.Sets/src/mage/sets/legends/SeaKingsBlessing.java new file mode 100644 index 0000000000..9c66d3e6d9 --- /dev/null +++ b/Mage.Sets/src/mage/sets/legends/SeaKingsBlessing.java @@ -0,0 +1,71 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.sets.legends; + +import java.util.UUID; + +import mage.ObjectColor; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BecomesColorTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author maxlebedev + */ +public class SeaKingsBlessing extends CardImpl { + + public SeaKingsBlessing(UUID ownerId) { + super(ownerId, 75, "Sea King's Blessing", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{U}"); + this.expansionSetCode = "LEG"; + + // Any number of target creatures become blue until end of turn. + Effect effect = new BecomesColorTargetEffect(ObjectColor.BLUE, Duration.EndOfTurn); + effect.setText("Any number of target creatures become blue until end of turn"); + this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE, new FilterCreaturePermanent(), false)); + + } + + public SeaKingsBlessing(final SeaKingsBlessing card) { + super(card); + } + + @Override + public SeaKingsBlessing copy() { + return new SeaKingsBlessing(this); + } + +} + diff --git a/Mage.Sets/src/mage/sets/legends/SylvanParadise.java b/Mage.Sets/src/mage/sets/legends/SylvanParadise.java new file mode 100644 index 0000000000..e6adb26503 --- /dev/null +++ b/Mage.Sets/src/mage/sets/legends/SylvanParadise.java @@ -0,0 +1,70 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.sets.legends; + + import java.util.UUID; + + import mage.ObjectColor; + import mage.abilities.effects.Effect; + import mage.abilities.effects.common.continuous.BecomesColorTargetEffect; + import mage.cards.CardImpl; + import mage.constants.CardType; + import mage.constants.Duration; + import mage.constants.Rarity; + import mage.filter.common.FilterCreaturePermanent; + import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author maxlebedev + */ +public class SylvanParadise extends CardImpl { + + public SylvanParadise(UUID ownerId) { + super(ownerId, 122, "Sylvan Paradise", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{G}"); + this.expansionSetCode = "LEG"; + + // Any number of target creatures become green until end of turn. + Effect effect = new BecomesColorTargetEffect(ObjectColor.GREEN, Duration.EndOfTurn); + effect.setText("Any number of target creatures become green until end of turn"); + this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE, new FilterCreaturePermanent(), false)); + + } + + public SylvanParadise(final SylvanParadise card) { + super(card); + } + + @Override + public SylvanParadise copy() { + return new SylvanParadise(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/legends/TouchOfDarkness.java b/Mage.Sets/src/mage/sets/legends/TouchOfDarkness.java new file mode 100644 index 0000000000..0b13992063 --- /dev/null +++ b/Mage.Sets/src/mage/sets/legends/TouchOfDarkness.java @@ -0,0 +1,71 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.sets.legends; + +import java.util.UUID; + +import mage.ObjectColor; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BecomesColorTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author maxlebedev + */ +public class TouchOfDarkness extends CardImpl { + + public TouchOfDarkness(UUID ownerId) { + super(ownerId, 36, "Touch of Darkness", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{B}"); + this.expansionSetCode = "LEG"; + + // Any number of target creatures become black until end of turn. + Effect effect = new BecomesColorTargetEffect(ObjectColor.BLACK, Duration.EndOfTurn); + effect.setText("Any number of target creatures become black until end of turn"); + this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE, new FilterCreaturePermanent(), false)); + + } + + public TouchOfDarkness(final TouchOfDarkness card) { + super(card); + } + + @Override + public TouchOfDarkness copy() { + return new TouchOfDarkness(this); + } + +} + From 148f63367263550399b1399fd85c2bf78b0eaca1 Mon Sep 17 00:00:00 2001 From: Samuel Sandeen Date: Sat, 3 Sep 2016 10:33:54 -0400 Subject: [PATCH 08/20] Make the Counters API for card and permanent consistent. --- Mage.Common/src/mage/view/CardView.java | 8 ++-- .../player/ai/ma/ArtificialScoringSystem.java | 4 +- .../ma/optimizers/impl/LevelUpOptimizer.java | 2 +- .../player/ai/simulators/CombatSimulator.java | 2 +- .../mage/player/ai/GameStateEvaluator.java | 2 +- .../sets/alarareborn/AvenMimeomancer.java | 4 +- .../sets/archenemy/MakeshiftMannequin.java | 2 +- .../avacynrestored/DescentIntoMadness.java | 2 +- .../mage/sets/avacynrestored/HeraldOfWar.java | 2 +- .../sets/avacynrestored/OtherworldAtlas.java | 2 +- .../UndergrowthChampion.java | 2 +- .../sets/bornofthegods/AstralCornucopia.java | 4 +- .../mage/sets/championsofkamigawa/Hankyu.java | 2 +- .../championsofkamigawa/PiousKitsune.java | 2 +- .../src/mage/sets/coldsnap/DarkDepths.java | 2 +- .../mage/sets/coldsnap/HibernationsEnd.java | 2 +- .../sets/commander/AnimarSoulOfElements.java | 2 +- .../sets/commander/VishKalBloodArbiter.java | 2 +- .../commander2013/MarathWillOfTheWild.java | 6 +-- .../sets/commander2013/PhantomNantuko.java | 2 +- .../mage/sets/commander2013/PlagueBoiler.java | 4 +- .../mage/sets/commander2014/AEtherSnap.java | 4 +- .../sets/commander2015/BloodsporeThrinax.java | 2 +- .../mage/sets/commander2015/ThiefOfBlood.java | 2 +- .../sets/conflux/GwafaHazidProfiteer.java | 2 +- .../sets/darkascension/JarOfEyeballs.java | 2 +- .../src/mage/sets/darksteel/AEtherVial.java | 2 +- .../mage/sets/darksteel/DarksteelReactor.java | 2 +- .../sets/dissension/CytoplastRootKin.java | 2 +- .../mage/sets/dragonsmaze/BredForTheHunt.java | 2 +- .../src/mage/sets/dragonsmaze/GiveTake.java | 2 +- .../sets/dragonsmaze/VorelOfTheHullClade.java | 2 +- .../dragonsoftarkir/GleamOfAuthority.java | 2 +- .../sets/dragonsoftarkir/MythRealized.java | 2 +- .../dragonsoftarkir/ServantOfTheScale.java | 2 +- .../mage/sets/eldritchmoon/IdentityThief.java | 2 +- .../mage/sets/eldritchmoon/NoosegrafMob.java | 2 +- .../src/mage/sets/eventide/GilderBairn.java | 2 +- .../src/mage/sets/eventide/Necroskitter.java | 2 +- .../src/mage/sets/exodus/SpikeCannibal.java | 2 +- .../sets/fatereforged/DaghatarTheAdamant.java | 2 +- .../sets/fifthdawn/EngineeredExplosives.java | 2 +- .../sets/fourthedition/ClockworkAvian.java | 2 +- .../mage/sets/futuresight/CoalitionRelic.java | 2 +- .../mage/sets/futuresight/DustOfMoments.java | 2 +- .../sets/futuresight/LostAuramancers.java | 2 +- .../src/mage/sets/gatecrash/Bioshift.java | 3 +- .../mage/sets/gatecrash/SimicFluxmage.java | 2 +- .../mage/sets/innistrad/EssenceOfTheWild.java | 2 +- .../mage/sets/innistrad/GarrukRelentless.java | 2 +- .../src/mage/sets/innistrad/GutterGrime.java | 2 +- .../sets/innistrad/LudevicsTestSubject.java | 4 +- .../mage/sets/journeyintonyx/SageOfHours.java | 2 +- .../journeyintonyx/SolidarityOfHeroes.java | 2 +- .../mage/sets/judgment/PhantomCentaur.java | 2 +- .../src/mage/sets/judgment/PhantomFlock.java | 2 +- .../mage/sets/judgment/PhantomNishoba.java | 2 +- .../src/mage/sets/judgment/PhantomNomad.java | 2 +- .../src/mage/sets/judgment/PhantomTiger.java | 2 +- .../src/mage/sets/khansoftarkir/BringLow.java | 2 +- .../sets/khansoftarkir/RiteOfTheSerpent.java | 2 +- .../sets/limitedalpha/ClockworkBeast.java | 2 +- .../src/mage/sets/lorwyn/AquitectsWill.java | 2 +- .../mage/sets/lorwyn/AshlingThePilgrim.java | 2 +- .../mage/sets/magic2011/PhylacteryLich.java | 2 +- .../mage/sets/magic2012/PrimordialHydra.java | 2 +- .../mage/sets/magic2013/SlumberingDragon.java | 2 +- .../mage/sets/magic2014/DoorOfDestinies.java | 2 +- .../mage/sets/magic2014/KalonianHydra.java | 2 +- .../src/mage/sets/magic2015/ChasmSkulker.java | 2 +- .../sets/magic2015/YisanTheWandererBard.java | 2 +- .../sets/magicplayerrewards/PowderKeg.java | 2 +- .../masterseditioniii/DivineIntervention.java | 2 +- .../mage/sets/masterseditioniv/Cyclone.java | 2 +- .../sets/mercadianmasques/BlackMarket.java | 2 +- .../mage/sets/mirrodin/AltarOfShadows.java | 2 +- .../mage/sets/mirrodin/ChaliceOfTheVoid.java | 2 +- .../src/mage/sets/mirrodin/JinxedChoker.java | 4 +- .../src/mage/sets/mirrodin/OblivionStone.java | 6 +-- .../morningtide/KinsbaileBorderguard.java | 2 +- .../sets/morningtide/OonasBlackguard.java | 2 +- .../src/mage/sets/nemesis/TangleWire.java | 2 +- .../mage/sets/newphyrexia/GremlinMine.java | 2 +- .../mage/sets/newphyrexia/HexParasite.java | 6 +-- .../newphyrexia/ShrineOfPiercingVision.java | 2 +- .../oathofthegatewatch/GladehartCavalry.java | 2 +- .../src/mage/sets/odyssey/BombSquad.java | 4 +- .../src/mage/sets/odyssey/DelayingShield.java | 2 +- .../src/mage/sets/onslaught/Aurification.java | 2 +- .../mage/sets/planarchaos/FungalBehemoth.java | 2 +- .../src/mage/sets/ravnica/Necroplasm.java | 2 +- .../sets/returntoravnica/AzorsElocutors.java | 2 +- .../sets/riseoftheeldrazi/SphinxBoneWand.java | 2 +- .../sets/riseoftheeldrazi/ThoughtGorger.java | 2 +- .../sets/scarsofmirrodin/CullingDais.java | 2 +- .../mage/sets/scarsofmirrodin/Grindclock.java | 2 +- .../scarsofmirrodin/LiegeOfTheTangle.java | 2 +- .../sets/scarsofmirrodin/RatchetBomb.java | 2 +- .../mage/sets/scourge/ForgottenAncient.java | 2 +- .../sets/shadowmoor/BlowflyInfestation.java | 2 +- .../mage/sets/shadowmoor/FateTransfer.java | 2 +- .../src/mage/sets/shadowmoor/GriefTyrant.java | 2 +- .../src/mage/sets/shadowmoor/Heartmender.java | 2 +- .../src/mage/sets/shadowmoor/LeechBonder.java | 4 +- .../src/mage/sets/shadowmoor/Woeleecher.java | 4 +- .../shadowsoverinnistrad/BrainInAJar.java | 2 +- .../mage/sets/stronghold/CrovaxTheCursed.java | 4 +- .../src/mage/sets/tempest/EssenceBottle.java | 2 +- .../src/mage/sets/tempest/LegacysAllure.java | 2 +- .../src/mage/sets/tempest/Magmasaur.java | 2 +- .../src/mage/sets/tempest/TortureChamber.java | 4 +- .../mage/sets/timespiral/Clockspinning.java | 10 ++--- .../mage/sets/timespiral/ClockworkHydra.java | 2 +- .../mage/sets/timespiral/JhoirasTimebug.java | 2 +- .../src/mage/sets/timespiral/PhantomWurm.java | 2 +- .../sets/timespiral/ThelonOfHavenwood.java | 2 +- .../src/mage/sets/torment/CephalidVandal.java | 2 +- .../mage/sets/urzaslegacy/Anthroplasm.java | 2 +- .../mage/sets/urzaslegacy/MoltenHydra.java | 2 +- .../src/mage/sets/urzassaga/Smokestack.java | 2 +- .../src/mage/sets/urzassaga/VileRequiem.java | 2 +- .../vintagemasters/MarchesaTheBlackRose.java | 2 +- .../sets/vintagemasters/SaprolingBurst.java | 2 +- .../mage/sets/visions/PhyrexianMarauder.java | 2 +- .../sets/worldwake/QuestForTheNihilStone.java | 2 +- .../sets/worldwake/QuestForUlasTemple.java | 2 +- .../mage/sets/zendikar/ArchmageAscension.java | 2 +- .../sets/zendikar/BeastmasterAscension.java | 2 +- .../mage/sets/zendikar/EternityVessel.java | 2 +- .../sets/zendikar/LuminarchAscension.java | 2 +- .../mage/sets/zendikar/ObsidianFireheart.java | 2 +- .../sets/zendikar/PyromancerAscension.java | 2 +- .../mage/sets/zendikar/VampireHexmage.java | 2 +- .../activated/LevelUpAbilityTest.java | 10 ++--- .../org/mage/test/cards/copy/VesuvaTest.java | 2 +- .../mage/test/cards/single/ChronozoaTest.java | 2 +- .../test/cards/single/DustOfMomentsTest.java | 2 +- .../base/impl/CardTestPlayerAPIImpl.java | 3 +- .../common/AttachedToCounterCondition.java | 4 +- .../LastTimeCounterRemovedCondition.java | 2 +- .../common/PermanentHasCounterCondition.java | 6 +-- .../common/SourceHasCounterCondition.java | 4 +- .../costs/common/PayLoyaltyCost.java | 6 +-- .../costs/common/PayVariableLoyaltyCost.java | 2 +- .../costs/common/RemoveCounterCost.java | 16 ++++---- .../common/RemoveCountersSourceCost.java | 4 +- .../RemoveVariableCountersSourceCost.java | 2 +- .../RemoveVariableCountersTargetCost.java | 4 +- .../dynamicvalue/common/CountersCount.java | 2 +- .../effects/ApplyCountersEffect.java | 2 +- .../common/RemoveAllCountersSourceEffect.java | 2 +- .../counter/AddCountersSourceEffect.java | 4 +- .../counter/AddCountersTargetEffect.java | 6 +-- .../common/counter/ProliferateEffect.java | 16 ++++---- .../counter/RemoveCounterSourceEffect.java | 2 +- .../counter/RemoveCounterTargetEffect.java | 12 +++--- .../keyword/CumulativeUpkeepAbility.java | 2 +- .../mage/abilities/keyword/FadingAbility.java | 2 +- .../mage/abilities/keyword/GraftAbility.java | 4 +- .../abilities/keyword/ModularAbility.java | 4 +- .../abilities/keyword/PersistAbility.java | 2 +- .../abilities/keyword/UndyingAbility.java | 2 +- .../abilities/keyword/UnleashAbility.java | 2 +- .../keyword/VanishingSacrificeAbility.java | 2 +- .../keyword/VanishingUpkeepAbility.java | 2 +- Mage/src/main/java/mage/cards/Card.java | 3 ++ Mage/src/main/java/mage/cards/CardImpl.java | 14 +++++-- .../FilterPermanentOrPlayerWithCounter.java | 2 +- .../permanent/CounterAnyPredicate.java | 2 +- .../predicate/permanent/CounterPredicate.java | 4 +- Mage/src/main/java/mage/game/GameImpl.java | 12 +++--- Mage/src/main/java/mage/game/GameState.java | 6 +-- .../java/mage/game/permanent/Permanent.java | 3 +- .../mage/game/permanent/PermanentImpl.java | 38 ++++--------------- Mage/src/main/java/mage/game/stack/Spell.java | 7 ++++ .../TargetPermanentOrPlayerWithCounter.java | 4 +- 176 files changed, 272 insertions(+), 277 deletions(-) diff --git a/Mage.Common/src/mage/view/CardView.java b/Mage.Common/src/mage/view/CardView.java index ca3b6c48ee..18ef48839e 100644 --- a/Mage.Common/src/mage/view/CardView.java +++ b/Mage.Common/src/mage/view/CardView.java @@ -246,14 +246,14 @@ public class CardView extends SimpleCardView { if (card instanceof Permanent) { this.mageObjectType = MageObjectType.PERMANENT; Permanent permanent = (Permanent) card; - this.loyalty = Integer.toString(permanent.getCounters().getCount(CounterType.LOYALTY)); + this.loyalty = Integer.toString(permanent.getCounters(game).getCount(CounterType.LOYALTY)); this.pairedCard = permanent.getPairedCard() != null ? permanent.getPairedCard().getSourceId() : null; if (!permanent.getControllerId().equals(permanent.getOwnerId())) { controlledByOwner = false; } - if (game != null && permanent.getCounters() != null && !permanent.getCounters().isEmpty()) { + if (game != null && permanent.getCounters(game) != null && !permanent.getCounters(game).isEmpty()) { counters = new ArrayList<>(); - for (Counter counter : permanent.getCounters().values()) { + for (Counter counter : permanent.getCounters(game).values()) { counters.add(new CounterView(counter)); } } @@ -348,7 +348,7 @@ public class CardView extends SimpleCardView { this.mageObjectType = MageObjectType.PERMANENT; this.power = Integer.toString(object.getPower().getValue()); this.toughness = Integer.toString(object.getToughness().getValue()); - this.loyalty = Integer.toString(((Permanent) object).getCounters().getCount(CounterType.LOYALTY)); + this.loyalty = Integer.toString(((Permanent) object).getCounters((Game)null).getCount(CounterType.LOYALTY)); } else { this.power = object.getPower().toString(); this.toughness = object.getToughness().toString(); diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java index 9b0c017197..2e3d0d8ccc 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java @@ -64,8 +64,8 @@ public class ArtificialScoringSystem { public static int getVariablePermanentScore(final Game game, final Permanent permanent) { - int score = permanent.getCounters().getCount(CounterType.CHARGE) * 30; - score += permanent.getCounters().getCount(CounterType.LEVEL) * 30; + int score = permanent.getCounters(game).getCount(CounterType.CHARGE) * 30; + score += permanent.getCounters(game).getCount(CounterType.LEVEL) * 30; score -= permanent.getDamage() * 2; if (!canTap(permanent)) { score += getTappedScore(permanent); diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/optimizers/impl/LevelUpOptimizer.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/optimizers/impl/LevelUpOptimizer.java index 9cfe9a1078..c3c8934fa1 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/optimizers/impl/LevelUpOptimizer.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/optimizers/impl/LevelUpOptimizer.java @@ -30,7 +30,7 @@ public class LevelUpOptimizer extends BaseTreeOptimizer { if (permanent != null && permanent instanceof PermanentCard) { PermanentCard leveler = (PermanentCard) permanent; // check already existing Level counters and compare to maximum that make sense - if (permanent.getCounters().getCount(CounterType.LEVEL) >= leveler.getMaxLevelCounters()) { + if (permanent.getCounters(game).getCount(CounterType.LEVEL) >= leveler.getMaxLevelCounters()) { removeAbility(ability); } } diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/simulators/CombatSimulator.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/simulators/CombatSimulator.java index 00e7e3102d..d2eb5ffdf9 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/simulators/CombatSimulator.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/simulators/CombatSimulator.java @@ -68,7 +68,7 @@ public class CombatSimulator implements Serializable { } else { Permanent permanent = game.getPermanent(defenderId); - simCombat.planeswalkerLoyalty.put(defenderId, permanent.getCounters().getCount(CounterType.LOYALTY)); + simCombat.planeswalkerLoyalty.put(defenderId, permanent.getCounters(game).getCount(CounterType.LOYALTY)); } } return simCombat; diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/GameStateEvaluator.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/GameStateEvaluator.java index 16e131031e..4887da0e61 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/GameStateEvaluator.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/GameStateEvaluator.java @@ -111,7 +111,7 @@ public class GameStateEvaluator { if (!(ability instanceof ManaAbility) && ability.canActivate(ability.getControllerId(), game)) value += ability.getEffects().size(); } - for (Counter counter: permanent.getCounters().values()) { + for (Counter counter: permanent.getCounters(game).values()) { if (!(counter instanceof BoostCounter)) { value += counter.getCount(); } diff --git a/Mage.Sets/src/mage/sets/alarareborn/AvenMimeomancer.java b/Mage.Sets/src/mage/sets/alarareborn/AvenMimeomancer.java index bed26c6136..31274e7924 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/AvenMimeomancer.java +++ b/Mage.Sets/src/mage/sets/alarareborn/AvenMimeomancer.java @@ -116,7 +116,7 @@ class AvenEffect extends ContinuousEffectImpl { @Override public boolean isInactive(Ability source, Game game) { Permanent creature = game.getPermanent(this.targetPointer.getFirst(game, source)); - if (creature != null && creature.getCounters().getCount(CounterType.FEATHER) < 1) { + if (creature != null && creature.getCounters(game).getCount(CounterType.FEATHER) < 1) { return true; } return false; @@ -160,7 +160,7 @@ class AvenEffect2 extends ContinuousEffectImpl { @Override public boolean isInactive(Ability source, Game game) { Permanent creature = game.getPermanent(this.targetPointer.getFirst(game, source)); - if (creature != null && creature.getCounters().getCount(CounterType.FEATHER) < 1) { + if (creature != null && creature.getCounters(game).getCount(CounterType.FEATHER) < 1) { return true; } return false; diff --git a/Mage.Sets/src/mage/sets/archenemy/MakeshiftMannequin.java b/Mage.Sets/src/mage/sets/archenemy/MakeshiftMannequin.java index cf248de7b5..c3bd077fa0 100644 --- a/Mage.Sets/src/mage/sets/archenemy/MakeshiftMannequin.java +++ b/Mage.Sets/src/mage/sets/archenemy/MakeshiftMannequin.java @@ -141,7 +141,7 @@ class MakeshiftMannequinGainAbilityEffect extends ContinuousEffectImpl { @Override public boolean isInactive(Ability source, Game game) { Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); - return permanent == null || permanent.getCounters().getCount(CounterType.MANNEQUIN) < 1; + return permanent == null || permanent.getCounters(game).getCount(CounterType.MANNEQUIN) < 1; } @Override diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java b/Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java index 25472b037a..0bea2d7ccc 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java @@ -117,7 +117,7 @@ class DescentIntoMadnessEffect extends OneShotEffect { sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); } if (sourcePermanent != null && controller != null) { - int count = sourcePermanent.getCounters().getCount(CounterType.DESPAIR); + int count = sourcePermanent.getCounters(game).getCount(CounterType.DESPAIR); if (count > 0) { // select the permanents and hand cards in turn order LinkedList selectedObjects = new LinkedList<>(); diff --git a/Mage.Sets/src/mage/sets/avacynrestored/HeraldOfWar.java b/Mage.Sets/src/mage/sets/avacynrestored/HeraldOfWar.java index ac3bc38035..9e73eb62c4 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/HeraldOfWar.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/HeraldOfWar.java @@ -94,7 +94,7 @@ class HeraldOfWarCostReductionEffect extends CostModificationEffectImpl { SpellAbility spellAbility = (SpellAbility) abilityToModify; Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { - int amount = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (amount > 0) { CardUtil.adjustCost(spellAbility, amount); return true; diff --git a/Mage.Sets/src/mage/sets/avacynrestored/OtherworldAtlas.java b/Mage.Sets/src/mage/sets/avacynrestored/OtherworldAtlas.java index 43594a8956..ed7791b301 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/OtherworldAtlas.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/OtherworldAtlas.java @@ -91,7 +91,7 @@ class OtherworldAtlasDrawEffect extends OneShotEffect { Player sourcePlayer = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - int amount = permanent.getCounters().getCount(CounterType.CHARGE); + int amount = permanent.getCounters(game).getCount(CounterType.CHARGE); if (amount > 0) { for (UUID playerId : game.getState().getPlayersInRange(sourcePlayer.getId(), game)) { Player player = game.getPlayer(playerId); diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/UndergrowthChampion.java b/Mage.Sets/src/mage/sets/battleforzendikar/UndergrowthChampion.java index 504b6eec6a..245efb96da 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/UndergrowthChampion.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/UndergrowthChampion.java @@ -119,7 +119,7 @@ class UndergrowthChampionPreventionEffect extends PreventionEffectImpl { } } - if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { preventDamageAction(event, source, game); StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); diff --git a/Mage.Sets/src/mage/sets/bornofthegods/AstralCornucopia.java b/Mage.Sets/src/mage/sets/bornofthegods/AstralCornucopia.java index 2df81d9357..5b92049360 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/AstralCornucopia.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/AstralCornucopia.java @@ -93,7 +93,7 @@ class AstralCornucopiaManaAbility extends ManaAbility { netMana.clear(); Permanent sourcePermanent = game.getPermanent(getSourceId()); if (sourcePermanent != null) { - int counters = sourcePermanent.getCounters().getCount(CounterType.CHARGE.getName()); + int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName()); if (counters > 0) { netMana.add(new Mana(0, 0, 0, 0, 0, 0, counters, 0)); } @@ -132,7 +132,7 @@ class AstralCornucopiaManaEffect extends ManaEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (choice.getChoice() != null) { String color = choice.getChoice(); - int counters = sourcePermanent.getCounters().getCount(CounterType.CHARGE.getName()); + int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName()); switch (color) { case "Red": computedMana.setRed(counters); diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/Hankyu.java b/Mage.Sets/src/mage/sets/championsofkamigawa/Hankyu.java index cc32185da8..d5d1e79f89 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/Hankyu.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/Hankyu.java @@ -188,7 +188,7 @@ class HankyuCountersSourceCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent equipment = game.getPermanent(this.effectGivingEquipmentId); if (equipment != null ) { - this.removedCounters = equipment.getCounters().getCount(CounterType.AIM); + this.removedCounters = equipment.getCounters(game).getCount(CounterType.AIM); if (this.removedCounters > 0) { equipment.removeCounters("aim", this.removedCounters, game); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/PiousKitsune.java b/Mage.Sets/src/mage/sets/championsofkamigawa/PiousKitsune.java index d7a17269b4..7422587a91 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/PiousKitsune.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/PiousKitsune.java @@ -112,7 +112,7 @@ class PiousKitsuneEffect extends OneShotEffect { if (game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - int life = permanent.getCounters().getCount(CounterType.DEVOTION); + int life = permanent.getCounters(game).getCount(CounterType.DEVOTION); if (life > 0) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { diff --git a/Mage.Sets/src/mage/sets/coldsnap/DarkDepths.java b/Mage.Sets/src/mage/sets/coldsnap/DarkDepths.java index 108f81524b..f7d83f6409 100644 --- a/Mage.Sets/src/mage/sets/coldsnap/DarkDepths.java +++ b/Mage.Sets/src/mage/sets/coldsnap/DarkDepths.java @@ -131,7 +131,7 @@ class DarkDepthsAbility extends StateTriggeredAbility { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(getSourceId()); - return permanent != null && permanent.getCounters().getCount(CounterType.ICE) == 0; + return permanent != null && permanent.getCounters(game).getCount(CounterType.ICE) == 0; } @Override diff --git a/Mage.Sets/src/mage/sets/coldsnap/HibernationsEnd.java b/Mage.Sets/src/mage/sets/coldsnap/HibernationsEnd.java index 09d46b4974..a4f224f38d 100644 --- a/Mage.Sets/src/mage/sets/coldsnap/HibernationsEnd.java +++ b/Mage.Sets/src/mage/sets/coldsnap/HibernationsEnd.java @@ -128,7 +128,7 @@ class HibernationsEndEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourcePermanent != null && player != null) { - int newConvertedCost = sourcePermanent.getCounters().getCount("age"); + int newConvertedCost = sourcePermanent.getCounters(game).getCount("age"); FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost); filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, newConvertedCost)); filter.add(new CardTypePredicate(CardType.CREATURE)); diff --git a/Mage.Sets/src/mage/sets/commander/AnimarSoulOfElements.java b/Mage.Sets/src/mage/sets/commander/AnimarSoulOfElements.java index e8c9e26074..325e030224 100644 --- a/Mage.Sets/src/mage/sets/commander/AnimarSoulOfElements.java +++ b/Mage.Sets/src/mage/sets/commander/AnimarSoulOfElements.java @@ -117,7 +117,7 @@ class AnimarCostReductionEffect extends CostModificationEffectImpl { Ability spellAbility = (SpellAbility) abilityToModify; Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null && spellAbility != null) { - int amount = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (amount > 0) { CardUtil.reduceCost(spellAbility, amount); return true; diff --git a/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java b/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java index 9594ad1d90..55662f63ee 100644 --- a/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java +++ b/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java @@ -123,7 +123,7 @@ class VishKalBloodArbiterCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { - this.amount = permanent.getCounters().getCount(name); + this.amount = permanent.getCounters(game).getCount(name); permanent.removeCounters(name, amount, game); this.paid = true; } diff --git a/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java b/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java index f56934af52..f3976e03af 100644 --- a/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java +++ b/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java @@ -112,7 +112,7 @@ public class MarathWillOfTheWild extends CardImpl { if (ability instanceof SimpleActivatedAbility && ability.getModes().size() == 3) { Permanent sourcePermanent = game.getPermanent(ability.getSourceId()); if (sourcePermanent != null) { - int amount = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (amount > 0) { for (VariableCost cost: ability.getManaCostsToPay().getVariableCosts()) { if (cost instanceof VariableManaCost) { @@ -192,7 +192,7 @@ class MarathWillOfTheWildRemoveCountersCost extends CostImpl { @Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Permanent permanent = game.getPermanent(sourceId); - if (permanent != null && permanent.getCounters().getCount(CounterType.P1P1) > 0) { + if (permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { return true; } return false; @@ -202,7 +202,7 @@ class MarathWillOfTheWildRemoveCountersCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { int amount = new ManacostVariableValue().calculate(game, ability, null); Permanent permanent = game.getPermanent(sourceId); - if (permanent != null && permanent.getCounters().getCount(CounterType.P1P1) >= amount) { + if (permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) >= amount) { permanent.removeCounters(CounterType.P1P1.getName(), amount, game); this.paid = true; } diff --git a/Mage.Sets/src/mage/sets/commander2013/PhantomNantuko.java b/Mage.Sets/src/mage/sets/commander2013/PhantomNantuko.java index 9f2d2f37d8..3c5de1ded5 100644 --- a/Mage.Sets/src/mage/sets/commander2013/PhantomNantuko.java +++ b/Mage.Sets/src/mage/sets/commander2013/PhantomNantuko.java @@ -129,7 +129,7 @@ class PhantomNantukoPreventionEffect extends PreventionEffectImpl { } } - if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); sb.append("Removed a +1/+1 counter "); diff --git a/Mage.Sets/src/mage/sets/commander2013/PlagueBoiler.java b/Mage.Sets/src/mage/sets/commander2013/PlagueBoiler.java index e29d0cf668..61e86c34cd 100644 --- a/Mage.Sets/src/mage/sets/commander2013/PlagueBoiler.java +++ b/Mage.Sets/src/mage/sets/commander2013/PlagueBoiler.java @@ -101,7 +101,7 @@ class PlagueBoilerEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (controller != null && sourcePermanent != null) { - if (!sourcePermanent.getCounters().containsKey(CounterType.PLAGUE) || controller.chooseUse(outcome, "Put a plague counter on? (No removes one)", source, game)) { + if (!sourcePermanent.getCounters(game).containsKey(CounterType.PLAGUE) || controller.chooseUse(outcome, "Put a plague counter on? (No removes one)", source, game)) { return new AddCountersSourceEffect(CounterType.PLAGUE.createInstance(), true).apply(game, source); } else { return new RemoveCounterSourceEffect(CounterType.PLAGUE.createInstance()).apply(game, source); @@ -135,7 +135,7 @@ class PlagueBoilerTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (event.getTargetId().equals(this.getSourceId()) && event.getData().equals(CounterType.PLAGUE.getName())) { Permanent sourcePermanent = game.getPermanent(this.getSourceId()); - if (sourcePermanent != null && sourcePermanent.getCounters().getCount(CounterType.PLAGUE) >= 3) { + if (sourcePermanent != null && sourcePermanent.getCounters(game).getCount(CounterType.PLAGUE) >= 3) { return true; } } diff --git a/Mage.Sets/src/mage/sets/commander2014/AEtherSnap.java b/Mage.Sets/src/mage/sets/commander2014/AEtherSnap.java index 922537d431..7cae9c21f5 100644 --- a/Mage.Sets/src/mage/sets/commander2014/AEtherSnap.java +++ b/Mage.Sets/src/mage/sets/commander2014/AEtherSnap.java @@ -90,8 +90,8 @@ class AEtherSnapEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterPermanent(), controller.getId(), source.getSourceId(), game)) { if (permanent instanceof PermanentToken) { controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); - } else if (!permanent.getCounters().isEmpty()) { - Counters counters = permanent.getCounters().copy(); + } else if (!permanent.getCounters(game).isEmpty()) { + Counters counters = permanent.getCounters(game).copy(); for (Counter counter : counters.values()) { permanent.removeCounters(counter, game); } diff --git a/Mage.Sets/src/mage/sets/commander2015/BloodsporeThrinax.java b/Mage.Sets/src/mage/sets/commander2015/BloodsporeThrinax.java index 5a5d699db5..7c8a0d4922 100644 --- a/Mage.Sets/src/mage/sets/commander2015/BloodsporeThrinax.java +++ b/Mage.Sets/src/mage/sets/commander2015/BloodsporeThrinax.java @@ -106,7 +106,7 @@ class BloodsporeThrinaxEntersBattlefieldEffect extends ReplacementEffectImpl { Permanent sourceCreature = game.getPermanent(source.getSourceId()); Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); if (sourceCreature != null && creature != null) { - int amount = sourceCreature.getCounters().getCount(CounterType.P1P1); + int amount = sourceCreature.getCounters(game).getCount(CounterType.P1P1); if (amount > 0) { creature.addCounters(CounterType.P1P1.createInstance(amount), game); } diff --git a/Mage.Sets/src/mage/sets/commander2015/ThiefOfBlood.java b/Mage.Sets/src/mage/sets/commander2015/ThiefOfBlood.java index 1d68088026..ac0ff03b42 100644 --- a/Mage.Sets/src/mage/sets/commander2015/ThiefOfBlood.java +++ b/Mage.Sets/src/mage/sets/commander2015/ThiefOfBlood.java @@ -101,7 +101,7 @@ class ThiefOfBloodEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int countersRemoved = 0; for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { - Counters counters = permanent.getCounters().copy(); + Counters counters = permanent.getCounters(game).copy(); for (Counter counter : counters.values()) { permanent.removeCounters(counter.getName(), counter.getCount(), game); countersRemoved += counter.getCount(); diff --git a/Mage.Sets/src/mage/sets/conflux/GwafaHazidProfiteer.java b/Mage.Sets/src/mage/sets/conflux/GwafaHazidProfiteer.java index 938bdf266a..ff96e311e0 100644 --- a/Mage.Sets/src/mage/sets/conflux/GwafaHazidProfiteer.java +++ b/Mage.Sets/src/mage/sets/conflux/GwafaHazidProfiteer.java @@ -140,7 +140,7 @@ class GwafaHazidProfiteerEffect2 extends RestrictionEffect { @Override public boolean applies(Permanent permanent, Ability source, Game game) { - return permanent.getCounters().containsKey(CounterType.BRIBERY); + return permanent.getCounters(game).containsKey(CounterType.BRIBERY); } @Override diff --git a/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java b/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java index 8ffde604dc..ebd5bf5714 100644 --- a/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java +++ b/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java @@ -148,7 +148,7 @@ class JarOfEyeballsCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getSourceId()); if (permanent != null) { - this.removedCounters = permanent.getCounters().getCount(CounterType.EYEBALL); + this.removedCounters = permanent.getCounters(game).getCount(CounterType.EYEBALL); if (this.removedCounters > 0) { permanent.removeCounters(CounterType.EYEBALL.createInstance(this.removedCounters), game); } diff --git a/Mage.Sets/src/mage/sets/darksteel/AEtherVial.java b/Mage.Sets/src/mage/sets/darksteel/AEtherVial.java index 2b8937f5f9..d396249c52 100644 --- a/Mage.Sets/src/mage/sets/darksteel/AEtherVial.java +++ b/Mage.Sets/src/mage/sets/darksteel/AEtherVial.java @@ -101,7 +101,7 @@ class AEtherVialEffect extends OneShotEffect { return false; } } - int count = permanent.getCounters().getCount(CounterType.CHARGE); + int count = permanent.getCounters(game).getCount(CounterType.CHARGE); FilterCreatureCard filter = new FilterCreatureCard("creature card with converted mana cost equal to " + count); filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, count)); diff --git a/Mage.Sets/src/mage/sets/darksteel/DarksteelReactor.java b/Mage.Sets/src/mage/sets/darksteel/DarksteelReactor.java index 9a559a9c10..363bfff68d 100644 --- a/Mage.Sets/src/mage/sets/darksteel/DarksteelReactor.java +++ b/Mage.Sets/src/mage/sets/darksteel/DarksteelReactor.java @@ -90,7 +90,7 @@ class DarksteelReactorStateTriggeredAbility extends StateTriggeredAbility { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(this.getSourceId()); - if(permanent != null && permanent.getCounters().getCount(CounterType.CHARGE) >= 20){ + if(permanent != null && permanent.getCounters(game).getCount(CounterType.CHARGE) >= 20){ return true; } return false; diff --git a/Mage.Sets/src/mage/sets/dissension/CytoplastRootKin.java b/Mage.Sets/src/mage/sets/dissension/CytoplastRootKin.java index 9c0de869b6..7d90f9c63e 100644 --- a/Mage.Sets/src/mage/sets/dissension/CytoplastRootKin.java +++ b/Mage.Sets/src/mage/sets/dissension/CytoplastRootKin.java @@ -114,7 +114,7 @@ class CytoplastRootKinEffect extends OneShotEffect { if (sourcePermanent != null && targetPermanent != null && !sourcePermanent.getId().equals(targetPermanent.getId()) - && targetPermanent.getCounters().getCount(CounterType.P1P1) > 0) { + && targetPermanent.getCounters(game).getCount(CounterType.P1P1) > 0) { targetPermanent.removeCounters(CounterType.P1P1.createInstance(), game); sourcePermanent.addCounters(CounterType.P1P1.createInstance(), game); return true; diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/BredForTheHunt.java b/Mage.Sets/src/mage/sets/dragonsmaze/BredForTheHunt.java index d7f5af5a27..02c57cb665 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/BredForTheHunt.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/BredForTheHunt.java @@ -89,7 +89,7 @@ class BredForTheHuntTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (((DamagedEvent) event).isCombatDamage()) { Permanent creature = game.getPermanent(event.getSourceId()); - if (creature != null && creature.getControllerId().equals(getControllerId()) && creature.getCounters().getCount(CounterType.P1P1) > 0) { + if (creature != null && creature.getControllerId().equals(getControllerId()) && creature.getCounters(game).getCount(CounterType.P1P1) > 0) { return true; } } diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/GiveTake.java b/Mage.Sets/src/mage/sets/dragonsmaze/GiveTake.java index 5f6c694014..659d2721e2 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/GiveTake.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/GiveTake.java @@ -93,7 +93,7 @@ class TakeEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent creature = game.getPermanent(targetPointer.getFirst(game, source)); if (creature != null) { - int numberCounters = creature.getCounters().getCount(CounterType.P1P1); + int numberCounters = creature.getCounters(game).getCount(CounterType.P1P1); if (numberCounters > 0) { creature.removeCounters(CounterType.P1P1.getName(), numberCounters, game); Player controller = game.getPlayer(source.getControllerId()); diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/VorelOfTheHullClade.java b/Mage.Sets/src/mage/sets/dragonsmaze/VorelOfTheHullClade.java index f853e89091..f537d09c28 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/VorelOfTheHullClade.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/VorelOfTheHullClade.java @@ -107,7 +107,7 @@ class VorelOfTheHullCladeEffect extends OneShotEffect { if (target == null) { return false; } - for (Counter counter : target.getCounters().values()) { + for (Counter counter : target.getCounters(game).values()) { Counter newCounter = new Counter(counter.getName(), counter.getCount()); target.addCounters(newCounter, game); } diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/GleamOfAuthority.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/GleamOfAuthority.java index 43b9341a94..156f757298 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/GleamOfAuthority.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/GleamOfAuthority.java @@ -111,7 +111,7 @@ class CountersOnControlledCount implements DynamicValue { Permanent enchantment = game.getPermanent(sourceAbility.getSourceId()); for (Permanent permanent : game.getState().getBattlefield().getAllActivePermanents(filter, sourceAbility.getControllerId(), game)) { if (!permanent.getId().equals(enchantment.getAttachedTo())) { - count += permanent.getCounters().getCount(CounterType.P1P1); + count += permanent.getCounters(game).getCount(CounterType.P1P1); } } return count; diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/MythRealized.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/MythRealized.java index 942e517199..10247877cb 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/MythRealized.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/MythRealized.java @@ -131,7 +131,7 @@ class MythRealizedSetPTEffect extends ContinuousEffectImpl { if (controller != null) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && new MageObjectReference(source.getSourceObject(game), game).refersTo(permanent, game)) { - int amount = permanent.getCounters().getCount(CounterType.LORE); + int amount = permanent.getCounters(game).getCount(CounterType.LORE); permanent.getPower().setValue(amount); permanent.getToughness().setValue(amount); return true; diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/ServantOfTheScale.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/ServantOfTheScale.java index 2967f548d0..21ab714bb1 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/ServantOfTheScale.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/ServantOfTheScale.java @@ -104,7 +104,7 @@ class ServantOfTheScaleEffect extends OneShotEffect { if (sourcePermanent != null && controller != null && (sourcePermanent.getZoneChangeCounter(game) == source.getSourceObjectZoneChangeCounter() // Token || sourcePermanent.getZoneChangeCounter(game) + 1 == source.getSourceObjectZoneChangeCounter())) { // PermanentCard - int amount = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (amount > 0) { Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(amount)); effect.setTargetPointer(targetPointer); diff --git a/Mage.Sets/src/mage/sets/eldritchmoon/IdentityThief.java b/Mage.Sets/src/mage/sets/eldritchmoon/IdentityThief.java index 12cbb8c3b6..2a3834b7e4 100644 --- a/Mage.Sets/src/mage/sets/eldritchmoon/IdentityThief.java +++ b/Mage.Sets/src/mage/sets/eldritchmoon/IdentityThief.java @@ -139,7 +139,7 @@ class IdentityThiefEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && permanent != null && sourcePermanent != null) { Permanent permanentReset = permanent.copy(); - permanentReset.getCounters().clear(); + permanentReset.getCounters(game).clear(); permanentReset.getPower().resetToBaseValue(); permanentReset.getToughness().resetToBaseValue(); CopyEffect copyEffect = new CopyEffect(Duration.EndOfTurn, permanentReset, source.getSourceId()); diff --git a/Mage.Sets/src/mage/sets/eldritchmoon/NoosegrafMob.java b/Mage.Sets/src/mage/sets/eldritchmoon/NoosegrafMob.java index 6d1c24d906..f4c8a3ffdc 100644 --- a/Mage.Sets/src/mage/sets/eldritchmoon/NoosegrafMob.java +++ b/Mage.Sets/src/mage/sets/eldritchmoon/NoosegrafMob.java @@ -96,7 +96,7 @@ class NoosegrafMobEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && permanent != null && permanent.getCounters().getCount(CounterType.P1P1) > 0) { + if (controller != null && permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { permanent.removeCounters(CounterType.P1P1.createInstance(), game); Effect effect = new CreateTokenEffect(new ZombieToken()); return effect.apply(game, source); diff --git a/Mage.Sets/src/mage/sets/eventide/GilderBairn.java b/Mage.Sets/src/mage/sets/eventide/GilderBairn.java index a17be6b9fe..2c2d3f2342 100644 --- a/Mage.Sets/src/mage/sets/eventide/GilderBairn.java +++ b/Mage.Sets/src/mage/sets/eventide/GilderBairn.java @@ -98,7 +98,7 @@ class GilderBairnEffect extends OneShotEffect { if (target == null) { return false; } - for (Counter counter : target.getCounters().values()) { + for (Counter counter : target.getCounters(game).values()) { Counter newCounter = new Counter(counter.getName(), counter.getCount()); target.addCounters(newCounter, game); } diff --git a/Mage.Sets/src/mage/sets/eventide/Necroskitter.java b/Mage.Sets/src/mage/sets/eventide/Necroskitter.java index 054381415a..3b790761ff 100644 --- a/Mage.Sets/src/mage/sets/eventide/Necroskitter.java +++ b/Mage.Sets/src/mage/sets/eventide/Necroskitter.java @@ -103,7 +103,7 @@ class NecroskitterTriggeredAbility extends TriggeredAbilityImpl { if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { Permanent permanent = zEvent.getTarget(); if (permanent != null - && permanent.getCounters().containsKey(CounterType.M1M1) + && permanent.getCounters(game).containsKey(CounterType.M1M1) && game.getOpponents(controllerId).contains(permanent.getControllerId())) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getTargetId(), game.getState().getZoneChangeCounter(event.getTargetId()))); diff --git a/Mage.Sets/src/mage/sets/exodus/SpikeCannibal.java b/Mage.Sets/src/mage/sets/exodus/SpikeCannibal.java index 385b3ca0c4..65756c41f3 100644 --- a/Mage.Sets/src/mage/sets/exodus/SpikeCannibal.java +++ b/Mage.Sets/src/mage/sets/exodus/SpikeCannibal.java @@ -104,7 +104,7 @@ class SpikeCannibalEffect extends OneShotEffect { if (sourcePermanent != null) { for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (creature != sourcePermanent) { - int numberCounters = creature.getCounters().getCount(CounterType.P1P1); + int numberCounters = creature.getCounters(game).getCount(CounterType.P1P1); if (numberCounters > 0) { creature.removeCounters(CounterType.P1P1.getName(), numberCounters, game); countersRemoved += numberCounters; diff --git a/Mage.Sets/src/mage/sets/fatereforged/DaghatarTheAdamant.java b/Mage.Sets/src/mage/sets/fatereforged/DaghatarTheAdamant.java index 327de83e8c..cdd50b828a 100644 --- a/Mage.Sets/src/mage/sets/fatereforged/DaghatarTheAdamant.java +++ b/Mage.Sets/src/mage/sets/fatereforged/DaghatarTheAdamant.java @@ -111,7 +111,7 @@ class MoveCounterFromTargetToTargetEffect extends OneShotEffect { MageObject sourceObject = game.getObject(source.getSourceId()); if (sourceObject != null && controller != null) { Permanent fromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source)); - if (fromPermanent != null && fromPermanent.getCounters().getCount(CounterType.P1P1) > 0) { + if (fromPermanent != null && fromPermanent.getCounters(game).getCount(CounterType.P1P1) > 0) { Permanent toPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (toPermanent != null) { fromPermanent.removeCounters(CounterType.P1P1.createInstance(), game); diff --git a/Mage.Sets/src/mage/sets/fifthdawn/EngineeredExplosives.java b/Mage.Sets/src/mage/sets/fifthdawn/EngineeredExplosives.java index e8d7576e5f..cdf2d19367 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/EngineeredExplosives.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/EngineeredExplosives.java @@ -99,7 +99,7 @@ class EngineeredExplosivesEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { MageObject engineeredExplosives = game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); if(engineeredExplosives != null && engineeredExplosives instanceof Permanent){ - int count = ((Permanent)engineeredExplosives).getCounters().getCount(CounterType.CHARGE); + int count = ((Permanent)engineeredExplosives).getCounters(game).getCount(CounterType.CHARGE); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if(permanent.getConvertedManaCost() == count){ permanent.destroy(source.getSourceId(), game, false); diff --git a/Mage.Sets/src/mage/sets/fourthedition/ClockworkAvian.java b/Mage.Sets/src/mage/sets/fourthedition/ClockworkAvian.java index 62e3877f28..87815b41c4 100644 --- a/Mage.Sets/src/mage/sets/fourthedition/ClockworkAvian.java +++ b/Mage.Sets/src/mage/sets/fourthedition/ClockworkAvian.java @@ -100,7 +100,7 @@ class AvianAddCountersSourceEffect extends AddCountersSourceEffect { @Override public boolean apply(Game game, Ability source) { //record how many counters - Counters permCounters = game.getPermanent(source.getSourceId()).getCounters(); + Counters permCounters = game.getPermanent(source.getSourceId()).getCounters(game); int countersWas = permCounters.getCount(CounterType.P1P0); if (countersWas < 4){ super.apply(game, source); diff --git a/Mage.Sets/src/mage/sets/futuresight/CoalitionRelic.java b/Mage.Sets/src/mage/sets/futuresight/CoalitionRelic.java index 8577a414ce..adc57e3fd9 100644 --- a/Mage.Sets/src/mage/sets/futuresight/CoalitionRelic.java +++ b/Mage.Sets/src/mage/sets/futuresight/CoalitionRelic.java @@ -97,7 +97,7 @@ class CoalitionRelicEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Player player = game.getPlayer(source.getControllerId()); if (sourcePermanent != null && player != null) { - int chargeCounters = sourcePermanent.getCounters().getCount(CounterType.CHARGE); + int chargeCounters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE); sourcePermanent.removeCounters(CounterType.CHARGE.createInstance(chargeCounters), game); Mana mana = new Mana(); ChoiceColor choice = new ChoiceColor(); diff --git a/Mage.Sets/src/mage/sets/futuresight/DustOfMoments.java b/Mage.Sets/src/mage/sets/futuresight/DustOfMoments.java index 1736ded268..fe3eef96e3 100644 --- a/Mage.Sets/src/mage/sets/futuresight/DustOfMoments.java +++ b/Mage.Sets/src/mage/sets/futuresight/DustOfMoments.java @@ -138,7 +138,7 @@ public class DustOfMoments extends CardImpl { if (permFilter.match(card, game)) { final String counterName = counter.getName(); if (shouldRemoveCounters()) { - final Counter existingCounterOfSameType = card.getCounters().get(counterName); + final Counter existingCounterOfSameType = card.getCounters(game).get(counterName); final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount()); final Counter modifiedCounter = new Counter(counterName, countersToRemove); card.removeCounters(modifiedCounter, game); diff --git a/Mage.Sets/src/mage/sets/futuresight/LostAuramancers.java b/Mage.Sets/src/mage/sets/futuresight/LostAuramancers.java index 513cac67db..d0a2b3b9e1 100644 --- a/Mage.Sets/src/mage/sets/futuresight/LostAuramancers.java +++ b/Mage.Sets/src/mage/sets/futuresight/LostAuramancers.java @@ -104,7 +104,7 @@ class LostAuramancersAbility extends PutIntoGraveFromBattlefieldSourceTriggeredA public boolean checkTrigger(GameEvent event, Game game) { if (super.checkTrigger(event, game)) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (!permanent.getCounters().containsKey(CounterType.TIME) || permanent.getCounters().getCount(CounterType.TIME) == 0) { + if (!permanent.getCounters(game).containsKey(CounterType.TIME) || permanent.getCounters(game).getCount(CounterType.TIME) == 0) { return true; } } diff --git a/Mage.Sets/src/mage/sets/gatecrash/Bioshift.java b/Mage.Sets/src/mage/sets/gatecrash/Bioshift.java index bb89a69a92..2f79caf786 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/Bioshift.java +++ b/Mage.Sets/src/mage/sets/gatecrash/Bioshift.java @@ -45,7 +45,6 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.game.stack.StackObject; import mage.players.Player; -import mage.target.Target; import mage.target.common.TargetCreaturePermanent; /** @@ -114,7 +113,7 @@ class MoveCounterFromTargetToTargetEffect extends OneShotEffect { if (fromPermanent == null || toPermanent == null || !fromPermanent.getControllerId().equals(toPermanent.getControllerId())) { return false; } - int amountCounters = fromPermanent.getCounters().getCount(CounterType.P1P1); + int amountCounters = fromPermanent.getCounters(game).getCount(CounterType.P1P1); if (amountCounters > 0) { int amountToMove = controller.getAmount(0, amountCounters, "How many counters do you want to move?", game); if (amountToMove > 0) { diff --git a/Mage.Sets/src/mage/sets/gatecrash/SimicFluxmage.java b/Mage.Sets/src/mage/sets/gatecrash/SimicFluxmage.java index ad91e5ba28..e74b6581c5 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/SimicFluxmage.java +++ b/Mage.Sets/src/mage/sets/gatecrash/SimicFluxmage.java @@ -101,7 +101,7 @@ class MoveCounterFromSourceToTargetEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - if (sourcePermanent != null && sourcePermanent.getCounters().getCount(CounterType.P1P1) > 0) { + if (sourcePermanent != null && sourcePermanent.getCounters(game).getCount(CounterType.P1P1) > 0) { Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source)); if (targetPermanent != null) { sourcePermanent.removeCounters(CounterType.P1P1.createInstance(), game); diff --git a/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java b/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java index 7372a9e86b..5ed4f834f0 100644 --- a/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java +++ b/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java @@ -100,7 +100,7 @@ class EssenceOfTheWildEffect extends ReplacementEffectImpl { Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourceObject != null) { Permanent permanentReset = sourceObject.copy(); - permanentReset.getCounters().clear(); + permanentReset.getCounters(game).clear(); permanentReset.getPower().resetToBaseValue(); permanentReset.getToughness().resetToBaseValue(); game.addEffect(new CopyEffect(Duration.Custom, permanentReset, event.getTargetId()), source); diff --git a/Mage.Sets/src/mage/sets/innistrad/GarrukRelentless.java b/Mage.Sets/src/mage/sets/innistrad/GarrukRelentless.java index 1f43014bc5..5a27be7ae0 100644 --- a/Mage.Sets/src/mage/sets/innistrad/GarrukRelentless.java +++ b/Mage.Sets/src/mage/sets/innistrad/GarrukRelentless.java @@ -112,7 +112,7 @@ class GarrukRelentlessTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (event.getTargetId().equals(sourceId)) { Permanent permanent = game.getPermanent(sourceId); - if (permanent != null && !permanent.isTransformed() && permanent.getCounters().getCount(CounterType.LOYALTY) <= 2) { + if (permanent != null && !permanent.isTransformed() && permanent.getCounters(game).getCount(CounterType.LOYALTY) <= 2) { return true; } } diff --git a/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java b/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java index 39a459d495..5b29b87244 100644 --- a/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java +++ b/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java @@ -173,7 +173,7 @@ class GutterGrimeCounters implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent p = game.getPermanent(sourceId); if (p != null) { - return p.getCounters().getCount(CounterType.SLIME); + return p.getCounters(game).getCount(CounterType.SLIME); } return 0; } diff --git a/Mage.Sets/src/mage/sets/innistrad/LudevicsTestSubject.java b/Mage.Sets/src/mage/sets/innistrad/LudevicsTestSubject.java index 63d53328be..44c51fea78 100644 --- a/Mage.Sets/src/mage/sets/innistrad/LudevicsTestSubject.java +++ b/Mage.Sets/src/mage/sets/innistrad/LudevicsTestSubject.java @@ -96,8 +96,8 @@ class LudevicsTestSubjectEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent p = game.getPermanent(source.getSourceId()); if (p != null) { - if (p.getCounters().getCount(CounterType.HATCHLING) >= 5) { - p.removeCounters(CounterType.HATCHLING.getName(), p.getCounters().getCount(CounterType.HATCHLING), game); + if (p.getCounters(game).getCount(CounterType.HATCHLING) >= 5) { + p.removeCounters(CounterType.HATCHLING.getName(), p.getCounters(game).getCount(CounterType.HATCHLING), game); TransformSourceEffect effect = new TransformSourceEffect(true); return effect.apply(game, source); } diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/SageOfHours.java b/Mage.Sets/src/mage/sets/journeyintonyx/SageOfHours.java index 49ed1548fa..1d9bd57025 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/SageOfHours.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/SageOfHours.java @@ -104,7 +104,7 @@ class SageOfHoursCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getSourceId()); if (permanent != null) { - this.removedCounters = permanent.getCounters().getCount(CounterType.P1P1); + this.removedCounters = permanent.getCounters(game).getCount(CounterType.P1P1); if (this.removedCounters > 0) { permanent.removeCounters(CounterType.P1P1.createInstance(this.removedCounters), game); } diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/SolidarityOfHeroes.java b/Mage.Sets/src/mage/sets/journeyintonyx/SolidarityOfHeroes.java index 12aac92253..63db68f8c7 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/SolidarityOfHeroes.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/SolidarityOfHeroes.java @@ -93,7 +93,7 @@ class SolidarityOfHeroesEffect extends OneShotEffect { for (UUID targetId: getTargetPointer().getTargets(game, source)) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - int existingCounters = permanent.getCounters().getCount(CounterType.P1P1); + int existingCounters = permanent.getCounters(game).getCount(CounterType.P1P1); if (existingCounters > 0) { permanent.addCounters(CounterType.P1P1.createInstance(existingCounters), game); } diff --git a/Mage.Sets/src/mage/sets/judgment/PhantomCentaur.java b/Mage.Sets/src/mage/sets/judgment/PhantomCentaur.java index 63680d0df0..88ad9b7801 100644 --- a/Mage.Sets/src/mage/sets/judgment/PhantomCentaur.java +++ b/Mage.Sets/src/mage/sets/judgment/PhantomCentaur.java @@ -136,7 +136,7 @@ class PhantomCentaurPreventionEffect extends PreventionEffectImpl { } } - if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); sb.append("Removed a +1/+1 counter "); diff --git a/Mage.Sets/src/mage/sets/judgment/PhantomFlock.java b/Mage.Sets/src/mage/sets/judgment/PhantomFlock.java index 9f949c7ef0..c8de420247 100644 --- a/Mage.Sets/src/mage/sets/judgment/PhantomFlock.java +++ b/Mage.Sets/src/mage/sets/judgment/PhantomFlock.java @@ -127,7 +127,7 @@ class PhantomFlockPreventionEffect extends PreventionEffectImpl { } } - if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); sb.append("Removed a +1/+1 counter "); diff --git a/Mage.Sets/src/mage/sets/judgment/PhantomNishoba.java b/Mage.Sets/src/mage/sets/judgment/PhantomNishoba.java index 51cb80804d..06c79c8025 100644 --- a/Mage.Sets/src/mage/sets/judgment/PhantomNishoba.java +++ b/Mage.Sets/src/mage/sets/judgment/PhantomNishoba.java @@ -131,7 +131,7 @@ class PhantomNishobaPreventionEffect extends PreventionEffectImpl { } } - if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); sb.append("Removed a +1/+1 counter "); diff --git a/Mage.Sets/src/mage/sets/judgment/PhantomNomad.java b/Mage.Sets/src/mage/sets/judgment/PhantomNomad.java index 3c10caeb7a..cbb20cd675 100644 --- a/Mage.Sets/src/mage/sets/judgment/PhantomNomad.java +++ b/Mage.Sets/src/mage/sets/judgment/PhantomNomad.java @@ -126,7 +126,7 @@ class PhantomNomadPreventionEffect extends PreventionEffectImpl { } } - if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); sb.append("Removed a +1/+1 counter "); diff --git a/Mage.Sets/src/mage/sets/judgment/PhantomTiger.java b/Mage.Sets/src/mage/sets/judgment/PhantomTiger.java index 4c488085ad..de1b49816f 100644 --- a/Mage.Sets/src/mage/sets/judgment/PhantomTiger.java +++ b/Mage.Sets/src/mage/sets/judgment/PhantomTiger.java @@ -122,7 +122,7 @@ class PhantomTigerPreventionEffect extends PreventionEffectImpl { } } - if (removeCounter && permanent.getCounters().getCount(CounterType.P1P1) > 0) { + if (removeCounter && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); sb.append("Removed a +1/+1 counter "); diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/BringLow.java b/Mage.Sets/src/mage/sets/khansoftarkir/BringLow.java index 3ecb45a596..7dfee4808a 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/BringLow.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/BringLow.java @@ -83,7 +83,7 @@ class TargetHasCounterCondition implements Condition { if (!source.getTargets().isEmpty()) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - return permanent.getCounters().containsKey(counterType); + return permanent.getCounters(game).containsKey(counterType); } } return false; diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/RiteOfTheSerpent.java b/Mage.Sets/src/mage/sets/khansoftarkir/RiteOfTheSerpent.java index 378c9afbe6..49aacd513d 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/RiteOfTheSerpent.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/RiteOfTheSerpent.java @@ -89,7 +89,7 @@ class RiteOfTheSerpentEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent targetCreature = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); if (targetCreature != null) { - if (targetCreature.getCounters().containsKey(CounterType.P1P1)) { + if (targetCreature.getCounters(game).containsKey(CounterType.P1P1)) { new CreateTokenEffect(new SnakeToken("KTK")).apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/sets/limitedalpha/ClockworkBeast.java b/Mage.Sets/src/mage/sets/limitedalpha/ClockworkBeast.java index fe322b6c50..c77adb96b1 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/ClockworkBeast.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/ClockworkBeast.java @@ -125,7 +125,7 @@ class BeastAddCountersSourceEffect extends AddCountersSourceEffect { @Override public boolean apply(Game game, Ability source) { - Counters permCounters = game.getPermanent(source.getSourceId()).getCounters(); + Counters permCounters = game.getPermanent(source.getSourceId()).getCounters(game); int countersWas = permCounters.getCount(CounterType.P1P0); if (countersWas < 7){ super.apply(game, source); diff --git a/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java index 8604c8ab21..d3a2e72c25 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java +++ b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java @@ -105,7 +105,7 @@ class AquitectsWillEffect extends BecomesBasicLandTargetEffect { if (land == null) { // if permanent left battlefield the effect can be removed because it was only valid for that object this.discard(); - } else if (land.getCounters().getCount(CounterType.FLOOD) > 0) { + } else if (land.getCounters(game).getCount(CounterType.FLOOD) > 0) { // only if Flood counter is on the object it becomes an Island.(it would be possible to remove and return the counters with e.g. Fate Transfer if the land becomes a creature too) super.apply(layer, sublayer, source, game); } diff --git a/Mage.Sets/src/mage/sets/lorwyn/AshlingThePilgrim.java b/Mage.Sets/src/mage/sets/lorwyn/AshlingThePilgrim.java index cefdfba27c..d25c366a7e 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/AshlingThePilgrim.java +++ b/Mage.Sets/src/mage/sets/lorwyn/AshlingThePilgrim.java @@ -122,7 +122,7 @@ class AshlingThePilgrimEffect extends OneShotEffect { } info.activations++; if (info.activations == 3) { - int damage = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int damage = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (damage > 0) { sourcePermanent.removeCounters(CounterType.P1P1.getName(), damage, game); return new DamageEverythingEffect(damage, new FilterCreaturePermanent()).apply(game, source); diff --git a/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java b/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java index 6cf3a7c724..5363d13833 100644 --- a/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java +++ b/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java @@ -100,7 +100,7 @@ public class PhylacteryLich extends CardImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { for (Permanent perm : game.getBattlefield().getAllActivePermanents(controllerId)) { - if (perm.getCounters().getCount("phylactery") > 0) { + if (perm.getCounters(game).getCount("phylactery") > 0) { return false; } } diff --git a/Mage.Sets/src/mage/sets/magic2012/PrimordialHydra.java b/Mage.Sets/src/mage/sets/magic2012/PrimordialHydra.java index f6f2386327..fb184e046b 100644 --- a/Mage.Sets/src/mage/sets/magic2012/PrimordialHydra.java +++ b/Mage.Sets/src/mage/sets/magic2012/PrimordialHydra.java @@ -103,7 +103,7 @@ class PrimordialHydraDoubleEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { - int amount = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (amount > 0) { sourcePermanent.addCounters(CounterType.P1P1.createInstance(amount), game); } diff --git a/Mage.Sets/src/mage/sets/magic2013/SlumberingDragon.java b/Mage.Sets/src/mage/sets/magic2013/SlumberingDragon.java index 22702ac44f..4cd96d6799 100644 --- a/Mage.Sets/src/mage/sets/magic2013/SlumberingDragon.java +++ b/Mage.Sets/src/mage/sets/magic2013/SlumberingDragon.java @@ -96,7 +96,7 @@ class SlumberingDragonEffect extends RestrictionEffect { @Override public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent.getId().equals(source.getSourceId())) { - if (permanent.getCounters().getCount(CounterType.P1P1) >= 5) { + if (permanent.getCounters(game).getCount(CounterType.P1P1) >= 5) { return false; } return true; diff --git a/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java b/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java index 5a342a704b..2c9a4e37a8 100644 --- a/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java +++ b/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java @@ -154,7 +154,7 @@ class BoostCreatureEffectEffect extends ContinuousEffectImpl { if (subtype != null) { for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { if (perm.hasSubtype(subtype, game)) { - int boost = permanent.getCounters().getCount(CounterType.CHARGE); + int boost = permanent.getCounters(game).getCount(CounterType.CHARGE); perm.addPower(boost); perm.addToughness(boost); } diff --git a/Mage.Sets/src/mage/sets/magic2014/KalonianHydra.java b/Mage.Sets/src/mage/sets/magic2014/KalonianHydra.java index e76a552a26..9f801bdb5e 100644 --- a/Mage.Sets/src/mage/sets/magic2014/KalonianHydra.java +++ b/Mage.Sets/src/mage/sets/magic2014/KalonianHydra.java @@ -108,7 +108,7 @@ class KalonianHydraEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent permanent : permanents) { - int existingCounters = permanent.getCounters().getCount(CounterType.P1P1); + int existingCounters = permanent.getCounters(game).getCount(CounterType.P1P1); if (existingCounters > 0) { permanent.addCounters(CounterType.P1P1.createInstance(existingCounters), game); } diff --git a/Mage.Sets/src/mage/sets/magic2015/ChasmSkulker.java b/Mage.Sets/src/mage/sets/magic2015/ChasmSkulker.java index 3f46ea7843..8594a94364 100644 --- a/Mage.Sets/src/mage/sets/magic2015/ChasmSkulker.java +++ b/Mage.Sets/src/mage/sets/magic2015/ChasmSkulker.java @@ -101,7 +101,7 @@ class ChasmSkulkerEffect extends OneShotEffect { if (controller != null) { Permanent permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); if (permanent != null) { - int counters = permanent.getCounters().getCount(CounterType.P1P1); + int counters = permanent.getCounters(game).getCount(CounterType.P1P1); if (counters > 0) { return new CreateTokenEffect(new ChasmSkulkerSquidToken(), counters).apply(game, source); } diff --git a/Mage.Sets/src/mage/sets/magic2015/YisanTheWandererBard.java b/Mage.Sets/src/mage/sets/magic2015/YisanTheWandererBard.java index 56c2762021..f799200c7c 100644 --- a/Mage.Sets/src/mage/sets/magic2015/YisanTheWandererBard.java +++ b/Mage.Sets/src/mage/sets/magic2015/YisanTheWandererBard.java @@ -105,7 +105,7 @@ class YisanTheWandererBardEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourcePermanent != null && controller != null) { - int newConvertedCost = sourcePermanent.getCounters().getCount("verse"); + int newConvertedCost = sourcePermanent.getCounters(game).getCount("verse"); FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost); filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, newConvertedCost)); filter.add(new CardTypePredicate(CardType.CREATURE)); diff --git a/Mage.Sets/src/mage/sets/magicplayerrewards/PowderKeg.java b/Mage.Sets/src/mage/sets/magicplayerrewards/PowderKeg.java index fa93f70731..3e32f46a69 100644 --- a/Mage.Sets/src/mage/sets/magicplayerrewards/PowderKeg.java +++ b/Mage.Sets/src/mage/sets/magicplayerrewards/PowderKeg.java @@ -93,7 +93,7 @@ class PowderKegEffect extends OneShotEffect { } } - int count = p.getCounters().getCount(CounterType.FUSE); + int count = p.getCounters(game).getCount(CounterType.FUSE); for (Permanent perm: game.getBattlefield().getAllActivePermanents()) { if (perm.getConvertedManaCost() == count && ((perm.getCardType().contains(CardType.ARTIFACT)) || (perm.getCardType().contains(CardType.CREATURE)))) { diff --git a/Mage.Sets/src/mage/sets/masterseditioniii/DivineIntervention.java b/Mage.Sets/src/mage/sets/masterseditioniii/DivineIntervention.java index 2fec7ff9d3..14ede09f09 100644 --- a/Mage.Sets/src/mage/sets/masterseditioniii/DivineIntervention.java +++ b/Mage.Sets/src/mage/sets/masterseditioniii/DivineIntervention.java @@ -158,7 +158,7 @@ public class DivineIntervention extends CardImpl { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && sourcePermanent != null) { - if (game.getState().getZone(sourcePermanent.getId()) == Zone.BATTLEFIELD && sourcePermanent.getCounters().getCount(CounterType.INTERVENTION) == 0) { + if (game.getState().getZone(sourcePermanent.getId()) == Zone.BATTLEFIELD && sourcePermanent.getCounters(game).getCount(CounterType.INTERVENTION) == 0) { game.setDraw(controller.getId()); for (UUID player : game.getOpponents(controller.getId())) { diff --git a/Mage.Sets/src/mage/sets/masterseditioniv/Cyclone.java b/Mage.Sets/src/mage/sets/masterseditioniv/Cyclone.java index 80c3684f06..ef32c84afc 100644 --- a/Mage.Sets/src/mage/sets/masterseditioniv/Cyclone.java +++ b/Mage.Sets/src/mage/sets/masterseditioniv/Cyclone.java @@ -93,7 +93,7 @@ class CycloneEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); - int total = permanent.getCounters().getCount(CounterType.WIND); + int total = permanent.getCounters(game).getCount(CounterType.WIND); String greens = ""; diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/BlackMarket.java b/Mage.Sets/src/mage/sets/mercadianmasques/BlackMarket.java index 7f37e44083..664d7e94a5 100644 --- a/Mage.Sets/src/mage/sets/mercadianmasques/BlackMarket.java +++ b/Mage.Sets/src/mage/sets/mercadianmasques/BlackMarket.java @@ -91,7 +91,7 @@ class BlackMarketEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Player player = game.getPlayer(source.getControllerId()); if (sourcePermanent != null && player != null) { - int chargeCounters = sourcePermanent.getCounters().getCount(CounterType.CHARGE); + int chargeCounters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE); if (chargeCounters > 0){ player.getManaPool().addMana(Mana.BlackMana(chargeCounters), game, source); return true; diff --git a/Mage.Sets/src/mage/sets/mirrodin/AltarOfShadows.java b/Mage.Sets/src/mage/sets/mirrodin/AltarOfShadows.java index e9cab6c8b7..bd7369c932 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/AltarOfShadows.java +++ b/Mage.Sets/src/mage/sets/mirrodin/AltarOfShadows.java @@ -101,7 +101,7 @@ class AltarOfShadowsEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Player player = game.getPlayer(source.getControllerId()); if (sourcePermanent != null && player != null) { - int chargeCounters = sourcePermanent.getCounters().getCount(CounterType.CHARGE); + int chargeCounters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE); if (chargeCounters > 0){ player.getManaPool().addMana(Mana.BlackMana(chargeCounters), game, source); return true; diff --git a/Mage.Sets/src/mage/sets/mirrodin/ChaliceOfTheVoid.java b/Mage.Sets/src/mage/sets/mirrodin/ChaliceOfTheVoid.java index 8d67325035..907b9ec9fc 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/ChaliceOfTheVoid.java +++ b/Mage.Sets/src/mage/sets/mirrodin/ChaliceOfTheVoid.java @@ -97,7 +97,7 @@ class ChaliceOfTheVoidTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { Permanent chalice = game.getPermanent(getSourceId()); Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && chalice != null && spell.getConvertedManaCost() == chalice.getCounters().getCount(CounterType.CHARGE)) { + if (spell != null && chalice != null && spell.getConvertedManaCost() == chalice.getCounters(game).getCount(CounterType.CHARGE)) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getTargetId())); } diff --git a/Mage.Sets/src/mage/sets/mirrodin/JinxedChoker.java b/Mage.Sets/src/mage/sets/mirrodin/JinxedChoker.java index 9ce1f78d59..aa37521d92 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/JinxedChoker.java +++ b/Mage.Sets/src/mage/sets/mirrodin/JinxedChoker.java @@ -127,7 +127,7 @@ class JinxedChokerDynamicValue implements DynamicValue { int count = 0; if (permanent != null){ - count = permanent.getCounters().getCount(CounterType.CHARGE); + count = permanent.getCounters(game).getCount(CounterType.CHARGE); } return count; } @@ -169,7 +169,7 @@ class JinxedChokerCounterEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (controller != null && sourcePermanent != null) { - if (!sourcePermanent.getCounters().containsKey(CounterType.CHARGE) || controller.chooseUse(outcome, "Put a charge counter on? (No removes one)", source, game)) { + if (!sourcePermanent.getCounters(game).containsKey(CounterType.CHARGE) || controller.chooseUse(outcome, "Put a charge counter on? (No removes one)", source, game)) { return new AddCountersSourceEffect(CounterType.CHARGE.createInstance(), true).apply(game, source); } else { return new RemoveCounterSourceEffect(CounterType.CHARGE.createInstance()).apply(game, source); diff --git a/Mage.Sets/src/mage/sets/mirrodin/OblivionStone.java b/Mage.Sets/src/mage/sets/mirrodin/OblivionStone.java index c48b20ca4a..f74c4ec9c9 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/OblivionStone.java +++ b/Mage.Sets/src/mage/sets/mirrodin/OblivionStone.java @@ -90,13 +90,13 @@ class OblivionStoneEffect extends OneShotEffect { @java.lang.Override public boolean apply(Game game, Ability source) { for (Permanent p : game.getBattlefield().getAllActivePermanents()) { - if (!(p.getCardType().contains(CardType.LAND) || p.getCounters().containsKey(CounterType.FATE))) { + if (!(p.getCardType().contains(CardType.LAND) || p.getCounters(game).containsKey(CounterType.FATE))) { p.destroy(source.getSourceId(), game, false); } } for (Permanent p : game.getBattlefield().getAllActivePermanents()) { - if (p.getCounters().containsKey(CounterType.FATE)) { - p.removeCounters(CounterType.FATE.getName(), p.getCounters().getCount(CounterType.FATE), game); + if (p.getCounters(game).containsKey(CounterType.FATE)) { + p.removeCounters(CounterType.FATE.getName(), p.getCounters(game).getCount(CounterType.FATE), game); } } return true; diff --git a/Mage.Sets/src/mage/sets/morningtide/KinsbaileBorderguard.java b/Mage.Sets/src/mage/sets/morningtide/KinsbaileBorderguard.java index 5080aa2baa..14805d6f17 100644 --- a/Mage.Sets/src/mage/sets/morningtide/KinsbaileBorderguard.java +++ b/Mage.Sets/src/mage/sets/morningtide/KinsbaileBorderguard.java @@ -92,7 +92,7 @@ class AllCountersCount implements DynamicValue { Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(sourceAbility.getSourceId()); if(sourcePermanent != null) { int total = 0; - for(Counter counter : sourcePermanent.getCounters().values()) { + for(Counter counter : sourcePermanent.getCounters(game).values()) { total += counter.getCount(); } return total; diff --git a/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java b/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java index 085cd722d3..46be4f2a8d 100644 --- a/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java +++ b/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java @@ -157,7 +157,7 @@ class OonasBlackguardTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (((DamagedPlayerEvent) event).isCombatDamage()) { Permanent creature = game.getPermanent(event.getSourceId()); - if (creature != null && creature.getControllerId().equals(getControllerId()) && creature.getCounters().getCount(CounterType.P1P1) > 0) { + if (creature != null && creature.getControllerId().equals(getControllerId()) && creature.getCounters(game).getCount(CounterType.P1P1) > 0) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } diff --git a/Mage.Sets/src/mage/sets/nemesis/TangleWire.java b/Mage.Sets/src/mage/sets/nemesis/TangleWire.java index 53644de7d9..065bbd6304 100644 --- a/Mage.Sets/src/mage/sets/nemesis/TangleWire.java +++ b/Mage.Sets/src/mage/sets/nemesis/TangleWire.java @@ -103,7 +103,7 @@ class TangleWireEffect extends OneShotEffect { } int targetCount = game.getBattlefield().countAll(filter, player.getId(), game); - int counterCount = permanent.getCounters().getCount(CounterType.FADE); + int counterCount = permanent.getCounters(game).getCount(CounterType.FADE); int amount = Math.min(counterCount, targetCount); Target target = new TargetControlledPermanent(amount, amount, filter, true); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/GremlinMine.java b/Mage.Sets/src/mage/sets/newphyrexia/GremlinMine.java index 53c8d39de8..02ecda3ba9 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/GremlinMine.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/GremlinMine.java @@ -110,7 +110,7 @@ class GremlinMineEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (player != null && permanent != null) { - int existingCount = permanent.getCounters().getCount(CounterType.CHARGE); + int existingCount = permanent.getCounters(game).getCount(CounterType.CHARGE); if (existingCount > 0) { Choice choice = new ChoiceImpl(); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/HexParasite.java b/Mage.Sets/src/mage/sets/newphyrexia/HexParasite.java index 75cc958ff7..f67e1ff620 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/HexParasite.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/HexParasite.java @@ -99,14 +99,14 @@ class HexParasiteEffect extends OneShotEffect { if (permanent != null && player != null) { int toRemove = source.getManaCostsToPay().getX(); int removed = 0; - String[] counterNames = permanent.getCounters().keySet().toArray(new String[0]); + String[] counterNames = permanent.getCounters(game).keySet().toArray(new String[0]); for (String counterName : counterNames) { if (player.chooseUse(Outcome.Neutral, "Do you want to remove " + counterName + " counters?", source, game)) { - if (permanent.getCounters().get(counterName).getCount() == 1 || toRemove == 1) { + if (permanent.getCounters(game).get(counterName).getCount() == 1 || toRemove == 1) { permanent.removeCounters(counterName, 1, game); removed++; } else { - int amount = player.getAmount(1, Math.min(permanent.getCounters().get(counterName).getCount(), toRemove - removed), "How many?", game); + int amount = player.getAmount(1, Math.min(permanent.getCounters(game).get(counterName).getCount(), toRemove - removed), "How many?", game); if (amount > 0) { removed += amount; permanent.removeCounters(counterName, amount, game); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java b/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java index ac8b220380..9319ba4ef5 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java @@ -114,7 +114,7 @@ class ShrineOfPiercingVisionEffect extends OneShotEffect { if (player == null || permanent == null) { return false; } - int count = permanent.getCounters().getCount(CounterType.CHARGE); + int count = permanent.getCounters(game).getCount(CounterType.CHARGE); Cards cards = new CardsImpl(); count = Math.min(player.getLibrary().size(), count); diff --git a/Mage.Sets/src/mage/sets/oathofthegatewatch/GladehartCavalry.java b/Mage.Sets/src/mage/sets/oathofthegatewatch/GladehartCavalry.java index 9e535d57ee..199b17ad02 100644 --- a/Mage.Sets/src/mage/sets/oathofthegatewatch/GladehartCavalry.java +++ b/Mage.Sets/src/mage/sets/oathofthegatewatch/GladehartCavalry.java @@ -102,7 +102,7 @@ class GladehartCavalryTriggeredAbility extends TriggeredAbilityImpl { if (permanent != null && permanent.getControllerId().equals(this.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE) - && permanent.getCounters().getCount(CounterType.P1P1) > 0) { + && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { return true; } } diff --git a/Mage.Sets/src/mage/sets/odyssey/BombSquad.java b/Mage.Sets/src/mage/sets/odyssey/BombSquad.java index 87bf9c3083..f6b94f2535 100644 --- a/Mage.Sets/src/mage/sets/odyssey/BombSquad.java +++ b/Mage.Sets/src/mage/sets/odyssey/BombSquad.java @@ -122,7 +122,7 @@ class BombSquadTriggeredAbility extends TriggeredAbilityImpl { if (event.getData().equals(CounterType.FUSE.getName())) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent != null && filter.match(permanent, game)) { - if (4 <= permanent.getCounters().getCount(CounterType.FUSE)) { + if (4 <= permanent.getCounters(game).getCount(CounterType.FUSE)) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(permanent.getId())); } @@ -159,7 +159,7 @@ class BombSquadDamgeEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (creature != null) { - creature.removeCounters(CounterType.FUSE.getName(), creature.getCounters().getCount(CounterType.FUSE), game); + creature.removeCounters(CounterType.FUSE.getName(), creature.getCounters(game).getCount(CounterType.FUSE), game); creature.destroy(source.getSourceId(), game, false); } if (creature == null) { diff --git a/Mage.Sets/src/mage/sets/odyssey/DelayingShield.java b/Mage.Sets/src/mage/sets/odyssey/DelayingShield.java index 2e7965676c..29e69e6685 100644 --- a/Mage.Sets/src/mage/sets/odyssey/DelayingShield.java +++ b/Mage.Sets/src/mage/sets/odyssey/DelayingShield.java @@ -134,7 +134,7 @@ class DelayingShieldUpkeepEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (controller != null && permanent != null) { - int numCounters = permanent.getCounters().getCount(CounterType.DELAY); + int numCounters = permanent.getCounters(game).getCount(CounterType.DELAY); permanent.removeCounters(CounterType.DELAY.createInstance(numCounters), game); for (int i = numCounters; i > 0; i--) { if (controller.chooseUse(Outcome.Benefit, "Pay {1}{W}? (" + i + " counters left to pay)", source, game)) { diff --git a/Mage.Sets/src/mage/sets/onslaught/Aurification.java b/Mage.Sets/src/mage/sets/onslaught/Aurification.java index 92479ceca5..c864f15cfe 100644 --- a/Mage.Sets/src/mage/sets/onslaught/Aurification.java +++ b/Mage.Sets/src/mage/sets/onslaught/Aurification.java @@ -155,7 +155,7 @@ public class Aurification extends CardImpl { public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(CardType.CREATURE)) { if (permanent != null){ - permanent.getCounters().removeAllCounters(CounterType.GOLD); + permanent.getCounters(game).removeAllCounters(CounterType.GOLD); } } return true; diff --git a/Mage.Sets/src/mage/sets/planarchaos/FungalBehemoth.java b/Mage.Sets/src/mage/sets/planarchaos/FungalBehemoth.java index 41e396f1c4..d6191eea3d 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/FungalBehemoth.java +++ b/Mage.Sets/src/mage/sets/planarchaos/FungalBehemoth.java @@ -124,7 +124,7 @@ class P1P1CountersOnControlledCreaturesCount implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), sourceAbility.getControllerId(), game)) { - count += permanent.getCounters().getCount(CounterType.P1P1); + count += permanent.getCounters(game).getCount(CounterType.P1P1); } return count; } diff --git a/Mage.Sets/src/mage/sets/ravnica/Necroplasm.java b/Mage.Sets/src/mage/sets/ravnica/Necroplasm.java index 3327d28d26..21b1eb9ec1 100644 --- a/Mage.Sets/src/mage/sets/ravnica/Necroplasm.java +++ b/Mage.Sets/src/mage/sets/ravnica/Necroplasm.java @@ -103,7 +103,7 @@ class NecroplasmEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (player != null && sourcePermanent != null) { - int numCounters = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int numCounters = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); FilterCreaturePermanent filter = new FilterCreaturePermanent(); filter.add(new ConvertedManaCostPredicate(ComparisonType.Equal, numCounters)); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { diff --git a/Mage.Sets/src/mage/sets/returntoravnica/AzorsElocutors.java b/Mage.Sets/src/mage/sets/returntoravnica/AzorsElocutors.java index 39f8c09982..1507245f11 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/AzorsElocutors.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/AzorsElocutors.java @@ -129,7 +129,7 @@ class AzorsElocutorsEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.addCounters(new Counter("filibuster"), game); - if (permanent.getCounters().getCount("filibuster") > 4) { + if (permanent.getCounters(game).getCount("filibuster") > 4) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { player.won(game); diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/SphinxBoneWand.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/SphinxBoneWand.java index cda66dbda5..7352bac0e9 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/SphinxBoneWand.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/SphinxBoneWand.java @@ -99,7 +99,7 @@ class SphinxBoneWandEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { sourcePermanent.addCounters(CounterType.CHARGE.createInstance(), game); - int amount = sourcePermanent.getCounters().getCount(CounterType.CHARGE); + int amount = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE); Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/ThoughtGorger.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/ThoughtGorger.java index d9fe95cd8f..64cf6a6e4f 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/ThoughtGorger.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/ThoughtGorger.java @@ -130,7 +130,7 @@ class ThoughtGorgerEffectLeaves extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent thoughtGorgerLastState = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); - int numberCounters = thoughtGorgerLastState.getCounters().getCount(CounterType.P1P1); + int numberCounters = thoughtGorgerLastState.getCounters(game).getCount(CounterType.P1P1); if (player != null) { player.drawCards(numberCounters, game); return true; diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/CullingDais.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/CullingDais.java index 81bff54a08..74ab2c6d08 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/CullingDais.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/CullingDais.java @@ -92,7 +92,7 @@ class CullingDaisEffect extends OneShotEffect { Permanent p = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); Player player = game.getPlayer(source.getControllerId()); if (p != null && player != null) { - int count = p.getCounters().getCount(CounterType.CHARGE); + int count = p.getCounters(game).getCount(CounterType.CHARGE); player.drawCards(count, game); return true; } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/Grindclock.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/Grindclock.java index 5819d90842..3df7499d4d 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/Grindclock.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/Grindclock.java @@ -83,7 +83,7 @@ class GrindclockEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - int amount = game.getPermanent(source.getSourceId()).getCounters().getCount(CounterType.CHARGE); + int amount = game.getPermanent(source.getSourceId()).getCounters(game).getCount(CounterType.CHARGE); Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (targetPlayer != null) { targetPlayer.moveCards(targetPlayer.getLibrary().getTopCards(game, amount), Zone.GRAVEYARD, source, game); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/LiegeOfTheTangle.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/LiegeOfTheTangle.java index 6f46999fee..9d06e013dc 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/LiegeOfTheTangle.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/LiegeOfTheTangle.java @@ -135,7 +135,7 @@ class LiegeOfTheTangleEffect extends ContinuousEffectImpl { for (Iterator it = affectedObjectList.iterator(); it.hasNext();) { Permanent perm = it.next().getPermanent(game); if (perm != null) { - if (perm.getCounters().getCount(CounterType.AWAKENING) > 0) { + if (perm.getCounters(game).getCount(CounterType.AWAKENING) > 0) { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/RatchetBomb.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/RatchetBomb.java index a5b43eea93..93c2f77f47 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/RatchetBomb.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/RatchetBomb.java @@ -94,7 +94,7 @@ public class RatchetBomb extends CardImpl { } } - int count = p.getCounters().getCount(CounterType.CHARGE); + int count = p.getCounters(game).getCount(CounterType.CHARGE); for (Permanent perm: game.getBattlefield().getAllActivePermanents()) { if (perm.getConvertedManaCost() == count && !(perm.getCardType().contains(CardType.LAND))) { perm.destroy(source.getSourceId(), game, false); diff --git a/Mage.Sets/src/mage/sets/scourge/ForgottenAncient.java b/Mage.Sets/src/mage/sets/scourge/ForgottenAncient.java index 497d7b5b2e..aad2b972b8 100644 --- a/Mage.Sets/src/mage/sets/scourge/ForgottenAncient.java +++ b/Mage.Sets/src/mage/sets/scourge/ForgottenAncient.java @@ -116,7 +116,7 @@ public class ForgottenAncient extends CardImpl { return false; } - int numCounters = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int numCounters = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); ArrayList counterMovements = new ArrayList<>(); do { diff --git a/Mage.Sets/src/mage/sets/shadowmoor/BlowflyInfestation.java b/Mage.Sets/src/mage/sets/shadowmoor/BlowflyInfestation.java index d3056ac462..dbab73a32e 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/BlowflyInfestation.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/BlowflyInfestation.java @@ -92,7 +92,7 @@ class BlowflyInfestationCondition implements Condition { } } if (permanent != null) { - return permanent.getCounters().containsKey(CounterType.M1M1); + return permanent.getCounters(game).containsKey(CounterType.M1M1); } return false; } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/FateTransfer.java b/Mage.Sets/src/mage/sets/shadowmoor/FateTransfer.java index 6555350861..c0c3986a93 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/FateTransfer.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/FateTransfer.java @@ -102,7 +102,7 @@ class FateTransferEffect extends OneShotEffect { if (creatureToMoveCountersFrom != null && creatureToMoveCountersTo != null) { Permanent copyCreature = creatureToMoveCountersFrom.copy(); - for (Counter counter : copyCreature.getCounters().values()) { + for (Counter counter : copyCreature.getCounters(game).values()) { creatureToMoveCountersFrom.removeCounters(counter, game); creatureToMoveCountersTo.addCounters(counter, game); } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/GriefTyrant.java b/Mage.Sets/src/mage/sets/shadowmoor/GriefTyrant.java index 6b1523ee1e..1c7b61300e 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/GriefTyrant.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/GriefTyrant.java @@ -96,7 +96,7 @@ class GriefTyrantEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source)); Permanent griefTyrant = game.getPermanentOrLKIBattlefield(source.getSourceId()); - int countersOnGriefTyrant = griefTyrant.getCounters().getCount(CounterType.M1M1); + int countersOnGriefTyrant = griefTyrant.getCounters(game).getCount(CounterType.M1M1); if (targetCreature != null) { targetCreature.addCounters(CounterType.M1M1.createInstance(countersOnGriefTyrant), game); return true; diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Heartmender.java b/Mage.Sets/src/mage/sets/shadowmoor/Heartmender.java index 5d40d09f3d..bd8a7ba443 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/Heartmender.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/Heartmender.java @@ -99,7 +99,7 @@ class HeartmenderEffect extends OneShotEffect { } for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (creature != null - && creature.getCounters().getCount(counter.getName()) >= counter.getCount()) { + && creature.getCounters(game).getCount(counter.getName()) >= counter.getCount()) { creature.removeCounters(counter.getName(), counter.getCount(), game); game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName()) .append(" counter from ").append(creature.getName()).toString()); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/LeechBonder.java b/Mage.Sets/src/mage/sets/shadowmoor/LeechBonder.java index 3877ea3184..f4ca31fb61 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/LeechBonder.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/LeechBonder.java @@ -119,13 +119,13 @@ class LeechBonderEffect extends OneShotEffect { } Choice choice = new ChoiceImpl(); Set possibleChoices = new HashSet<>(); - for (String counterName : fromPermanent.getCounters().keySet()) { + for (String counterName : fromPermanent.getCounters(game).keySet()) { possibleChoices.add(counterName); } choice.setChoices(possibleChoices); if (controller.choose(outcome, choice, game)) { String chosen = choice.getChoice(); - if (fromPermanent.getCounters().containsKey(chosen)) { + if (fromPermanent.getCounters(game).containsKey(chosen)) { CounterType counterType = CounterType.findByName(chosen); if (counterType != null) { Counter counter = counterType.createInstance(); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Woeleecher.java b/Mage.Sets/src/mage/sets/shadowmoor/Woeleecher.java index d7ea5cad84..a3dfcc05ba 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/Woeleecher.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/Woeleecher.java @@ -102,9 +102,9 @@ class WoeleecherEffect extends OneShotEffect { Permanent target = game.getPermanent(source.getFirstTarget()); Player you = game.getPlayer(source.getControllerId()); if (target != null) { - numberCountersOriginal = target.getCounters().getCount(CounterType.M1M1); + numberCountersOriginal = target.getCounters(game).getCount(CounterType.M1M1); target.removeCounters(CounterType.M1M1.createInstance(), game); - numberCountersAfter = target.getCounters().getCount(CounterType.M1M1); + numberCountersAfter = target.getCounters(game).getCount(CounterType.M1M1); if (numberCountersAfter < numberCountersOriginal && you != null) { you.gainLife(2, game); return true; diff --git a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/BrainInAJar.java b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/BrainInAJar.java index 4994645e6e..4ef113d70f 100644 --- a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/BrainInAJar.java +++ b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/BrainInAJar.java @@ -106,7 +106,7 @@ class BrainInAJarCastEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourceObject = game.getPermanent(source.getSourceId()); if (controller != null && sourceObject != null) { - int counters = sourceObject.getCounters().getCount(CounterType.CHARGE); + int counters = sourceObject.getCounters(game).getCount(CounterType.CHARGE); FilterCard filter = new FilterInstantOrSorceryCard(); filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, counters)); int cardsToCast = controller.getHand().count(filter, source.getControllerId(), source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/sets/stronghold/CrovaxTheCursed.java b/Mage.Sets/src/mage/sets/stronghold/CrovaxTheCursed.java index aac366b200..cabc6f546d 100644 --- a/Mage.Sets/src/mage/sets/stronghold/CrovaxTheCursed.java +++ b/Mage.Sets/src/mage/sets/stronghold/CrovaxTheCursed.java @@ -113,11 +113,11 @@ class CrovaxTheCursedEffect extends OneShotEffect { if (creatures > 0 && controller.chooseUse(outcome, "Sacrifice a creature?", source, game)) { if (new SacrificeControllerEffect(new FilterCreaturePermanent(), 1, "").apply(game, source)) { if (sourceObject != null) { - sourceObject.getCounters().addCounter(CounterType.P1P1.createInstance()); + sourceObject.getCounters(game).addCounter(CounterType.P1P1.createInstance()); game.informPlayers(controller.getLogName() + " puts a +1/+1 counter on " + sourceObject.getName()); } } - } else if (sourceObject != null && sourceObject.getCounters().containsKey(CounterType.P1P1)) { + } else if (sourceObject != null && sourceObject.getCounters(game).containsKey(CounterType.P1P1)) { sourceObject.removeCounters(CounterType.P1P1.getName(), 1, game); game.informPlayers(controller.getLogName() + " removes a +1/+1 counter from " + sourceObject.getName()); } diff --git a/Mage.Sets/src/mage/sets/tempest/EssenceBottle.java b/Mage.Sets/src/mage/sets/tempest/EssenceBottle.java index 2bc7202af2..6ac36a749b 100644 --- a/Mage.Sets/src/mage/sets/tempest/EssenceBottle.java +++ b/Mage.Sets/src/mage/sets/tempest/EssenceBottle.java @@ -101,7 +101,7 @@ class EssenceBottleCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getSourceId()); if (permanent != null) { - this.removedCounters = permanent.getCounters().getCount(CounterType.ELIXIR); + this.removedCounters = permanent.getCounters(game).getCount(CounterType.ELIXIR); if (this.removedCounters > 0) { permanent.removeCounters(CounterType.ELIXIR.createInstance(this.removedCounters), game); } diff --git a/Mage.Sets/src/mage/sets/tempest/LegacysAllure.java b/Mage.Sets/src/mage/sets/tempest/LegacysAllure.java index 0ece69c2ba..63072ce777 100644 --- a/Mage.Sets/src/mage/sets/tempest/LegacysAllure.java +++ b/Mage.Sets/src/mage/sets/tempest/LegacysAllure.java @@ -80,7 +80,7 @@ public class LegacysAllure extends CardImpl { if (ability.getOriginalId().equals(originalId)) { Permanent sourcePermanent = game.getPermanent(ability.getSourceId()); if (sourcePermanent != null) { - int numbCounters = sourcePermanent.getCounters().getCount("treasure"); + int numbCounters = sourcePermanent.getCounters(game).getCount("treasure"); FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on " + getLogName()); filter.add(new PowerPredicate(Filter.ComparisonType.LessThan, numbCounters + 1)); ability.getTargets().clear(); diff --git a/Mage.Sets/src/mage/sets/tempest/Magmasaur.java b/Mage.Sets/src/mage/sets/tempest/Magmasaur.java index 2cdccfd05c..2de4991ac7 100644 --- a/Mage.Sets/src/mage/sets/tempest/Magmasaur.java +++ b/Mage.Sets/src/mage/sets/tempest/Magmasaur.java @@ -112,7 +112,7 @@ class MagmasaurEffect extends OneShotEffect { if (controller.chooseUse(outcome, "Remove a +1/+1 counter from " + sourceObject.getLogName() + "?", source, game)) { sourceObject.removeCounters(CounterType.P1P1.getName(), 1, game); } else { - int counters = sourceObject.getCounters().getCount(CounterType.P1P1); + int counters = sourceObject.getCounters(game).getCount(CounterType.P1P1); sourceObject.sacrifice(source.getSourceId(), game); new DamageEverythingEffect(counters, filter).apply(game, source); } diff --git a/Mage.Sets/src/mage/sets/tempest/TortureChamber.java b/Mage.Sets/src/mage/sets/tempest/TortureChamber.java index 5a464f1cd1..21965c84e6 100644 --- a/Mage.Sets/src/mage/sets/tempest/TortureChamber.java +++ b/Mage.Sets/src/mage/sets/tempest/TortureChamber.java @@ -106,7 +106,7 @@ class TortureChamberCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getSourceId()); if (permanent != null) { - this.removedCounters = permanent.getCounters().getCount(CounterType.PAIN); + this.removedCounters = permanent.getCounters(game).getCount(CounterType.PAIN); if (this.removedCounters > 0) { permanent.removeCounters(CounterType.PAIN.createInstance(this.removedCounters), game); } @@ -146,7 +146,7 @@ class TortureChamberEffect1 extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { - int painCounters = permanent.getCounters().getCount(CounterType.PAIN); + int painCounters = permanent.getCounters(game).getCount(CounterType.PAIN); player.damage(painCounters, source.getSourceId(), game, false, true); return true; } diff --git a/Mage.Sets/src/mage/sets/timespiral/Clockspinning.java b/Mage.Sets/src/mage/sets/timespiral/Clockspinning.java index 293ffeb4c9..df4fbf408b 100644 --- a/Mage.Sets/src/mage/sets/timespiral/Clockspinning.java +++ b/Mage.Sets/src/mage/sets/timespiral/Clockspinning.java @@ -95,13 +95,13 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect { private Counter selectCounterType(Game game, Ability source, Permanent permanent) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && permanent.getCounters().size() > 0) { + if (controller != null && permanent.getCounters(game).size() > 0) { String counterName = null; - if (permanent.getCounters().size() > 1) { + if (permanent.getCounters(game).size() > 1) { Choice choice = new ChoiceImpl(true); Set choices = new HashSet<>(2); - for (Counter counter : permanent.getCounters().values()) { - if (permanent.getCounters().getCount(counter.getName()) > 0) { + for (Counter counter : permanent.getCounters(game).values()) { + if (permanent.getCounters(game).getCount(counter.getName()) > 0) { choices.add(counter.getName()); } } @@ -110,7 +110,7 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect { controller.choose(Outcome.Neutral, choice, game); counterName = choice.getChoice(); } else { - for (Counter counter : permanent.getCounters().values()) { + for (Counter counter : permanent.getCounters(game).values()) { if (counter.getCount() > 0) { counterName = counter.getName(); } diff --git a/Mage.Sets/src/mage/sets/timespiral/ClockworkHydra.java b/Mage.Sets/src/mage/sets/timespiral/ClockworkHydra.java index d66edb5b41..6477000c75 100644 --- a/Mage.Sets/src/mage/sets/timespiral/ClockworkHydra.java +++ b/Mage.Sets/src/mage/sets/timespiral/ClockworkHydra.java @@ -106,7 +106,7 @@ class ClockworkHydraEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && permanent != null && permanent.getCounters().getCount(CounterType.P1P1) > 0) { + if (controller != null && permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { permanent.removeCounters(CounterType.P1P1.createInstance(), game); Target target = new TargetCreatureOrPlayer(); if (controller.chooseTarget(outcome, target, source, game)) { diff --git a/Mage.Sets/src/mage/sets/timespiral/JhoirasTimebug.java b/Mage.Sets/src/mage/sets/timespiral/JhoirasTimebug.java index a6775e6a34..8eb3ea44e2 100644 --- a/Mage.Sets/src/mage/sets/timespiral/JhoirasTimebug.java +++ b/Mage.Sets/src/mage/sets/timespiral/JhoirasTimebug.java @@ -105,7 +105,7 @@ class JhoirasTimebugEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); - if (permanent != null && permanent.getCounters().containsKey(CounterType.TIME)) { + if (permanent != null && permanent.getCounters(game).containsKey(CounterType.TIME)) { if (controller.chooseUse(Outcome.Benefit, "Add a time counter? (Otherwise remove one)", source, game)) { permanent.addCounters(CounterType.TIME.createInstance(), game); } diff --git a/Mage.Sets/src/mage/sets/timespiral/PhantomWurm.java b/Mage.Sets/src/mage/sets/timespiral/PhantomWurm.java index 316f935aba..49597fd9f3 100644 --- a/Mage.Sets/src/mage/sets/timespiral/PhantomWurm.java +++ b/Mage.Sets/src/mage/sets/timespiral/PhantomWurm.java @@ -124,7 +124,7 @@ class PhantomWurmPreventionEffect extends PreventionEffectImpl { } } - if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); sb.append("Removed a +1/+1 counter "); diff --git a/Mage.Sets/src/mage/sets/timespiral/ThelonOfHavenwood.java b/Mage.Sets/src/mage/sets/timespiral/ThelonOfHavenwood.java index fd063d5143..0211746a0c 100644 --- a/Mage.Sets/src/mage/sets/timespiral/ThelonOfHavenwood.java +++ b/Mage.Sets/src/mage/sets/timespiral/ThelonOfHavenwood.java @@ -118,7 +118,7 @@ class ThelonOfHavenwoodBoostEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - int numCounters = creature.getCounters().getCount(CounterType.SPORE); + int numCounters = creature.getCounters(game).getCount(CounterType.SPORE); if (numCounters > 0) { creature.addPower(numCounters); creature.addToughness(numCounters); diff --git a/Mage.Sets/src/mage/sets/torment/CephalidVandal.java b/Mage.Sets/src/mage/sets/torment/CephalidVandal.java index 58ead923f0..e7a0fffd5e 100644 --- a/Mage.Sets/src/mage/sets/torment/CephalidVandal.java +++ b/Mage.Sets/src/mage/sets/torment/CephalidVandal.java @@ -97,7 +97,7 @@ class CephalidVandalEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && controller != null) { - int amount = permanent.getCounters().getCount(CounterType.SHRED); + int amount = permanent.getCounters(game).getCount(CounterType.SHRED); controller.moveCards(controller.getLibrary().getTopCards(game, amount), Zone.GRAVEYARD, source, game); } return true; diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/Anthroplasm.java b/Mage.Sets/src/mage/sets/urzaslegacy/Anthroplasm.java index 09abe51999..5a941a9205 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/Anthroplasm.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/Anthroplasm.java @@ -100,7 +100,7 @@ class AnthroplasmEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { //Remove all +1/+1 counters - permanent.removeCounters(permanent.getCounters().get(CounterType.P1P1.getName()), game); + permanent.removeCounters(permanent.getCounters(game).get(CounterType.P1P1.getName()), game); //put X +1/+1 counters permanent.addCounters(CounterType.P1P1.createInstance(source.getManaCostsToPay().getX()), game); return true; diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java b/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java index 3e0f9f8cc7..48f3cbdb9c 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java @@ -114,7 +114,7 @@ class RemoveAllCountersSourceCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { - this.amount = permanent.getCounters().getCount(name); + this.amount = permanent.getCounters(game).getCount(name); permanent.removeCounters(name, amount, game); this.paid = true; } diff --git a/Mage.Sets/src/mage/sets/urzassaga/Smokestack.java b/Mage.Sets/src/mage/sets/urzassaga/Smokestack.java index 4622fa38b2..42d7bcbbdb 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/Smokestack.java +++ b/Mage.Sets/src/mage/sets/urzassaga/Smokestack.java @@ -93,7 +93,7 @@ class SmokestackEffect extends OneShotEffect { Player activePlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (activePlayer != null && sourcePermanent != null) { - int count = sourcePermanent.getCounters().getCount("Soot"); + int count = sourcePermanent.getCounters(game).getCount("Soot"); if (count > 0) { int amount = Math.min(count, game.getBattlefield().countAll(new FilterControlledPermanent(), activePlayer.getId(), game)); Target target = new TargetControlledPermanent(amount, amount, new FilterControlledPermanent(), false); diff --git a/Mage.Sets/src/mage/sets/urzassaga/VileRequiem.java b/Mage.Sets/src/mage/sets/urzassaga/VileRequiem.java index e5d630bcae..eb05d84c59 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/VileRequiem.java +++ b/Mage.Sets/src/mage/sets/urzassaga/VileRequiem.java @@ -88,7 +88,7 @@ public class VileRequiem extends CardImpl { if (ability.getOriginalId().equals(originalId)) { Permanent sourcePermanent = game.getPermanent(ability.getSourceId()); if (sourcePermanent != null) { - int numberCounters = sourcePermanent.getCounters().getCount(CounterType.VERSE); + int numberCounters = sourcePermanent.getCounters(game).getCount(CounterType.VERSE); ability.getTargets().clear(); FilterCreaturePermanent newFilter = filter.copy(); newFilter.setMessage(new StringBuilder("up to ").append(CardUtil.numberToText(numberCounters)).append(" target nonblack creatures").toString()); diff --git a/Mage.Sets/src/mage/sets/vintagemasters/MarchesaTheBlackRose.java b/Mage.Sets/src/mage/sets/vintagemasters/MarchesaTheBlackRose.java index f59007cb13..50f525e503 100644 --- a/Mage.Sets/src/mage/sets/vintagemasters/MarchesaTheBlackRose.java +++ b/Mage.Sets/src/mage/sets/vintagemasters/MarchesaTheBlackRose.java @@ -121,7 +121,7 @@ class MarchesaTheBlackRoseTriggeredAbility extends TriggeredAbilityImpl { if (permanent != null && permanent.getControllerId().equals(this.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE) - && permanent.getCounters().getCount(CounterType.P1P1) > 0) { + && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game) + 1)); } diff --git a/Mage.Sets/src/mage/sets/vintagemasters/SaprolingBurst.java b/Mage.Sets/src/mage/sets/vintagemasters/SaprolingBurst.java index aa82cc0b0c..97f10ddd56 100644 --- a/Mage.Sets/src/mage/sets/vintagemasters/SaprolingBurst.java +++ b/Mage.Sets/src/mage/sets/vintagemasters/SaprolingBurst.java @@ -151,7 +151,7 @@ class SaprolingBurstTokenDynamicValue implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent permanent = this.saprolingBurstMOR.getPermanent(game); if (permanent != null) { - return permanent.getCounters().getCount(CounterType.FADE); + return permanent.getCounters(game).getCount(CounterType.FADE); } return 0; } diff --git a/Mage.Sets/src/mage/sets/visions/PhyrexianMarauder.java b/Mage.Sets/src/mage/sets/visions/PhyrexianMarauder.java index b28df13771..f52a251747 100644 --- a/Mage.Sets/src/mage/sets/visions/PhyrexianMarauder.java +++ b/Mage.Sets/src/mage/sets/visions/PhyrexianMarauder.java @@ -99,7 +99,7 @@ class PhyrexianMarauderCantAttackUnlessYouPayEffect extends CantAttackBlockUnles public ManaCosts getManaCostToPay(GameEvent event, Ability source, Game game) { Permanent sourceObject = game.getPermanent(source.getSourceId()); if (sourceObject != null) { - int counter = sourceObject.getCounters().getCount(CounterType.P1P1); + int counter = sourceObject.getCounters(game).getCount(CounterType.P1P1); if (counter > 0) { return new ManaCostsImpl<>("{" + counter + "}"); } diff --git a/Mage.Sets/src/mage/sets/worldwake/QuestForTheNihilStone.java b/Mage.Sets/src/mage/sets/worldwake/QuestForTheNihilStone.java index 86429ffe03..65f6c15be9 100644 --- a/Mage.Sets/src/mage/sets/worldwake/QuestForTheNihilStone.java +++ b/Mage.Sets/src/mage/sets/worldwake/QuestForTheNihilStone.java @@ -134,7 +134,7 @@ class QuestForTheNihilStoneTriggeredAbility2 extends TriggeredAbilityImpl { Player opponent = game.getPlayer(event.getPlayerId()); if (opponent != null && opponent.getHand().size() == 0 - && quest.getCounters().getCount(CounterType.QUEST) >= 2) { + && quest.getCounters(game).getCount(CounterType.QUEST) >= 2) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(opponent.getId())); return true; diff --git a/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java b/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java index 62939a97ce..511505a445 100644 --- a/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java +++ b/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java @@ -141,7 +141,7 @@ class QuestForUlasTempleTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent quest = game.getPermanent(super.getSourceId()); - return quest != null && quest.getCounters().getCount(CounterType.QUEST) >= 3; + return quest != null && quest.getCounters(game).getCount(CounterType.QUEST) >= 3; } @Override diff --git a/Mage.Sets/src/mage/sets/zendikar/ArchmageAscension.java b/Mage.Sets/src/mage/sets/zendikar/ArchmageAscension.java index bf5da3cf61..98323b0386 100644 --- a/Mage.Sets/src/mage/sets/zendikar/ArchmageAscension.java +++ b/Mage.Sets/src/mage/sets/zendikar/ArchmageAscension.java @@ -158,7 +158,7 @@ class ArchmageAscensionReplacementEffect extends ReplacementEffectImpl { Player you = game.getPlayer(source.getControllerId()); return event.getPlayerId().equals(source.getControllerId()) && archmage != null - && archmage.getCounters().getCount(CounterType.QUEST) >= 6 + && archmage.getCounters(game).getCount(CounterType.QUEST) >= 6 && you != null && you.chooseUse(Outcome.Benefit, "Would you like to search your library instead of drawing a card?", source, game); } diff --git a/Mage.Sets/src/mage/sets/zendikar/BeastmasterAscension.java b/Mage.Sets/src/mage/sets/zendikar/BeastmasterAscension.java index c396f64f6d..718265ee1e 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BeastmasterAscension.java +++ b/Mage.Sets/src/mage/sets/zendikar/BeastmasterAscension.java @@ -84,7 +84,7 @@ class BeastmasterAscensionEffect extends BoostControlledEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null && permanent.getCounters().getCount(CounterType.QUEST) > 6) { + if (permanent != null && permanent.getCounters(game).getCount(CounterType.QUEST) > 6) { super.apply(game, source); } return false; diff --git a/Mage.Sets/src/mage/sets/zendikar/EternityVessel.java b/Mage.Sets/src/mage/sets/zendikar/EternityVessel.java index e98268f67c..2717b1f5a9 100644 --- a/Mage.Sets/src/mage/sets/zendikar/EternityVessel.java +++ b/Mage.Sets/src/mage/sets/zendikar/EternityVessel.java @@ -117,7 +117,7 @@ class EternityVesselEffect2 extends OneShotEffect { Permanent vessel = game.getPermanent(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); if (vessel != null && controller != null) { - controller.setLife(vessel.getCounters().getCount(CounterType.CHARGE), game); + controller.setLife(vessel.getCounters(game).getCount(CounterType.CHARGE), game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java b/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java index 2a679d24b8..1fa4e3c90c 100644 --- a/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java +++ b/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java @@ -125,7 +125,7 @@ class SourceHasCountersCost extends CostImpl { @Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return (game.getPermanent(sourceId).getCounters().getCount(counterType) >= counters); + return (game.getPermanent(sourceId).getCounters(game).getCount(counterType) >= counters); } @Override diff --git a/Mage.Sets/src/mage/sets/zendikar/ObsidianFireheart.java b/Mage.Sets/src/mage/sets/zendikar/ObsidianFireheart.java index 20326b53f7..5347f1fa91 100644 --- a/Mage.Sets/src/mage/sets/zendikar/ObsidianFireheart.java +++ b/Mage.Sets/src/mage/sets/zendikar/ObsidianFireheart.java @@ -115,7 +115,7 @@ class ObsidianFireheartGainAbilityEffect extends GainAbilityTargetEffect { @Override public boolean isInactive(Ability source, Game game) { Permanent land = game.getPermanent(this.targetPointer.getFirst(game, source)); - if (land != null && land.getCounters().getCount(CounterType.BLAZE) < 1) { + if (land != null && land.getCounters(game).getCount(CounterType.BLAZE) < 1) { return true; } return false; diff --git a/Mage.Sets/src/mage/sets/zendikar/PyromancerAscension.java b/Mage.Sets/src/mage/sets/zendikar/PyromancerAscension.java index e45e614d65..95793a88a7 100644 --- a/Mage.Sets/src/mage/sets/zendikar/PyromancerAscension.java +++ b/Mage.Sets/src/mage/sets/zendikar/PyromancerAscension.java @@ -151,7 +151,7 @@ class PyromancerAscensionCopyTriggeredAbility extends TriggeredAbilityImpl { Spell spell = game.getStack().getSpell(event.getTargetId()); if (isControlledInstantOrSorcery(spell)) { Permanent permanent = game.getBattlefield().getPermanent(this.getSourceId()); - if (permanent != null && permanent.getCounters().getCount(CounterType.QUEST) >= 2) { + if (permanent != null && permanent.getCounters(game).getCount(CounterType.QUEST) >= 2) { this.getEffects().get(0).setTargetPointer(new FixedTarget(spell.getId())); return true; } diff --git a/Mage.Sets/src/mage/sets/zendikar/VampireHexmage.java b/Mage.Sets/src/mage/sets/zendikar/VampireHexmage.java index b51edc62b2..819b24d691 100644 --- a/Mage.Sets/src/mage/sets/zendikar/VampireHexmage.java +++ b/Mage.Sets/src/mage/sets/zendikar/VampireHexmage.java @@ -100,7 +100,7 @@ class VampireHexmageEffect extends OneShotEffect { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - for(Counter counter : permanent.getCounters().values()){ + for(Counter counter : permanent.getCounters(game).values()){ permanent.removeCounters(counter, game); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/LevelUpAbilityTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/LevelUpAbilityTest.java index 8eda402cc2..dfc038e1a6 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/LevelUpAbilityTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/LevelUpAbilityTest.java @@ -27,7 +27,7 @@ public class LevelUpAbilityTest extends CardTestPlayerBase { execute(); Permanent master = getPermanent("Transcendent Master", playerA.getId()); - Assert.assertTrue(master.getCounters().isEmpty()); + Assert.assertTrue(master.getCounters(currentGame).isEmpty()); Assert.assertEquals(3, master.getPower().getValue()); Assert.assertEquals(3, master.getToughness().getValue()); @@ -49,7 +49,7 @@ public class LevelUpAbilityTest extends CardTestPlayerBase { execute(); Permanent master = getPermanent("Transcendent Master", playerA.getId()); - Assert.assertEquals(1, master.getCounters().getCount(CounterType.LEVEL)); + Assert.assertEquals(1, master.getCounters(currentGame).getCount(CounterType.LEVEL)); Assert.assertEquals(3, master.getPower().getValue()); Assert.assertEquals(3, master.getToughness().getValue()); @@ -73,7 +73,7 @@ public class LevelUpAbilityTest extends CardTestPlayerBase { execute(); Permanent master = getPermanent("Transcendent Master", playerA.getId()); - Assert.assertEquals(6, master.getCounters().getCount(CounterType.LEVEL)); + Assert.assertEquals(6, master.getCounters(currentGame).getCount(CounterType.LEVEL)); Assert.assertEquals(6, master.getPower().getValue()); Assert.assertEquals(6, master.getToughness().getValue()); @@ -99,7 +99,7 @@ public class LevelUpAbilityTest extends CardTestPlayerBase { execute(); Permanent master = getPermanent("Transcendent Master", playerA.getId()); - Assert.assertEquals(12, master.getCounters().getCount(CounterType.LEVEL)); + Assert.assertEquals(12, master.getCounters(currentGame).getCount(CounterType.LEVEL)); Assert.assertEquals("Power different", 9, master.getPower().getValue()); Assert.assertEquals("Toughness different", 9, master.getToughness().getValue()); @@ -123,7 +123,7 @@ public class LevelUpAbilityTest extends CardTestPlayerBase { execute(); Permanent master = getPermanent("Transcendent Master", playerA.getId()); - Assert.assertEquals(15, master.getCounters().getCount(CounterType.LEVEL)); + Assert.assertEquals(15, master.getCounters(currentGame).getCount(CounterType.LEVEL)); Assert.assertEquals("Power different", 9, master.getPower().getValue()); Assert.assertEquals("Toughness different", 9, master.getToughness().getValue()); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/VesuvaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/VesuvaTest.java index 5115f62996..7ac84a509a 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/copy/VesuvaTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/VesuvaTest.java @@ -96,7 +96,7 @@ public class VesuvaTest extends CardTestPlayerBase { Permanent darkDepth = getPermanent("Dark Depths", playerA); if (darkDepth != null) { - Assert.assertEquals(10, darkDepth.getCounters().getCount("ice")); + Assert.assertEquals(10, darkDepth.getCounters(currentGame).getCount("ice")); } assertTappedCount("Dark Depths", true, 1); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/ChronozoaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/ChronozoaTest.java index 7125bdce73..0112beef2c 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/ChronozoaTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/ChronozoaTest.java @@ -65,7 +65,7 @@ public class ChronozoaTest extends CardTestPlayerBase { Assert.assertEquals("Chronozoa has to be a token", true, creature instanceof PermanentToken); // Make sure each token has 2 time counters - final Counters counters = creature.getCounters(); + final Counters counters = creature.getCounters(currentGame); Assert.assertEquals(1, counters.size()); for(final Counter counter : counters.values()) { Assert.assertEquals(CounterType.TIME.getName(), counter.getName()); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/DustOfMomentsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/DustOfMomentsTest.java index bd0af195e4..0368051b65 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/DustOfMomentsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/DustOfMomentsTest.java @@ -30,7 +30,7 @@ public class DustOfMomentsTest extends CardTestPlayerBase { for (final Permanent creature : activeCreatures) { Assert.assertEquals("Chronozoa", creature.getName()); - Assert.assertEquals(3, creature.getCounters().getCount(CounterType.TIME)); + Assert.assertEquals(3, creature.getCounters(currentGame).getCount(CounterType.TIME)); } // Check time counters on kraken assertCounterOnExiledCardCount("Deep-Sea Kraken", CounterType.TIME, 6); diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index e4177371fc..fc92814a8b 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -30,7 +30,6 @@ import org.junit.Assert; import org.junit.Before; import org.mage.test.player.TestPlayer; import org.mage.test.serverside.base.CardTestAPI; -import org.mage.test.serverside.base.CardTestAPI.GameResult; import org.mage.test.serverside.base.MageTestPlayerBase; /** @@ -637,7 +636,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } Assert.assertNotNull("There is no such permanent " + (player == null ? "" : "for player " + player.getName()) + " on the battlefield, cardName=" + cardName, found); - Assert.assertEquals("(Battlefield) Counter counts are not equal (" + cardName + ":" + type + ")", count, found.getCounters().getCount(type)); + Assert.assertEquals("(Battlefield) Counter counts are not equal (" + cardName + ":" + type + ")", count, found.getCounters(currentGame).getCount(type)); } /** diff --git a/Mage/src/main/java/mage/abilities/condition/common/AttachedToCounterCondition.java b/Mage/src/main/java/mage/abilities/condition/common/AttachedToCounterCondition.java index f23dfc3505..644d753a09 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/AttachedToCounterCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/AttachedToCounterCondition.java @@ -70,13 +70,13 @@ public class AttachedToCounterCondition implements Condition { return false; } if (from != -1) { //range compare - int count = attachedTo.getCounters().getCount(counterType); + int count = attachedTo.getCounters(game).getCount(counterType); if (to == Integer.MAX_VALUE) { return count >= from; } return count >= from && count <= to; } else { // single compare (lte) - return attachedTo.getCounters().getCount(counterType) >= amount; + return attachedTo.getCounters(game).getCount(counterType) >= amount; } } } diff --git a/Mage/src/main/java/mage/abilities/condition/common/LastTimeCounterRemovedCondition.java b/Mage/src/main/java/mage/abilities/condition/common/LastTimeCounterRemovedCondition.java index 0c47125c9c..a68e20036f 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/LastTimeCounterRemovedCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/LastTimeCounterRemovedCondition.java @@ -26,7 +26,7 @@ public class LastTimeCounterRemovedCondition implements Condition{ permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); } if (permanent != null) { - final int timeCounters = permanent.getCounters().getCount(CounterType.TIME); + final int timeCounters = permanent.getCounters(game).getCount(CounterType.TIME); return timeCounters == 0; } else { return false; diff --git a/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java b/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java index 815e0b3bb3..b20f5d4b77 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java @@ -67,19 +67,19 @@ public class PermanentHasCounterCondition implements Condition { for (Permanent permanent : permanents) { switch (this.type) { case FEWER_THAN: - if (permanent.getCounters().getCount(this.counterType) < this.amount) { + if (permanent.getCounters(game).getCount(this.counterType) < this.amount) { conditionApplies = true; break; } break; case MORE_THAN: - if (permanent.getCounters().getCount(this.counterType) > this.amount) { + if (permanent.getCounters(game).getCount(this.counterType) > this.amount) { conditionApplies = true; break; } break; case EQUAL_TO: - if (permanent.getCounters().getCount(this.counterType) == this.amount) { + if (permanent.getCounters(game).getCount(this.counterType) == this.amount) { conditionApplies = true; break; } diff --git a/Mage/src/main/java/mage/abilities/condition/common/SourceHasCounterCondition.java b/Mage/src/main/java/mage/abilities/condition/common/SourceHasCounterCondition.java index 9471e7aab8..96434483e0 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/SourceHasCounterCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/SourceHasCounterCondition.java @@ -76,7 +76,7 @@ public class SourceHasCounterCondition implements Condition { if (card != null) { count = card.getCounters(game).getCount(counterType); } else { - count = permanent.getCounters().getCount(counterType); + count = permanent.getCounters(game).getCount(counterType); } if (to == Integer.MAX_VALUE) { return count >= from; @@ -86,7 +86,7 @@ public class SourceHasCounterCondition implements Condition { if (card != null) { return card.getCounters(game).getCount(counterType) >= amount; } else { - return permanent.getCounters().getCount(counterType) >= amount; + return permanent.getCounters(game).getCount(counterType) >= amount; } } } diff --git a/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java b/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java index 5cb975d7b1..9944d89abc 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java @@ -59,15 +59,15 @@ public class PayLoyaltyCost extends CostImpl { @Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Permanent planeswalker = game.getPermanent(sourceId); - return planeswalker != null && planeswalker.getCounters().getCount(CounterType.LOYALTY) + amount >= 0 && planeswalker.canLoyaltyBeUsed(game); + return planeswalker != null && planeswalker.getCounters(game).getCount(CounterType.LOYALTY) + amount >= 0 && planeswalker.canLoyaltyBeUsed(game); } @Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent planeswalker = game.getPermanent(sourceId); - if (planeswalker != null && planeswalker.getCounters().getCount(CounterType.LOYALTY) + amount >= 0 && planeswalker.canLoyaltyBeUsed(game)) { + if (planeswalker != null && planeswalker.getCounters(game).getCount(CounterType.LOYALTY) + amount >= 0 && planeswalker.canLoyaltyBeUsed(game)) { if (amount > 0) { - planeswalker.getCounters().addCounter(CounterType.LOYALTY.createInstance(amount)); + planeswalker.getCounters(game).addCounter(CounterType.LOYALTY.createInstance(amount)); } else if (amount < 0) { planeswalker.removeCounters(CounterType.LOYALTY.getName(), Math.abs(amount), game); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java b/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java index 7536b0df02..4a19e7ea42 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java @@ -72,7 +72,7 @@ public class PayVariableLoyaltyCost extends VariableCostImpl { int maxValue = 0; Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - maxValue = permanent.getCounters().getCount(CounterType.LOYALTY.getName()); + maxValue = permanent.getCounters(game).getCount(CounterType.LOYALTY.getName()); } return maxValue; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java index 38be9ace0e..100beada6c 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java @@ -93,16 +93,16 @@ public class RemoveCounterCost extends CostImpl { for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - if (permanent.getCounters().size() > 0 && (counterTypeToRemove == null || permanent.getCounters().containsKey(counterTypeToRemove))) { + if (permanent.getCounters(game).size() > 0 && (counterTypeToRemove == null || permanent.getCounters(game).containsKey(counterTypeToRemove))) { String counterName = null; if (counterTypeToRemove != null) { counterName = counterTypeToRemove.getName(); - } else if (permanent.getCounters().size() > 1 && counterTypeToRemove == null) { + } else if (permanent.getCounters(game).size() > 1 && counterTypeToRemove == null) { Choice choice = new ChoiceImpl(true); Set choices = new HashSet<>(); - for (Counter counter : permanent.getCounters().values()) { - if (permanent.getCounters().getCount(counter.getName()) > 0) { + for (Counter counter : permanent.getCounters(game).values()) { + if (permanent.getCounters(game).getCount(counter.getName()) > 0) { choices.add(counter.getName()); } } @@ -111,7 +111,7 @@ public class RemoveCounterCost extends CostImpl { controller.choose(Outcome.UnboostCreature, choice, game); counterName = choice.getChoice(); } else { - for (Counter counter : permanent.getCounters().values()) { + for (Counter counter : permanent.getCounters(game).values()) { if (counter.getCount() > 0) { counterName = counter.getName(); } @@ -119,16 +119,16 @@ public class RemoveCounterCost extends CostImpl { } if (counterName != null) { int countersLeft = countersToRemove - countersRemoved; - int countersOnPermanent = permanent.getCounters().getCount(counterName); + int countersOnPermanent = permanent.getCounters(game).getCount(counterName); int numberOfCountersSelected = 1; if (countersLeft > 1 && countersOnPermanent > 1) { numberOfCountersSelected = controller.getAmount(1, Math.min(countersLeft, countersOnPermanent), new StringBuilder("Remove how many counters from ").append(permanent.getIdName()).toString(), game); } permanent.removeCounters(counterName, numberOfCountersSelected, game); - if (permanent.getCounters().getCount(counterName) == 0) { + if (permanent.getCounters(game).getCount(counterName) == 0) { // this removes only the item with number = 0 from the collection - permanent.getCounters().removeCounter(counterName); + permanent.getCounters(game).removeCounter(counterName); } countersRemoved += numberOfCountersSelected; if (!game.isSimulation()) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java index ebf92959f4..66b8f49efa 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java @@ -64,7 +64,7 @@ public class RemoveCountersSourceCost extends CostImpl { @Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Permanent permanent = game.getPermanent(sourceId); - if (permanent != null && permanent.getCounters().getCount(name) >= amount) { + if (permanent != null && permanent.getCounters(game).getCount(name) >= amount) { return true; } return false; @@ -73,7 +73,7 @@ public class RemoveCountersSourceCost extends CostImpl { @Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); - if (permanent != null && permanent.getCounters().getCount(name) >= amount) { + if (permanent != null && permanent.getCounters(game).getCount(name) >= amount) { permanent.removeCounters(name, amount, game); this.paid = true; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java index 7678d64473..be4ce5e09d 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java @@ -92,7 +92,7 @@ public class RemoveVariableCountersSourceCost extends VariableCostImpl { int maxValue = 0; Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - maxValue = permanent.getCounters().getCount(counterName); + maxValue = permanent.getCounters(game).getCount(counterName); } return maxValue; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java index 6e24329656..bb5160b012 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java @@ -95,9 +95,9 @@ public class RemoveVariableCountersTargetCost extends VariableCostImpl { int maxValue = 0; for (Permanent permanent :game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { if (counterTypeToRemove != null) { - maxValue += permanent.getCounters().getCount(counterTypeToRemove); + maxValue += permanent.getCounters(game).getCount(counterTypeToRemove); } else { - for(Counter counter :permanent.getCounters().values()){ + for(Counter counter :permanent.getCounters(game).values()){ maxValue += counter.getCount(); } } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersCount.java index eb317e6101..5b239827fc 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersCount.java @@ -62,7 +62,7 @@ public class CountersCount implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { - count += permanent.getCounters().getCount(counter); + count += permanent.getCounters(game).getCount(counter); } return count; } diff --git a/Mage/src/main/java/mage/abilities/effects/ApplyCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/ApplyCountersEffect.java index ce497867d9..320fff976f 100644 --- a/Mage/src/main/java/mage/abilities/effects/ApplyCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/ApplyCountersEffect.java @@ -55,7 +55,7 @@ public class ApplyCountersEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { for (Permanent permanent: game.getBattlefield().getAllActivePermanents(CardType.CREATURE)) { - for (BoostCounter counter: permanent.getCounters().getBoostCounters()) { + for (BoostCounter counter: permanent.getCounters(game).getBoostCounters()) { permanent.addPower(counter.getPower() * counter.getCount()); permanent.addToughness(counter.getToughness() * counter.getCount()); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/RemoveAllCountersSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RemoveAllCountersSourceEffect.java index 0327dd6dd6..52ac8c477e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RemoveAllCountersSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RemoveAllCountersSourceEffect.java @@ -62,7 +62,7 @@ public class RemoveAllCountersSourceEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { - int count = sourcePermanent.getCounters().getCount(counterType); + int count = sourcePermanent.getCounters(game).getCount(counterType); sourcePermanent.removeCounters(counterType.getName(), count, game); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java index a39c2b7de8..0ea83b7f34 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java @@ -127,10 +127,10 @@ public class AddCountersSourceEffect extends OneShotEffect { countersToAdd--; } newCounter.add(countersToAdd); - int before = permanent.getCounters().getCount(newCounter.getName()); + int before = permanent.getCounters(game).getCount(newCounter.getName()); permanent.addCounters(newCounter, game); if (informPlayers && !game.isSimulation()) { - int amountAdded = permanent.getCounters().getCount(newCounter.getName()) - before; + int amountAdded = permanent.getCounters(game).getCount(newCounter.getName()) - before; Player player = game.getPlayer(source.getControllerId()); if (player != null) { game.informPlayers(player.getLogName() + " puts " + amountAdded + " " + newCounter.getName().toLowerCase() + " counter on " + permanent.getLogName()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java index a19cd3cd21..12ed557e84 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java @@ -96,9 +96,9 @@ public class AddCountersTargetEffect extends OneShotEffect { newCounter.remove(newCounter.getCount()); } newCounter.add(calculated); - int before = permanent.getCounters().getCount(counter.getName()); + int before = permanent.getCounters(game).getCount(counter.getName()); permanent.addCounters(newCounter, game); - int numberAdded = permanent.getCounters().getCount(counter.getName()) - before; + int numberAdded = permanent.getCounters(game).getCount(counter.getName()) - before; affectedTargets++; if (!game.isSimulation()) { game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " @@ -114,7 +114,7 @@ public class AddCountersTargetEffect extends OneShotEffect { + counter.getCount() + " " + counter.getName().toLowerCase() + " counter on " + player.getLogName()); } } else if (card != null) { - card.addCounters(counter.getName(), counter.getCount(), game); + card.addCounters(counter, game); if (!game.isSimulation()) { game.informPlayers(new StringBuilder("Added ").append(counter.getCount()).append(" ").append(counter.getName()) .append(" counter to ").append(card.getName()) diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java index b85e47bf84..7ae35237b8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java @@ -75,23 +75,25 @@ public class ProliferateEffect extends OneShotEffect { UUID chosen = (UUID) target.getTargets().get(idx); Permanent permanent = game.getPermanent(chosen); if (permanent != null) { - if (permanent.getCounters().size() > 0) { - if (permanent.getCounters().size() == 1) { - for (Counter counter : permanent.getCounters().values()) { - permanent.addCounters(counter.getName(), 1, game); + if (permanent.getCounters(game).size() > 0) { + if (permanent.getCounters(game).size() == 1) { + for (Counter counter : permanent.getCounters(game).values()) { + Counter newCounter = new Counter(counter.getName()); + permanent.addCounters(newCounter, game); } } else { Choice choice = new ChoiceImpl(true); Set choices = new HashSet<>(); - for (Counter counter : permanent.getCounters().values()) { + for (Counter counter : permanent.getCounters(game).values()) { choices.add(counter.getName()); } choice.setChoices(choices); choice.setMessage("Choose a counter to proliferate (" + permanent.getIdName() + ")"); controller.choose(Outcome.Benefit, choice, game); - for (Counter counter : permanent.getCounters().values()) { + for (Counter counter : permanent.getCounters(game).values()) { if (counter.getName().equals(choice.getChoice())) { - permanent.addCounters(counter.getName(), 1, game); + Counter newCounter = new Counter(counter.getName()); + permanent.addCounters(newCounter, game); break; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java index 3c075450d9..a371859fc5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java @@ -57,7 +57,7 @@ public class RemoveCounterSourceEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null && permanent.getCounters().getCount(counter.getName()) >= counter.getCount()) { + if (permanent != null && permanent.getCounters(game).getCount(counter.getName()) >= counter.getCount()) { permanent.removeCounters(counter.getName(), counter.getCount(), game); if (!game.isSimulation()) { game.informPlayers("Removed " + counter.getCount() + " " + counter.getName() + " counter from " + permanent.getLogName()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java index b596453d62..ff8a03f950 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java @@ -71,7 +71,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect { Permanent p = game.getPermanent(targetPointer.getFirst(game, source)); if(p != null) { Counter toRemove = (counter == null ? selectCounterType(game, source, p) : counter); - if(toRemove != null && p.getCounters().getCount(toRemove.getName()) >= toRemove.getCount()) { + if(toRemove != null && p.getCounters(game).getCount(toRemove.getName()) >= toRemove.getCount()) { p.removeCounters(toRemove.getName(), toRemove.getCount(), game); if(!game.isSimulation()) game.informPlayers("Removed " + toRemove.getCount() + " " + toRemove.getName() @@ -93,13 +93,13 @@ public class RemoveCounterTargetEffect extends OneShotEffect { private Counter selectCounterType(Game game, Ability source, Permanent permanent) { Player controller = game.getPlayer(source.getControllerId()); - if(controller != null && permanent.getCounters().size() > 0) { + if(controller != null && permanent.getCounters(game).size() > 0) { String counterName = null; - if(permanent.getCounters().size() > 1) { + if(permanent.getCounters(game).size() > 1) { Choice choice = new ChoiceImpl(true); Set choices = new HashSet<>(); - for(Counter counter : permanent.getCounters().values()) { - if (permanent.getCounters().getCount(counter.getName()) > 0) { + for(Counter counter : permanent.getCounters(game).values()) { + if (permanent.getCounters(game).getCount(counter.getName()) > 0) { choices.add(counter.getName()); } } @@ -108,7 +108,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect { controller.choose(Outcome.Detriment, choice, game); counterName = choice.getChoice(); } else { - for(Counter counter : permanent.getCounters().values()) { + for(Counter counter : permanent.getCounters(game).values()) { if(counter.getCount() > 0) { counterName = counter.getName(); } diff --git a/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java b/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java index 7fdecb10d3..eb8e0e7bac 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java @@ -98,7 +98,7 @@ class CumulativeUpkeepEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { - int ageCounter = permanent.getCounters().getCount(CounterType.AGE); + int ageCounter = permanent.getCounters(game).getCount(CounterType.AGE); if (cumulativeCost instanceof ManaCost) { ManaCostsImpl totalCost = new ManaCostsImpl<>(); for (int i = 0; i < ageCounter; i++) { diff --git a/Mage/src/main/java/mage/abilities/keyword/FadingAbility.java b/Mage/src/main/java/mage/abilities/keyword/FadingAbility.java index e8e4529581..2a8ec6fc76 100644 --- a/Mage/src/main/java/mage/abilities/keyword/FadingAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/FadingAbility.java @@ -62,7 +62,7 @@ class FadingEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - int amount = permanent.getCounters().getCount(CounterType.FADE); + int amount = permanent.getCounters(game).getCount(CounterType.FADE); if (amount > 0) { permanent.removeCounters(CounterType.FADE.createInstance(), game); } else { diff --git a/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java b/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java index c201f81c01..c60b3c4bb0 100644 --- a/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java @@ -95,7 +95,7 @@ public class GraftAbility extends TriggeredAbilityImpl { if (sourcePermanent != null && permanent != null && !sourcePermanent.getId().equals(permanent.getId()) - && sourcePermanent.getCounters().containsKey(CounterType.P1P1) + && sourcePermanent.getCounters(game).containsKey(CounterType.P1P1) && filter.match(permanent, game)) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getTargetId())); @@ -168,7 +168,7 @@ class GraftDistributeCounterEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { - int numberOfCounters = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int numberOfCounters = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (numberOfCounters > 0) { Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source)); if (targetCreature != null) { diff --git a/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java b/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java index 5efdb7a01a..62800ca784 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java @@ -75,7 +75,7 @@ public class ModularAbility extends DiesTriggeredAbility { public boolean checkTrigger(GameEvent event, Game game) { if (super.checkTrigger(event, game)) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getTarget().getCounters().getCount(CounterType.P1P1) > 0) { + if (zEvent.getTarget().getCounters(game).getCount(CounterType.P1P1) > 0) { return true; } } @@ -157,7 +157,7 @@ class ModularDistributeCounterEffect extends OneShotEffect { Permanent targetArtifact = game.getPermanent(targetPointer.getFirst(game, source)); Player player = game.getPlayer(source.getControllerId()); if (sourcePermanent != null && targetArtifact != null && player != null) { - int numberOfCounters = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int numberOfCounters = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (numberOfCounters > 0) { targetArtifact.addCounters(CounterType.P1P1.createInstance(numberOfCounters), game); } diff --git a/Mage/src/main/java/mage/abilities/keyword/PersistAbility.java b/Mage/src/main/java/mage/abilities/keyword/PersistAbility.java index 3f4a297c7d..085d893a49 100644 --- a/Mage/src/main/java/mage/abilities/keyword/PersistAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/PersistAbility.java @@ -65,7 +65,7 @@ public class PersistAbility extends DiesTriggeredAbility { public boolean checkTrigger(GameEvent event, Game game) { if (super.checkTrigger(event, game)) { Permanent permanent = ((ZoneChangeEvent) event).getTarget(); - if (permanent.getCounters().getCount(CounterType.M1M1) == 0) { + if (permanent.getCounters(game).getCount(CounterType.M1M1) == 0) { FixedTarget fixedTarget = new FixedTarget(permanent.getId()); fixedTarget.init(game, this); return true; diff --git a/Mage/src/main/java/mage/abilities/keyword/UndyingAbility.java b/Mage/src/main/java/mage/abilities/keyword/UndyingAbility.java index 237989397a..66df34d1fb 100644 --- a/Mage/src/main/java/mage/abilities/keyword/UndyingAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/UndyingAbility.java @@ -35,7 +35,7 @@ public class UndyingAbility extends DiesTriggeredAbility { public boolean checkTrigger(GameEvent event, Game game) { if (super.checkTrigger(event, game)) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (!permanent.getCounters().containsKey(CounterType.P1P1) || permanent.getCounters().getCount(CounterType.P1P1) == 0) { + if (!permanent.getCounters(game).containsKey(CounterType.P1P1) || permanent.getCounters(game).getCount(CounterType.P1P1) == 0) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java b/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java index ec10932966..eb0a9ec4a3 100644 --- a/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java @@ -136,7 +136,7 @@ class UnleashRestrictionEffect extends RestrictionEffect { @Override public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent != null && permanent.getId().equals(source.getSourceId())) { - if (permanent.getCounters().getCount(CounterType.P1P1) > 0) { + if (permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/keyword/VanishingSacrificeAbility.java b/Mage/src/main/java/mage/abilities/keyword/VanishingSacrificeAbility.java index b6f2dc6a10..642c563e21 100644 --- a/Mage/src/main/java/mage/abilities/keyword/VanishingSacrificeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/VanishingSacrificeAbility.java @@ -28,7 +28,7 @@ public class VanishingSacrificeAbility extends TriggeredAbilityImpl { if (event.getData().equals("time") && event.getTargetId().equals(this.getSourceId())) { Permanent p = game.getPermanent(this.getSourceId()); if (p != null) { - return p.getCounters().getCount(CounterType.TIME) == 0; + return p.getCounters(game).getCount(CounterType.TIME) == 0; } } return false; diff --git a/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java b/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java index 2b5bf00431..30994dc7a9 100644 --- a/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java @@ -64,7 +64,7 @@ class VanishingEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent p = game.getPermanent(source.getSourceId()); if (p != null) { - int amount = p.getCounters().getCount(CounterType.TIME); + int amount = p.getCounters(game).getCount(CounterType.TIME); if (amount > 0) { p.removeCounters(CounterType.TIME.createInstance(), game); game.informPlayers("Removed a time counter from " + p.getLogName() + " (" + amount + " left)"); diff --git a/Mage/src/main/java/mage/cards/Card.java b/Mage/src/main/java/mage/cards/Card.java index 3befec124b..13895bc84c 100644 --- a/Mage/src/main/java/mage/cards/Card.java +++ b/Mage/src/main/java/mage/cards/Card.java @@ -40,6 +40,7 @@ import mage.constants.Zone; import mage.counters.Counter; import mage.counters.Counters; import mage.game.Game; +import mage.game.GameState; import mage.game.permanent.Permanent; public interface Card extends MageObject { @@ -152,6 +153,8 @@ public interface Card extends MageObject { Counters getCounters(Game game); + Counters getCounters(GameState state); + boolean addCounters(String name, int amount, Game game); boolean addCounters(String name, int amount, Game game, ArrayList appliedEffects); diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index 050e5d5ee0..a0c23ef525 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -53,6 +53,7 @@ import mage.counters.Counters; import mage.game.CardAttribute; import mage.game.CardState; import mage.game.Game; +import mage.game.GameState; import mage.game.command.Commander; import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; @@ -655,7 +656,12 @@ public abstract class CardImpl extends MageObjectImpl implements Card { @Override public Counters getCounters(Game game) { - return game.getState().getCardState(this.objectId).getCounters(); + return getCounters(game.getState()); + } + + @Override + public Counters getCounters(GameState state) { + return state.getCardState(this.objectId).getCounters(); } @Override @@ -673,7 +679,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, ownerId, name, 1); event.setAppliedEffects(appliedEffects); if (!game.replaceEvent(event)) { - game.getState().getCardState(this.objectId).getCounters().addCounter(name, 1); + getCounters(game).addCounter(name, 1); game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, ownerId, name, 1)); } else { returnCode = false; @@ -703,7 +709,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, ownerId, counter.getName(), 1); event.setAppliedEffects(appliedEffects); if (!game.replaceEvent(event)) { - game.getState().getCardState(this.objectId).getCounters().addCounter(eventCounter); + getCounters(game).addCounter(eventCounter); game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, ownerId, counter.getName(), 1)); } else { returnCode = false; @@ -718,7 +724,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { @Override public void removeCounters(String name, int amount, Game game) { for (int i = 0; i < amount; i++) { - game.getState().getCardState(this.objectId).getCounters().removeCounter(name, 1); + getCounters(game).removeCounter(name, 1); GameEvent event = GameEvent.getEvent(GameEvent.EventType.COUNTER_REMOVED, objectId, ownerId); event.setData(name); game.fireEvent(event); diff --git a/Mage/src/main/java/mage/filter/common/FilterPermanentOrPlayerWithCounter.java b/Mage/src/main/java/mage/filter/common/FilterPermanentOrPlayerWithCounter.java index 44d4330b85..e175fc7fe4 100644 --- a/Mage/src/main/java/mage/filter/common/FilterPermanentOrPlayerWithCounter.java +++ b/Mage/src/main/java/mage/filter/common/FilterPermanentOrPlayerWithCounter.java @@ -59,7 +59,7 @@ public class FilterPermanentOrPlayerWithCounter extends FilterPermanentOrPlayer return false; } } else if (o instanceof Permanent) { - if (((Permanent)o).getCounters().size() == 0) { + if (((Permanent)o).getCounters(game).size() == 0) { return false; } } diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/CounterAnyPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/CounterAnyPredicate.java index 68c9d6f3c2..67b7c998d8 100644 --- a/Mage/src/main/java/mage/filter/predicate/permanent/CounterAnyPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/permanent/CounterAnyPredicate.java @@ -43,7 +43,7 @@ public class CounterAnyPredicate implements Predicate { @Override public boolean apply(Permanent input, Game game) { - for (Counter counter: input.getCounters().values()) { + for (Counter counter: input.getCounters(game).values()) { if (counter.getCount()> 0) { return true; } diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/CounterPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/CounterPredicate.java index dd746ddad9..8058f2796d 100644 --- a/Mage/src/main/java/mage/filter/predicate/permanent/CounterPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/permanent/CounterPredicate.java @@ -51,9 +51,9 @@ public class CounterPredicate implements Predicate { @Override public boolean apply(Permanent input, Game game) { if (counter == null) { - return !input.getCounters().keySet().isEmpty(); + return !input.getCounters(game).keySet().isEmpty(); } else { - return input.getCounters().containsKey(counter); + return input.getCounters(game).containsKey(counter); } } diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index 1a543b15f0..5ea6d0feb4 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -1722,7 +1722,7 @@ public abstract class GameImpl implements Game, Serializable { } if (perm.getCardType().contains(CardType.PLANESWALKER)) { //20091005 - 704.5i - if (perm.getCounters().getCount(CounterType.LOYALTY) == 0) { + if (perm.getCounters(this).getCount(CounterType.LOYALTY) == 0) { if (movePermanentToGraveyardWithInfo(perm)) { somethingHappened = true; continue; @@ -1860,12 +1860,12 @@ public abstract class GameImpl implements Game, Serializable { } //20110501 - 704.5r - if (perm.getCounters().containsKey(CounterType.P1P1) && perm.getCounters().containsKey(CounterType.M1M1)) { - int p1p1 = perm.getCounters().getCount(CounterType.P1P1); - int m1m1 = perm.getCounters().getCount(CounterType.M1M1); + if (perm.getCounters(this).containsKey(CounterType.P1P1) && perm.getCounters(this).containsKey(CounterType.M1M1)) { + int p1p1 = perm.getCounters(this).getCount(CounterType.P1P1); + int m1m1 = perm.getCounters(this).getCount(CounterType.M1M1); int min = Math.min(p1p1, m1m1); - perm.getCounters().removeCounter(CounterType.P1P1, min); - perm.getCounters().removeCounter(CounterType.M1M1, min); + perm.getCounters(this).removeCounter(CounterType.P1P1, min); + perm.getCounters(this).removeCounter(CounterType.M1M1, min); } } diff --git a/Mage/src/main/java/mage/game/GameState.java b/Mage/src/main/java/mage/game/GameState.java index eec7695c56..2e48c954ce 100644 --- a/Mage/src/main/java/mage/game/GameState.java +++ b/Mage/src/main/java/mage/game/GameState.java @@ -264,7 +264,7 @@ public class GameState implements Serializable, Copyable { sb.append("permanents"); for (Permanent permanent : battlefield.getAllPermanents()) { - sb.append(permanent.getValue()); + sb.append(permanent.getValue(this)); } sb.append("spells"); @@ -305,7 +305,7 @@ public class GameState implements Serializable, Copyable { sb.append("permanents"); List perms = new ArrayList<>(); for (Permanent permanent : battlefield.getAllPermanents()) { - perms.add(permanent.getValue()); + perms.add(permanent.getValue(this)); } Collections.sort(perms); sb.append(perms); @@ -357,7 +357,7 @@ public class GameState implements Serializable, Copyable { sb.append("permanents"); List perms = new ArrayList<>(); for (Permanent permanent : battlefield.getAllPermanents()) { - perms.add(permanent.getValue()); + perms.add(permanent.getValue(this)); } Collections.sort(perms); sb.append(perms); diff --git a/Mage/src/main/java/mage/game/permanent/Permanent.java b/Mage/src/main/java/mage/game/permanent/Permanent.java index 7319a51a11..56670bc3fa 100644 --- a/Mage/src/main/java/mage/game/permanent/Permanent.java +++ b/Mage/src/main/java/mage/game/permanent/Permanent.java @@ -40,6 +40,7 @@ import mage.constants.Zone; import mage.counters.Counters; import mage.game.Controllable; import mage.game.Game; +import mage.game.GameState; public interface Permanent extends Card, Controllable { @@ -161,7 +162,7 @@ public interface Permanent extends Card, Controllable { boolean entersBattlefield(UUID sourceId, Game game, Zone fromZone, boolean fireEvent); - String getValue(); + String getValue(GameState state); @Deprecated void addAbility(Ability ability); diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index 08462ac566..501dca7d47 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -65,6 +65,7 @@ import mage.counters.Counter; import mage.counters.CounterType; import mage.counters.Counters; import mage.game.Game; +import mage.game.GameState; import mage.game.command.CommandObject; import mage.game.events.DamageCreatureEvent; import mage.game.events.DamagePlaneswalkerEvent; @@ -219,12 +220,12 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } @Override - public String getValue() { + public String getValue(GameState state) { StringBuilder sb = threadLocalBuilder.get(); sb.append(controllerId).append(name).append(tapped).append(damage); sb.append(subtype).append(supertype).append(power.getValue()).append(toughness.getValue()); sb.append(abilities.getValue()); - for (Counter counter : getCounters().values()) { + for (Counter counter : getCounters(state).values()) { sb.append(counter.getName()).append(counter.getCount()); } return sb.toString(); @@ -333,31 +334,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } @Override - public boolean addCounters(String name, int amount, Game game) { - return addCounters(name, amount, game, null); - } - - @Override - public boolean addCounters(String name, int amount, Game game, ArrayList appliedEffects) { - boolean returnCode = true; - GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, controllerId, name, amount); - countersEvent.setAppliedEffects(appliedEffects); - if (!game.replaceEvent(countersEvent)) { - for (int i = 0; i < countersEvent.getAmount(); i++) { - GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, controllerId, name, 1); - event.setAppliedEffects(appliedEffects); - if (!game.replaceEvent(event)) { - counters.addCounter(name, 1); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, controllerId, name, 1)); - } else { - returnCode = false; - } - } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERS_ADDED, objectId, controllerId, name, amount)); - } else { - returnCode = false; - } - return returnCode; + public Counters getCounters(GameState state) { + return counters; } @Override @@ -878,10 +856,10 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { int actualDamage = event.getAmount(); if (actualDamage > 0) { int countersToRemove = actualDamage; - if (countersToRemove > getCounters().getCount(CounterType.LOYALTY)) { - countersToRemove = getCounters().getCount(CounterType.LOYALTY); + if (countersToRemove > getCounters(game).getCount(CounterType.LOYALTY)) { + countersToRemove = getCounters(game).getCount(CounterType.LOYALTY); } - getCounters().removeCounter(CounterType.LOYALTY, countersToRemove); + getCounters(game).removeCounter(CounterType.LOYALTY, countersToRemove); game.fireEvent(new DamagedPlaneswalkerEvent(objectId, sourceId, controllerId, actualDamage, combat)); return actualDamage; } diff --git a/Mage/src/main/java/mage/game/stack/Spell.java b/Mage/src/main/java/mage/game/stack/Spell.java index 6ce48963fa..9a1b8eebbb 100644 --- a/Mage/src/main/java/mage/game/stack/Spell.java +++ b/Mage/src/main/java/mage/game/stack/Spell.java @@ -56,6 +56,7 @@ import mage.constants.ZoneDetail; import mage.counters.Counter; import mage.counters.Counters; import mage.game.Game; +import mage.game.GameState; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; @@ -825,9 +826,15 @@ public class Spell extends StackObjImpl implements Card { @Override public Counters getCounters(Game game) { + return card.getCounters(game); } + @Override + public Counters getCounters(GameState state) { + return card.getCounters(state); + } + @Override public boolean addCounters(String name, int amount, Game game) { return card.addCounters(name, amount, game); diff --git a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayerWithCounter.java b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayerWithCounter.java index 700c5c4f84..ae63a8aba9 100644 --- a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayerWithCounter.java +++ b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayerWithCounter.java @@ -80,7 +80,7 @@ public class TargetPermanentOrPlayerWithCounter extends TargetPermanentOrPlayer public boolean canTarget(UUID id, Game game) { Permanent permanent = game.getPermanent(id); if (permanent != null) { - if (permanent.getCounters().size() == 0) { + if (permanent.getCounters(game).size() == 0) { return false; } } @@ -97,7 +97,7 @@ public class TargetPermanentOrPlayerWithCounter extends TargetPermanentOrPlayer public boolean canTarget(UUID id, Ability source, Game game) { Permanent permanent = game.getPermanent(id); if (permanent != null) { - if (permanent.getCounters().size() == 0) { + if (permanent.getCounters(game).size() == 0) { return false; } } From 53edfaeaa01a325bd77e1b248388e2ac60cb186c Mon Sep 17 00:00:00 2001 From: Matt Oslan Date: Sat, 3 Sep 2016 13:02:23 -0400 Subject: [PATCH 09/20] Implement Vulshok Battlemaster --- .../sets/mirrodin/VulshokBattlemaster.java | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/mirrodin/VulshokBattlemaster.java diff --git a/Mage.Sets/src/mage/sets/mirrodin/VulshokBattlemaster.java b/Mage.Sets/src/mage/sets/mirrodin/VulshokBattlemaster.java new file mode 100644 index 0000000000..bd5ea4e431 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodin/VulshokBattlemaster.java @@ -0,0 +1,109 @@ +/* + * 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.mirrodin; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author Derpthemeus + */ +public class VulshokBattlemaster extends CardImpl { + + public VulshokBattlemaster(UUID ownerId) { + super(ownerId, 110, "Vulshok Battlemaster", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{R}"); + this.expansionSetCode = "MRD"; + this.subtype.add("Human"); + this.subtype.add("Warrior"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Haste + this.addAbility(HasteAbility.getInstance()); + // When Vulshok Battlemaster enters the battlefield, attach all Equipment on the battlefield to it. + this.addAbility(new EntersBattlefieldTriggeredAbility(new VulshokBattlemasterEffect())); + } + + public VulshokBattlemaster(final VulshokBattlemaster card) { + super(card); + } + + @java.lang.Override + public VulshokBattlemaster copy() { + return new VulshokBattlemaster(this); + } + + class VulshokBattlemasterEffect extends OneShotEffect { + + public VulshokBattlemasterEffect() { + super(Outcome.Benefit); + this.staticText = "attach all Equipment on the battlefield to it"; + } + + public VulshokBattlemasterEffect(final VulshokBattlemasterEffect effect) { + super(effect); + } + + @java.lang.Override + public VulshokBattlemasterEffect copy() { + return new VulshokBattlemasterEffect(this); + } + + @java.lang.Override + public boolean apply(Game game, Ability source) { + Permanent battlemaster = game.getPermanent(source.getSourceId()); + if (battlemaster != null) { + FilterPermanent filter = new FilterPermanent(); + filter.add(new SubtypePredicate("Equipment")); + for (Permanent equipment : game.getBattlefield().getAllActivePermanents(filter, game)) { + if (equipment != null) { + //If an Equipment can’t equip Vulshok Battlemaster, it isn’t attached to the Battlemaster, and it doesn’t become unattached (if it’s attached to a creature). (http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=48125) + if (!battlemaster.cantBeAttachedBy(equipment, game)) { + battlemaster.addAttachment(equipment.getId(), game); + } + } + } + return true; + } + return false; + } + } +} From cfa5b13f0bc6b02f7f2c5137b763cfe16d6d308e Mon Sep 17 00:00:00 2001 From: Matt Oslan Date: Sat, 3 Sep 2016 14:11:54 -0400 Subject: [PATCH 10/20] Implement Living Armor --- .../src/mage/sets/chronicles/LivingArmor.java | 98 +++++++++++++++++++ .../src/mage/sets/thedark/LivingArmor.java | 54 ++++++++++ 2 files changed, 152 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/chronicles/LivingArmor.java create mode 100644 Mage.Sets/src/mage/sets/thedark/LivingArmor.java diff --git a/Mage.Sets/src/mage/sets/chronicles/LivingArmor.java b/Mage.Sets/src/mage/sets/chronicles/LivingArmor.java new file mode 100644 index 0000000000..5567e3a84e --- /dev/null +++ b/Mage.Sets/src/mage/sets/chronicles/LivingArmor.java @@ -0,0 +1,98 @@ +/* + * 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.chronicles; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.BoostCounter; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author Derpthemeus + */ +public class LivingArmor extends CardImpl { + + public LivingArmor(UUID ownerId) { + super(ownerId, 83, "Living Armor", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{4}"); + this.expansionSetCode = "CHR"; + + // {tap}, Sacrifice Living Armor: Put X +0/+1 counters on target creature, where X is that creature's converted mana cost. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new LivingArmorEffect(), new TapSourceCost()); + ability.addCost(new SacrificeSourceCost()); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + } + + public LivingArmor(final LivingArmor card) { + super(card); + } + + @Override + public LivingArmor copy() { + return new LivingArmor(this); + } + + class LivingArmorEffect extends OneShotEffect { + + public LivingArmorEffect() { + super(Outcome.BoostCreature); + this.staticText = "Put X +0/+1 counters on target creature, where X is that creature's converted mana cost"; + } + + public LivingArmorEffect(final LivingArmorEffect effect) { + super(effect); + } + + @Override + public LivingArmorEffect copy() { + return new LivingArmorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent creature = game.getPermanent(source.getTargets().getFirstTarget()); + if (creature != null) { + int amount = creature.getConvertedManaCost(); + creature.addCounters(new BoostCounter(0, 1, amount), game); + } + return false; + } + } +} diff --git a/Mage.Sets/src/mage/sets/thedark/LivingArmor.java b/Mage.Sets/src/mage/sets/thedark/LivingArmor.java new file mode 100644 index 0000000000..5a17b0441e --- /dev/null +++ b/Mage.Sets/src/mage/sets/thedark/LivingArmor.java @@ -0,0 +1,54 @@ +/* + * 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.thedark; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author Derpthemeus + */ +public class LivingArmor extends mage.sets.chronicles.LivingArmor { + + public LivingArmor(UUID ownerId) { + super(ownerId); + this.cardNumber = "101"; + this.expansionSetCode = "DRK"; + this.rarity = Rarity.UNCOMMON; + } + + public LivingArmor(final LivingArmor card) { + super(card); + } + + @Override + public LivingArmor copy() { + return new LivingArmor(this); + } +} From 00e3ca1939b11d2ab1e207c323bfe6df5e85d5ed Mon Sep 17 00:00:00 2001 From: Matt Oslan Date: Sat, 3 Sep 2016 14:12:21 -0400 Subject: [PATCH 11/20] Implement Walking Dead --- .../src/mage/sets/legends/WalkingDead.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/legends/WalkingDead.java diff --git a/Mage.Sets/src/mage/sets/legends/WalkingDead.java b/Mage.Sets/src/mage/sets/legends/WalkingDead.java new file mode 100644 index 0000000000..082c6aa0d7 --- /dev/null +++ b/Mage.Sets/src/mage/sets/legends/WalkingDead.java @@ -0,0 +1,65 @@ +/* + * 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.legends; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.RegenerateSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author Derpthemeus + */ +public class WalkingDead extends CardImpl { + + public WalkingDead(UUID ownerId) { + super(ownerId, 40, "Walking Dead", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{B}"); + this.expansionSetCode = "LEG"; + this.subtype.add("Zombie"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {B}: Regenerate Walking Dead. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{B}"))); + } + + public WalkingDead(final WalkingDead card) { + super(card); + } + + @Override + public WalkingDead copy() { + return new WalkingDead(this); + } +} From eaa16a179bc7a05c79f60bd88c9720e0e590eb39 Mon Sep 17 00:00:00 2001 From: Matt Oslan Date: Sat, 3 Sep 2016 14:13:55 -0400 Subject: [PATCH 12/20] Implement Cyclopean Mummy --- .../sets/fourthedition/CyclopeanMummy.java | 52 +++++++++++++++ .../src/mage/sets/legends/CyclopeanMummy.java | 63 +++++++++++++++++++ .../sets/masterseditioniv/CyclopeanMummy.java | 52 +++++++++++++++ 3 files changed, 167 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/fourthedition/CyclopeanMummy.java create mode 100644 Mage.Sets/src/mage/sets/legends/CyclopeanMummy.java create mode 100644 Mage.Sets/src/mage/sets/masterseditioniv/CyclopeanMummy.java diff --git a/Mage.Sets/src/mage/sets/fourthedition/CyclopeanMummy.java b/Mage.Sets/src/mage/sets/fourthedition/CyclopeanMummy.java new file mode 100644 index 0000000000..26703142ac --- /dev/null +++ b/Mage.Sets/src/mage/sets/fourthedition/CyclopeanMummy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.fourthedition; + +import java.util.UUID; + +/** + * + * @author Derpthemeus + */ +public class CyclopeanMummy extends mage.sets.legends.CyclopeanMummy { + + public CyclopeanMummy(UUID ownerId) { + super(ownerId); + this.cardNumber = "12"; + this.expansionSetCode = "4ED"; + } + + public CyclopeanMummy(final CyclopeanMummy card) { + super(card); + } + + @Override + public CyclopeanMummy copy() { + return new CyclopeanMummy(this); + } +} diff --git a/Mage.Sets/src/mage/sets/legends/CyclopeanMummy.java b/Mage.Sets/src/mage/sets/legends/CyclopeanMummy.java new file mode 100644 index 0000000000..ce89843d2e --- /dev/null +++ b/Mage.Sets/src/mage/sets/legends/CyclopeanMummy.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.legends; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.effects.common.ExileSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; + +/** + * + * @author Derpthemeus + */ +public class CyclopeanMummy extends CardImpl { + + public CyclopeanMummy(UUID ownerId) { + super(ownerId, 7, "Cyclopean Mummy", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{B}"); + this.expansionSetCode = "LEG"; + this.subtype.add("Zombie"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // When Cyclopean Mummy dies, exile it. + this.addAbility(new DiesTriggeredAbility(new ExileSourceEffect())); + } + + public CyclopeanMummy(final CyclopeanMummy card) { + super(card); + } + + @Override + public CyclopeanMummy copy() { + return new CyclopeanMummy(this); + } +} diff --git a/Mage.Sets/src/mage/sets/masterseditioniv/CyclopeanMummy.java b/Mage.Sets/src/mage/sets/masterseditioniv/CyclopeanMummy.java new file mode 100644 index 0000000000..479d9420f9 --- /dev/null +++ b/Mage.Sets/src/mage/sets/masterseditioniv/CyclopeanMummy.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.masterseditioniv; + +import java.util.UUID; + +/** + * + * @author Derpthemeus + */ +public class CyclopeanMummy extends mage.sets.legends.CyclopeanMummy { + + public CyclopeanMummy(UUID ownerId) { + super(ownerId); + this.cardNumber = "72"; + this.expansionSetCode = "ME4"; + } + + public CyclopeanMummy(final CyclopeanMummy card) { + super(card); + } + + @Override + public CyclopeanMummy copy() { + return new CyclopeanMummy(this); + } +} From ecd1985dabe3284bf84b72ca52b3f05b7ddd8ad6 Mon Sep 17 00:00:00 2001 From: Max Lebedev Date: Sat, 3 Sep 2016 16:04:22 -0400 Subject: [PATCH 13/20] implemented Vernal Equinox --- .../sets/mercadianmasques/VernalEquinox.java | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/mercadianmasques/VernalEquinox.java diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/VernalEquinox.java b/Mage.Sets/src/mage/sets/mercadianmasques/VernalEquinox.java new file mode 100644 index 0000000000..2a058df88a --- /dev/null +++ b/Mage.Sets/src/mage/sets/mercadianmasques/VernalEquinox.java @@ -0,0 +1,71 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.mercadianmasques; + +import java.util.UUID; + +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.continuous.CastAsThoughItHadFlashAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; + +/** + * + * @author maxlebedev + */ +public class VernalEquinox extends CardImpl { + + private static final FilterCard filter = new FilterCard("creature and enchantment cards"); + + static { + filter.add(Predicates.or(new CardTypePredicate(CardType.CREATURE), new CardTypePredicate(CardType.ENCHANTMENT))); + } + + public VernalEquinox(UUID ownerId) { + super(ownerId, 283, "Vernal Equinox", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}"); + this.expansionSetCode = "MMQ"; + + // Any player may cast creature and enchantment cards as though they had flash. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CastAsThoughItHadFlashAllEffect(Duration.WhileOnBattlefield, filter))); + } + + public VernalEquinox(final VernalEquinox card) { + super(card); + } + + @Override + public VernalEquinox copy() { + return new VernalEquinox(this); + } +} From 66f785dd716506c76b64c49b6de095b268aab8f7 Mon Sep 17 00:00:00 2001 From: Styxo Date: Sat, 3 Sep 2016 22:34:45 +0200 Subject: [PATCH 14/20] Fixed AddCountersTargetEffect --- .../counter/AddCountersTargetEffect.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java index a19cd3cd21..efe8af78ed 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java @@ -145,19 +145,23 @@ public class AddCountersTargetEffect extends OneShotEffect { sb.append("s"); } sb.append(" on "); - - Target target = mode.getTargets().get(0); - if (target.getNumberOfTargets() == 0) { - sb.append("up to "); - } - if (target.getMaxNumberOfTargets() > 1 || target.getNumberOfTargets() == 0) { - sb.append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName()); - } else { - if (!target.getTargetName().startsWith("another")) { - sb.append("target "); + if (mode.getTargets().size() > 0) { + Target target = mode.getTargets().get(0); + if (target.getNumberOfTargets() == 0) { + sb.append("up to "); } - sb.append(target.getTargetName()); + + if (target.getMaxNumberOfTargets() > 1 || target.getNumberOfTargets() == 0) { + sb.append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName()); + } else { + if (!target.getTargetName().startsWith("another")) { + sb.append("target "); + } + sb.append(target.getTargetName()); + } + } else { + sb.append("that creature"); } if (amount.getMessage().length() > 0) { From bec11804f550b3ba4d7f203032f28c3974d86ec7 Mon Sep 17 00:00:00 2001 From: Samuel Sandeen Date: Sat, 3 Sep 2016 16:52:41 -0400 Subject: [PATCH 15/20] Make the handling of counters more consistent. This dramatically reduces the code duplication around counters handling. --- .../commander/SkullbriarTheWalkingGrave.java | 73 +++++++++++++++++++ .../common/CountersSourceCount.java | 2 +- .../counter/AddCountersTargetEffect.java | 4 +- Mage/src/main/java/mage/cards/Card.java | 4 - Mage/src/main/java/mage/cards/CardImpl.java | 45 ++++-------- Mage/src/main/java/mage/cards/MeldCard.java | 17 ----- .../java/mage/game/permanent/Permanent.java | 2 - .../mage/game/permanent/PermanentImpl.java | 45 +----------- .../mage/game/permanent/PermanentMeld.java | 14 ---- Mage/src/main/java/mage/game/stack/Spell.java | 11 --- .../main/java/mage/players/PlayerImpl.java | 33 ++++++--- 11 files changed, 116 insertions(+), 134 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/commander/SkullbriarTheWalkingGrave.java diff --git a/Mage.Sets/src/mage/sets/commander/SkullbriarTheWalkingGrave.java b/Mage.Sets/src/mage/sets/commander/SkullbriarTheWalkingGrave.java new file mode 100644 index 0000000000..316cb3fc9a --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander/SkullbriarTheWalkingGrave.java @@ -0,0 +1,73 @@ +/* + * 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.commander; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.cards.repository.CardRepository; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.counters.CounterType; + +/** + * + * @author anonymous + */ +public class SkullbriarTheWalkingGrave extends CardImpl { + + public SkullbriarTheWalkingGrave(UUID ownerId) { + super(ownerId, 227, "Skullbriar, the Walking Grave", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{B}{G}"); + this.expansionSetCode = "CMD"; + this.supertype.add("Legendary"); + this.subtype.add("Zombie"); + this.subtype.add("Elemental"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Haste + this.addAbility(HasteAbility.getInstance()); + // Whenever Skullbriar, the Walking Grave deals combat damage to a player, put a +1/+1 counter on it. + this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility( + new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false)); + // Counters remain on Skullbriar as it moves to any zone other than a player's hand or library. + + } + + public SkullbriarTheWalkingGrave(final SkullbriarTheWalkingGrave card) { + super(card); + } + + @Override + public SkullbriarTheWalkingGrave copy() { + return new SkullbriarTheWalkingGrave(this); + } +} diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersSourceCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersSourceCount.java index d132ed29a6..53c1a7f2c6 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersSourceCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersSourceCount.java @@ -23,7 +23,7 @@ public class CountersSourceCount implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent permanent = game.getPermanentOrLKIBattlefield(sourceAbility.getSourceId()); if (permanent != null) { - return permanent.getCounters().getCount(counter); + return permanent.getCounters(game).getCount(counter); } return 0; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java index 12ed557e84..529100514b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java @@ -145,7 +145,9 @@ public class AddCountersTargetEffect extends OneShotEffect { sb.append("s"); } sb.append(" on "); - + + + Target target = mode.getTargets().get(0); if (target.getNumberOfTargets() == 0) { sb.append("up to "); diff --git a/Mage/src/main/java/mage/cards/Card.java b/Mage/src/main/java/mage/cards/Card.java index 13895bc84c..b5525dc669 100644 --- a/Mage/src/main/java/mage/cards/Card.java +++ b/Mage/src/main/java/mage/cards/Card.java @@ -155,10 +155,6 @@ public interface Card extends MageObject { Counters getCounters(GameState state); - boolean addCounters(String name, int amount, Game game); - - boolean addCounters(String name, int amount, Game game, ArrayList appliedEffects); - boolean addCounters(Counter counter, Game game); boolean addCounters(Counter counter, Game game, ArrayList appliedEffects); diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index a0c23ef525..ebe0e0aa52 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -664,31 +664,11 @@ public abstract class CardImpl extends MageObjectImpl implements Card { return state.getCardState(this.objectId).getCounters(); } - @Override - public boolean addCounters(String name, int amount, Game game) { - return addCounters(name, amount, game, null); - } - - @Override - public boolean addCounters(String name, int amount, Game game, ArrayList appliedEffects) { - boolean returnCode = true; - GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, ownerId, name, amount); - countersEvent.setAppliedEffects(appliedEffects); - if (!game.replaceEvent(countersEvent)) { - for (int i = 0; i < countersEvent.getAmount(); i++) { - GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, ownerId, name, 1); - event.setAppliedEffects(appliedEffects); - if (!game.replaceEvent(event)) { - getCounters(game).addCounter(name, 1); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, ownerId, name, 1)); - } else { - returnCode = false; - } - } - } else { - returnCode = false; - } - return returnCode; + /** + * @return The controller if available otherwise the owner. + */ + protected UUID getControllerOrOwner() { + return ownerId; } @Override @@ -699,22 +679,27 @@ public abstract class CardImpl extends MageObjectImpl implements Card { @Override public boolean addCounters(Counter counter, Game game, ArrayList appliedEffects) { boolean returnCode = true; - GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, ownerId, counter.getName(), counter.getCount()); + GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, getControllerOrOwner(), counter.getName(), counter.getCount()); countersEvent.setAppliedEffects(appliedEffects); if (!game.replaceEvent(countersEvent)) { int amount = countersEvent.getAmount(); + int finalAmount = amount; for (int i = 0; i < amount; i++) { Counter eventCounter = counter.copy(); - eventCounter.remove(amount - 1); - GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, ownerId, counter.getName(), 1); + eventCounter.remove(eventCounter.getCount() - 1); + GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, getControllerOrOwner(), counter.getName(), 1); event.setAppliedEffects(appliedEffects); if (!game.replaceEvent(event)) { getCounters(game).addCounter(eventCounter); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, ownerId, counter.getName(), 1)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, getControllerOrOwner(), counter.getName(), 1)); } else { + finalAmount--; returnCode = false; } } + if(finalAmount > 0) { + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERS_ADDED, objectId, getControllerOrOwner(), counter.getName(), amount)); + } } else { returnCode = false; } @@ -725,7 +710,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { public void removeCounters(String name, int amount, Game game) { for (int i = 0; i < amount; i++) { getCounters(game).removeCounter(name, 1); - GameEvent event = GameEvent.getEvent(GameEvent.EventType.COUNTER_REMOVED, objectId, ownerId); + GameEvent event = GameEvent.getEvent(GameEvent.EventType.COUNTER_REMOVED, objectId, getControllerOrOwner()); event.setData(name); game.fireEvent(event); } diff --git a/Mage/src/main/java/mage/cards/MeldCard.java b/Mage/src/main/java/mage/cards/MeldCard.java index d49cc2c53f..d7ccc2d657 100644 --- a/Mage/src/main/java/mage/cards/MeldCard.java +++ b/Mage/src/main/java/mage/cards/MeldCard.java @@ -346,21 +346,4 @@ public abstract class MeldCard extends CardImpl { return returnState; } } - - @Override - public boolean addCounters(String name, int amount, Game game, ArrayList appliedEffects) { - if (this.isMelded()) { - return super.addCounters(name, amount, game, appliedEffects); - } else { - // can this really happen? - boolean returnState = true; - if (topLastZoneChangeCounter == topHalfCard.getZoneChangeCounter(game)) { - returnState |= topHalfCard.addCounters(name, amount, game, appliedEffects); - } - if (bottomLastZoneChangeCounter == bottomHalfCard.getZoneChangeCounter(game)) { - returnState |= bottomHalfCard.addCounters(name, amount, game, appliedEffects); - } - return returnState; - } - } } diff --git a/Mage/src/main/java/mage/game/permanent/Permanent.java b/Mage/src/main/java/mage/game/permanent/Permanent.java index 56670bc3fa..a9718c49a3 100644 --- a/Mage/src/main/java/mage/game/permanent/Permanent.java +++ b/Mage/src/main/java/mage/game/permanent/Permanent.java @@ -104,8 +104,6 @@ public interface Permanent extends Card, Controllable { void setSecondCardFace(Card card); - Counters getCounters(); - List getAttachments(); UUID getAttachedTo(); diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index 501dca7d47..5ff27625d0 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -323,11 +323,6 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { getAbilities().clear(); } - @Override - public Counters getCounters() { - return counters; - } - @Override public Counters getCounters(Game game) { return counters; @@ -339,44 +334,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } @Override - public boolean addCounters(Counter counter, Game game, ArrayList appliedEffects) { - boolean returnCode = true; - GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, controllerId, counter.getName(), counter.getCount()); - countersEvent.setAppliedEffects(appliedEffects); - if (!game.replaceEvent(countersEvent)) { - int amount = countersEvent.getAmount(); - for (int i = 0; i < amount; i++) { - Counter eventCounter = counter.copy(); - eventCounter.remove(eventCounter.getCount() - 1); - GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, controllerId, counter.getName(), 1); - event.setAppliedEffects(appliedEffects); - if (!game.replaceEvent(event)) { - counters.addCounter(eventCounter); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, controllerId, counter.getName(), 1)); - } else { - returnCode = false; - } - } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERS_ADDED, objectId, controllerId, counter.getName(), amount)); - } else { - returnCode = false; - } - return returnCode; - } - - @Override - public void removeCounters(String name, int amount, Game game) { - for (int i = 0; i < amount; i++) { - counters.removeCounter(name, 1); - GameEvent event = GameEvent.getEvent(GameEvent.EventType.COUNTER_REMOVED, objectId, controllerId); - event.setData(name); - game.fireEvent(event); - } - } - - @Override - public void removeCounters(Counter counter, Game game) { - removeCounters(counter.getName(), counter.getCount(), game); + protected UUID getControllerOrOwner() { + return controllerId; } @Override diff --git a/Mage/src/main/java/mage/game/permanent/PermanentMeld.java b/Mage/src/main/java/mage/game/permanent/PermanentMeld.java index 36d4f336b0..6bd0f13116 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentMeld.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentMeld.java @@ -159,18 +159,4 @@ public class PermanentMeld extends PermanentCard { } return false; } - - @Override - public boolean addCounters(String name, int amount, Game game, ArrayList appliedEffects) { - MeldCard meldCard = (MeldCard) this.getCard(); - if (meldCard.isMelded()) { - return super.addCounters(name, amount, game, appliedEffects); - } else { - // can this really happen? - boolean returnState = true; - returnState |= meldCard.getTopHalfCard().addCounters(name, amount, game, appliedEffects); - returnState |= meldCard.getBottomHalfCard().addCounters(name, amount, game, appliedEffects); - return returnState; - } - } } diff --git a/Mage/src/main/java/mage/game/stack/Spell.java b/Mage/src/main/java/mage/game/stack/Spell.java index 9a1b8eebbb..85e4b2bb86 100644 --- a/Mage/src/main/java/mage/game/stack/Spell.java +++ b/Mage/src/main/java/mage/game/stack/Spell.java @@ -826,7 +826,6 @@ public class Spell extends StackObjImpl implements Card { @Override public Counters getCounters(Game game) { - return card.getCounters(game); } @@ -835,16 +834,6 @@ public class Spell extends StackObjImpl implements Card { return card.getCounters(state); } - @Override - public boolean addCounters(String name, int amount, Game game) { - return card.addCounters(name, amount, game); - } - - @Override - public boolean addCounters(String name, int amount, Game game, ArrayList appliedEffects) { - return card.addCounters(name, amount, game, appliedEffects); - } - @Override public boolean addCounters(Counter counter, Game game) { return card.addCounters(counter, game); diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 67c344afbb..02bb023242 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -1838,19 +1838,30 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public boolean addCounters(Counter counter, Game game) { - boolean returnState = true; - int amount = counter.getCount(); - for (int i = 0; i < amount; i++) { - Counter eventCounter = counter.copy(); - eventCounter.remove(amount - 1); - if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, playerId, playerId, counter.getName(), counter.getCount()))) { - counters.addCounter(eventCounter); - game.fireEvent(GameEvent.getEvent(EventType.COUNTER_ADDED, playerId, playerId, counter.getName(), counter.getCount())); - } else { - returnState = false; + boolean returnCode = true; + GameEvent countersEvent = GameEvent.getEvent(EventType.ADD_COUNTERS, playerId, playerId, counter.getName(), counter.getCount()); + if (!game.replaceEvent(countersEvent)) { + int amount = countersEvent.getAmount(); + int finalAmount = amount; + for (int i = 0; i < amount; i++) { + Counter eventCounter = counter.copy(); + eventCounter.remove(amount - 1); + GameEvent event = GameEvent.getEvent(EventType.ADD_COUNTER, playerId, playerId, counter.getName(), 1); + if (!game.replaceEvent(event)) { + getCounters().addCounter(eventCounter); + game.fireEvent(GameEvent.getEvent(EventType.COUNTER_ADDED, playerId, playerId, counter.getName(), 1)); + } else { + finalAmount--; + returnCode = false; + } } + if(finalAmount > 0) { + game.fireEvent(GameEvent.getEvent(EventType.COUNTERS_ADDED, playerId, playerId, counter.getName(), amount)); + } + } else { + returnCode = false; } - return returnState; + return returnCode; } @Override From a58432ac3f49c1bd2388b7b04dd938918481cee6 Mon Sep 17 00:00:00 2001 From: Matt Oslan Date: Sat, 3 Sep 2016 17:04:27 -0400 Subject: [PATCH 16/20] Change Minions' Murmurs from damage to life loss --- Mage.Sets/src/mage/sets/futuresight/MinionsMurmurs.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mage.Sets/src/mage/sets/futuresight/MinionsMurmurs.java b/Mage.Sets/src/mage/sets/futuresight/MinionsMurmurs.java index 5831196415..cc280927c3 100644 --- a/Mage.Sets/src/mage/sets/futuresight/MinionsMurmurs.java +++ b/Mage.Sets/src/mage/sets/futuresight/MinionsMurmurs.java @@ -83,7 +83,7 @@ public class MinionsMurmurs extends CardImpl { if (controller != null) { int creaturesControlled = game.getBattlefield().countAll(new FilterCreaturePermanent(), controller.getId(), game); controller.drawCards(creaturesControlled, game); - controller.damage(creaturesControlled, source.getId(), game, false, true); + controller.loseLife(creaturesControlled, game); return true; } return false; From ef5ed5256a3f49527fb78ded900672523d90d9af Mon Sep 17 00:00:00 2001 From: Samuel Sandeen Date: Sat, 3 Sep 2016 20:04:12 -0400 Subject: [PATCH 17/20] Clean up the deprecated moveCards methods in Player --- .../mage/sets/alarareborn/MindFuneral.java | 2 +- .../sets/battleforzendikar/BaneOfBalaGed.java | 2 +- .../sets/battleforzendikar/BlightHerder.java | 2 +- .../KioraMasterOfTheDepths.java | 2 +- .../battleforzendikar/UlamogsDespoiler.java | 2 +- .../battleforzendikar/UlamogsNullifier.java | 2 +- .../betrayersofkamigawa/SwayOfTheStars.java | 4 +- .../sets/bornofthegods/SatyrWayfinder.java | 2 +- .../championsofkamigawa/GiftsUngiven.java | 4 +- .../championsofkamigawa/InameDeathAspect.java | 2 +- .../src/mage/sets/commander/BuriedAlive.java | 2 +- .../mage/sets/commander/DesecratorHag.java | 2 +- .../src/mage/sets/commander2013/Foster.java | 2 +- .../sets/commander2013/StrategicPlanning.java | 2 +- .../mage/sets/commander2014/GraveSifter.java | 2 +- .../sets/commander2014/StitcherGeralf.java | 2 +- .../mage/sets/conflux/TeleminPerformance.java | 2 +- .../sets/darkascension/TrackersInstincts.java | 2 +- .../mage/sets/darksteel/ChromescaleDrake.java | 4 +- .../mage/sets/dissension/BoundDetermined.java | 2 +- .../dissension/MomirVigSimicVisionary.java | 2 +- .../src/mage/sets/dissension/RiseFall.java | 2 +- .../dragonsmaze/MirkoVoskMindDrinker.java | 2 +- .../sets/dragonsoftarkir/GurmagDrowner.java | 2 +- .../dragonsoftarkir/ProfanerOfTheDead.java | 2 +- .../sets/elspethvstezzeret/EchoingTruth.java | 2 +- .../fatereforged/RenownedWeaponsmith.java | 2 +- .../sets/fatereforged/SuddenReclamation.java | 2 +- .../src/mage/sets/fifthedition/Recall.java | 2 +- .../mage/sets/fifthedition/WindsOfChange.java | 2 +- .../mage/sets/gatecrash/BalustradeSpy.java | 2 +- .../sets/gatecrash/BorborygmosEnraged.java | 4 +- .../sets/gatecrash/CoercedConfession.java | 2 +- .../sets/gatecrash/ConsumingAberration.java | 2 +- .../src/mage/sets/gatecrash/DimirCharm.java | 2 +- .../src/mage/sets/gatecrash/MindGrind.java | 2 +- .../sets/gatecrash/UndercityInformer.java | 2 +- .../mage/sets/iceage/DemonicConsultation.java | 2 +- .../sets/innistrad/MirrorMadPhantasm.java | 2 +- Mage.Sets/src/mage/sets/innistrad/Mulch.java | 4 +- .../mage/sets/innistrad/TrepanationBlade.java | 2 +- .../src/mage/sets/journeyintonyx/Hubris.java | 2 +- .../sets/journeyintonyx/ScourgeOfFleets.java | 2 +- .../sets/khansoftarkir/BitterRevelation.java | 4 +- .../sets/khansoftarkir/ScoutTheBorders.java | 2 +- .../sets/khansoftarkir/SultaiSoothsayer.java | 2 +- .../sets/khansoftarkir/VillainousWealth.java | 2 +- .../mage/sets/limitedalpha/Timetwister.java | 4 +- .../src/mage/sets/magic2011/TimeReversal.java | 4 +- .../src/mage/sets/magic2012/SuturedGhoul.java | 2 +- .../mage/sets/magic2014/GlimpseTheFuture.java | 2 +- .../mage/sets/magicorigins/GatherThePack.java | 4 +- .../sets/magicorigins/SphinxsTutelage.java | 2 +- .../sets/masterseditionii/ForgottenLore.java | 2 +- .../sets/masterseditionii/ThoughtLash.java | 2 +- .../mage/sets/mirrodin/SpoilsOfTheVault.java | 2 +- .../sets/modernmasters2015/AllSunsDawn.java | 2 +- .../mage/sets/newphyrexia/LifesFinale.java | 2 +- .../src/mage/sets/onslaught/WeirdHarvest.java | 2 +- .../mage/sets/planarchaos/ShroudedLore.java | 2 +- .../sets/prereleaseevents/Gleancrawler.java | 2 +- Mage.Sets/src/mage/sets/ravnica/Grozoth.java | 2 +- .../returntoravnica/DestroyTheEvidence.java | 2 +- .../sets/returntoravnica/GrislySalvage.java | 2 +- .../mage/sets/returntoravnica/GuildFeud.java | 2 +- .../riseoftheeldrazi/RealmsUncharted.java | 4 +- .../sets/scarsofmirrodin/GenesisWave.java | 2 +- .../seventhedition/AncestralMemories.java | 2 +- .../sets/shadowmoor/AdviceFromTheFae.java | 2 +- .../sets/shadowmoor/TwilightShepherd.java | 2 +- .../sets/shardsofalara/TidehollowSculler.java | 2 +- .../src/mage/sets/stronghold/HermitDruid.java | 2 +- .../src/mage/sets/tempest/Grindstone.java | 2 +- .../src/mage/sets/tempest/Intuition.java | 2 +- Mage.Sets/src/mage/sets/tempest/Lobotomy.java | 2 +- Mage.Sets/src/mage/sets/tempest/WoodSage.java | 4 +- .../src/mage/sets/thedark/DanceOfMany.java | 2 +- .../mage/sets/theros/CommuneWithTheGods.java | 2 +- .../mage/sets/timeshifted/GrinningTotem.java | 2 +- .../src/mage/sets/torment/MesmericFiend.java | 2 +- .../sets/urzassaga/NoRestForTheWicked.java | 2 +- .../sets/weatherlight/SpinningDarkness.java | 2 +- .../src/mage/sets/zendikar/BeastHunt.java | 4 +- .../java/org/mage/test/player/TestPlayer.java | 20 +------- .../java/org/mage/test/stub/PlayerStub.java | 15 ------ .../abilities/effects/common/EnvoyEffect.java | 2 +- ...xileCardsFromTopOfLibraryTargetEffect.java | 2 +- .../common/LookLibraryControllerEffect.java | 2 +- .../ReturnToHandChosenPermanentEffect.java | 2 +- .../RevealLibraryPutIntoHandEffect.java | 2 +- ...leIntoLibraryGraveOfSourceOwnerEffect.java | 2 +- .../search/SearchLibraryPutInHandEffect.java | 2 +- .../effects/keyword/SweepEffect.java | 2 +- .../abilities/keyword/TransmuteAbility.java | 2 +- Mage/src/main/java/mage/cards/Card.java | 4 +- Mage/src/main/java/mage/players/Player.java | 12 +---- .../main/java/mage/players/PlayerImpl.java | 49 ------------------- 97 files changed, 108 insertions(+), 200 deletions(-) diff --git a/Mage.Sets/src/mage/sets/alarareborn/MindFuneral.java b/Mage.Sets/src/mage/sets/alarareborn/MindFuneral.java index 0fe7d721b9..c7e82231fc 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/MindFuneral.java +++ b/Mage.Sets/src/mage/sets/alarareborn/MindFuneral.java @@ -104,7 +104,7 @@ class MindFuneralEffect extends OneShotEffect { cards.add(card); } opponent.revealCards("Mind Funeral", cards, game); - opponent.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + opponent.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/BaneOfBalaGed.java b/Mage.Sets/src/mage/sets/battleforzendikar/BaneOfBalaGed.java index 7723735782..e57887451b 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/BaneOfBalaGed.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/BaneOfBalaGed.java @@ -93,7 +93,7 @@ class BaneOfBalaGedEffect extends OneShotEffect { if (defendingPlayer != null) { Target target = new TargetControlledPermanent(2); defendingPlayer.chooseTarget(outcome, target, source, game); - defendingPlayer.moveCards(new CardsImpl(target.getTargets()), null, Zone.EXILED, source, game); + defendingPlayer.moveCards(new CardsImpl(target.getTargets()), Zone.EXILED, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/BlightHerder.java b/Mage.Sets/src/mage/sets/battleforzendikar/BlightHerder.java index 51ba0d733f..8ef2652337 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/BlightHerder.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/BlightHerder.java @@ -107,7 +107,7 @@ class BlightHerderEffect extends OneShotEffect { if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) { if (controller.chooseTarget(outcome, target, source, game)) { Cards cardsToGraveyard = new CardsImpl(target.getTargets()); - controller.moveCards(cardsToGraveyard, null, Zone.GRAVEYARD, source, game); + controller.moveCards(cardsToGraveyard, Zone.GRAVEYARD, source, game); return new CreateTokenEffect(new EldraziScionToken(), 3).apply(game, source); } } diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/KioraMasterOfTheDepths.java b/Mage.Sets/src/mage/sets/battleforzendikar/KioraMasterOfTheDepths.java index c7919047f8..efccd05d30 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/KioraMasterOfTheDepths.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/KioraMasterOfTheDepths.java @@ -192,7 +192,7 @@ class KioraRevealEffect extends OneShotEffect { } } } - controller.moveCards(cards, null, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsDespoiler.java b/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsDespoiler.java index 4943bc184c..2ecd8cc067 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsDespoiler.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsDespoiler.java @@ -108,7 +108,7 @@ class UlamogsDespoilerEffect extends OneShotEffect { if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) { if (controller.chooseTarget(outcome, target, source, game)) { Cards cardsToGraveyard = new CardsImpl(target.getTargets()); - controller.moveCards(cardsToGraveyard, null, Zone.GRAVEYARD, source, game); + controller.moveCards(cardsToGraveyard, Zone.GRAVEYARD, source, game); return new AddCountersSourceEffect(CounterType.P1P1.createInstance(4)).apply(game, source); } } diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsNullifier.java b/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsNullifier.java index dcdff1c328..54cbfa219e 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsNullifier.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsNullifier.java @@ -123,7 +123,7 @@ class UlamogsNullifierEffect extends OneShotEffect { if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) { if (controller.chooseTarget(outcome, target, source, game)) { Cards cardsToGraveyard = new CardsImpl(target.getTargets()); - controller.moveCards(cardsToGraveyard, null, Zone.GRAVEYARD, source, game); + controller.moveCards(cardsToGraveyard, Zone.GRAVEYARD, source, game); game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); return true; } diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/SwayOfTheStars.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/SwayOfTheStars.java index 0e4f8ff942..eb3fe8b0f4 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/SwayOfTheStars.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/SwayOfTheStars.java @@ -91,8 +91,8 @@ class SwayOfTheStarsEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.moveCards(player.getHand(), Zone.HAND, Zone.LIBRARY, source, game); - player.moveCards(player.getGraveyard(), Zone.GRAVEYARD, Zone.LIBRARY, source, game); + player.moveCards(player.getHand(), Zone.LIBRARY, source, game); + player.moveCards(player.getGraveyard(), Zone.LIBRARY, source, game); FilterPermanent filter = new FilterPermanent(); filter.add(new OwnerIdPredicate(playerId)); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, controller.getId(), source.getSourceId(), game)) { diff --git a/Mage.Sets/src/mage/sets/bornofthegods/SatyrWayfinder.java b/Mage.Sets/src/mage/sets/bornofthegods/SatyrWayfinder.java index 408c1a7a9c..7c69c8281f 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/SatyrWayfinder.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/SatyrWayfinder.java @@ -113,7 +113,7 @@ class SatyrWayfinderEffect extends OneShotEffect { } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/GiftsUngiven.java b/Mage.Sets/src/mage/sets/championsofkamigawa/GiftsUngiven.java index 2ad8724c36..73fe0d0429 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/GiftsUngiven.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/GiftsUngiven.java @@ -119,8 +119,8 @@ class GiftsUngivenEffect extends OneShotEffect { } } - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); - player.moveCards(cardsToKeep, Zone.LIBRARY, Zone.HAND, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); + player.moveCards(cardsToKeep, Zone.HAND, source, game); } player.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/InameDeathAspect.java b/Mage.Sets/src/mage/sets/championsofkamigawa/InameDeathAspect.java index 01b06c60d7..f8e6173418 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/InameDeathAspect.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/InameDeathAspect.java @@ -98,7 +98,7 @@ class InameDeathAspectEffect extends SearchEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null && player.searchLibrary(target, game)) { if (target.getTargets().size() > 0) { - player.moveCards(new CardsImpl(target.getTargets()), Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game); } player.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/commander/BuriedAlive.java b/Mage.Sets/src/mage/sets/commander/BuriedAlive.java index 50a3159571..9201cdcf2f 100644 --- a/Mage.Sets/src/mage/sets/commander/BuriedAlive.java +++ b/Mage.Sets/src/mage/sets/commander/BuriedAlive.java @@ -89,7 +89,7 @@ class BuriedAliveEffect extends SearchEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (controller.searchLibrary(target, game)) { - controller.moveCards(new CardsImpl(target.getTargets()), Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game); } controller.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/commander/DesecratorHag.java b/Mage.Sets/src/mage/sets/commander/DesecratorHag.java index a5724d0748..fd5824cead 100644 --- a/Mage.Sets/src/mage/sets/commander/DesecratorHag.java +++ b/Mage.Sets/src/mage/sets/commander/DesecratorHag.java @@ -124,7 +124,7 @@ class DesecratorHagEffect extends OneShotEffect { } } } else { - return you.moveCards(cards, null, Zone.HAND, source, game); + return you.moveCards(cards, Zone.HAND, source, game); } } return false; diff --git a/Mage.Sets/src/mage/sets/commander2013/Foster.java b/Mage.Sets/src/mage/sets/commander2013/Foster.java index 37b0e13117..509d514db3 100644 --- a/Mage.Sets/src/mage/sets/commander2013/Foster.java +++ b/Mage.Sets/src/mage/sets/commander2013/Foster.java @@ -126,7 +126,7 @@ class FosterEffect extends OneShotEffect { controller.moveCards(cardFound, Zone.HAND, source, game); cards.remove(cardFound); } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/commander2013/StrategicPlanning.java b/Mage.Sets/src/mage/sets/commander2013/StrategicPlanning.java index dcb1ecdcc7..1db8513711 100644 --- a/Mage.Sets/src/mage/sets/commander2013/StrategicPlanning.java +++ b/Mage.Sets/src/mage/sets/commander2013/StrategicPlanning.java @@ -101,7 +101,7 @@ class StrategicPlanningEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/commander2014/GraveSifter.java b/Mage.Sets/src/mage/sets/commander2014/GraveSifter.java index 8dffb1f83c..9ce16fc6c1 100644 --- a/Mage.Sets/src/mage/sets/commander2014/GraveSifter.java +++ b/Mage.Sets/src/mage/sets/commander2014/GraveSifter.java @@ -111,7 +111,7 @@ class GraveSifterEffect extends OneShotEffect { filter.add(new SubtypePredicate(typeChoice.getChoice())); Target target = new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, filter); player.chooseTarget(outcome, target, source, game); - player.moveCards(new CardsImpl(target.getTargets()), null, Zone.HAND, source, game); + player.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); } } diff --git a/Mage.Sets/src/mage/sets/commander2014/StitcherGeralf.java b/Mage.Sets/src/mage/sets/commander2014/StitcherGeralf.java index 66079a6dc8..54409f0b92 100644 --- a/Mage.Sets/src/mage/sets/commander2014/StitcherGeralf.java +++ b/Mage.Sets/src/mage/sets/commander2014/StitcherGeralf.java @@ -108,7 +108,7 @@ class StitcherGeralfEffect extends OneShotEffect { cards.addAll(player.getLibrary().getTopCards(game, 3)); } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); TargetCard target = new TargetCard(0,2,Zone.GRAVEYARD, new FilterCreatureCard("creature cards to exile")); controller.chooseTarget(outcome, cards, target, source, game); int power = 0; diff --git a/Mage.Sets/src/mage/sets/conflux/TeleminPerformance.java b/Mage.Sets/src/mage/sets/conflux/TeleminPerformance.java index 9574a17f72..3096f19222 100644 --- a/Mage.Sets/src/mage/sets/conflux/TeleminPerformance.java +++ b/Mage.Sets/src/mage/sets/conflux/TeleminPerformance.java @@ -104,7 +104,7 @@ class TeleminPerformanceEffect extends OneShotEffect { } if (!cards.isEmpty()) { opponent.revealCards("Telemin Performance", cards, game); - opponent.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + opponent.moveCards(cards, Zone.GRAVEYARD, source, game); } if (creature != null) { return creature.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId()); diff --git a/Mage.Sets/src/mage/sets/darkascension/TrackersInstincts.java b/Mage.Sets/src/mage/sets/darkascension/TrackersInstincts.java index 3274bbb3c1..0e85ab4a98 100644 --- a/Mage.Sets/src/mage/sets/darkascension/TrackersInstincts.java +++ b/Mage.Sets/src/mage/sets/darkascension/TrackersInstincts.java @@ -118,7 +118,7 @@ class TrackersInstinctsEffect extends OneShotEffect { } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/darksteel/ChromescaleDrake.java b/Mage.Sets/src/mage/sets/darksteel/ChromescaleDrake.java index 9f06247482..5ebb37bde0 100644 --- a/Mage.Sets/src/mage/sets/darksteel/ChromescaleDrake.java +++ b/Mage.Sets/src/mage/sets/darksteel/ChromescaleDrake.java @@ -109,8 +109,8 @@ class ChromescaleDrakeEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cardsToHand, Zone.LIBRARY, Zone.HAND, source, game); - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/dissension/BoundDetermined.java b/Mage.Sets/src/mage/sets/dissension/BoundDetermined.java index b46d4946cd..c199091d4a 100644 --- a/Mage.Sets/src/mage/sets/dissension/BoundDetermined.java +++ b/Mage.Sets/src/mage/sets/dissension/BoundDetermined.java @@ -125,7 +125,7 @@ class BoundEffect extends OneShotEffect { TargetCardInYourGraveyard targetCard = new TargetCardInYourGraveyard(0, colors, new FilterCard("up to " + colors + " card" + (colors > 1 ? "s" : "") + " from your graveyard")); controller.chooseTarget(outcome, targetCard, source, game); - controller.moveCards(new CardsImpl(targetCard.getTargets()), null, Zone.HAND, source, game); + controller.moveCards(new CardsImpl(targetCard.getTargets()), Zone.HAND, source, game); } } } diff --git a/Mage.Sets/src/mage/sets/dissension/MomirVigSimicVisionary.java b/Mage.Sets/src/mage/sets/dissension/MomirVigSimicVisionary.java index 38d5e605ae..d3a84fbd87 100644 --- a/Mage.Sets/src/mage/sets/dissension/MomirVigSimicVisionary.java +++ b/Mage.Sets/src/mage/sets/dissension/MomirVigSimicVisionary.java @@ -136,7 +136,7 @@ class MomirVigSimicVisionaryEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } } diff --git a/Mage.Sets/src/mage/sets/dissension/RiseFall.java b/Mage.Sets/src/mage/sets/dissension/RiseFall.java index 3df0737e4e..58db402090 100644 --- a/Mage.Sets/src/mage/sets/dissension/RiseFall.java +++ b/Mage.Sets/src/mage/sets/dissension/RiseFall.java @@ -108,7 +108,7 @@ class RiseEffect extends OneShotEffect { if (permanent != null) { cardsToHand.add(permanent); } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/MirkoVoskMindDrinker.java b/Mage.Sets/src/mage/sets/dragonsmaze/MirkoVoskMindDrinker.java index f7db36f8b8..f835cf5538 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/MirkoVoskMindDrinker.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/MirkoVoskMindDrinker.java @@ -119,7 +119,7 @@ class MirkoVoskMindDrinkerEffect extends OneShotEffect { } } player.revealCards("by " + sourceObject.getName() + " from " + player.getName(), cards, game); - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } } diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/GurmagDrowner.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/GurmagDrowner.java index facf055482..48c93b2f49 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/GurmagDrowner.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/GurmagDrowner.java @@ -111,7 +111,7 @@ class GurmagDrownerEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/ProfanerOfTheDead.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/ProfanerOfTheDead.java index 536cc50246..a08fd37bed 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/ProfanerOfTheDead.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/ProfanerOfTheDead.java @@ -105,7 +105,7 @@ class ProfanerOfTheDeadReturnEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { cardsToHand.add(permanent); } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/elspethvstezzeret/EchoingTruth.java b/Mage.Sets/src/mage/sets/elspethvstezzeret/EchoingTruth.java index 48d87e364e..218e9d7372 100644 --- a/Mage.Sets/src/mage/sets/elspethvstezzeret/EchoingTruth.java +++ b/Mage.Sets/src/mage/sets/elspethvstezzeret/EchoingTruth.java @@ -103,7 +103,7 @@ class ReturnToHandAllNamedPermanentsEffect extends OneShotEffect { for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { cardsToHand.add(perm); } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return true; diff --git a/Mage.Sets/src/mage/sets/fatereforged/RenownedWeaponsmith.java b/Mage.Sets/src/mage/sets/fatereforged/RenownedWeaponsmith.java index 4a1a01b88e..32dc1e76b5 100644 --- a/Mage.Sets/src/mage/sets/fatereforged/RenownedWeaponsmith.java +++ b/Mage.Sets/src/mage/sets/fatereforged/RenownedWeaponsmith.java @@ -150,7 +150,7 @@ class RenownedWeaponsmithEffect extends OneShotEffect { Cards revealed = new CardsImpl(); revealed.add(card); controller.revealCards(sourceObject.getIdName(), revealed, game); - controller.moveCards(revealed, null, Zone.HAND, source, game); + controller.moveCards(revealed, Zone.HAND, source, game); } } controller.shuffleLibrary(source, game); diff --git a/Mage.Sets/src/mage/sets/fatereforged/SuddenReclamation.java b/Mage.Sets/src/mage/sets/fatereforged/SuddenReclamation.java index c12a2bd179..f4468150a5 100644 --- a/Mage.Sets/src/mage/sets/fatereforged/SuddenReclamation.java +++ b/Mage.Sets/src/mage/sets/fatereforged/SuddenReclamation.java @@ -110,7 +110,7 @@ class SuddenReclamationEffect extends OneShotEffect { cardsToHand.add(card); } } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/fifthedition/Recall.java b/Mage.Sets/src/mage/sets/fifthedition/Recall.java index f1af05b0fa..194e66d832 100644 --- a/Mage.Sets/src/mage/sets/fifthedition/Recall.java +++ b/Mage.Sets/src/mage/sets/fifthedition/Recall.java @@ -96,7 +96,7 @@ class RecallEffect extends OneShotEffect { TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(cardsDiscarded.size(), new FilterCard()); target.setNotTarget(true); target.choose(Outcome.ReturnToHand, controller.getId(), source.getSourceId(), game); - controller.moveCards(new CardsImpl(target.getTargets()), null, Zone.HAND, source, game); + controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); } return true; diff --git a/Mage.Sets/src/mage/sets/fifthedition/WindsOfChange.java b/Mage.Sets/src/mage/sets/fifthedition/WindsOfChange.java index 1086263c23..0a3fb274df 100644 --- a/Mage.Sets/src/mage/sets/fifthedition/WindsOfChange.java +++ b/Mage.Sets/src/mage/sets/fifthedition/WindsOfChange.java @@ -89,7 +89,7 @@ class WindsOfChangeEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { permanentsCount.put(playerId, player.getHand().size()); - player.moveCards(player.getHand(), Zone.HAND, Zone.LIBRARY, source, game); + player.moveCards(player.getHand(), Zone.LIBRARY, source, game); player.shuffleLibrary(source, game); } } diff --git a/Mage.Sets/src/mage/sets/gatecrash/BalustradeSpy.java b/Mage.Sets/src/mage/sets/gatecrash/BalustradeSpy.java index eb65a00470..68c1ed6350 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/BalustradeSpy.java +++ b/Mage.Sets/src/mage/sets/gatecrash/BalustradeSpy.java @@ -115,7 +115,7 @@ class BalustradeSpyEffect extends OneShotEffect { } if (!cards.isEmpty()) { controller.revealCards(sourceObject.getName(), cards, game); - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } return true; diff --git a/Mage.Sets/src/mage/sets/gatecrash/BorborygmosEnraged.java b/Mage.Sets/src/mage/sets/gatecrash/BorborygmosEnraged.java index 2fe0f586e9..8781f08619 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/BorborygmosEnraged.java +++ b/Mage.Sets/src/mage/sets/gatecrash/BorborygmosEnraged.java @@ -121,8 +121,8 @@ class BorborygmosEnragedEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(landCards, Zone.LIBRARY, Zone.HAND, source, game); - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(landCards, Zone.HAND, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/gatecrash/CoercedConfession.java b/Mage.Sets/src/mage/sets/gatecrash/CoercedConfession.java index b85bd19caa..cc02f22092 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/CoercedConfession.java +++ b/Mage.Sets/src/mage/sets/gatecrash/CoercedConfession.java @@ -97,7 +97,7 @@ class CoercedConfessionMillEffect extends OneShotEffect { ++foundCreatures; } } - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); if (foundCreatures > 0) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { diff --git a/Mage.Sets/src/mage/sets/gatecrash/ConsumingAberration.java b/Mage.Sets/src/mage/sets/gatecrash/ConsumingAberration.java index 1cde6bde25..5ce7583a7f 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/ConsumingAberration.java +++ b/Mage.Sets/src/mage/sets/gatecrash/ConsumingAberration.java @@ -116,7 +116,7 @@ class ConsumingAberrationEffect extends OneShotEffect { } } player.revealCards("Consuming Aberrtion", cards, game); - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/gatecrash/DimirCharm.java b/Mage.Sets/src/mage/sets/gatecrash/DimirCharm.java index 71b9e9393e..2a2dd6ce4d 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/DimirCharm.java +++ b/Mage.Sets/src/mage/sets/gatecrash/DimirCharm.java @@ -129,7 +129,7 @@ class DimirCharmEffect extends OneShotEffect { card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true); cards.remove(card); } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } } } diff --git a/Mage.Sets/src/mage/sets/gatecrash/MindGrind.java b/Mage.Sets/src/mage/sets/gatecrash/MindGrind.java index b679769c81..ff12970b23 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/MindGrind.java +++ b/Mage.Sets/src/mage/sets/gatecrash/MindGrind.java @@ -117,7 +117,7 @@ class MindGrindEffect extends OneShotEffect { } } player.revealCards("by " + sourceCard.getName() + " from " + player.getName(), cards, game); - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/gatecrash/UndercityInformer.java b/Mage.Sets/src/mage/sets/gatecrash/UndercityInformer.java index 3af182f815..362ade6001 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/UndercityInformer.java +++ b/Mage.Sets/src/mage/sets/gatecrash/UndercityInformer.java @@ -117,7 +117,7 @@ class UndercityInformerEffect extends OneShotEffect { } } player.revealCards("Undercity Informer", cards, game); - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } } diff --git a/Mage.Sets/src/mage/sets/iceage/DemonicConsultation.java b/Mage.Sets/src/mage/sets/iceage/DemonicConsultation.java index 5e5525d46e..19c9e51ce8 100644 --- a/Mage.Sets/src/mage/sets/iceage/DemonicConsultation.java +++ b/Mage.Sets/src/mage/sets/iceage/DemonicConsultation.java @@ -121,7 +121,7 @@ class DemonicConsultationEffect extends OneShotEffect { controller.moveCards(cardToHand, Zone.HAND, source, game); controller.revealCards(sourceObject.getIdName(), cardsToReaveal, game); cardsToReaveal.remove(cardToHand); - controller.moveCards(cardsToReaveal, null, Zone.EXILED, source, game); + controller.moveCards(cardsToReaveal, Zone.EXILED, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/innistrad/MirrorMadPhantasm.java b/Mage.Sets/src/mage/sets/innistrad/MirrorMadPhantasm.java index 27469b2576..064e28e748 100644 --- a/Mage.Sets/src/mage/sets/innistrad/MirrorMadPhantasm.java +++ b/Mage.Sets/src/mage/sets/innistrad/MirrorMadPhantasm.java @@ -108,7 +108,7 @@ class MirrorMadPhantasmEffect extends OneShotEffect { cards.add(card); } player.revealCards("Mirror-Mad Phantasm", cards, game); - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } } diff --git a/Mage.Sets/src/mage/sets/innistrad/Mulch.java b/Mage.Sets/src/mage/sets/innistrad/Mulch.java index edf5fa2f74..836bf46cbb 100644 --- a/Mage.Sets/src/mage/sets/innistrad/Mulch.java +++ b/Mage.Sets/src/mage/sets/innistrad/Mulch.java @@ -101,8 +101,8 @@ class MulchEffect extends OneShotEffect { otherCards.add(card); } } - controller.moveCards(landCards, Zone.LIBRARY, Zone.HAND, source, game); - controller.moveCards(otherCards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(landCards, Zone.HAND, source, game); + controller.moveCards(otherCards, Zone.GRAVEYARD, source, game); } return true; diff --git a/Mage.Sets/src/mage/sets/innistrad/TrepanationBlade.java b/Mage.Sets/src/mage/sets/innistrad/TrepanationBlade.java index 690d17eec3..5694be079c 100644 --- a/Mage.Sets/src/mage/sets/innistrad/TrepanationBlade.java +++ b/Mage.Sets/src/mage/sets/innistrad/TrepanationBlade.java @@ -120,7 +120,7 @@ class TrepanationBladeDiscardEffect extends OneShotEffect { } } } - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); if (!cards.isEmpty()) { player.revealCards(equipment.getName(), cards, game); game.getState().setValue(source.getSourceId().toString() + "_TrepanationBlade", cards.size()); diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/Hubris.java b/Mage.Sets/src/mage/sets/journeyintonyx/Hubris.java index 290ad41bed..77c0366e20 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/Hubris.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/Hubris.java @@ -101,7 +101,7 @@ class HubrisReturnEffect extends OneShotEffect { if (creature != null) { Cards cardsToHand = new CardsImpl(creature.getAttachments()); cardsToHand.add(creature); - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); } } return true; diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/ScourgeOfFleets.java b/Mage.Sets/src/mage/sets/journeyintonyx/ScourgeOfFleets.java index 3385a47e0d..cca63ec959 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/ScourgeOfFleets.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/ScourgeOfFleets.java @@ -113,7 +113,7 @@ class ScourgeOfFleetsEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents(creatureFilter, source.getControllerId(), source.getSourceId(), game)) { cardsToHand.add(permanent); } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/BitterRevelation.java b/Mage.Sets/src/mage/sets/khansoftarkir/BitterRevelation.java index eea813a126..5eaad045fb 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/BitterRevelation.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/BitterRevelation.java @@ -111,8 +111,8 @@ class BitterRevelationEffect extends OneShotEffect { } } } - player.moveCards(cardsToHand, Zone.LIBRARY, Zone.HAND, source, game); - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cardsToHand, Zone.HAND, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/ScoutTheBorders.java b/Mage.Sets/src/mage/sets/khansoftarkir/ScoutTheBorders.java index 544e4564ac..180f76c052 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/ScoutTheBorders.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/ScoutTheBorders.java @@ -122,7 +122,7 @@ class ScoutTheBordersEffect extends OneShotEffect { } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/SultaiSoothsayer.java b/Mage.Sets/src/mage/sets/khansoftarkir/SultaiSoothsayer.java index 91fd0210d3..73cad4c73d 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/SultaiSoothsayer.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/SultaiSoothsayer.java @@ -108,7 +108,7 @@ class SultaiSoothsayerEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/VillainousWealth.java b/Mage.Sets/src/mage/sets/khansoftarkir/VillainousWealth.java index 7e9b1319f0..ada3f95210 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/VillainousWealth.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/VillainousWealth.java @@ -103,7 +103,7 @@ class VillainousWealthEffect extends OneShotEffect { if (player != null) { Cards cardsToExile = new CardsImpl(); cardsToExile.addAll(player.getLibrary().getTopCards(game, source.getManaCostsToPay().getX())); - controller.moveCards(cardsToExile, null, Zone.EXILED, source, game); + controller.moveCards(cardsToExile, Zone.EXILED, source, game); if (controller.chooseUse(Outcome.PlayForFree, "Cast cards exiled with " + mageObject.getLogName() + " without paying its mana cost?", source, game)) { OuterLoop: while (cardsToExile.count(filter, game) > 0) { diff --git a/Mage.Sets/src/mage/sets/limitedalpha/Timetwister.java b/Mage.Sets/src/mage/sets/limitedalpha/Timetwister.java index dcc0eb8c28..22b030ddad 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/Timetwister.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/Timetwister.java @@ -84,8 +84,8 @@ class TimetwisterEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.moveCards(player.getHand(), Zone.HAND, Zone.LIBRARY, source, game); - player.moveCards(player.getGraveyard(), Zone.GRAVEYARD, Zone.LIBRARY, source, game); + player.moveCards(player.getHand(), Zone.LIBRARY, source, game); + player.moveCards(player.getGraveyard(), Zone.LIBRARY, source, game); player.shuffleLibrary(source, game); } } diff --git a/Mage.Sets/src/mage/sets/magic2011/TimeReversal.java b/Mage.Sets/src/mage/sets/magic2011/TimeReversal.java index 546496984a..f764227520 100644 --- a/Mage.Sets/src/mage/sets/magic2011/TimeReversal.java +++ b/Mage.Sets/src/mage/sets/magic2011/TimeReversal.java @@ -86,8 +86,8 @@ class TimeReversalEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.moveCards(player.getHand(), Zone.HAND, Zone.LIBRARY, source, game); - player.moveCards(player.getGraveyard(), Zone.GRAVEYARD, Zone.LIBRARY, source, game); + player.moveCards(player.getHand(), Zone.LIBRARY, source, game); + player.moveCards(player.getGraveyard(), Zone.LIBRARY, source, game); player.shuffleLibrary(source, game); } } diff --git a/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java b/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java index 18fcd21481..fdfbd21674 100644 --- a/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java +++ b/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java @@ -120,7 +120,7 @@ class SuturedGhoulEffect extends OneShotEffect { } } Cards cardsToExile = new CardsImpl(target.getTargets()); - controller.moveCards(cardsToExile, null, Zone.EXILED, source, game); + controller.moveCards(cardsToExile, Zone.EXILED, source, game); String msg = count == 1 ? "1 card" : count + "cards"; game.informPlayers(permanent.getLogName() + ": " + controller.getLogName() + " exiled " + msg); diff --git a/Mage.Sets/src/mage/sets/magic2014/GlimpseTheFuture.java b/Mage.Sets/src/mage/sets/magic2014/GlimpseTheFuture.java index 53604abaeb..0a0254fb40 100644 --- a/Mage.Sets/src/mage/sets/magic2014/GlimpseTheFuture.java +++ b/Mage.Sets/src/mage/sets/magic2014/GlimpseTheFuture.java @@ -109,7 +109,7 @@ class GlimpseTheFutureEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/magicorigins/GatherThePack.java b/Mage.Sets/src/mage/sets/magicorigins/GatherThePack.java index 924b1ac738..b934172d14 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/GatherThePack.java +++ b/Mage.Sets/src/mage/sets/magicorigins/GatherThePack.java @@ -103,12 +103,12 @@ class GatherThePackEffect extends OneShotEffect { Cards cardsToHand = new CardsImpl(target.getTargets()); if (cardsToHand.size() > 0) { cards.removeAll(cardsToHand); - controller.moveCards(cardsToHand, Zone.LIBRARY, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); } } } if (cards.size() > 0) { - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } } return true; diff --git a/Mage.Sets/src/mage/sets/magicorigins/SphinxsTutelage.java b/Mage.Sets/src/mage/sets/magicorigins/SphinxsTutelage.java index d57feb4c44..3702e2683e 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/SphinxsTutelage.java +++ b/Mage.Sets/src/mage/sets/magicorigins/SphinxsTutelage.java @@ -120,7 +120,7 @@ class SphinxsTutelageEffect extends OneShotEffect { } } } - targetPlayer.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + targetPlayer.moveCards(cards, Zone.GRAVEYARD, source, game); } while (colorShared && targetPlayer.canRespond()); return true; } diff --git a/Mage.Sets/src/mage/sets/masterseditionii/ForgottenLore.java b/Mage.Sets/src/mage/sets/masterseditionii/ForgottenLore.java index 4dad895194..3d8b9838a2 100644 --- a/Mage.Sets/src/mage/sets/masterseditionii/ForgottenLore.java +++ b/Mage.Sets/src/mage/sets/masterseditionii/ForgottenLore.java @@ -131,7 +131,7 @@ class ForgottenLoreEffect extends OneShotEffect { if(card != null) { Cards cardsToHand = new CardsImpl(); cardsToHand.add(card); - you.moveCards(cardsToHand, Zone.GRAVEYARD, Zone.HAND, source, game); + you.moveCards(cardsToHand, Zone.HAND, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/masterseditionii/ThoughtLash.java b/Mage.Sets/src/mage/sets/masterseditionii/ThoughtLash.java index cd7be65293..45b045fd0a 100644 --- a/Mage.Sets/src/mage/sets/masterseditionii/ThoughtLash.java +++ b/Mage.Sets/src/mage/sets/masterseditionii/ThoughtLash.java @@ -131,7 +131,7 @@ class ThoughtLashExileLibraryEffect extends OneShotEffect { if (controller != null) { Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, controller.getLibrary().size())); - controller.moveCards(cards, Zone.LIBRARY, Zone.EXILED, source, game); + controller.moveCards(cards, Zone.EXILED, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/mirrodin/SpoilsOfTheVault.java b/Mage.Sets/src/mage/sets/mirrodin/SpoilsOfTheVault.java index 7b19e41816..e49dd207a3 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/SpoilsOfTheVault.java +++ b/Mage.Sets/src/mage/sets/mirrodin/SpoilsOfTheVault.java @@ -108,7 +108,7 @@ class SpoilsOfTheVaultEffect extends OneShotEffect { } } controller.revealCards(sourceObject.getIdName(), cardsToReveal, game); - controller.moveCards(cardsToExile, null, Zone.EXILED, source, game); + controller.moveCards(cardsToExile, Zone.EXILED, source, game); controller.loseLife(cardsToExile.size(), game); return true; diff --git a/Mage.Sets/src/mage/sets/modernmasters2015/AllSunsDawn.java b/Mage.Sets/src/mage/sets/modernmasters2015/AllSunsDawn.java index 3a3bbbf469..28b28e6af8 100644 --- a/Mage.Sets/src/mage/sets/modernmasters2015/AllSunsDawn.java +++ b/Mage.Sets/src/mage/sets/modernmasters2015/AllSunsDawn.java @@ -120,7 +120,7 @@ class AllSunsDawnEffect extends OneShotEffect { cardsToHand.add(card); } } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/newphyrexia/LifesFinale.java b/Mage.Sets/src/mage/sets/newphyrexia/LifesFinale.java index ad2893b38a..71ee27cf4d 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/LifesFinale.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/LifesFinale.java @@ -98,7 +98,7 @@ class LifesFinaleEffect extends OneShotEffect { if (player != null && opponent != null) { TargetCardInLibrary target = new TargetCardInLibrary(0, 3, new FilterCreatureCard("creature cards from his library to put in his graveyard")); if (player.searchLibrary(target, game, opponent.getId())) { - player.moveCards(new CardsImpl(target.getTargets()), Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game); } opponent.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/onslaught/WeirdHarvest.java b/Mage.Sets/src/mage/sets/onslaught/WeirdHarvest.java index f430e4541d..7fe96967e7 100644 --- a/Mage.Sets/src/mage/sets/onslaught/WeirdHarvest.java +++ b/Mage.Sets/src/mage/sets/onslaught/WeirdHarvest.java @@ -118,7 +118,7 @@ class WeirdHarvestEffect extends OneShotEffect { if (player.searchLibrary(target, game)) { if (target.getTargets().size() > 0) { Cards cards = new CardsImpl(target.getTargets()); - player.moveCards(cards, null, Zone.HAND, source, game); + player.moveCards(cards, Zone.HAND, source, game); player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ")", cards, game); } } diff --git a/Mage.Sets/src/mage/sets/planarchaos/ShroudedLore.java b/Mage.Sets/src/mage/sets/planarchaos/ShroudedLore.java index 705affbb8b..12bde40676 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/ShroudedLore.java +++ b/Mage.Sets/src/mage/sets/planarchaos/ShroudedLore.java @@ -132,7 +132,7 @@ class ShroudedLoreEffect extends OneShotEffect { if(card != null) { Cards cardsToHand = new CardsImpl(); cardsToHand.add(card); - you.moveCards(cardsToHand, Zone.GRAVEYARD, Zone.HAND, source, game); + you.moveCards(cardsToHand, Zone.HAND, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/prereleaseevents/Gleancrawler.java b/Mage.Sets/src/mage/sets/prereleaseevents/Gleancrawler.java index 6ae7bbbde6..4ad26bc5b4 100644 --- a/Mage.Sets/src/mage/sets/prereleaseevents/Gleancrawler.java +++ b/Mage.Sets/src/mage/sets/prereleaseevents/Gleancrawler.java @@ -117,7 +117,7 @@ class GleancrawlerEffect extends OneShotEffect { } } } - controller.moveCards(cardsToHand, Zone.GRAVEYARD, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/ravnica/Grozoth.java b/Mage.Sets/src/mage/sets/ravnica/Grozoth.java index f6dd13b3a6..040a36acb8 100644 --- a/Mage.Sets/src/mage/sets/ravnica/Grozoth.java +++ b/Mage.Sets/src/mage/sets/ravnica/Grozoth.java @@ -128,7 +128,7 @@ class GrozothEffect extends SearchEffect { } } player.revealCards(sourceCard.getIdName(), cards, game); - player.moveCards(cards, Zone.LIBRARY, Zone.HAND, source, game); + player.moveCards(cards, Zone.HAND, source, game); } player.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/returntoravnica/DestroyTheEvidence.java b/Mage.Sets/src/mage/sets/returntoravnica/DestroyTheEvidence.java index 15dfea14f4..fd47c0782a 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/DestroyTheEvidence.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/DestroyTheEvidence.java @@ -114,7 +114,7 @@ class DestroyTheEvidenceEffect extends OneShotEffect { } } player.revealCards(sourceObject.getName(), cards, game, true); - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/returntoravnica/GrislySalvage.java b/Mage.Sets/src/mage/sets/returntoravnica/GrislySalvage.java index 2564e53eb4..531dce2b46 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/GrislySalvage.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/GrislySalvage.java @@ -116,7 +116,7 @@ class GrislySalvageEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/returntoravnica/GuildFeud.java b/Mage.Sets/src/mage/sets/returntoravnica/GuildFeud.java index cabc13af23..0a685745d5 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/GuildFeud.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/GuildFeud.java @@ -124,7 +124,7 @@ class GuildFeudEffect extends OneShotEffect { } } } - player.moveCards(topThreeCards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(topThreeCards, Zone.GRAVEYARD, source, game); } } // If two creatures are put onto the battlefield this way, those creatures fight each other diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/RealmsUncharted.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/RealmsUncharted.java index 37a9c3372a..46b5540722 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/RealmsUncharted.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/RealmsUncharted.java @@ -128,8 +128,8 @@ class RealmsUnchartedEffect extends OneShotEffect { cards.removeAll(cardsToKeep); } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); - controller.moveCards(cardsToKeep, Zone.LIBRARY, Zone.HAND, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); + controller.moveCards(cardsToKeep, Zone.HAND, source, game); } controller.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java index 08d1074900..5ea5ce4ebd 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java @@ -126,7 +126,7 @@ class GenesisWaveEffect extends OneShotEffect { } } controller.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game, false, false, false, null); - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/seventhedition/AncestralMemories.java b/Mage.Sets/src/mage/sets/seventhedition/AncestralMemories.java index 32b515cc39..8e748fb5a0 100644 --- a/Mage.Sets/src/mage/sets/seventhedition/AncestralMemories.java +++ b/Mage.Sets/src/mage/sets/seventhedition/AncestralMemories.java @@ -112,7 +112,7 @@ class AncestralMemoriesEffect extends OneShotEffect { } } } - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/AdviceFromTheFae.java b/Mage.Sets/src/mage/sets/shadowmoor/AdviceFromTheFae.java index 80c568ac4e..f40fb47f99 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/AdviceFromTheFae.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/AdviceFromTheFae.java @@ -115,7 +115,7 @@ class AdviceFromTheFaeEffect extends OneShotEffect { TargetCard target = new TargetCard(moreCreatures ? 2 : 1, Zone.LIBRARY, new FilterCard()); if (controller.choose(Outcome.DrawCard, cardsFromLibrary, target, game)) { cardsFromLibrary.removeAll(target.getTargets()); - controller.moveCards(new CardsImpl(target.getTargets()), null, Zone.HAND, source, game); + controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); } controller.putCardsOnBottomOfLibrary(cardsFromLibrary, game, source, true); return true; diff --git a/Mage.Sets/src/mage/sets/shadowmoor/TwilightShepherd.java b/Mage.Sets/src/mage/sets/shadowmoor/TwilightShepherd.java index 7f684f62f4..9b5f4c6fc7 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/TwilightShepherd.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/TwilightShepherd.java @@ -121,7 +121,7 @@ class TwilightShepherdEffect extends OneShotEffect { } } } - controller.moveCards(cardsToHand, Zone.GRAVEYARD, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/shardsofalara/TidehollowSculler.java b/Mage.Sets/src/mage/sets/shardsofalara/TidehollowSculler.java index c9743be6bb..d3aa48d02a 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/TidehollowSculler.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/TidehollowSculler.java @@ -149,7 +149,7 @@ class TidehollowScullerLeaveEffect extends OneShotEffect { int zoneChangeCounter = (sourceObject instanceof PermanentToken) ? source.getSourceObjectZoneChangeCounter() : source.getSourceObjectZoneChangeCounter() - 1; ExileZone exZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), zoneChangeCounter)); if (exZone != null) { - controller.moveCards(exZone, null, Zone.HAND, source, game); + controller.moveCards(exZone, Zone.HAND, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/stronghold/HermitDruid.java b/Mage.Sets/src/mage/sets/stronghold/HermitDruid.java index 3eeb728570..263463ad0b 100644 --- a/Mage.Sets/src/mage/sets/stronghold/HermitDruid.java +++ b/Mage.Sets/src/mage/sets/stronghold/HermitDruid.java @@ -120,7 +120,7 @@ class HermitDruidEffect extends OneShotEffect { } while (library.size() > 0 && card != null && !filter.match(card, game)); if (!cards.isEmpty()) { - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); if (card != null) { cards.add(card); } diff --git a/Mage.Sets/src/mage/sets/tempest/Grindstone.java b/Mage.Sets/src/mage/sets/tempest/Grindstone.java index e8332d026c..dd947828c7 100644 --- a/Mage.Sets/src/mage/sets/tempest/Grindstone.java +++ b/Mage.Sets/src/mage/sets/tempest/Grindstone.java @@ -115,7 +115,7 @@ class GrindstoneEffect extends OneShotEffect { colorShared = card1.getColor(game).shares(targetPlayer.getLibrary().removeFromTop(game).getColor(game)); } } - targetPlayer.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + targetPlayer.moveCards(cards, Zone.GRAVEYARD, source, game); } while (colorShared && targetPlayer.canRespond()); return true; } diff --git a/Mage.Sets/src/mage/sets/tempest/Intuition.java b/Mage.Sets/src/mage/sets/tempest/Intuition.java index 5702eb8381..46af1495f5 100644 --- a/Mage.Sets/src/mage/sets/tempest/Intuition.java +++ b/Mage.Sets/src/mage/sets/tempest/Intuition.java @@ -122,7 +122,7 @@ class IntuitionEffect extends SearchEffect { cards.remove(card); controller.moveCards(card, Zone.HAND, source, game); } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } controller.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/tempest/Lobotomy.java b/Mage.Sets/src/mage/sets/tempest/Lobotomy.java index ea79144455..104685c501 100644 --- a/Mage.Sets/src/mage/sets/tempest/Lobotomy.java +++ b/Mage.Sets/src/mage/sets/tempest/Lobotomy.java @@ -154,7 +154,7 @@ class LobotomyEffect extends OneShotEffect { } if (!cardsToExile.isEmpty()) { - controller.moveCards(cardsToExile, null, Zone.EXILED, source, game); + controller.moveCards(cardsToExile, Zone.EXILED, source, game); } targetPlayer.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/tempest/WoodSage.java b/Mage.Sets/src/mage/sets/tempest/WoodSage.java index e820268608..9cc189ca73 100644 --- a/Mage.Sets/src/mage/sets/tempest/WoodSage.java +++ b/Mage.Sets/src/mage/sets/tempest/WoodSage.java @@ -123,8 +123,8 @@ class WoodSageEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cardsToHand, Zone.LIBRARY, Zone.HAND, source, game); - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/thedark/DanceOfMany.java b/Mage.Sets/src/mage/sets/thedark/DanceOfMany.java index 147f295d9c..406ad92598 100644 --- a/Mage.Sets/src/mage/sets/thedark/DanceOfMany.java +++ b/Mage.Sets/src/mage/sets/thedark/DanceOfMany.java @@ -163,7 +163,7 @@ class DanceOfManyExileTokenEffect extends OneShotEffect { for (Permanent permanent : tokenPermanents) { cards.add(permanent); } - controller.moveCards(cards, null, Zone.EXILED, source, game); + controller.moveCards(cards, Zone.EXILED, source, game); return true; } } diff --git a/Mage.Sets/src/mage/sets/theros/CommuneWithTheGods.java b/Mage.Sets/src/mage/sets/theros/CommuneWithTheGods.java index bd2e5256b6..f69bde8dc0 100644 --- a/Mage.Sets/src/mage/sets/theros/CommuneWithTheGods.java +++ b/Mage.Sets/src/mage/sets/theros/CommuneWithTheGods.java @@ -122,7 +122,7 @@ class CommuneWithTheGodsEffect extends OneShotEffect { } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/timeshifted/GrinningTotem.java b/Mage.Sets/src/mage/sets/timeshifted/GrinningTotem.java index 9f02ecd2f0..db36f22d58 100644 --- a/Mage.Sets/src/mage/sets/timeshifted/GrinningTotem.java +++ b/Mage.Sets/src/mage/sets/timeshifted/GrinningTotem.java @@ -239,7 +239,7 @@ class GrinningTotemPutIntoGraveyardEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); ExileZone zone = game.getExile().getExileZone(exileZoneId); if (controller != null && zone != null) { - return controller.moveCards(zone, Zone.EXILED, Zone.GRAVEYARD, source, game); + return controller.moveCards(zone, Zone.GRAVEYARD, source, game); } return false; } diff --git a/Mage.Sets/src/mage/sets/torment/MesmericFiend.java b/Mage.Sets/src/mage/sets/torment/MesmericFiend.java index 9654d92bff..0fc01307b6 100644 --- a/Mage.Sets/src/mage/sets/torment/MesmericFiend.java +++ b/Mage.Sets/src/mage/sets/torment/MesmericFiend.java @@ -147,7 +147,7 @@ class MesmericFiendLeaveEffect extends OneShotEffect { int zoneChangeCounter = (sourceObject instanceof PermanentToken) ? source.getSourceObjectZoneChangeCounter() : source.getSourceObjectZoneChangeCounter() - 1; ExileZone exZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), zoneChangeCounter)); if (exZone != null) { - return controller.moveCards(exZone, null, Zone.HAND, source, game); + return controller.moveCards(exZone, Zone.HAND, source, game); } } return false; diff --git a/Mage.Sets/src/mage/sets/urzassaga/NoRestForTheWicked.java b/Mage.Sets/src/mage/sets/urzassaga/NoRestForTheWicked.java index 8d3b3c4a02..b05c92e0a0 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/NoRestForTheWicked.java +++ b/Mage.Sets/src/mage/sets/urzassaga/NoRestForTheWicked.java @@ -101,7 +101,7 @@ class NoRestForTheWickedEffect extends OneShotEffect { } } } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/weatherlight/SpinningDarkness.java b/Mage.Sets/src/mage/sets/weatherlight/SpinningDarkness.java index 3adbb45eb8..94ca45fde9 100644 --- a/Mage.Sets/src/mage/sets/weatherlight/SpinningDarkness.java +++ b/Mage.Sets/src/mage/sets/weatherlight/SpinningDarkness.java @@ -118,7 +118,7 @@ class SpinningDarknessCost extends CostImpl { } i++; } - paid = controller.moveCards(cardsToExile, Zone.GRAVEYARD, Zone.EXILED, ability, game); + paid = controller.moveCards(cardsToExile, Zone.EXILED, ability, game); } } return paid; diff --git a/Mage.Sets/src/mage/sets/zendikar/BeastHunt.java b/Mage.Sets/src/mage/sets/zendikar/BeastHunt.java index 9c0ccd380d..d663b1876c 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BeastHunt.java +++ b/Mage.Sets/src/mage/sets/zendikar/BeastHunt.java @@ -96,8 +96,8 @@ class BeastHuntEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cardsToHand, Zone.LIBRARY, Zone.HAND, source, game); - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index 68f3b51f58..62e89e3e74 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -1882,24 +1882,6 @@ public class TestPlayer implements Player { return computerPlayer.getCommanderId(); } - @Override - @Deprecated - public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game) { - return computerPlayer.moveCards(cards, fromZone, toZone, source, game); - } - - @Override - @Deprecated - public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game) { - return computerPlayer.moveCards(card, toZone, source, game); - } - - @Override - @Deprecated - public boolean moveCards(Set cards, Zone toZone, Ability source, Game game) { - return computerPlayer.moveCards(cards, toZone, source, game); - } - @Override public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game) { return computerPlayer.moveCardToHandWithInfo(card, sourceId, game); @@ -2156,7 +2138,7 @@ public class TestPlayer implements Player { } @Override - public boolean moveCards(Set cards, Zone fromZone, Zone toZone, Ability source, Game game) { + public boolean moveCards(Set cards, Zone toZone, Ability source, Game game) { return computerPlayer.moveCards(cards, toZone, source, game); } diff --git a/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java b/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java index 9a601cb185..dbc17018ca 100644 --- a/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java +++ b/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java @@ -1093,21 +1093,6 @@ public class PlayerStub implements Player { return null; } - @Override - public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game) { - return false; - } - - @Override - public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game) { - return false; - } - - @Override - public boolean moveCards(Set cards, Zone fromZone, Zone toZone, Ability source, Game game) { - return false; - } - @Override public boolean moveCards(Card card, Zone toZone, Ability source, Game game) { return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/EnvoyEffect.java b/Mage/src/main/java/mage/abilities/effects/common/EnvoyEffect.java index d9e584f607..4ca8bb884e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/EnvoyEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/EnvoyEffect.java @@ -84,7 +84,7 @@ public class EnvoyEffect extends OneShotEffect { } } cards.removeAll(cardsToHand); - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); controller.putCardsOnBottomOfLibrary(cards, game, source, true); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileCardsFromTopOfLibraryTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileCardsFromTopOfLibraryTargetEffect.java index 7a6e0a5231..9ca03c05f0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileCardsFromTopOfLibraryTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileCardsFromTopOfLibraryTargetEffect.java @@ -53,7 +53,7 @@ public class ExileCardsFromTopOfLibraryTargetEffect extends OneShotEffect { if (targetPlayer != null) { Cards cards = new CardsImpl(); cards.addAll(targetPlayer.getLibrary().getTopCards(game, amount)); - return targetPlayer.moveCards(cards, null, Zone.EXILED, source, game); + return targetPlayer.moveCards(cards, Zone.EXILED, source, game); } return false; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryControllerEffect.java index e6c8482992..cb152f0370 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryControllerEffect.java @@ -171,7 +171,7 @@ public class LookLibraryControllerEffect extends OneShotEffect { } break; case GRAVEYARD: - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); break; default: // not supported yet diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java index e078181893..ccb9e97478 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java @@ -77,7 +77,7 @@ public class ReturnToHandChosenPermanentEffect extends OneShotEffect { if (available > 0) { TargetControlledPermanent target = new TargetControlledPermanent(Math.min(number, available), number, filter, true); if (player.chooseTarget(this.outcome, target, source, game)) { - player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, Zone.HAND, source, game); + player.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); } } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/RevealLibraryPutIntoHandEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RevealLibraryPutIntoHandEffect.java index 19e50a63ac..22b744a50c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RevealLibraryPutIntoHandEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RevealLibraryPutIntoHandEffect.java @@ -97,7 +97,7 @@ public class RevealLibraryPutIntoHandEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); controller.putCardsOnBottomOfLibrary(cards, game, source, anyOrder); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibraryGraveOfSourceOwnerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibraryGraveOfSourceOwnerEffect.java index 9a320f3a7e..563a3d4c47 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibraryGraveOfSourceOwnerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibraryGraveOfSourceOwnerEffect.java @@ -58,7 +58,7 @@ public class ShuffleIntoLibraryGraveOfSourceOwnerEffect extends OneShotEffect { } Player owner = game.getPlayer(ownerId); if (owner != null) { - owner.moveCards(owner.getGraveyard(), null, Zone.LIBRARY, source, game); + owner.moveCards(owner.getGraveyard(), Zone.LIBRARY, source, game); owner.shuffleLibrary(source, game); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java index de5bbdc6c2..a992a18e79 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java @@ -98,7 +98,7 @@ public class SearchLibraryPutInHandEffect extends SearchEffect { cards.add(card); } } - controller.moveCards(cards, null, Zone.HAND, source, game); + controller.moveCards(cards, Zone.HAND, source, game); if (revealCards) { String name = "Reveal"; Card sourceCard = game.getCard(source.getSourceId()); diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/SweepEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/SweepEffect.java index 53dadbe70f..229b7d8bea 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/SweepEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/SweepEffect.java @@ -74,7 +74,7 @@ public class SweepEffect extends OneShotEffect { Target target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true); if (controller.chooseTarget(outcome, target, source, game)) { game.getState().setValue(CardUtil.getCardZoneString("sweep", source.getSourceId(), game), target.getTargets().size()); - controller.moveCards(new CardsImpl(target.getTargets()), null, Zone.HAND, source, game); + controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java b/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java index 8ed7e28446..100c0e7473 100644 --- a/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java @@ -85,7 +85,7 @@ class TransmuteEffect extends OneShotEffect { if (target.getTargets().size() > 0) { Cards revealed = new CardsImpl(target.getTargets()); controller.revealCards(sourceObject.getIdName(), revealed, game); - controller.moveCards(revealed, null, Zone.HAND, source, game); + controller.moveCards(revealed, Zone.HAND, source, game); } } controller.shuffleLibrary(source, game); diff --git a/Mage/src/main/java/mage/cards/Card.java b/Mage/src/main/java/mage/cards/Card.java index b5525dc669..abea174164 100644 --- a/Mage/src/main/java/mage/cards/Card.java +++ b/Mage/src/main/java/mage/cards/Card.java @@ -141,6 +141,8 @@ public interface Card extends MageObject { boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown, ArrayList appliedEffects); + void setZone(Zone zone, Game game); + List getMana(); void build(); @@ -172,6 +174,4 @@ public interface Card extends MageObject { * returned */ Card getMainCard(); - - void setZone(Zone zone, Game game); } diff --git a/Mage/src/main/java/mage/players/Player.java b/Mage/src/main/java/mage/players/Player.java index 72cdb89893..f476c8c5a3 100644 --- a/Mage/src/main/java/mage/players/Player.java +++ b/Mage/src/main/java/mage/players/Player.java @@ -654,27 +654,17 @@ public interface Player extends MageItem, Copyable { * Moves cards from one zone to another * * @param cards - * @param fromZone * @param toZone * @param source * @param game * @return */ - @Deprecated - boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game); - - @Deprecated - boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game); - - @Deprecated - boolean moveCards(Set cards, Zone fromZone, Zone toZone, Ability source, Game game); + boolean moveCards(Cards cards, Zone toZone, Ability source, Game game); boolean moveCards(Card card, Zone toZone, Ability source, Game game); boolean moveCards(Card card, Zone toZone, Ability source, Game game, boolean tapped, boolean faceDown, boolean byOwner, ArrayList appliedEffects); - boolean moveCards(Cards cards, Zone toZone, Ability source, Game game); - boolean moveCards(Set cards, Zone toZone, Ability source, Game game); /** diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 02bb023242..d921af4bd4 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -3116,55 +3116,6 @@ public abstract class PlayerImpl implements Player, Serializable { return this.commanderId; } - @Override - public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game) { - if (cards.isEmpty()) { - return true; - } - Set cardList = new HashSet<>(); - for (UUID cardId : cards) { - fromZone = game.getState().getZone(cardId); - if (Zone.BATTLEFIELD.equals(fromZone)) { - Permanent permanent = game.getPermanent(cardId); - if (permanent != null) { - cardList.add(permanent); - } - } else { - Card card = game.getCard(cardId); - if (card == null) { - Spell spell = game.getState().getStack().getSpell(cardId); - if (spell != null) { - if (!spell.isCopy()) { - card = spell.getCard(); - } else { - // If a spell is returned to its owner's hand, it's removed from the stack and thus will not resolve - game.getStack().remove(spell); - game.informPlayers(spell.getLogName() + " was removed from the stack"); - } - } - } - if (card != null) { - cardList.add(card); - } - } - } - return moveCards(cardList, toZone, source, game); - } - - @Override - public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game) { - Set cardList = new HashSet<>(); - if (card != null) { - cardList.add(card); - } - return moveCards(cardList, toZone, source, game); - } - - @Override - public boolean moveCards(Set cards, Zone fromZone, Zone toZone, Ability source, Game game) { - return moveCards(cards, toZone, source, game); - } - @Override public boolean moveCards(Card card, Zone toZone, Ability source, Game game) { return moveCards(card, toZone, source, game, false, false, false, null); From ac4658576b5dc05ce6c8bcfc5ba33f6e09cef7a4 Mon Sep 17 00:00:00 2001 From: Samuel Sandeen Date: Sat, 3 Sep 2016 20:24:05 -0400 Subject: [PATCH 18/20] Remove Skullbriar There are still too many changes required before it can be implemented. --- .../commander/SkullbriarTheWalkingGrave.java | 73 ------------------- 1 file changed, 73 deletions(-) delete mode 100644 Mage.Sets/src/mage/sets/commander/SkullbriarTheWalkingGrave.java diff --git a/Mage.Sets/src/mage/sets/commander/SkullbriarTheWalkingGrave.java b/Mage.Sets/src/mage/sets/commander/SkullbriarTheWalkingGrave.java deleted file mode 100644 index 316cb3fc9a..0000000000 --- a/Mage.Sets/src/mage/sets/commander/SkullbriarTheWalkingGrave.java +++ /dev/null @@ -1,73 +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.sets.commander; - -import java.util.UUID; -import mage.MageInt; -import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; -import mage.abilities.effects.common.counter.AddCountersSourceEffect; -import mage.abilities.keyword.HasteAbility; -import mage.cards.CardImpl; -import mage.cards.repository.CardRepository; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.counters.CounterType; - -/** - * - * @author anonymous - */ -public class SkullbriarTheWalkingGrave extends CardImpl { - - public SkullbriarTheWalkingGrave(UUID ownerId) { - super(ownerId, 227, "Skullbriar, the Walking Grave", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{B}{G}"); - this.expansionSetCode = "CMD"; - this.supertype.add("Legendary"); - this.subtype.add("Zombie"); - this.subtype.add("Elemental"); - this.power = new MageInt(1); - this.toughness = new MageInt(1); - - // Haste - this.addAbility(HasteAbility.getInstance()); - // Whenever Skullbriar, the Walking Grave deals combat damage to a player, put a +1/+1 counter on it. - this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility( - new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false)); - // Counters remain on Skullbriar as it moves to any zone other than a player's hand or library. - - } - - public SkullbriarTheWalkingGrave(final SkullbriarTheWalkingGrave card) { - super(card); - } - - @Override - public SkullbriarTheWalkingGrave copy() { - return new SkullbriarTheWalkingGrave(this); - } -} From e43333aece65c0c30523a9268f3fd863b24cad6d Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 4 Sep 2016 11:01:42 +0200 Subject: [PATCH 19/20] * Mayael's Aria - Fixed that the +1/+1 counter was added to every controlled permanent instead of only creature permanents. --- Mage.Sets/src/mage/sets/alarareborn/MayaelsAria.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mage.Sets/src/mage/sets/alarareborn/MayaelsAria.java b/Mage.Sets/src/mage/sets/alarareborn/MayaelsAria.java index af7b7db6c2..a3baa40ad6 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/MayaelsAria.java +++ b/Mage.Sets/src/mage/sets/alarareborn/MayaelsAria.java @@ -97,7 +97,7 @@ class MayaelsAriaEffect extends OneShotEffect { FilterCreaturePermanent filter = new FilterCreaturePermanent(); filter.add(new PowerPredicate(Filter.ComparisonType.GreaterThan, 4)); if (game.getState().getBattlefield().countAll(filter, controller.getId(), game) > 0) { - for (Permanent creature : game.getBattlefield().getAllActivePermanents(source.getControllerId())) { + for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) { creature.addCounters(CounterType.P1P1.createInstance(), game); } } From fb5087683f990123ae4549e5342b10b2254cca34 Mon Sep 17 00:00:00 2001 From: spjspj Date: Sun, 4 Sep 2016 22:34:43 +1000 Subject: [PATCH 20/20] spjspj - Implement new token source (mtg.onl) for downloading of tokens to tokenDescriptor format in TOK.zip --- .../card/dl/sources/CardImageSource.java | 2 + .../dl/sources/MagicCardsImageSource.java | 10 + .../card/dl/sources/MtgImageSource.java | 10 + .../dl/sources/MtgOnlTokensImageSource.java | 358 ++++++++++++++++++ .../dl/sources/MythicspoilerComSource.java | 10 + .../card/dl/sources/TokensMtgImageSource.java | 10 + .../dl/sources/WizardCardsImageSource.java | 10 + .../plugins/card/images/DownloadPictures.java | 75 +++- .../plugins/card/utils/CardImageUtils.java | 11 + 9 files changed, 481 insertions(+), 15 deletions(-) create mode 100644 Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgOnlTokensImageSource.java diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardImageSource.java index b84f07cc1a..5ac34ceb12 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardImageSource.java @@ -10,6 +10,8 @@ public interface CardImageSource { String generateURL(CardDownloadData card) throws Exception; String generateTokenUrl(CardDownloadData card) throws Exception; + String getNextHttpImageUrl(); + String getFileForHttpImage(String httpImageUrl); String getSourceName(); Float getAverageSize(); } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java index 9b5f589a08..df1ebc90ca 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java @@ -145,6 +145,16 @@ public class MagicCardsImageSource implements CardImageSource { } return instance; } + + @Override + public String getNextHttpImageUrl() { + return null; + } + + @Override + public String getFileForHttpImage(String httpImageUrl) { + return null; + } @Override public String generateURL(CardDownloadData card) throws Exception { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java index 1ff1f21c03..b7f77ac791 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java @@ -54,6 +54,16 @@ public class MtgImageSource implements CardImageSource { public String getSourceName() { return "mtgimage.com"; } + + @Override + public String getNextHttpImageUrl() { + return null; + } + + @Override + public String getFileForHttpImage(String httpImageUrl) { + return null; + } @Override public String generateURL(CardDownloadData card) throws Exception { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgOnlTokensImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgOnlTokensImageSource.java new file mode 100644 index 0000000000..f91179d0b4 --- /dev/null +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgOnlTokensImageSource.java @@ -0,0 +1,358 @@ +/* + * 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 org.mage.plugins.card.dl.sources; + +import java.io.IOException; +import java.net.URL; +import java.util.HashMap; +import org.apache.log4j.Logger; +import org.mage.plugins.card.images.CardDownloadData; +import org.mage.plugins.card.images.DownloadPictures; + +/** + * + * @author spjspj + */ +public class MtgOnlTokensImageSource implements CardImageSource { + + private static final Logger logger = Logger.getLogger(MtgOnlTokensImageSource.class); + + private static CardImageSource instance = new MtgOnlTokensImageSource(); + + public static CardImageSource getInstance() { + if (instance == null) { + instance = new MtgOnlTokensImageSource(); + } + return instance; + } + + @Override + public String getSourceName() { + return "http://mtg.onl/token-list/tokens/"; + } + + @Override + public Float getAverageSize() { + return 26.7f; + } + + @Override + public String getNextHttpImageUrl() { + if (copyUrlToImage == null) { + setupLinks(); + } + + for (String key : copyUrlToImageDone.keySet()) { + if (copyUrlToImageDone.get(key) == false) { + copyUrlToImageDone.put(key, true); + return key; + } + } + return null; + } + + @Override + public String getFileForHttpImage(String httpImageUrl) { + if (httpImageUrl != null) { + return copyUrlToImage.get(httpImageUrl); + } + return null; + } + + @Override + public String generateURL(CardDownloadData card) throws Exception { + return null; + } + + HashMap copyUrlToImage = null; + HashMap copyImageToUrl = null; + HashMap copyUrlToImageDone = null; + + private void setupLinks() { + if (copyUrlToImage != null) { + return; + } + copyUrlToImage = new HashMap(); + copyImageToUrl = new HashMap(); + copyUrlToImageDone = new HashMap(); + copyUrlToImage.put("Angel_B_3_3.jpg", "ANGEL.B.ANGEL.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Angel_W_3_3.jpg", "ANGEL.W.ANGEL.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Angel_W_4_4.jpg", "ANGEL.W.ANGEL.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Ape_G_2_2.jpg", "APE.G.APE.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Ape_G_3_3.jpg", "APE.G.APE.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Ashaya_the_Awoken_World_G_4_4.jpg", "ASHAYATHEAWOKENWORLD.G.ELEMENTAL.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Assassin_B_1_1.jpg", "ASSASSIN.B.ASSASSIN.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Assembly-Worker_2_2.jpg", "ASSEMBLYWORKER..ASSEMBLYWORKER.ARTIFACTCREATURE.2.2.full.jpg"); + copyUrlToImage.put("Avatar_W_y_y.jpg", "AVATAR.W.AVATAR.CREATURE.S.S.full.jpg"); + copyUrlToImage.put("Bat_B_1_1.jpg", "BAT.B.BAT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Bat_B_1_2.jpg", "BAT.B.BAT.CREATURE.1.2.full.jpg"); + copyUrlToImage.put("Bear_G_2_2.jpg", "BEAR.G.BEAR.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Bear_G_4_4.jpg", "BEAR.G.BEAR.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Beast_B_3_3.jpg", "BEAST.B.BEAST.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Beast_G_3_3.jpg", "BEAST.G.BEAST.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Beast_G_2_2.jpg", "BEAST.G.BEAST.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Beast_G_4_4.jpg", "BEAST.G.BEAST.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Beast_G_5_5.jpg", "BEAST.G.BEAST.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Beast_RGW_8_8.jpg", "BEAST.WRG.BEAST.CREATURE.8.8.full.jpg"); + copyUrlToImage.put("Bird_Soldier_W_1_1.jpg", "BIRDSOLDIER.W.BIRD.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Bird_U_1_1.jpg", "BIRD.U.BIRD.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Bird_U_2_2.jpg", "BIRD.U.BIRD.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Bird_U_2_2_Enchantment.jpg", "BIRD.U.BIRD.ENCHANTMENTCREATURE.2.2.full.jpg"); + copyUrlToImage.put("Bird_WU_1_1.jpg", "BIRD.WU.BIRD.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Bird_W_1_1.jpg", "BIRD.W.BIRD.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Bird_W_3_3.jpg", "BIRD.W.BIRD.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Bird_W_3_4.jpg", "BIRD.W.BIRD.CREATURE.3.4.full.jpg"); + copyUrlToImage.put("Boar_G_2_2.jpg", "BOAR.G.BOAR.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Boar_G_3_3.jpg", "BOAR.G.BOAR.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Butterfly_G_1_1.jpg", "BUTTERFLY.G.INSECT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Camarid_U_1_1.jpg", "CAMARID.U.CAMARID.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Caribou_W_0_1.jpg", "CARIBOU.W.CARIBOU.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Carnivore_R_3_1.jpg", "CARNIVORE.R.BEAST.CREATURE.3.1.full.jpg"); + copyUrlToImage.put("Cat_B_2_1.jpg", "CAT.B.CAT.CREATURE.2.1.full.jpg"); + copyUrlToImage.put("Cat_G_1_1.jpg", "CAT.G.CAT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Cat_R_1_1.jpg", "CAT.R.CAT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Cat_Soldier_W_1_1.jpg", "CATSOLDIER.W.CATSOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Cat_W_2_2.jpg", "CAT.W.CAT.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Cat_Warrior_G_2_2.jpg", "CATWARRIOR.G.CATWARRIOR.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Centaur_G_3_3.jpg", "CENTAUR.G.CENTAUR.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Centaur_G_3_3_Enchantment.jpg", "CENTAUR.G.CENTAUR.ENCHANTMENTCREATURE.3.3.full.jpg"); + copyUrlToImage.put("Centaur_G_3_3_protection.jpg", "CENTAUR.G.CENTAUR.CREATURE.3.3a.full.jpg"); + copyUrlToImage.put("Citizen_W_1_1.jpg", "CITIZEN.W.CITIZEN.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Cleric_WB_1_1.jpg", "CLERIC.WB.CLERIC.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Cleric_W_2_1.jpg", "CLERIC.W.CLERIC.CREATUREENCHANTMENT.2.1.full.jpg"); + copyUrlToImage.put("Cloud_Sprite_U_1_1.jpg", "CLOUDSPRITE.U.FAERIE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Clue.jpg", "CLUE..CLUE.ARTIFACT.0.0.full.jpg"); + copyUrlToImage.put("Construct_1_1.jpg", "CONSTRUCT..CONSTRUCT.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Construct_6_12.jpg", "CONSTRUCT..CONSTRUCT.CREATUREARTIFACT.6.12.full.jpg"); + copyUrlToImage.put("Demon_B_5_5.jpg", "DEMON.B.DEMON.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Demon_B_y_y.jpg", "DEMON.B.DEMON.CREATURE.S.S.full.jpg"); + copyUrlToImage.put("Devil_R_1_1.jpg", "DEVIL.R.DEVIL.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Djinn_5_5.jpg", "DJINN..DJINN.ARTIFACTCREATURE.5.5.full.jpg"); + copyUrlToImage.put("Djinn_Monk_U_2_2.jpg", "DJINNMONK.U.DJINNMONK.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Dragon_RG_1_1.jpg", "DRAGON.RG.DRAGON.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Dragon_R_2_2.jpg", "DRAGON.R.DRAGON.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Dragon_R_4_4.jpg", "DRAGON.R.DRAGON.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Dragon_R_5_5.jpg", "DRAGON.R.DRAGON.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Dragon_R_6_6.jpg", "DRAGON.R.DRAGON.CREATURE.6.6.full.jpg"); + copyUrlToImage.put("Dragon_Spirit_U_5_5.jpg", "DRAGONSPIRIT.U.DRAGONSPIRIT.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Drake_UG_2_2.jpg", "DRAKE.UG.DRAKE.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Drake_U_2_2.jpg", "DRAKE.U.DRAKE.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Eldrazi_10_10.jpg", "ELDRAZI..ELDRAZI.CREATURE.10.10.full.jpg"); + copyUrlToImage.put("Eldrazi_Scion_1_1.jpg", "ELDRAZISCION..ELDRAZISCION.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Eldrazi_Spawn_0_1.jpg", "ELDRAZISPAWN..ELDRAZISPAWN.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Elemental_BR_5_5.jpg", "ELEMENTAL.BR.ELEMENTAL.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Elemental_GW_y_y.jpg", "ELEMENTAL.WG.ELEMENTAL.CREATURE.S.S.full.jpg"); + copyUrlToImage.put("Elemental_G_2_2.jpg", "ELEMENTAL.G.ELEMENTAL.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Elemental_G_4_4.jpg", "ELEMENTAL.G.ELEMENTAL.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Elemental_G_5_3.jpg", "ELEMENTAL.G.ELEMENTAL.CREATURE.5.3.full.jpg"); + copyUrlToImage.put("Elemental_G_7_7.jpg", "ELEMENTAL.G.ELEMENTAL.CREATURE.7.7.full.jpg"); + copyUrlToImage.put("Elemental_R_7_1.jpg", "ELEMENTAL.R.ELEMENTAL.CREATURE.7.1.full.jpg"); + copyUrlToImage.put("Elemental_Shaman_R_3_1.jpg", "ELEMENTALSHAMAN.R.ELEMENTALSHAMAN.CREATURE.3.1.full.jpg"); + copyUrlToImage.put("Elephant_G_3_3.jpg", "ELEPHANT.G.ELEPHANT.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Elf_Druid_G_1_1.jpg", "ELFDRUID.G.ELFDRUID.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Elf_G_1_1.jpg", "ELFWARRIOR.G.ELFWARRIOR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Elf_Warrior_GW_1_1.jpg", "ELFWARRIOR.WG.ELFWARRIOR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Elf_Warrior_G_1_1.jpg", "ELFWARRIOR.G.ELFWARRIOR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Faerie_Rogue_B_1_1.jpg", "FAERIEROGUE.B.FAERIEROGUE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Faerie_Rogue_UB_1_1.jpg", "FAERIEROGUE.UB.FAERIEROGUE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Faerie_U_1_1.jpg", "FAERIE.U.FAERIE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Festering_Goblin_B_1_1.jpg", "FESTERINGGOBLIN.B.ZOMBIEGOBLIN.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Fish_U_3_3.jpg", "FISH.U.FISH.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Frog_Lizard_G_3_3.jpg", "FROGLIZARD.G.FROGLIZARD.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Gargoyle_3_4.jpg", "GARGOYLE..GARGOYLE.CREATUREARTIFACT.3.4.full.jpg"); + copyUrlToImage.put("Germ_B_0_0.jpg", "GERM.B.GERM.CREATURE.0.0.full.jpg"); + copyUrlToImage.put("Giant_R_4_4.jpg", "GIANT.R.GIANT.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Giant_Warrior_RG_4_4.jpg", "GIANTWARRIOR.RG.GIANTWARRIOR.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Giant_Warrior_W_5_5.jpg", "GIANTWARRIOR.W.GIANTWARRIOR.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Gnome_1_1.jpg", "GNOME..GNOME.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Goat_W_0_1.jpg", "GOAT.W.GOAT.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Goblin_R_1_1.jpg", "GOBLIN.R.GOBLIN.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Goblin_R_2_1.jpg", "GOBLIN.R.GOBLIN.CREATURE.2.1.full.jpg"); + copyUrlToImage.put("Goblin_Rogue_B_1_1.jpg", "GOBLINROGUE.B.GOBLINROGUE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Goblin_Scout_R_1_1.jpg", "GOBLINSCOUT.R.GOBLINSCOUT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Goblin_Soldier_RW_1_1.jpg", "GOBLINSOLDIER.WR.GOBLINSOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Goblin_Warrior_RG_1_1.jpg", "GOBLINWARRIOR.RG.GOBLINWARRIOR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Gold_.jpg", "GOLD...ARTIFACT.0.0.full.jpg"); + copyUrlToImage.put("Goldmeadow_Harrier_W_1_1.jpg", "GOLDMEADOWHARRIER.W.KITHKINSOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Golem_3_3.jpg", "GOLEM..GOLEM.ARTIFACTCREATURE.3.3.full.jpg"); + copyUrlToImage.put("Golem_3_3_Enchantment.jpg", "GOLEM..GOLEM.ENCHANTMENTARTIFACTCREATURE.3.3.full.jpg"); + copyUrlToImage.put("Golem_9_9.jpg", "GOLEM..GOLEM.ARTIFACTCREATURE.9.9.full.jpg"); + copyUrlToImage.put("Graveborn_BR_3_1.jpg", "GRAVEBORN.BR.GRAVEBORN.CREATURE.3.1.full.jpg"); + copyUrlToImage.put("Griffin_W_2_2.jpg", "GRIFFIN.W.GRIFFIN.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Harpy_B_1_1.jpg", "HARPY.B.HARPY.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Hellion_R_4_4.jpg", "HELLION.R.HELLION.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Hippo_G_1_1.jpg", "HIPPO.G.HIPPO.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Homunculus_U_0_1.jpg", "HOMUNCULUS.U.HOMUNCULUS.CREATUREARTIFACT.0.1.full.jpg"); + copyUrlToImage.put("Homunculus_U_2_2.jpg", "HOMUNCULUS.U.HOMUNCULUS.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Hornet_1_1.jpg", "HORNET..INSECT.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Horror_B_4_4.jpg", "HORROR.B.HORROR.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Horror_B_X_X.jpg", "HORROR.B.HORROR.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Horror_UB_1_1.jpg", "HORROR.UB.HORROR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Horror_X_X.jpg", "HORROR..HORROR.ARTIFACTCREATURE.X.X.full.jpg"); + copyUrlToImage.put("Hound_G_1_1.jpg", "HOUND.G.HOUND.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Human_Cleric_WB_1_1.jpg", "HUMANCLERIC.WB.HUMANCLERIC.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Human_R_1_1.jpg", "HUMAN.R.HUMAN.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Human_Soldier_W_1_1.jpg", "HUMANSOLDIER.W.HUMANSOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Human_W_1_1.jpg", "HUMAN.W.HUMAN.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Hydra_G_X_X.jpg", "HYDRA.G.HYDRA.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Illusion_U_1_1.jpg", "ILLUSION.U.ILLUSION.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Illusion_U_2_2.jpg", "ILLUSION.U.ILLUSION.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Insect_G_1_1.jpg", "INSECT.G.INSECT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Insect_G_6_1.jpg", "INSECT.G.INSECT.CREATURE.6.1.full.jpg"); + copyUrlToImage.put("Kaldra_4_4.jpg", "KALDRA..AVATAR.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Kavu_B_3_3.jpg", "KAVU.B.KAVU.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Kelp_U_0_1.jpg", "KELP.U.PLANTWALL.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Kithkin_Soldier_W_1_1.jpg", "KITHKINSOLDIER.W.KITHKINSOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Knight_Ally_W_2_2.jpg", "KNIGHTALLY.W.KNIGHTALLY.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Knight_B_2_2.jpg", "KNIGHT.B.KNIGHT.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Knight_W_1_1.jpg", "KNIGHT.W.KNIGHT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Knight_W_2_2.jpg", "KNIGHT.W.KNIGHT.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Kobolds_of_Kher_Keep_R_0_1.jpg", "KOBOLDSOFKHERKEEP.R.KOBOLD.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Kor_Ally_W_1_1.jpg", "KORALLY.W.KORALLY.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Kor_Soldier_W_1_1.jpg", "KORSOLDIER.W.KORSOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Kraken_U_9_9.jpg", "KRAKEN.U.KRAKEN.CREATURE.9.9.full.jpg"); + copyUrlToImage.put("Landmine_.jpg", "LANDMINE...ARTIFACT.0.0.full.jpg"); + copyUrlToImage.put("Lightning_Ranger_R_5_1.jpg", "LIGHTNINGRAGER.R.ELEMENTAL.CREATURE.5.1.full.jpg"); + copyUrlToImage.put("Lizard_G_2_2.jpg", "LIZARD.G.LIZARD.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Llanowar_Elves_G_1_1.jpg", "LLANOWARELVES.G.ELFDRUID.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Marit_Lage_B_20_20.jpg", "MARITLAGE.B.AVATAR.CREATURE.20.20.full.jpg"); + copyUrlToImage.put("Merfolk_U_1_1.jpg", "MERFOLK.U.MERFOLK.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Merfolk_Wizard_U_1_1.jpg", "MERFOLKWIZARD.U.MERFOLKWIZARD.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Metallic_Sliver_1_1.jpg", "METALLICSLIVER..SLIVER.CREATUREARTIFACT.1.1.full.jpg"); + copyUrlToImage.put("Minion_B_1_1.jpg", "MINION.B.MINION.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Minion_B_X_X.jpg", "MINION.B.MINION.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Minor_Demon_BR_1_1.jpg", "MINORDEMON.BR.DEMON.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Minotaur_R_2_3.jpg", "MINOTAUR.R.MINOTAUR.CREATURE.2.3.full.jpg"); + copyUrlToImage.put("Monk_W_1_1.jpg", "MONK.W.MONK.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Myr_1_1.jpg", "MYR..MYR.CREATUREARTIFACT.1.1.full.jpg"); + copyUrlToImage.put("Octopus_U_8_8.jpg", "OCTOPUS.U.OCTOPUS.CREATURE.8.8.full.jpg"); + copyUrlToImage.put("Ogre_R_3_3.jpg", "OGRE.R.OGRE.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Ogre_R_4_4.jpg", "OGRE.R.OGRE.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Ooze_G_1_1.jpg", "OOZE.G.OOZE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Ooze_G_2_2.jpg", "OOZE.G.OOZE.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Ooze_G_3_3.jpg", "OOZE.G.OOZE.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Orb_U_X_X.jpg", "ORB.U.ORB.CREATURE.X.X.jpg.full.jpg"); + copyUrlToImage.put("Pegasus_W_1_1.jpg", "PEGASUS.W.PEGASUS.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Pentavite_1_1.jpg", "PENTAVITE..PENTAVITE.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Pest_0_1.jpg", "PEST..PEST.ARTIFACTCREATURE.0.1.full.jpg"); + copyUrlToImage.put("Pincher_2_2.jpg", "PINCHER..PINCHER.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Plant_G_0_1.jpg", "PLANT.G.PLANT.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Plant_G_1_1.jpg", "PLANT.G.PLANT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Rat_B_1_1.jpg", "RAT.B.RAT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Reflection_W_2_2.jpg", "REFLECTION.W.REFLECTION.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Rhino_G_4_4.jpg", "RHINO.G.RHINO.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Rukh_R_4_4.jpg", "BIRD.R.BIRD.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Sand_1_1.jpg", "SAND..SAND.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Sand_Warrior_RGW_1_1.jpg", "SANDWARRIOR.WRG.SANDWARRIOR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Saporling_G_1_1.jpg", "SAPROLING.G.SAPROLING.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Satyr_RG_2_2.jpg", "SATYR.RG.SATYR.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Serf_B_0_1.jpg", "SERF.B.SERF.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Shapeshifter_1_1.jpg", "SHAPESHIFTER..SHAPESHIFTER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Skeleton_B_1_1.jpg", "SKELETON.B.SKELETON.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Sliver_1_1.jpg", "SLIVER..SLIVER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Snake_1_1.jpg", "SNAKE..SNAKE.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Snake_B_1_1.jpg", "SNAKE.B.SNAKE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Snake_GB_1_1.jpg", "SNAKE.BG.SNAKE.ENCHANTMENTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Snake_GU_1_1.jpg", "SNAKE.UG.SNAKE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Snake_G_1_1.jpg", "SNAKE.G.SNAKE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Soldier_Ally_W_1_1.jpg", "SOLDIERALLY.W.SOLDIERALLY.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Soldier_RW_1_1.jpg", "SOLDIER.WR.SOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Soldier_R_1_1.jpg", "SOLDIER.R.SOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Soldier_W_1_1.jpg", "SOLDIER.W.SOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Soldier_W_1_1_Enchantment.jpg", "SOLDIER.W.SOLDIER.ENCHANTMENTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Spark_Elemental_R_3_1.jpg", "SPARKELEMENTAL.R.ELEMENTAL.CREATURE.3.1.full.jpg"); + copyUrlToImage.put("Spawn_2_2.jpg", "SPAWN..SPAWN.ARTIFACTCREATURE.2.2.full.jpg"); + copyUrlToImage.put("Sphinx_U_4_4.jpg", "SPHINX.U.SPHINX.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Spider_B_2_4.jpg", "SPIDER.B.SPIDER.CREATURE.2.4.full.jpg"); + copyUrlToImage.put("Spider_G_1_2.jpg", "SPIDER.G.SPIDER.CREATURE.1.2.full.jpg"); + copyUrlToImage.put("Spider_G_1_3.jpg", "SPIDER.G.SPIDER.ENCHANTMENTCREATURE.1.3.full.jpg"); + copyUrlToImage.put("Spike_G_1_1.jpg", "SPIKE.G.SPIKE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Spirit_1_1.jpg", "SPIRIT..SPIRIT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Spirit_U_1_1.jpg", "SPIRIT.U.SPIRIT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Spirit_WB_1_1.jpg", "SPIRIT.WB.SPIRIT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Spirit_WB_y_y.jpg", "SPIRIT.WB.SPIRIT.ENCHANTMENTCREATURE.S.S.full.jpg"); + copyUrlToImage.put("Spirit_W_1_1.jpg", "SPIRIT.W.SPIRIT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Spirit_W_3_3.jpg", "SPIRIT.W.SPIRIT.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Spirit_Warror_BG_y_y.jpg", "SPIRITWARRIOR.BG.SPIRITWARRIOR.CREATURE.S.S.full.jpg"); + copyUrlToImage.put("Squid_U_1_1.jpg", "SQUID.U.SQUID.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Squirrel_G_1_1.jpg", "SQUIRREL.G.SQUIRREL.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Stoneforged_Blade_.jpg", "STONEFORGEDBLADE..EQUIPMENT.ARTIFACT.0.0.full.jpg"); + copyUrlToImage.put("Tetravite_1_1.jpg", "TETRAVITE..TETRAVITE.CREATUREARTIFACT.1.1.full.jpg"); + copyUrlToImage.put("Thopter_1_1.jpg", "THOPTER..THOPTER.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Thopter_U_1_1.jpg", "THOPTER.U.THOPTER.CREATUREARTIFACT.1.1.full.jpg"); + copyUrlToImage.put("Thrull_B_0_1.jpg", "THRULL.B.THRULL.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Thrull_B_1_1.jpg", "THRULL.B.THRULL.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Treefolk_G_X_X.jpg", "TREEFOLK.G.TREEFOLK.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Treefolk_Shaman_G_2_5.jpg", "TREEFOLKSHAMAN.G.TREEFOLKSHAMAN.CREATURE.2.5.full.jpg"); + copyUrlToImage.put("Treefolk_Warrior_G_y_y.jpg", "TREEFOLKWARRIOR.G.TREEFOLKWARRIOR.CREATURE.S.S.full.jpg"); + copyUrlToImage.put("Triskelavite_1_1.jpg", "TRISKELAVITE..TRISKELAVITE.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Tuktuk_the_Returned_5_5.jpg", "TUKTUKTHERETURNED..GOBLIN.ARTIFACTCREATURE.5.5.full.jpg"); + copyUrlToImage.put("Urami_B_5_5.jpg", "URAMI.B.DEMONSPIRIT.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Vampire_B_1_1.jpg", "VAMPIRE.B.VAMPIRE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Vampire_B_2_2.jpg", "VAMPIRE.B.VAMPIRE.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Vampire_B_X_X.jpg", "VAMPIRE.B.VAMPIRE.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Vampire_Knight_B_1_1.jpg", "VAMPIREKNIGHT.B.VAMPIREKNIGHT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Voja_GW_2_2.jpg", "VOJA.WG.WOLF.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Wall_U_5_5.jpg", "WALL.U.WALL.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Warrior_B_2_1.jpg", "WARRIOR.B.WARRIOR.CREATURE.2.1.full.jpg"); + copyUrlToImage.put("Warrior_R_1_1.jpg", "WARRIOR.R.WARRIOR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Warrior_W_1_1.jpg", "WARRIOR.W.WARRIOR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Wasp_1_1.jpg", "WASP..INSECT.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Weird_U_3_3.jpg", "WEIRD.U.WEIRD.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Whale_U_6_6.jpg", "WHALE.U.WHALE.CREATURE.6.6.full.jpg"); + copyUrlToImage.put("Wirefly_2_2.jpg", "WIREFLY..INSECT.ARTIFACTCREATURE.2.2.full.jpg"); + copyUrlToImage.put("Wolf_G_2_2.jpg", "WOLF.G.WOLF.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Wood_G_0_1.jpg", "WOOD.G.WALL.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Worm_BG_1_1.jpg", "WORM.BG.WORM.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Wurm_3_3.jpg", "WURM..WURM.ARTIFACTCREATURE.3.3.full.jpg"); + copyUrlToImage.put("Wurm_B_6_6.jpg", "WURM.B.WURM.CREATURE.6.6.full.jpg"); + copyUrlToImage.put("Wurm_G_6_6.jpg", "WURM.G.WURM.CREATURE.6.6.full.jpg"); + copyUrlToImage.put("Zombie_B_2_2.jpg", "ZOMBIE.B.ZOMBIE.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Zombie_B_2_2_Enchantment.jpg", "ZOMBIE.B.ZOMBIE.ENCHANTMENTCREATURE.2.2.full.jpg"); + copyUrlToImage.put("Zombie_B_5_5.jpg", "ZOMBIEGIANT.B.ZOMBIEGIANT.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Zombie_B_X_X.jpg", "ZOMBIE.B.ZOMBIE.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Zombie_Horror_B_X_X.jpg", "ZOMBIEHORROR.B.ZOMBIEHORROR.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Zombie_U_X_X.jpg", "ZOMBIE.U.ZOMBIE.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Zombie_Wizard_UB_1_1.jpg", "ZOMBIEWIZARD.BG.ZOMBIEWIZARD.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Zombie_Wizard_UB_1_1.jpg", "ZOMBIEWIZARD.UB.ZOMBIEWIZARD.CREATURE.1.1.full.jpg"); + + for (String key : copyUrlToImage.keySet()) { + copyUrlToImageDone.put(key, false); + copyImageToUrl.put(copyUrlToImage.get(key), key); + } + } + + @Override + public String generateTokenUrl(CardDownloadData card) throws IOException { + + if (copyUrlToImage == null) { + setupLinks(); + } + return null; + } +} diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java index 7883eaecce..11b1657c08 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java @@ -234,4 +234,14 @@ public class MythicspoilerComSource implements CardImageSource { public Float getAverageSize() { return 50.0f; } + + @Override + public String getNextHttpImageUrl() { + return null; + } + + @Override + public String getFileForHttpImage(String httpImageUrl) { + return null; + } } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java index 0761b05cb4..089085660b 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java @@ -66,6 +66,16 @@ public class TokensMtgImageSource implements CardImageSource { public Float getAverageSize() { return 26.7f; } + + @Override + public String getNextHttpImageUrl() { + return null; + } + + @Override + public String getFileForHttpImage(String httpImageUrl) { + return null; + } @Override public String generateURL(CardDownloadData card) throws Exception { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java index b00d7b5621..d07ac10d8f 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java @@ -260,6 +260,16 @@ public class WizardCardsImageSource implements CardImageSource { languageAliases.put("de", "German"); } + @Override + public String getNextHttpImageUrl() { + return null; + } + + @Override + public String getFileForHttpImage(String httpImageUrl) { + return null; + } + private Map getSetLinks(String cardSet) { ConcurrentHashMap setLinks = new ConcurrentHashMap<>(); ExecutorService executor = Executors.newFixedThreadPool(10); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java index 339db215fe..2a4a1ca9f4 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java @@ -58,6 +58,7 @@ import net.java.truevfs.kernel.spec.FsSyncException; import org.apache.log4j.Logger; import org.mage.plugins.card.dl.sources.CardImageSource; import org.mage.plugins.card.dl.sources.MagicCardsImageSource; +import org.mage.plugins.card.dl.sources.MtgOnlTokensImageSource; import org.mage.plugins.card.dl.sources.MythicspoilerComSource; import org.mage.plugins.card.dl.sources.TokensMtgImageSource; import org.mage.plugins.card.dl.sources.WizardCardsImageSource; @@ -145,6 +146,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab "wizards.com", "mythicspoiler.com", "tokens.mtg.onl", //"mtgimage.com (HQ)", + "mtg.onl" //"mtgathering.ru HQ", //"mtgathering.ru MQ", //"mtgathering.ru LQ", @@ -172,6 +174,9 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab case 3: cardImageSource = TokensMtgImageSource.getInstance(); break; + case 4: + cardImageSource = MtgOnlTokensImageSource.getInstance(); + break; } int count = DownloadPictures.this.cards.size(); float mb = (count * cardImageSource.getAverageSize()) / 1024; @@ -239,7 +244,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab TFile file; for (CardInfo card : allCards) { if (!card.getCardNumber().isEmpty() && !"0".equals(card.getCardNumber()) && !card.getSetCode().isEmpty()) { - CardDownloadData url = new CardDownloadData(card.getName(), card.getSetCode(), card.getCardNumber(), card.usesVariousArt(), + CardDownloadData url = new CardDownloadData(card.getName(), card.getSetCode(), card.getCardNumber(), card.usesVariousArt(), 0, "", "", false, card.isDoubleFaced(), card.isNightCard()); file = new TFile(CardImageUtils.generateImagePath(url)); if (!file.exists()) { @@ -492,14 +497,29 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab url = cardImageSource.generateURL(card); } - if (url != null) { + if (url == null) { + String imageRef = cardImageSource.getNextHttpImageUrl(); + String fileName = cardImageSource.getFileForHttpImage(imageRef); + if (imageRef != null && fileName != null) { + imageRef = cardImageSource.getSourceName() + imageRef; + try { + URL imageUrl = new URL(imageRef); + + Runnable task = new DownloadTask(imageUrl, fileName, 1); + executor.execute(task); + } catch (Exception ex) { + } + } else { + if (card != null) { + logger.info("Card not available on " + cardImageSource.getSourceName() + ": " + card.getName() + " (" + card.getSet() + ")"); + synchronized (sync) { + update(cardIndex + 1, cardsToDownload.size()); + } + } + } + } else if (url != null) { Runnable task = new DownloadTask(card, new URL(url), cardsToDownload.size()); executor.execute(task); - } else { - logger.info("Card not available on " + cardImageSource.getSourceName() + ": " + card.getName() + " (" + card.getSet() + ")"); - synchronized (sync) { - update(cardIndex + 1, cardsToDownload.size()); - } } } catch (Exception ex) { @@ -535,11 +555,23 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab private final CardDownloadData card; private final URL url; private final int count; + private final String actualFilename; + private boolean useSpecifiedPaths; public DownloadTask(CardDownloadData card, URL url, int count) { this.card = card; this.url = url; this.count = count; + this.actualFilename = ""; + useSpecifiedPaths = false; + } + + public DownloadTask(URL url, String actualFilename, int count) { + this.card = null; + this.url = url; + this.count = count; + this.actualFilename = actualFilename; + useSpecifiedPaths = true; } @Override @@ -549,9 +581,20 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab TFile outputFile = null; try { filePath.append(Constants.IO.imageBaseDir); - filePath.append(card.hashCode()).append(".").append(card.getName().replace(":", "").replace("//", "-")).append(".jpg"); - temporaryFile = new File(filePath.toString()); - String imagePath = CardImageUtils.generateImagePath(card); + if (!useSpecifiedPaths && card != null) { + filePath.append(card.hashCode()).append(".").append(card.getName().replace(":", "").replace("//", "-")).append(".jpg"); + temporaryFile = new File(filePath.toString()); + } + String imagePath; + if (useSpecifiedPaths) { + imagePath = CardImageUtils.getTokenBasePath(); // temporaryFile = plugins/images\NUM.jace, telepath unbound.jpg + imagePath += actualFilename; // imagePath = d:\xmage_images\ORI.zip\ORI\Jace,telepathunbound.jpg + String tmpFile = filePath + actualFilename + ".2"; + temporaryFile = new File(tmpFile.toString()); + } else { + imagePath = CardImageUtils.generateImagePath(card); + } + outputFile = new TFile(imagePath); if (!outputFile.exists()) { outputFile.getParentFile().mkdirs(); @@ -599,7 +642,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab out.flush(); out.close(); - if (card.isTwoFacedCard()) { + if (card != null && card.isTwoFacedCard()) { BufferedImage image = ImageIO.read(temporaryFile); if (image.getHeight() == 470) { BufferedImage renderedImage = new BufferedImage(265, 370, BufferedImage.TYPE_INT_RGB); @@ -620,11 +663,13 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab new TFile(temporaryFile).cp_rp(outputFile); } } else { - logger.warn("Image download for " + card.getName() - + (!card.getDownloadName().equals(card.getName()) ? " downloadname: " + card.getDownloadName() : "") - + "(" + card.getSet() + ") failed - responseCode: " + responseCode + " url: " + url.toString()); + if (card != null) { + logger.warn("Image download for " + card.getName() + + (!card.getDownloadName().equals(card.getName()) ? " downloadname: " + card.getDownloadName() : "") + + "(" + card.getSet() + ") failed - responseCode: " + responseCode + " url: " + url.toString()); + } if (logger.isDebugEnabled()) { // Shows the returned html from the request to the web server - logger.debug("Return ed HTML ERROR:\n" + convertStreamToString(((HttpURLConnection) httpConn).getErrorStream())); + logger.debug("Returned HTML ERROR:\n" + convertStreamToString(((HttpURLConnection) httpConn).getErrorStream())); } } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java b/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java index 8e69839c56..d527c659dc 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java @@ -117,6 +117,17 @@ public class CardImageUtils { return buildPath(imagesDir, set); } } + + public static String getTokenBasePath() { + String useDefault = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_USE_DEFAULT, "true"); + String imagesPath = useDefault.equals("true") ? null : PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PATH, null); + + if (PreferencesDialog.isSaveImagesToZip()) { + return imagesPath + TFile.separator + "TOK" + ".zip" + TFile.separator; + } else { + return imagesPath + TFile.separator + "TOK" + TFile.separator; + } + } private static String getTokenDescriptorImagePath(CardDownloadData card) { String useDefault = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_USE_DEFAULT, "true");