diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/NezumiCutthroat.java b/Mage.Sets/src/mage/sets/championsofkamigawa/NezumiCutthroat.java index 0cfb818682..38a9802dbe 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/NezumiCutthroat.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/NezumiCutthroat.java @@ -51,7 +51,7 @@ public class NezumiCutthroat extends CardImpl { this.power = new MageInt(2); this.toughness = new MageInt(1); this.addAbility(FearAbility.getInstance()); - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); } public NezumiCutthroat(final NezumiCutthroat card) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/VillainousOgre.java b/Mage.Sets/src/mage/sets/championsofkamigawa/VillainousOgre.java index e58ebb903e..f2d13016ad 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/VillainousOgre.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/VillainousOgre.java @@ -64,7 +64,7 @@ public class VillainousOgre extends CardImpl { this.power = new MageInt(3); this.toughness = new MageInt(2); - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); // As long as you control a Demon, Villainous Ogre has "{B}: Regenerate Villainous Ogre. this.addAbility( new ConditionalActivatedAbility( diff --git a/Mage.Sets/src/mage/sets/conflux/ShamblingRemains.java b/Mage.Sets/src/mage/sets/conflux/ShamblingRemains.java index bfdc8d8c43..65bd8bc33b 100644 --- a/Mage.Sets/src/mage/sets/conflux/ShamblingRemains.java +++ b/Mage.Sets/src/mage/sets/conflux/ShamblingRemains.java @@ -54,7 +54,7 @@ public class ShamblingRemains extends CardImpl { this.toughness = new MageInt(3); // Shambling Remains can't block. - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); // Unearth {B}{R} this.addAbility(new UnearthAbility(new ManaCostsImpl("{B}{R}"))); } diff --git a/Mage.Sets/src/mage/sets/darkascension/Gravecrawler.java b/Mage.Sets/src/mage/sets/darkascension/Gravecrawler.java index 22548bc993..565dc956b1 100644 --- a/Mage.Sets/src/mage/sets/darkascension/Gravecrawler.java +++ b/Mage.Sets/src/mage/sets/darkascension/Gravecrawler.java @@ -60,7 +60,7 @@ public class Gravecrawler extends CardImpl { this.toughness = new MageInt(1); // Gravecrawler can't block. - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); // You may cast Gravecrawler from your graveyard as long as you control a Zombie. this.addAbility(new SimpleStaticAbility(Zone.ALL, new GravecrawlerPlayEffect())); diff --git a/Mage.Sets/src/mage/sets/darkascension/SightlessGhoul.java b/Mage.Sets/src/mage/sets/darkascension/SightlessGhoul.java index 70cc205cc4..7bf59eb550 100644 --- a/Mage.Sets/src/mage/sets/darkascension/SightlessGhoul.java +++ b/Mage.Sets/src/mage/sets/darkascension/SightlessGhoul.java @@ -52,7 +52,7 @@ public class SightlessGhoul extends CardImpl { this.toughness = new MageInt(2); // Sightless Ghoul can't block. - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); // Undying this.addAbility(new UndyingAbility()); } diff --git a/Mage.Sets/src/mage/sets/darkascension/UnhallowedCathar.java b/Mage.Sets/src/mage/sets/darkascension/UnhallowedCathar.java index f75aa50da6..6a987b0fe6 100644 --- a/Mage.Sets/src/mage/sets/darkascension/UnhallowedCathar.java +++ b/Mage.Sets/src/mage/sets/darkascension/UnhallowedCathar.java @@ -54,7 +54,7 @@ public class UnhallowedCathar extends CardImpl { this.toughness = new MageInt(1); // Unhallowed Cathar can't block. - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); } public UnhallowedCathar(final UnhallowedCathar card) { diff --git a/Mage.Sets/src/mage/sets/darksteel/ScavengingScarab.java b/Mage.Sets/src/mage/sets/darksteel/ScavengingScarab.java index b492f349ff..d4651ca42a 100644 --- a/Mage.Sets/src/mage/sets/darksteel/ScavengingScarab.java +++ b/Mage.Sets/src/mage/sets/darksteel/ScavengingScarab.java @@ -48,7 +48,7 @@ public class ScavengingScarab extends CardImpl { this.color.setBlack(true); this.power = new MageInt(3); this.toughness = new MageInt(3); - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); } public ScavengingScarab(final ScavengingScarab card) { diff --git a/Mage.Sets/src/mage/sets/guildpact/DaggerclawImp.java b/Mage.Sets/src/mage/sets/guildpact/DaggerclawImp.java index 645897d9c6..f9ecb1fb58 100644 --- a/Mage.Sets/src/mage/sets/guildpact/DaggerclawImp.java +++ b/Mage.Sets/src/mage/sets/guildpact/DaggerclawImp.java @@ -50,7 +50,7 @@ public class DaggerclawImp extends CardImpl { this.power = new MageInt(3); this.toughness = new MageInt(1); this.addAbility(FlyingAbility.getInstance()); - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); } public DaggerclawImp (final DaggerclawImp card) { diff --git a/Mage.Sets/src/mage/sets/innistrad/VampireInterloper.java b/Mage.Sets/src/mage/sets/innistrad/VampireInterloper.java index 62c2a67db1..6363a213a3 100644 --- a/Mage.Sets/src/mage/sets/innistrad/VampireInterloper.java +++ b/Mage.Sets/src/mage/sets/innistrad/VampireInterloper.java @@ -54,7 +54,7 @@ public class VampireInterloper extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // Vampire Interloper can't block. - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); } public VampireInterloper(final VampireInterloper card) { diff --git a/Mage.Sets/src/mage/sets/lorwyn/NightshadeStinger.java b/Mage.Sets/src/mage/sets/lorwyn/NightshadeStinger.java index 53fb8cec92..6e138c014f 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/NightshadeStinger.java +++ b/Mage.Sets/src/mage/sets/lorwyn/NightshadeStinger.java @@ -52,7 +52,7 @@ public class NightshadeStinger extends CardImpl { this.toughness = new MageInt(1); this.addAbility(FlyingAbility.getInstance()); // Nightshade Stinger can't block. - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); } public NightshadeStinger(final NightshadeStinger card) { diff --git a/Mage.Sets/src/mage/sets/magic2012/TormentedSoul.java b/Mage.Sets/src/mage/sets/magic2012/TormentedSoul.java index 6d07df56b1..0a85b630cb 100644 --- a/Mage.Sets/src/mage/sets/magic2012/TormentedSoul.java +++ b/Mage.Sets/src/mage/sets/magic2012/TormentedSoul.java @@ -49,7 +49,7 @@ public class TormentedSoul extends CardImpl { this.color.setBlack(true); this.power = new MageInt(1); this.toughness = new MageInt(1); - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); this.addAbility(new UnblockableAbility()); } diff --git a/Mage.Sets/src/mage/sets/magic2013/VeilbornGhoul.java b/Mage.Sets/src/mage/sets/magic2013/VeilbornGhoul.java index 14356727db..bf0bfe424d 100644 --- a/Mage.Sets/src/mage/sets/magic2013/VeilbornGhoul.java +++ b/Mage.Sets/src/mage/sets/magic2013/VeilbornGhoul.java @@ -57,7 +57,7 @@ public class VeilbornGhoul extends CardImpl { this.toughness = new MageInt(1); // Veilborn Ghoul can't block. - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); // Whenever a Swamp enters the battlefield under your control, you may return Veilborn Ghoul from your graveyard to your hand. this.addAbility(new VeilbornGhoulTriggeredAbility()); diff --git a/Mage.Sets/src/mage/sets/scourge/CarrionFeeder.java b/Mage.Sets/src/mage/sets/scourge/CarrionFeeder.java index 318d16bf92..23367cf197 100644 --- a/Mage.Sets/src/mage/sets/scourge/CarrionFeeder.java +++ b/Mage.Sets/src/mage/sets/scourge/CarrionFeeder.java @@ -56,7 +56,7 @@ public class CarrionFeeder extends CardImpl { this.toughness = new MageInt(1); // Carrion Feeder can't block. - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); // Sacrifice a creature: Put a +1/+1 counter on Carrion Feeder. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), diff --git a/Mage.Sets/src/mage/sets/shadowmoor/AshenmoorGouger.java b/Mage.Sets/src/mage/sets/shadowmoor/AshenmoorGouger.java index 7c0ee0588e..217e4283fa 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/AshenmoorGouger.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/AshenmoorGouger.java @@ -51,7 +51,7 @@ public class AshenmoorGouger extends CardImpl { this.power = new MageInt(4); this.toughness = new MageInt(4); - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); } public AshenmoorGouger(final AshenmoorGouger card) { diff --git a/Mage.Sets/src/mage/sets/shadowmoor/InkfathomInfiltrator.java b/Mage.Sets/src/mage/sets/shadowmoor/InkfathomInfiltrator.java index ad2ccbe2ea..7db0478512 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/InkfathomInfiltrator.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/InkfathomInfiltrator.java @@ -52,7 +52,7 @@ public class InkfathomInfiltrator extends CardImpl { this.power = new MageInt(2); this.toughness = new MageInt(1); - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); this.addAbility(new UnblockableAbility()); } diff --git a/Mage.Sets/src/mage/sets/tenth/SpinelessThug.java b/Mage.Sets/src/mage/sets/tenth/SpinelessThug.java index 14ccd0229b..49c57a1888 100644 --- a/Mage.Sets/src/mage/sets/tenth/SpinelessThug.java +++ b/Mage.Sets/src/mage/sets/tenth/SpinelessThug.java @@ -48,7 +48,7 @@ public class SpinelessThug extends CardImpl { this.color.setBlack(true); this.power = new MageInt(2); this.toughness = new MageInt(2); - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); } public SpinelessThug(final SpinelessThug card) { diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/PygmyPyrosaur.java b/Mage.Sets/src/mage/sets/urzaslegacy/PygmyPyrosaur.java index d491e43e6f..cc7f101b2d 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/PygmyPyrosaur.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/PygmyPyrosaur.java @@ -55,7 +55,7 @@ public class PygmyPyrosaur extends CardImpl { this.toughness = new MageInt(1); // Pygmy Pyrosaur can't block. - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); // {R}: Pygmy Pyrosaur gets +1/+0 until end of turn. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}"))); } diff --git a/Mage.Sets/src/mage/sets/worldwake/BojukaBrigand.java b/Mage.Sets/src/mage/sets/worldwake/BojukaBrigand.java index a1389b0a77..fd0bd97e3d 100644 --- a/Mage.Sets/src/mage/sets/worldwake/BojukaBrigand.java +++ b/Mage.Sets/src/mage/sets/worldwake/BojukaBrigand.java @@ -54,7 +54,7 @@ public class BojukaBrigand extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(1); - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); this.addAbility(new AllyEntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true)); } diff --git a/Mage.Sets/src/mage/sets/zendikar/Bloodghast.java b/Mage.Sets/src/mage/sets/zendikar/Bloodghast.java index cabbcb2ceb..9ed3e929ec 100644 --- a/Mage.Sets/src/mage/sets/zendikar/Bloodghast.java +++ b/Mage.Sets/src/mage/sets/zendikar/Bloodghast.java @@ -60,7 +60,7 @@ public class Bloodghast extends CardImpl { this.power = new MageInt(2); this.toughness = new MageInt(1); - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); this.addAbility(new LandfallAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(), true)); ContinuousEffect effect = new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(effect, diff --git a/Mage.Sets/src/mage/sets/zendikar/HagraCrocodile.java b/Mage.Sets/src/mage/sets/zendikar/HagraCrocodile.java index a772bc7b5b..194eaad8bb 100644 --- a/Mage.Sets/src/mage/sets/zendikar/HagraCrocodile.java +++ b/Mage.Sets/src/mage/sets/zendikar/HagraCrocodile.java @@ -52,7 +52,7 @@ public class HagraCrocodile extends CardImpl { this.power = new MageInt(3); this.toughness = new MageInt(1); - this.addAbility(CantBlockAbility.getInstance()); + this.addAbility(new CantBlockAbility()); this.addAbility(new LandfallAbility(new BoostSourceEffect(2, 2, Duration.EndOfTurn), false)); } diff --git a/Mage/src/mage/abilities/common/CantBlockAbility.java b/Mage/src/mage/abilities/common/CantBlockAbility.java index efad2f668d..426c080d45 100644 --- a/Mage/src/mage/abilities/common/CantBlockAbility.java +++ b/Mage/src/mage/abilities/common/CantBlockAbility.java @@ -1,38 +1,48 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.common; import mage.Constants.Duration; import mage.Constants.Zone; -import mage.abilities.Ability; -import mage.abilities.MageSingleton; -import mage.abilities.effects.RestrictionEffect; -import mage.game.Game; -import mage.game.permanent.Permanent; - -import java.io.ObjectStreamException; +import mage.abilities.effects.common.CantBlockSourceEffect; /** * * @author maurer.it_at_gmail.com */ -public class CantBlockAbility extends SimpleStaticAbility implements MageSingleton { +public class CantBlockAbility extends SimpleStaticAbility { - private static final CantBlockAbility fINSTANCE = new CantBlockAbility(); - - private Object readResolve() throws ObjectStreamException { - return fINSTANCE; + public CantBlockAbility() { + super(Zone.BATTLEFIELD, new CantBlockSourceEffect(Duration.WhileOnBattlefield)); } - public static CantBlockAbility getInstance() { - return fINSTANCE; - } - - private CantBlockAbility() { - super(Zone.BATTLEFIELD, new CantBlockEffect()); + private CantBlockAbility(CantBlockAbility ability) { + super(ability); } @Override @@ -42,34 +52,6 @@ public class CantBlockAbility extends SimpleStaticAbility implements MageSinglet @Override public CantBlockAbility copy() { - return fINSTANCE; + return new CantBlockAbility(this); } - -} - -class CantBlockEffect extends RestrictionEffect implements MageSingleton { - - public CantBlockEffect() { - super(Duration.EndOfGame); - } - - public CantBlockEffect(final CantBlockEffect effect) { - super(effect); - } - - @Override - public boolean applies(Permanent permanent, Ability source, Game game) { - return permanent.getAbilities().containsKey(CantBlockAbility.getInstance().getId()) || source.getId().equals(CantBlockAbility.getInstance().getId()); - } - - @Override - public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) { - return !blocker.getAbilities().containsKey(CantBlockAbility.getInstance().getId()); - } - - @Override - public CantBlockEffect copy() { - return new CantBlockEffect(this); - } - } diff --git a/Mage/src/mage/abilities/effects/common/CantBlockSourceEffect.java b/Mage/src/mage/abilities/effects/common/CantBlockSourceEffect.java index bf5ba1b9b6..b7e3488b8e 100644 --- a/Mage/src/mage/abilities/effects/common/CantBlockSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/CantBlockSourceEffect.java @@ -42,6 +42,10 @@ public class CantBlockSourceEffect extends RestrictionEffect