diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/AshenSkinZubera.java b/Mage.Sets/src/mage/sets/championsofkamigawa/AshenSkinZubera.java index 7becdfe49b..afed7041bd 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/AshenSkinZubera.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/AshenSkinZubera.java @@ -63,7 +63,7 @@ public class AshenSkinZubera extends CardImpl { Ability ability = new DiesTriggeredAbility(new DiscardTargetEffect(new AshenSkinZuberaDynamicValue())); ability.addTarget(new TargetOpponent()); this.addAbility(ability); - this.watchers.add(new AshenSkinZuberaWatcher(ownerId)); + this.addWatcher(new AshenSkinZuberaWatcher()); } public AshenSkinZubera(final AshenSkinZubera card) { @@ -81,8 +81,8 @@ class AshenSkinZuberaWatcher extends WatcherImpl { public int zuberasDiedThisTurn = 0; - public AshenSkinZuberaWatcher(UUID controllerId) { - super("ZuberasDiedAshenSkinZubera", controllerId); + public AshenSkinZuberaWatcher() { + super("ZuberasDiedAshenSkinZubera"); } public AshenSkinZuberaWatcher(final AshenSkinZuberaWatcher watcher) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/DrippingTongueZubera.java b/Mage.Sets/src/mage/sets/championsofkamigawa/DrippingTongueZubera.java index a0b9d7e4f3..f11f2e537c 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/DrippingTongueZubera.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/DrippingTongueZubera.java @@ -62,7 +62,7 @@ public class DrippingTongueZubera extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(2); this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new SpiritToken(), new DrippingTongueZuberaDynamicValue()), false)); - this.watchers.add(new DrippingTongueZuberaWatcher(ownerId)); + this.addWatcher(new DrippingTongueZuberaWatcher()); } public DrippingTongueZubera (final DrippingTongueZubera card) { @@ -80,8 +80,8 @@ class DrippingTongueZuberaWatcher extends WatcherImpl { Ability ability = new DiesTriggeredAbility(new DamageTargetEffect(new EmberFistZuberaDynamicValue())); ability.addTarget(new TargetCreatureOrPlayer()); this.addAbility(ability); - this.watchers.add(new EmberFistZuberaWatcher(ownerId)); + this.addWatcher(new EmberFistZuberaWatcher()); } public EmberFistZubera (final EmberFistZubera card) { @@ -82,8 +82,8 @@ class EmberFistZuberaWatcher extends WatcherImpl { public int zuberasDiedThisTurn = 0; - public EmberFistZuberaWatcher(UUID controllerId) { - super("ZuberasDiedEmberFistZubera", controllerId); + public EmberFistZuberaWatcher() { + super("ZuberasDiedEmberFistZubera"); } public EmberFistZuberaWatcher(final EmberFistZuberaWatcher watcher) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/FloatingDreamZubera.java b/Mage.Sets/src/mage/sets/championsofkamigawa/FloatingDreamZubera.java index ee93314662..834521718d 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/FloatingDreamZubera.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/FloatingDreamZubera.java @@ -60,7 +60,7 @@ public class FloatingDreamZubera extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(2); this.addAbility(new DiesTriggeredAbility(new DrawCardControllerEffect(new FloatingDreamZuberaDynamicValue()))); - this.watchers.add(new FloatingDreamZuberaWatcher(ownerId)); + this.addWatcher(new FloatingDreamZuberaWatcher()); } public FloatingDreamZubera(final FloatingDreamZubera card) { @@ -79,8 +79,8 @@ class FloatingDreamZuberaWatcher extends WatcherImpl public int zuberasDiedThisTurn = 0; - public FloatingDreamZuberaWatcher(UUID controllerId) { - super("ZuberasDiedFloatingDreamZubera", controllerId); + public FloatingDreamZuberaWatcher() { + super("ZuberasDiedFloatingDreamZubera"); } public FloatingDreamZuberaWatcher(final FloatingDreamZuberaWatcher watcher) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/SilentChantZubera.java b/Mage.Sets/src/mage/sets/championsofkamigawa/SilentChantZubera.java index e6caa137e0..c64cadb175 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/SilentChantZubera.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/SilentChantZubera.java @@ -62,7 +62,7 @@ public class SilentChantZubera extends CardImpl { this.toughness = new MageInt(2); Ability ability = new DiesTriggeredAbility(new GainLifeEffect(new SilentChantZuberaDynamicValue())); this.addAbility(ability); - this.watchers.add(new AshenSkinZuberaWatcher(ownerId)); + this.addWatcher(new AshenSkinZuberaWatcher()); } public SilentChantZubera (final SilentChantZubera card) { @@ -80,8 +80,8 @@ class SilentChantZuberaWatcher extends WatcherImpl { public int zuberasDiedThisTurn = 0; - public SilentChantZuberaWatcher(UUID controllerId) { - super("ZuberasDiedSilentChantZubera", controllerId); + public SilentChantZuberaWatcher() { + super("ZuberasDiedSilentChantZubera"); } public SilentChantZuberaWatcher(final SilentChantZuberaWatcher watcher) { diff --git a/Mage.Sets/src/mage/sets/magic2011/AngelicArbiter.java b/Mage.Sets/src/mage/sets/magic2011/AngelicArbiter.java index c6c0c8a58a..a4ea81ef37 100644 --- a/Mage.Sets/src/mage/sets/magic2011/AngelicArbiter.java +++ b/Mage.Sets/src/mage/sets/magic2011/AngelicArbiter.java @@ -61,8 +61,8 @@ public class AngelicArbiter extends CardImpl { this.toughness = new MageInt(6); this.addAbility(FlyingAbility.getInstance()); - this.watchers.add(new AngelicArbiterWatcher1(ownerId)); - this.watchers.add(new AngelicArbiterWatcher2(ownerId)); + this.addWatcher(new AngelicArbiterWatcher1()); + this.addWatcher(new AngelicArbiterWatcher2()); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AngelicArbiterEffect1())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AngelicArbiterEffect2())); } @@ -80,8 +80,8 @@ public class AngelicArbiter extends CardImpl { class AngelicArbiterWatcher1 extends WatcherImpl { - public AngelicArbiterWatcher1(UUID controllerId) { - super("CastSpell", controllerId); + public AngelicArbiterWatcher1() { + super("CastSpell"); } public AngelicArbiterWatcher1(final AngelicArbiterWatcher1 watcher) { @@ -103,8 +103,8 @@ class AngelicArbiterWatcher1 extends WatcherImpl { class AngelicArbiterWatcher2 extends WatcherImpl { - public AngelicArbiterWatcher2(UUID controllerId) { - super("Attacked", controllerId); + public AngelicArbiterWatcher2() { + super("Attacked"); } public AngelicArbiterWatcher2(final AngelicArbiterWatcher2 watcher) { diff --git a/Mage.Sets/src/mage/sets/magic2011/BloodcrazedGoblin.java b/Mage.Sets/src/mage/sets/magic2011/BloodcrazedGoblin.java index 4cae8fc0b1..5fca1d6777 100644 --- a/Mage.Sets/src/mage/sets/magic2011/BloodcrazedGoblin.java +++ b/Mage.Sets/src/mage/sets/magic2011/BloodcrazedGoblin.java @@ -60,7 +60,7 @@ public class BloodcrazedGoblin extends CardImpl { this.power = new MageInt(2); this.toughness = new MageInt(2); - this.watchers.add(new BloodcrazedGoblinWatcher(ownerId)); + this.addWatcher(new BloodcrazedGoblinWatcher()); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BloodcrazedGoblinEffect())); } @@ -77,8 +77,8 @@ public class BloodcrazedGoblin extends CardImpl { class BloodcrazedGoblinWatcher extends WatcherImpl { - public BloodcrazedGoblinWatcher(UUID controllerId) { - super("OpponentDamaged", controllerId); + public BloodcrazedGoblinWatcher() { + super("OpponentDamaged"); } public BloodcrazedGoblinWatcher(final BloodcrazedGoblinWatcher watcher) { diff --git a/Mage.Sets/src/mage/sets/magic2012/BloodOgre.java b/Mage.Sets/src/mage/sets/magic2012/BloodOgre.java index 58a5eeda54..0bef234f17 100644 --- a/Mage.Sets/src/mage/sets/magic2012/BloodOgre.java +++ b/Mage.Sets/src/mage/sets/magic2012/BloodOgre.java @@ -52,7 +52,7 @@ public class BloodOgre extends CardImpl { this.toughness = new MageInt(2); this.addAbility(new BloodthirstAbility(1)); - this.watchers.add(new BloodthirstWatcher(ownerId)); + this.addWatcher(new BloodthirstWatcher()); this.addAbility(FirstStrikeAbility.getInstance()); } diff --git a/Mage.Sets/src/mage/sets/magic2012/BloodrageVampire.java b/Mage.Sets/src/mage/sets/magic2012/BloodrageVampire.java index 46ce07e52f..9cb357ce47 100644 --- a/Mage.Sets/src/mage/sets/magic2012/BloodrageVampire.java +++ b/Mage.Sets/src/mage/sets/magic2012/BloodrageVampire.java @@ -51,7 +51,7 @@ public class BloodrageVampire extends CardImpl { this.toughness = new MageInt(1); this.addAbility(new BloodthirstAbility(1)); - this.watchers.add(new BloodthirstWatcher(ownerId)); + this.addWatcher(new BloodthirstWatcher()); } public BloodrageVampire(final BloodrageVampire card) { diff --git a/Mage.Sets/src/mage/sets/magic2012/CarnageWurm.java b/Mage.Sets/src/mage/sets/magic2012/CarnageWurm.java index 13998aaf55..80ce0642a0 100644 --- a/Mage.Sets/src/mage/sets/magic2012/CarnageWurm.java +++ b/Mage.Sets/src/mage/sets/magic2012/CarnageWurm.java @@ -52,7 +52,7 @@ public class CarnageWurm extends CardImpl { this.toughness = new MageInt(6); this.addAbility(new BloodthirstAbility(3)); - this.watchers.add(new BloodthirstWatcher(ownerId)); + this.addWatcher(new BloodthirstWatcher()); this.addAbility(TrampleAbility.getInstance()); } diff --git a/Mage.Sets/src/mage/sets/magic2012/DuskhunterBat.java b/Mage.Sets/src/mage/sets/magic2012/DuskhunterBat.java index 21fa86c09a..132434e543 100644 --- a/Mage.Sets/src/mage/sets/magic2012/DuskhunterBat.java +++ b/Mage.Sets/src/mage/sets/magic2012/DuskhunterBat.java @@ -52,7 +52,7 @@ public class DuskhunterBat extends CardImpl { this.toughness = new MageInt(1); this.addAbility(new BloodthirstAbility(1)); - this.watchers.add(new BloodthirstWatcher(ownerId)); + this.addWatcher(new BloodthirstWatcher()); this.addAbility(FlyingAbility.getInstance()); } diff --git a/Mage.Sets/src/mage/sets/magic2012/FurybornHellkite.java b/Mage.Sets/src/mage/sets/magic2012/FurybornHellkite.java index 9ecb68a57e..122078a9af 100644 --- a/Mage.Sets/src/mage/sets/magic2012/FurybornHellkite.java +++ b/Mage.Sets/src/mage/sets/magic2012/FurybornHellkite.java @@ -52,7 +52,7 @@ public class FurybornHellkite extends CardImpl { this.toughness = new MageInt(6); this.addAbility(new BloodthirstAbility(6)); - this.watchers.add(new BloodthirstWatcher(ownerId)); + this.addWatcher(new BloodthirstWatcher()); this.addAbility(FlyingAbility.getInstance()); } diff --git a/Mage.Sets/src/mage/sets/magic2012/GorehornMinotaurs.java b/Mage.Sets/src/mage/sets/magic2012/GorehornMinotaurs.java index 3d1bf87c57..c1b9e2cdd0 100644 --- a/Mage.Sets/src/mage/sets/magic2012/GorehornMinotaurs.java +++ b/Mage.Sets/src/mage/sets/magic2012/GorehornMinotaurs.java @@ -52,7 +52,7 @@ public class GorehornMinotaurs extends CardImpl { this.toughness = new MageInt(3); this.addAbility(new BloodthirstAbility(2)); - this.watchers.add(new BloodthirstWatcher(ownerId)); + this.addWatcher(new BloodthirstWatcher()); } public GorehornMinotaurs(final GorehornMinotaurs card) { diff --git a/Mage.Sets/src/mage/sets/magic2012/LurkingCrocodile.java b/Mage.Sets/src/mage/sets/magic2012/LurkingCrocodile.java index 22902884d6..03f99a72f2 100644 --- a/Mage.Sets/src/mage/sets/magic2012/LurkingCrocodile.java +++ b/Mage.Sets/src/mage/sets/magic2012/LurkingCrocodile.java @@ -52,7 +52,7 @@ public class LurkingCrocodile extends CardImpl { this.toughness = new MageInt(2); this.addAbility(new BloodthirstAbility(1)); - this.watchers.add(new BloodthirstWatcher(ownerId)); + this.addWatcher(new BloodthirstWatcher()); this.addAbility(new IslandwalkAbility()); } diff --git a/Mage.Sets/src/mage/sets/magic2012/VampireOutcasts.java b/Mage.Sets/src/mage/sets/magic2012/VampireOutcasts.java index cde585c2ce..a387e3f666 100644 --- a/Mage.Sets/src/mage/sets/magic2012/VampireOutcasts.java +++ b/Mage.Sets/src/mage/sets/magic2012/VampireOutcasts.java @@ -52,7 +52,7 @@ public class VampireOutcasts extends CardImpl { this.toughness = new MageInt(2); this.addAbility(new BloodthirstAbility(2)); - this.watchers.add(new BloodthirstWatcher(ownerId)); + this.addWatcher(new BloodthirstWatcher()); this.addAbility(LifelinkAbility.getInstance()); } diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/Vengevine.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/Vengevine.java index 9c826a41cd..8e63213aa5 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/Vengevine.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/Vengevine.java @@ -60,7 +60,7 @@ public class Vengevine extends CardImpl { this.addAbility(HasteAbility.getInstance()); this.addAbility(new VengevineAbility()); - this.watchers.add(new VengevineWatcher(ownerId)); + this.addWatcher(new VengevineWatcher()); } public Vengevine(final Vengevine card) { @@ -112,8 +112,8 @@ class VengevineWatcher extends WatcherImpl { int creatureSpellCount = 0; - public VengevineWatcher(UUID controllerId) { - super("CreatureCast", controllerId); + public VengevineWatcher() { + super("CreatureCast"); } public VengevineWatcher(final VengevineWatcher watcher) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/FleshAllergy.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/FleshAllergy.java index 32a786ff90..c252dbcbd1 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/FleshAllergy.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/FleshAllergy.java @@ -65,7 +65,7 @@ public class FleshAllergy extends CardImpl { this.getSpellAbility().addEffect(new DestroyTargetEffect()); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect(new FleshAllergyEffect()); - this.watchers.add(new FleshAllergyWatcher(ownerId)); + this.addWatcher(new FleshAllergyWatcher()); } public FleshAllergy (final FleshAllergy card) { @@ -82,8 +82,8 @@ class FleshAllergyWatcher extends WatcherImpl { public int creaturesDiedThisTurn = 0; - public FleshAllergyWatcher(UUID controllerId) { - super("CreaturesDiedFleshAllergy", controllerId); + public FleshAllergyWatcher() { + super("CreaturesDiedFleshAllergy"); } public FleshAllergyWatcher(final FleshAllergyWatcher watcher) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/MoltenPsyche.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/MoltenPsyche.java index 009dd69680..cfea79050d 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/MoltenPsyche.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/MoltenPsyche.java @@ -53,7 +53,7 @@ public class MoltenPsyche extends CardImpl { this.expansionSetCode = "SOM"; this.color.setRed(true); this.getSpellAbility().addEffect(new MoltenPsycheEffect()); - this.watchers.add(new MoltenPsycheWatcher(ownerId)); + this.addWatcher(new MoltenPsycheWatcher()); } public MoltenPsyche(final MoltenPsyche card) { @@ -110,8 +110,8 @@ class MoltenPsycheWatcher extends WatcherImpl { private Map draws = new HashMap(); - public MoltenPsycheWatcher(UUID controllerId) { - super("CardsDrawnMoltenPsyche", controllerId); + public MoltenPsycheWatcher() { + super("CardsDrawnMoltenPsyche"); } public MoltenPsycheWatcher(final MoltenPsycheWatcher watcher) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/MyrBattlesphere.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/MyrBattlesphere.java index 18c4358eac..cf0c59b5bd 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/MyrBattlesphere.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/MyrBattlesphere.java @@ -143,7 +143,7 @@ class MyrBattlesphereEffect extends OneShotEffect { UUID defenderId = game.getCombat().getDefendingPlayer(source.getSourceId()); Player defender = game.getPlayer(defenderId); if (defender != null) { - defender.damage(source.getCosts().getVariableCosts().get(0).getAmount(), source.getSourceId(), game, false, false); + defender.damage(source.getManaCostsToPay().getVariableCosts().get(0).getAmount(), source.getSourceId(), game, false, false); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/SteelHellkite.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/SteelHellkite.java index 133ea2a5ea..242efd3005 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/SteelHellkite.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/SteelHellkite.java @@ -67,7 +67,7 @@ public class SteelHellkite extends CardImpl { // {X}: Destroy each nonland permanent with converted mana cost X whose controller was dealt combat damage by Steel Hellkite this turn. Activate this ability only once each turn. this.addAbility(new ActivateOncePerTurnActivatedAbility(Constants.Zone.BATTLEFIELD, new SteelHellkiteDestroyEffect(), new ManaCostsImpl("{X}"))); - this.watchers.add(new SteelHellkiteWatcher(ownerId)); + this.addWatcher(new SteelHellkiteWatcher()); } public SteelHellkite(final SteelHellkite card) { @@ -118,8 +118,8 @@ class SteelHellkiteWatcher extends WatcherImpl { public Map> damagedPlayers = new HashMap>(); - public SteelHellkiteWatcher(UUID controllerId) { - super("SteelHellkiteWatcher", controllerId); + public SteelHellkiteWatcher() { + super("SteelHellkiteWatcher"); } public SteelHellkiteWatcher(final SteelHellkiteWatcher watcher) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/TunnelIgnus.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/TunnelIgnus.java index 315a9f1400..91be53fceb 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/TunnelIgnus.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/TunnelIgnus.java @@ -58,7 +58,7 @@ public class TunnelIgnus extends CardImpl { this.color.setRed(true); this.power = new MageInt(2); this.toughness = new MageInt(1); - this.watchers.add(new TunnelIgnusWatcher(ownerId)); + this.addWatcher(new TunnelIgnusWatcher()); this.addAbility(new TunnelIgnusTriggeredAbility()); } @@ -76,8 +76,8 @@ public class TunnelIgnus extends CardImpl { class TunnelIgnusWatcher extends WatcherImpl { int count = 0; - public TunnelIgnusWatcher(UUID controllerId) { - super("LandPlayedCount", controllerId); + public TunnelIgnusWatcher() { + super("LandPlayedCount"); } public TunnelIgnusWatcher(final TunnelIgnusWatcher watcher) { diff --git a/Mage.Sets/src/mage/sets/worldwake/Groundswell.java b/Mage.Sets/src/mage/sets/worldwake/Groundswell.java index b88a17e512..6bbf9d9a2a 100644 --- a/Mage.Sets/src/mage/sets/worldwake/Groundswell.java +++ b/Mage.Sets/src/mage/sets/worldwake/Groundswell.java @@ -63,7 +63,7 @@ public class Groundswell extends CardImpl { this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect(new GroundswellEffect(Duration.EndOfTurn)); - this.watchers.add(new GroundswellWatcher(ownerId)); + this.addWatcher(new GroundswellWatcher()); } public Groundswell(final Groundswell card) { @@ -78,8 +78,8 @@ public class Groundswell extends CardImpl { class GroundswellWatcher extends WatcherImpl { - public GroundswellWatcher(UUID controllerId) { - super("LandPlayed", controllerId); + public GroundswellWatcher() { + super("LandPlayed"); } public GroundswellWatcher(final GroundswellWatcher watcher) { diff --git a/Mage.Sets/src/mage/sets/worldwake/SearingBlaze.java b/Mage.Sets/src/mage/sets/worldwake/SearingBlaze.java index c76fca1258..aeaf44e15b 100644 --- a/Mage.Sets/src/mage/sets/worldwake/SearingBlaze.java +++ b/Mage.Sets/src/mage/sets/worldwake/SearingBlaze.java @@ -61,7 +61,7 @@ public class SearingBlaze extends CardImpl { //TODO: change this to only allow creatures controlled by first target this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect(new SearingBlazeEffect()); - this.watchers.add(new SearingBlazeWatcher(ownerId)); + this.addWatcher(new SearingBlazeWatcher()); } public SearingBlaze(final SearingBlaze card) { @@ -77,8 +77,8 @@ public class SearingBlaze extends CardImpl { class SearingBlazeWatcher extends WatcherImpl { - public SearingBlazeWatcher(UUID controllerId) { - super("LandPlayed", controllerId); + public SearingBlazeWatcher() { + super("LandPlayed"); } public SearingBlazeWatcher(final SearingBlazeWatcher watcher) { diff --git a/Mage.Sets/src/mage/sets/zendikar/ArchiveTrap.java b/Mage.Sets/src/mage/sets/zendikar/ArchiveTrap.java index 2acb8597fe..745ec13281 100644 --- a/Mage.Sets/src/mage/sets/zendikar/ArchiveTrap.java +++ b/Mage.Sets/src/mage/sets/zendikar/ArchiveTrap.java @@ -56,7 +56,7 @@ public class ArchiveTrap extends CardImpl { this.getSpellAbility().addTarget(new TargetOpponent()); this.getSpellAbility().addEffect(new PutLibraryIntoGraveTargetEffect(13)); this.getSpellAbility().addAlternativeCost(new ArchiveTrapAlternativeCost()); - this.watchers.add(new ArchiveTrapWatcher(ownerId)); + this.addWatcher(new ArchiveTrapWatcher()); } public ArchiveTrap(final ArchiveTrap card) { @@ -72,8 +72,8 @@ public class ArchiveTrap extends CardImpl { class ArchiveTrapWatcher extends WatcherImpl { - public ArchiveTrapWatcher(UUID controllerId) { - super("LibrarySearched", controllerId); + public ArchiveTrapWatcher() { + super("LibrarySearched"); } public ArchiveTrapWatcher(final ArchiveTrapWatcher watcher) { diff --git a/Mage/src/mage/cards/Card.java b/Mage/src/mage/cards/Card.java index 45bc21a2ee..c32f54bc15 100644 --- a/Mage/src/mage/cards/Card.java +++ b/Mage/src/mage/cards/Card.java @@ -38,6 +38,7 @@ import mage.abilities.Ability; import mage.abilities.SpellAbility; import mage.game.Game; import mage.game.events.GameEvent; +import mage.watchers.Watcher; import mage.watchers.Watchers; public interface Card extends MageObject { @@ -50,6 +51,7 @@ public interface Card extends MageObject { public void setControllerId(UUID controllerId); public void setOwnerId(UUID ownerId); public void addAbility(Ability ability); + public void addWatcher(Watcher watcher); public SpellAbility getSpellAbility(); public List getRules(); public Watchers getWatchers(); diff --git a/Mage/src/mage/cards/CardImpl.java b/Mage/src/mage/cards/CardImpl.java index ddb9564626..4ff64b602d 100644 --- a/Mage/src/mage/cards/CardImpl.java +++ b/Mage/src/mage/cards/CardImpl.java @@ -48,6 +48,7 @@ import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.PermanentCard; import mage.game.stack.Spell; +import mage.watchers.Watcher; import mage.watchers.Watchers; import org.apache.log4j.Logger; @@ -101,6 +102,7 @@ public abstract class CardImpl> extends MageObjectImpl this.objectId = UUID.randomUUID(); this.abilities.newId(); this.abilities.setSourceId(objectId); + this.watchers.setSourceId(objectId); } public static Card createCard(String name) { @@ -151,6 +153,13 @@ public abstract class CardImpl> extends MageObjectImpl abilities.add(ability); } + @Override + public void addWatcher(Watcher watcher) { + watcher.setSourceId(this.getId()); + watcher.setControllerId(this.ownerId); + watchers.add(watcher); + } + @Override public SpellAbility getSpellAbility() { for (Ability ability: abilities.getActivatedAbilities(Zone.HAND)) { diff --git a/Mage/src/mage/game/stack/Spell.java b/Mage/src/mage/game/stack/Spell.java index 1f98eff4b0..d75942211a 100644 --- a/Mage/src/mage/game/stack/Spell.java +++ b/Mage/src/mage/game/stack/Spell.java @@ -52,6 +52,7 @@ import mage.watchers.Watchers; import java.util.List; import java.util.UUID; +import mage.watchers.Watcher; /** * @@ -249,6 +250,9 @@ public class Spell> implements StackObject, Card { public void addAbility(Ability ability) {} @Override + public void addWatcher(Watcher watcher) {} + + @Override public SpellAbility getSpellAbility() { return ability; } diff --git a/Mage/src/mage/watchers/Watcher.java b/Mage/src/mage/watchers/Watcher.java index 4f04b60ac8..2a9afb6bf4 100644 --- a/Mage/src/mage/watchers/Watcher.java +++ b/Mage/src/mage/watchers/Watcher.java @@ -41,6 +41,8 @@ public interface Watcher> extends Serializable { public UUID getControllerId(); public void setControllerId(UUID controllerId); + public UUID getSourceId(); + public void setSourceId(UUID sourceId); public String getKey(); public void watch(GameEvent event, Game game); public boolean conditionMet(); diff --git a/Mage/src/mage/watchers/WatcherImpl.java b/Mage/src/mage/watchers/WatcherImpl.java index ebb7ee8d5c..91588736d3 100644 --- a/Mage/src/mage/watchers/WatcherImpl.java +++ b/Mage/src/mage/watchers/WatcherImpl.java @@ -39,18 +39,19 @@ import java.util.UUID; public abstract class WatcherImpl> implements Watcher { protected UUID controllerId; + protected UUID sourceId; protected String key; protected boolean condition; - public WatcherImpl(String key, UUID controllerId) { + public WatcherImpl(String key) { this.key = key; - this.controllerId = controllerId; } public WatcherImpl(final WatcherImpl watcher) { this.condition = watcher.condition; this.key = watcher.key; this.controllerId = watcher.controllerId; + this.sourceId = watcher.sourceId; } @Override @@ -63,6 +64,16 @@ public abstract class WatcherImpl> implements Watcher { } } + public void setSourceId(UUID sourceId) { + for (Watcher watcher: this) { + watcher.setSourceId(sourceId); + } + } + + public void setControllerId(UUID controllerId) { + for (Watcher watcher: this) { + watcher.setControllerId(controllerId); + } + } + public Watcher get(UUID controllerId, String key) { for (Watcher watcher: this) { if (watcher.getControllerId().equals(controllerId) && watcher.getKey().equals(key)) diff --git a/Mage/src/mage/watchers/common/BloodthirstWatcher.java b/Mage/src/mage/watchers/common/BloodthirstWatcher.java index 66a6136e32..a666da6912 100644 --- a/Mage/src/mage/watchers/common/BloodthirstWatcher.java +++ b/Mage/src/mage/watchers/common/BloodthirstWatcher.java @@ -5,15 +5,13 @@ import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; import mage.watchers.WatcherImpl; -import java.util.UUID; - /** * Must be installed to card for proper Bloodthirst work * @author Loki */ public class BloodthirstWatcher extends WatcherImpl { - public BloodthirstWatcher(UUID controllerId) { - super("DamagedOpponents", controllerId); + public BloodthirstWatcher() { + super("DamagedOpponents"); } public BloodthirstWatcher(final BloodthirstWatcher watcher) {