From efae1251f95faba97bb4b5dd8bf2170852ebf937 Mon Sep 17 00:00:00 2001 From: igoudt Date: Sat, 29 Apr 2017 08:33:10 +0200 Subject: [PATCH] first batch of watcher naming --- .../mage/cards/a/ApproachOfTheSecondSun.java | 2 +- .../src/mage/cards/a/ArchmageAscension.java | 2 +- .../src/mage/cards/a/AsmiraHolyAvenger.java | 4 +-- Mage.Sets/src/mage/cards/a/AvengingArrow.java | 2 +- .../src/mage/cards/b/BloodcrazedGoblin.java | 2 +- .../src/mage/cards/b/BontuTheGlorified.java | 2 +- .../mage/cards/b/BoseijuWhoSheltersAll.java | 2 +- .../src/mage/cards/b/BrimstoneVolley.java | 3 ++- .../src/mage/cards/c/CathedralMembrane.java | 19 +++++--------- Mage.Sets/src/mage/cards/c/CavernOfSouls.java | 4 +-- .../mage/cards/c/ChainsOfMephistopheles.java | 2 +- .../src/mage/cards/c/ChildrenOfKorlis.java | 2 +- .../src/mage/cards/c/CivilizedScholar.java | 2 +- Mage.Sets/src/mage/cards/c/ConduitOfRuin.java | 4 +-- .../src/mage/cards/c/CurseOfExhaustion.java | 2 +- Mage.Sets/src/mage/cards/d/DraconicRoar.java | 2 +- .../src/mage/cards/d/DuelingGrounds.java | 2 +- Mage.Sets/src/mage/cards/f/FaithsReward.java | 4 +-- .../src/mage/cards/f/FeastOnTheFallen.java | 2 +- Mage.Sets/src/mage/cards/f/FirstResponse.java | 2 +- Mage.Sets/src/mage/cards/f/Flamebreak.java | 2 +- .../mage/cards/f/FoulTongueInvocation.java | 2 +- Mage.Sets/src/mage/cards/f/FreshMeat.java | 2 +- .../src/mage/cards/g/GiltspireAvenger.java | 23 ++++++++-------- Mage.Sets/src/mage/cards/g/Gomazoa.java | 4 +-- .../src/mage/cards/h/HallowedMoonlight.java | 2 +- .../src/mage/cards/h/HomicidalBrute.java | 3 ++- Mage.Sets/src/mage/cards/i/Insist.java | 26 +++++++++---------- .../src/mage/cards/k/KeranosGodOfStorms.java | 2 +- .../src/mage/cards/k/KnollspineDragon.java | 2 +- .../src/mage/cards/k/KumanosBlessing.java | 4 +-- .../src/mage/cards/k/KuonOgreAscendant.java | 2 +- .../src/mage/cards/k/KytheonHeroOfAkros.java | 2 +- .../mage/cards/l/LeovoldEmissaryOfTrest.java | 2 +- .../src/mage/cards/l/LuminarchAscension.java | 2 +- .../src/mage/cards/m/MoggConscripts.java | 2 +- Mage.Sets/src/mage/cards/m/MoltenPsyche.java | 6 ++--- Mage.Sets/src/mage/cards/o/OathOfChandra.java | 4 +-- Mage.Sets/src/mage/cards/o/OpalPalace.java | 4 +-- .../src/mage/cards/o/OratorOfOjutai.java | 4 +-- Mage.Sets/src/mage/cards/o/Overmaster.java | 4 +-- .../src/mage/cards/r/ReaperFromTheAbyss.java | 3 ++- Mage.Sets/src/mage/cards/r/Reciprocate.java | 6 ++--- .../src/mage/cards/r/RixMaadiGuildmage.java | 2 +- Mage.Sets/src/mage/cards/r/RuneflareTrap.java | 2 +- .../src/mage/cards/s/SavageSummoning.java | 8 +++--- .../src/mage/cards/s/ScaleguardSentinels.java | 2 +- Mage.Sets/src/mage/cards/s/ScoutsWarning.java | 4 +-- Mage.Sets/src/mage/cards/s/SearingBlaze.java | 2 +- Mage.Sets/src/mage/cards/s/SecondGuess.java | 2 +- Mage.Sets/src/mage/cards/s/SecondSunrise.java | 4 +-- .../src/mage/cards/s/ShadowOfTheGrave.java | 3 +-- .../src/mage/cards/s/SilentChantZubera.java | 2 +- .../src/mage/cards/s/SilumgarsScorn.java | 2 +- .../src/mage/cards/s/SkarrganFirebird.java | 2 +- Mage.Sets/src/mage/cards/s/Skeletonize.java | 2 +- Mage.Sets/src/mage/cards/s/SoulReap.java | 4 +-- .../mage/cards/s/SpiritOfTheLabyrinth.java | 4 +-- Mage.Sets/src/mage/cards/s/SteelHellkite.java | 7 ++--- Mage.Sets/src/mage/cards/s/SummoningTrap.java | 4 +-- Mage.Sets/src/mage/cards/t/TaintedSigil.java | 2 +- .../src/mage/cards/t/TapestryOfTheAges.java | 4 +-- Mage.Sets/src/mage/cards/t/TimeToReflect.java | 4 +-- Mage.Sets/src/mage/cards/u/UrzasMiter.java | 4 +-- Mage.Sets/src/mage/cards/v/Vengevine.java | 4 +-- Mage.Sets/src/mage/cards/v/VileRedeemer.java | 6 ++--- .../src/mage/cards/w/WindbriskHeights.java | 2 +- .../condition/common/MorbidCondition.java | 3 ++- .../NoSpellsWereCastLastTurnCondition.java | 2 +- ...OrMoreSpellsWereCastLastTurnCondition.java | 2 +- .../mage/abilities/keyword/StormAbility.java | 2 +- ...fDamageAPlayerReceivedThisTurnWatcher.java | 2 +- .../AttackedOrBlockedThisCombatWatcher.java | 2 +- .../common/AttackedThisTurnWatcher.java | 2 +- .../common/BlockedAttackerWatcher.java | 2 +- .../common/BlockedThisTurnWatcher.java | 2 +- .../watchers/common/BloodthirstWatcher.java | 5 ++-- .../CardsAmountDrawnThisTurnWatcher.java | 3 +-- ...CardsCycledOrDiscardedThisTurnWatcher.java | 2 +- .../CardsDrawnDuringDrawStepWatcher.java | 2 +- .../common/CardsPutIntoGraveyardWatcher.java | 2 +- .../common/CastFromGraveyardWatcher.java | 2 +- .../watchers/common/CastFromHandWatcher.java | 2 +- .../common/CastSpellLastTurnWatcher.java | 2 +- .../watchers/common/CommanderInfoWatcher.java | 2 +- .../common/CreatureWasCastWatcher.java | 2 +- .../watchers/common/CreaturesDiedWatcher.java | 2 +- .../watchers/common/DamageDoneWatcher.java | 2 +- .../watchers/common/DamagedByWatcher.java | 2 +- ...heBattlefieldWhileSpellWasCastWatcher.java | 2 +- .../common/FirstSpellCastThisTurnWatcher.java | 2 +- .../watchers/common/FirstTimeStepWatcher.java | 2 +- .../watchers/common/GravestormWatcher.java | 2 +- .../mage/watchers/common/LandfallWatcher.java | 2 +- .../LifeLossOtherFromCombatWatcher.java | 4 +-- .../common/ManaSpentToCastWatcher.java | 2 +- .../mage/watchers/common/MiracleWatcher.java | 2 +- .../mage/watchers/common/MorbidWatcher.java | 2 +- ...rOfTimesPermanentTargetedATurnWatcher.java | 2 +- .../PermanentsEnteredBattlefieldWatcher.java | 2 +- .../common/PermanentsSacrificedWatcher.java | 2 +- .../common/PlayerAttackedWatcher.java | 2 +- .../common/PlayerCastCreatureWatcher.java | 2 +- .../common/PlayerDamagedBySourceWatcher.java | 2 +- .../common/PlayerGainedLifeWatcher.java | 2 +- .../common/PlayerLostLifeWatcher.java | 2 +- .../mage/watchers/common/ProwlWatcher.java | 2 +- .../mage/watchers/common/RevoltWatcher.java | 2 +- .../common/SourceDidDamageWatcher.java | 2 +- .../watchers/common/SpellsCastWatcher.java | 2 +- .../watchers/common/ZuberasDiedWatcher.java | 2 +- 111 files changed, 177 insertions(+), 179 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/ApproachOfTheSecondSun.java b/Mage.Sets/src/mage/cards/a/ApproachOfTheSecondSun.java index fe964aabca..e829994ad8 100644 --- a/Mage.Sets/src/mage/cards/a/ApproachOfTheSecondSun.java +++ b/Mage.Sets/src/mage/cards/a/ApproachOfTheSecondSun.java @@ -109,7 +109,7 @@ class ApproachOfTheSecondSunWatcher extends Watcher { private Map approachesCast = new HashMap<>(); public ApproachOfTheSecondSunWatcher() { - super(ApproachOfTheSecondSunWatcher.class.getName(), WatcherScope.GAME); + super(ApproachOfTheSecondSunWatcher.class.getSimpleName(), WatcherScope.GAME); } public ApproachOfTheSecondSunWatcher(final ApproachOfTheSecondSunWatcher watcher) { diff --git a/Mage.Sets/src/mage/cards/a/ArchmageAscension.java b/Mage.Sets/src/mage/cards/a/ArchmageAscension.java index aa0a0c2beb..031ab9fc70 100644 --- a/Mage.Sets/src/mage/cards/a/ArchmageAscension.java +++ b/Mage.Sets/src/mage/cards/a/ArchmageAscension.java @@ -102,7 +102,7 @@ class ArchmageAscensionTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { Permanent archmage = game.getPermanent(super.getSourceId()); CardsAmountDrawnThisTurnWatcher watcher = - (CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.BASIC_KEY); + (CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName()); return archmage != null && watcher != null && watcher.getAmountCardsDrawn(this.getControllerId()) >= 2; } diff --git a/Mage.Sets/src/mage/cards/a/AsmiraHolyAvenger.java b/Mage.Sets/src/mage/cards/a/AsmiraHolyAvenger.java index e568a74a9a..c1a1af8b3a 100644 --- a/Mage.Sets/src/mage/cards/a/AsmiraHolyAvenger.java +++ b/Mage.Sets/src/mage/cards/a/AsmiraHolyAvenger.java @@ -83,7 +83,7 @@ class AsmiraHolyAvengerWatcher extends Watcher { private int creaturesCount = 0; public AsmiraHolyAvengerWatcher() { - super("YourCreaturesDied", WatcherScope.PLAYER); + super(AsmiraHolyAvengerWatcher.class.getSimpleName(), WatcherScope.PLAYER); condition = true; } @@ -122,7 +122,7 @@ class AsmiraHolyAvengerDynamicValue implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - AsmiraHolyAvengerWatcher watcher = (AsmiraHolyAvengerWatcher) game.getState().getWatchers().get("YourCreaturesDied", sourceAbility.getControllerId()); + AsmiraHolyAvengerWatcher watcher = (AsmiraHolyAvengerWatcher) game.getState().getWatchers().get(AsmiraHolyAvengerWatcher.class.getSimpleName(), sourceAbility.getControllerId()); if (watcher != null) { return watcher.getCreaturesCount(); } diff --git a/Mage.Sets/src/mage/cards/a/AvengingArrow.java b/Mage.Sets/src/mage/cards/a/AvengingArrow.java index c02c3f3211..797581a39c 100644 --- a/Mage.Sets/src/mage/cards/a/AvengingArrow.java +++ b/Mage.Sets/src/mage/cards/a/AvengingArrow.java @@ -94,7 +94,7 @@ class AvengingArrowTarget extends TargetPermanent { public Set possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) { Set availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game); Set possibleTargets = new HashSet<>(); - SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get("SourceDidDamageWatcher"); + SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get(SourceDidDamageWatcher.class.getSimpleName()); if (watcher != null) { for (UUID targetId : availablePossibleTargets) { Permanent permanent = game.getPermanent(targetId); diff --git a/Mage.Sets/src/mage/cards/b/BloodcrazedGoblin.java b/Mage.Sets/src/mage/cards/b/BloodcrazedGoblin.java index c3afe95167..2fb3e97381 100644 --- a/Mage.Sets/src/mage/cards/b/BloodcrazedGoblin.java +++ b/Mage.Sets/src/mage/cards/b/BloodcrazedGoblin.java @@ -96,7 +96,7 @@ class BloodcrazedGoblinEffect extends RestrictionEffect { @Override public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent.getId().equals(source.getSourceId())) { - BloodthirstWatcher watcher = (BloodthirstWatcher) game.getState().getWatchers().get("DamagedOpponents", source.getControllerId()); // BloodthirstWatcher + BloodthirstWatcher watcher = (BloodthirstWatcher) game.getState().getWatchers().get(BloodthirstWatcher.class.getSimpleName(), source.getControllerId()); // BloodthirstWatcher return !watcher.conditionMet(); } return false; diff --git a/Mage.Sets/src/mage/cards/b/BontuTheGlorified.java b/Mage.Sets/src/mage/cards/b/BontuTheGlorified.java index 6736154c0e..574cc827bc 100644 --- a/Mage.Sets/src/mage/cards/b/BontuTheGlorified.java +++ b/Mage.Sets/src/mage/cards/b/BontuTheGlorified.java @@ -134,7 +134,7 @@ class BontuTheGlorifiedRestrictionEffect extends RestrictionEffect { public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent.getId().equals(source.getSourceId())) { Player controller = game.getPlayer(source.getControllerId()); - CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get("CreaturesDiedWatcher"); + CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get(CreaturesDiedWatcher.class.getSimpleName()); if (controller != null && watcher != null) { return (watcher.getAmountOfCreaturesDiesThisTurn(controller.getId()) == 0); diff --git a/Mage.Sets/src/mage/cards/b/BoseijuWhoSheltersAll.java b/Mage.Sets/src/mage/cards/b/BoseijuWhoSheltersAll.java index 4c7f7aad76..279d4ec5d7 100644 --- a/Mage.Sets/src/mage/cards/b/BoseijuWhoSheltersAll.java +++ b/Mage.Sets/src/mage/cards/b/BoseijuWhoSheltersAll.java @@ -158,7 +158,7 @@ class BoseijuWhoSheltersAllCantCounterEffect extends ContinuousRuleModifyingEffe @Override public boolean applies(GameEvent event, Ability source, Game game) { - BoseijuWhoSheltersAllWatcher watcher = (BoseijuWhoSheltersAllWatcher) game.getState().getWatchers().get("ManaPaidFromBoseijuWhoSheltersAllWatcher"); + BoseijuWhoSheltersAllWatcher watcher = (BoseijuWhoSheltersAllWatcher) game.getState().getWatchers().get(BoseijuWhoSheltersAllWatcher.class.getSimpleName()); Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && watcher.spells.contains(spell.getId())) { if (filter.match(spell.getCard(), game)) { diff --git a/Mage.Sets/src/mage/cards/b/BrimstoneVolley.java b/Mage.Sets/src/mage/cards/b/BrimstoneVolley.java index f825212a34..94e8b4a2c7 100644 --- a/Mage.Sets/src/mage/cards/b/BrimstoneVolley.java +++ b/Mage.Sets/src/mage/cards/b/BrimstoneVolley.java @@ -38,6 +38,7 @@ import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCreatureOrPlayer; import mage.watchers.Watcher; +import mage.watchers.common.MorbidWatcher; import java.util.UUID; @@ -80,7 +81,7 @@ class BrimstoneVolleyEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { int damage = 3; - Watcher watcher = game.getState().getWatchers().get("Morbid"); + Watcher watcher = game.getState().getWatchers().get(MorbidWatcher.class.getSimpleName()); if (watcher.conditionMet()) { damage = 5; } diff --git a/Mage.Sets/src/mage/cards/c/CathedralMembrane.java b/Mage.Sets/src/mage/cards/c/CathedralMembrane.java index 544b9137aa..f5db2ac016 100644 --- a/Mage.Sets/src/mage/cards/c/CathedralMembrane.java +++ b/Mage.Sets/src/mage/cards/c/CathedralMembrane.java @@ -40,18 +40,15 @@ import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.watchers.Watcher; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; +import java.util.*; /** - * * @author BetaSteward */ public class CathedralMembrane extends CardImpl { public CathedralMembrane(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{1}{W/P}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{1}{W/P}"); this.subtype.add("Wall"); this.power = new MageInt(0); @@ -94,7 +91,7 @@ class CathedralMembraneAbility extends ZoneChangeTriggeredAbility { public boolean checkTrigger(GameEvent event, Game game) { if (super.checkTrigger(event, game)) { if (game.getPhase().getType() == TurnPhase.COMBAT) { - return true; + return true; } } return false; @@ -120,7 +117,7 @@ class CathedralMembraneEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - CathedralMembraneWatcher watcher = (CathedralMembraneWatcher) game.getState().getWatchers().get("CathedralMembraneWatcher", source.getSourceId()); + CathedralMembraneWatcher watcher = (CathedralMembraneWatcher) game.getState().getWatchers().get(CathedralMembraneWatcher.class.getSimpleName(), source.getSourceId()); if (watcher != null) { for (UUID uuid : watcher.blockedCreatures) { Permanent permanent = game.getPermanent(uuid); @@ -135,10 +132,10 @@ class CathedralMembraneEffect extends OneShotEffect { class CathedralMembraneWatcher extends Watcher { - public List blockedCreatures = new ArrayList<>(); + public Set blockedCreatures = new HashSet<>(); public CathedralMembraneWatcher() { - super("CathedralMembraneWatcher", WatcherScope.CARD); + super(CathedralMembraneWatcher.class.getSimpleName(), WatcherScope.CARD); } public CathedralMembraneWatcher(final CathedralMembraneWatcher watcher) { @@ -154,9 +151,7 @@ class CathedralMembraneWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED && event.getSourceId().equals(sourceId)) { - if (!blockedCreatures.contains(event.getTargetId())) { - blockedCreatures.add(event.getTargetId()); - } + blockedCreatures.add(event.getTargetId()); } } diff --git a/Mage.Sets/src/mage/cards/c/CavernOfSouls.java b/Mage.Sets/src/mage/cards/c/CavernOfSouls.java index 9e4487669d..8fcc5ae9d0 100644 --- a/Mage.Sets/src/mage/cards/c/CavernOfSouls.java +++ b/Mage.Sets/src/mage/cards/c/CavernOfSouls.java @@ -152,7 +152,7 @@ class CavernOfSoulsWatcher extends Watcher { private final String originalId; public CavernOfSoulsWatcher(UUID originalId) { - super("ManaPaidFromCavernOfSoulsWatcher", WatcherScope.CARD); + super(CavernOfSoulsWatcher.class.getSimpleName(), WatcherScope.CARD); this.originalId = originalId.toString(); } @@ -224,7 +224,7 @@ class CavernOfSoulsCantCounterEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - CavernOfSoulsWatcher watcher = (CavernOfSoulsWatcher) game.getState().getWatchers().get("ManaPaidFromCavernOfSoulsWatcher", source.getSourceId()); + CavernOfSoulsWatcher watcher = (CavernOfSoulsWatcher) game.getState().getWatchers().get(CavernOfSoulsWatcher.class.getSimpleName(), source.getSourceId()); Spell spell = game.getStack().getSpell(event.getTargetId()); return spell != null && watcher != null && watcher.spellCantBeCountered(spell.getId()); } diff --git a/Mage.Sets/src/mage/cards/c/ChainsOfMephistopheles.java b/Mage.Sets/src/mage/cards/c/ChainsOfMephistopheles.java index 6e0088dd3e..5eb0071f49 100644 --- a/Mage.Sets/src/mage/cards/c/ChainsOfMephistopheles.java +++ b/Mage.Sets/src/mage/cards/c/ChainsOfMephistopheles.java @@ -113,7 +113,7 @@ class ChainsOfMephistophelesReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getPhase().getStep().getType() == PhaseStep.DRAW) { - CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get("CardsDrawnDuringDrawStep"); + CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get(CardsDrawnDuringDrawStepWatcher.class.getSimpleName()); if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) { return true; } diff --git a/Mage.Sets/src/mage/cards/c/ChildrenOfKorlis.java b/Mage.Sets/src/mage/cards/c/ChildrenOfKorlis.java index f0d308f8b0..dbacc7be8f 100644 --- a/Mage.Sets/src/mage/cards/c/ChildrenOfKorlis.java +++ b/Mage.Sets/src/mage/cards/c/ChildrenOfKorlis.java @@ -78,7 +78,7 @@ class SourceControllerLostLifeCount implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher"); + PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName()); if (watcher != null) { return watcher.getLiveLost(sourceAbility.getControllerId()); } diff --git a/Mage.Sets/src/mage/cards/c/CivilizedScholar.java b/Mage.Sets/src/mage/cards/c/CivilizedScholar.java index b18b64fae2..6e34eb7867 100644 --- a/Mage.Sets/src/mage/cards/c/CivilizedScholar.java +++ b/Mage.Sets/src/mage/cards/c/CivilizedScholar.java @@ -83,7 +83,7 @@ public class CivilizedScholar extends CardImpl { class HomicidalBruteWatcher extends Watcher { public HomicidalBruteWatcher() { - super("HomicidalBruteAttacked", WatcherScope.CARD); + super(HomicidalBruteWatcher.class.getSimpleName(), WatcherScope.CARD); } public HomicidalBruteWatcher(final HomicidalBruteWatcher watcher) { diff --git a/Mage.Sets/src/mage/cards/c/ConduitOfRuin.java b/Mage.Sets/src/mage/cards/c/ConduitOfRuin.java index 9d44e437c2..62d6813a55 100644 --- a/Mage.Sets/src/mage/cards/c/ConduitOfRuin.java +++ b/Mage.Sets/src/mage/cards/c/ConduitOfRuin.java @@ -101,7 +101,7 @@ class ConduitOfRuinWatcher extends Watcher { int spellCount = 0; public ConduitOfRuinWatcher() { - super("FirstCreatureSpellCastThisTurn", WatcherScope.GAME); + super(ConduitOfRuinWatcher.class.getSimpleName(), WatcherScope.GAME); playerCreatureSpells = new HashMap<>(); } @@ -143,7 +143,7 @@ class FirstCastCreatureSpellPredicate implements ObjectPlayerPredicate input, Game game) { if (input.getObject() instanceof Spell && ((Spell) input.getObject()).isCreature()) { - ConduitOfRuinWatcher watcher = (ConduitOfRuinWatcher) game.getState().getWatchers().get("FirstCreatureSpellCastThisTurn"); + ConduitOfRuinWatcher watcher = (ConduitOfRuinWatcher) game.getState().getWatchers().get(ConduitOfRuinWatcher.class.getSimpleName()); return watcher != null && watcher.creatureSpellsCastThisTurn(input.getPlayerId()) == 0; } return false; diff --git a/Mage.Sets/src/mage/cards/c/CurseOfExhaustion.java b/Mage.Sets/src/mage/cards/c/CurseOfExhaustion.java index 0556bce5c1..c8602f0080 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfExhaustion.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfExhaustion.java @@ -107,7 +107,7 @@ class CurseOfExhaustionEffect extends ContinuousRuleModifyingEffectImpl { if (enchantment != null && enchantment.getAttachedTo() != null) { Player player = game.getPlayer(enchantment.getAttachedTo()); if (player != null && event.getPlayerId().equals(player.getId())) { - CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName()); + CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName()); if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) > 0) { return true; } diff --git a/Mage.Sets/src/mage/cards/d/DraconicRoar.java b/Mage.Sets/src/mage/cards/d/DraconicRoar.java index 57135017bb..ee8fb30c20 100644 --- a/Mage.Sets/src/mage/cards/d/DraconicRoar.java +++ b/Mage.Sets/src/mage/cards/d/DraconicRoar.java @@ -116,7 +116,7 @@ class DraconicRoarEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher"); + DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName()); if (watcher != null && watcher.castWithConditionTrue(source.getId())) { Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); if (permanent != null) { diff --git a/Mage.Sets/src/mage/cards/d/DuelingGrounds.java b/Mage.Sets/src/mage/cards/d/DuelingGrounds.java index 4ad7859c70..13f4de1d5d 100644 --- a/Mage.Sets/src/mage/cards/d/DuelingGrounds.java +++ b/Mage.Sets/src/mage/cards/d/DuelingGrounds.java @@ -134,7 +134,7 @@ class NoMoreThanOneCreatureCanBlockEachTurnEffect extends RestrictionEffect { if (!game.getCombat().getBlockers().isEmpty()) { return false; } - BlockedThisTurnWatcher watcher = (BlockedThisTurnWatcher) game.getState().getWatchers().get("BlockedThisTurn"); + BlockedThisTurnWatcher watcher = (BlockedThisTurnWatcher) game.getState().getWatchers().get(BlockedThisTurnWatcher.class.getSimpleName()); Set blockedThisTurnCreatures = watcher.getBlockedThisTurnCreatures(); MageObjectReference blockerReference = new MageObjectReference(blocker.getId(), blocker.getZoneChangeCounter(game), game); return blockedThisTurnCreatures.isEmpty() diff --git a/Mage.Sets/src/mage/cards/f/FaithsReward.java b/Mage.Sets/src/mage/cards/f/FaithsReward.java index 0ea52836eb..c560afe275 100644 --- a/Mage.Sets/src/mage/cards/f/FaithsReward.java +++ b/Mage.Sets/src/mage/cards/f/FaithsReward.java @@ -82,7 +82,7 @@ class FaithsRewardEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - FaithsRewardWatcher watcher = (FaithsRewardWatcher) game.getState().getWatchers().get("FaithsRewardWatcher"); + FaithsRewardWatcher watcher = (FaithsRewardWatcher) game.getState().getWatchers().get(FaithsRewardWatcher.class.getSimpleName()); if (watcher != null) { for (UUID id : watcher.cards) { Card c = game.getCard(id); @@ -105,7 +105,7 @@ class FaithsRewardWatcher extends Watcher { ArrayList cards = new ArrayList<>(); public FaithsRewardWatcher() { - super("FaithsRewardWatcher", WatcherScope.GAME); + super(FaithsRewardWatcher.class.getSimpleName(), WatcherScope.GAME); } public FaithsRewardWatcher(final FaithsRewardWatcher watcher) { diff --git a/Mage.Sets/src/mage/cards/f/FeastOnTheFallen.java b/Mage.Sets/src/mage/cards/f/FeastOnTheFallen.java index 27c424cfed..6e08312975 100644 --- a/Mage.Sets/src/mage/cards/f/FeastOnTheFallen.java +++ b/Mage.Sets/src/mage/cards/f/FeastOnTheFallen.java @@ -81,7 +81,7 @@ enum FeastOnTheFallenCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher"); + PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName()); if (watcher != null) { for (UUID opponentId : game.getOpponents(source.getControllerId())) { if (watcher.getLiveLostLastTurn(opponentId) > 0) { diff --git a/Mage.Sets/src/mage/cards/f/FirstResponse.java b/Mage.Sets/src/mage/cards/f/FirstResponse.java index 41210761f6..a1a30a4a7a 100644 --- a/Mage.Sets/src/mage/cards/f/FirstResponse.java +++ b/Mage.Sets/src/mage/cards/f/FirstResponse.java @@ -84,7 +84,7 @@ class FirstResponseEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher"); + PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName()); if (watcher != null) { if (watcher.getLiveLostLastTurn(source.getControllerId()) > 0) { return new CreateTokenEffect(new SoldierToken()).apply(game, source); diff --git a/Mage.Sets/src/mage/cards/f/Flamebreak.java b/Mage.Sets/src/mage/cards/f/Flamebreak.java index f702ee66cf..98a6822f8f 100644 --- a/Mage.Sets/src/mage/cards/f/Flamebreak.java +++ b/Mage.Sets/src/mage/cards/f/Flamebreak.java @@ -103,7 +103,7 @@ class FlamebreakCantRegenerateEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getType() == EventType.REGENERATE) { - DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId()); + DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get(DamagedByWatcher.class.getSimpleName(), source.getSourceId()); if (watcher != null) { return watcher.wasDamaged(event.getTargetId(), game); } diff --git a/Mage.Sets/src/mage/cards/f/FoulTongueInvocation.java b/Mage.Sets/src/mage/cards/f/FoulTongueInvocation.java index 09938de420..a544e618ea 100644 --- a/Mage.Sets/src/mage/cards/f/FoulTongueInvocation.java +++ b/Mage.Sets/src/mage/cards/f/FoulTongueInvocation.java @@ -116,7 +116,7 @@ class FoulTongueInvocationEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher"); + DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName()); if (watcher != null && watcher.castWithConditionTrue(source.getId())) { controller.gainLife(4, game); } diff --git a/Mage.Sets/src/mage/cards/f/FreshMeat.java b/Mage.Sets/src/mage/cards/f/FreshMeat.java index 87d68b3468..0151843f27 100644 --- a/Mage.Sets/src/mage/cards/f/FreshMeat.java +++ b/Mage.Sets/src/mage/cards/f/FreshMeat.java @@ -68,7 +68,7 @@ class FreshMeatDynamicValue implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get("CreaturesDiedWatcher"); + CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get(CreaturesDiedWatcher.class.getSimpleName()); if (watcher != null) { return watcher.getAmountOfCreaturesDiesThisTurn(sourceAbility.getControllerId()); } diff --git a/Mage.Sets/src/mage/cards/g/GiltspireAvenger.java b/Mage.Sets/src/mage/cards/g/GiltspireAvenger.java index 72d5b4bbce..7ed98aa5f7 100644 --- a/Mage.Sets/src/mage/cards/g/GiltspireAvenger.java +++ b/Mage.Sets/src/mage/cards/g/GiltspireAvenger.java @@ -49,13 +49,12 @@ import java.util.Set; import java.util.UUID; /** - * * @author BetaSteward_at_googlemail.com */ public class GiltspireAvenger extends CardImpl { public GiltspireAvenger(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}{W}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{W}{U}"); this.subtype.add("Human"); this.subtype.add("Soldier"); @@ -97,7 +96,7 @@ class GiltspireAvengerTarget extends TargetPermanent { @Override public boolean canTarget(UUID id, Ability source, Game game) { - PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource",source.getControllerId()); + PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), source.getControllerId()); if (watcher != null && watcher.hasSourceDoneDamage(id, game)) { return super.canTarget(id, source, game); } @@ -108,10 +107,10 @@ class GiltspireAvengerTarget extends TargetPermanent { public Set possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) { Set availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game); Set possibleTargets = new HashSet<>(); - PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", sourceControllerId); + PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), sourceControllerId); for (UUID targetId : availablePossibleTargets) { Permanent permanent = game.getPermanent(targetId); - if(permanent != null && watcher != null && watcher.hasSourceDoneDamage(targetId, game)){ + if (permanent != null && watcher != null && watcher.hasSourceDoneDamage(targetId, game)) { possibleTargets.add(targetId); } } @@ -126,15 +125,15 @@ class GiltspireAvengerTarget extends TargetPermanent { } int count = 0; MageObject targetSource = game.getObject(sourceId); - PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", sourceControllerId); - for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, sourceControllerId, sourceId, game)) { - if (!targets.containsKey(permanent.getId()) && permanent.canBeTargetedBy(targetSource, sourceControllerId, game) + PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), sourceControllerId); + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, sourceControllerId, sourceId, game)) { + if (!targets.containsKey(permanent.getId()) && permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && watcher != null && watcher.hasSourceDoneDamage(permanent.getId(), game)) { - count++; - if (count >= remainingTargets) { - return true; - } + count++; + if (count >= remainingTargets) { + return true; } + } } return false; } diff --git a/Mage.Sets/src/mage/cards/g/Gomazoa.java b/Mage.Sets/src/mage/cards/g/Gomazoa.java index 4eb27b36df..ccd19fb855 100644 --- a/Mage.Sets/src/mage/cards/g/Gomazoa.java +++ b/Mage.Sets/src/mage/cards/g/Gomazoa.java @@ -112,7 +112,7 @@ class GomazoaEffect extends OneShotEffect { players.add(gomazoa.getOwnerId()); } - BlockedByWatcher watcher = (BlockedByWatcher) game.getState().getWatchers().get("BlockedByWatcher", source.getSourceId()); + BlockedByWatcher watcher = (BlockedByWatcher) game.getState().getWatchers().get(BlockedByWatcher.class.getSimpleName(), source.getSourceId()); creaturesBlocked = watcher.blockedByWatcher; for (UUID blockedById : creaturesBlocked) { @@ -143,7 +143,7 @@ class BlockedByWatcher extends Watcher { public List blockedByWatcher = new ArrayList<>(); public BlockedByWatcher() { - super("BlockedByWatcher", WatcherScope.CARD); + super(BlockedByWatcher.class.getSimpleName(), WatcherScope.CARD); } public BlockedByWatcher(final BlockedByWatcher watcher) { diff --git a/Mage.Sets/src/mage/cards/h/HallowedMoonlight.java b/Mage.Sets/src/mage/cards/h/HallowedMoonlight.java index b0920e567a..eb39f8c1c3 100644 --- a/Mage.Sets/src/mage/cards/h/HallowedMoonlight.java +++ b/Mage.Sets/src/mage/cards/h/HallowedMoonlight.java @@ -109,7 +109,7 @@ class HallowedMoonlightEffect extends ReplacementEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { EntersTheBattlefieldEvent entersTheBattlefieldEvent = (EntersTheBattlefieldEvent) event; if (entersTheBattlefieldEvent.getTarget().isCreature()) { - CreatureWasCastWatcher watcher = (CreatureWasCastWatcher) game.getState().getWatchers().get("CreatureWasCast"); + CreatureWasCastWatcher watcher = (CreatureWasCastWatcher) game.getState().getWatchers().get(CreatureWasCastWatcher.class.getSimpleName()); if (watcher != null && !watcher.wasCreatureCastThisTurn(event.getTargetId())) { return true; } diff --git a/Mage.Sets/src/mage/cards/h/HomicidalBrute.java b/Mage.Sets/src/mage/cards/h/HomicidalBrute.java index b81af06e19..87057ff3ba 100644 --- a/Mage.Sets/src/mage/cards/h/HomicidalBrute.java +++ b/Mage.Sets/src/mage/cards/h/HomicidalBrute.java @@ -34,6 +34,7 @@ import mage.abilities.effects.common.TapSourceEffect; import mage.abilities.effects.common.TransformSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.cards.c.CivilizedScholar; import mage.constants.CardType; import mage.constants.Zone; import mage.game.Game; @@ -98,7 +99,7 @@ class HomicidalBruteTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getPlayerId().equals(this.controllerId)) { - Watcher watcher = game.getState().getWatchers().get("HomicidalBruteAttacked", sourceId); + Watcher watcher = game.getState().getWatchers().get("HomicidalBruteWatcher", sourceId); if (watcher == null || !watcher.conditionMet()) { return true; } diff --git a/Mage.Sets/src/mage/cards/i/Insist.java b/Mage.Sets/src/mage/cards/i/Insist.java index 61005a0e34..6fdb81bb49 100644 --- a/Mage.Sets/src/mage/cards/i/Insist.java +++ b/Mage.Sets/src/mage/cards/i/Insist.java @@ -28,6 +28,7 @@ package mage.cards.i; import java.util.UUID; + import mage.MageObject; import mage.abilities.Ability; import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; @@ -45,18 +46,17 @@ import mage.game.stack.Spell; import mage.watchers.Watcher; /** - * * @author fireshoes */ public class Insist extends CardImpl { public Insist(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{G}"); + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}"); // The next creature spell you cast this turn can't be countered by spells or abilities. this.getSpellAbility().addEffect(new InsistEffect()); this.getSpellAbility().addWatcher(new InsistWatcher()); - + // Draw a card. Effect effect = new DrawCardSourceControllerEffect(1); effect.setText("

Draw a card"); @@ -74,7 +74,7 @@ public class Insist extends CardImpl { } class InsistEffect extends ContinuousRuleModifyingEffectImpl { - + InsistEffect() { super(Duration.EndOfTurn, Outcome.Benefit); staticText = "The next creature spell you cast this turn can't be countered by spells or abilities"; @@ -92,10 +92,10 @@ class InsistEffect extends ContinuousRuleModifyingEffectImpl { @Override public void init(Ability source, Game game) { super.init(source, game); - InsistWatcher watcher = (InsistWatcher) game.getState().getWatchers().get("insistWatcher", source.getControllerId()); - if (watcher != null) { - watcher.setReady(); - } + InsistWatcher watcher = (InsistWatcher) game.getState().getWatchers().get(InsistWatcher.class.getSimpleName(), source.getControllerId()); + if (watcher != null) { + watcher.setReady(); + } } @Override @@ -111,16 +111,16 @@ class InsistEffect extends ContinuousRuleModifyingEffectImpl { } return null; } - + @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.COUNTER; } - + @Override public boolean applies(GameEvent event, Ability source, Game game) { Spell spell = game.getStack().getSpell(event.getTargetId()); - InsistWatcher watcher = (InsistWatcher) game.getState().getWatchers().get("insistWatcher", source.getControllerId()); + InsistWatcher watcher = (InsistWatcher) game.getState().getWatchers().get(InsistWatcher.class.getSimpleName(), source.getControllerId()); return spell != null && watcher != null && watcher.isUncounterable(spell.getId()); } } @@ -131,7 +131,7 @@ class InsistWatcher extends Watcher { protected UUID uncounterableSpell; InsistWatcher() { - super("insistWatcher", WatcherScope.PLAYER); + super(InsistWatcher.class.getSimpleName(), WatcherScope.PLAYER); } InsistWatcher(final InsistWatcher watcher) { @@ -160,7 +160,7 @@ class InsistWatcher extends Watcher { public boolean isUncounterable(UUID spellId) { return spellId.equals(uncounterableSpell); } - + public void setReady() { ready = true; } diff --git a/Mage.Sets/src/mage/cards/k/KeranosGodOfStorms.java b/Mage.Sets/src/mage/cards/k/KeranosGodOfStorms.java index 167a26e335..98a0478818 100644 --- a/Mage.Sets/src/mage/cards/k/KeranosGodOfStorms.java +++ b/Mage.Sets/src/mage/cards/k/KeranosGodOfStorms.java @@ -120,7 +120,7 @@ class KeranosGodOfStormsTriggeredAbility extends TriggeredAbilityImpl { if (event.getPlayerId().equals(this.getControllerId())) { if (game.getActivePlayerId().equals(this.getControllerId())) { CardsAmountDrawnThisTurnWatcher watcher = - (CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.BASIC_KEY); + (CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName()); if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) != 1) { return false; } diff --git a/Mage.Sets/src/mage/cards/k/KnollspineDragon.java b/Mage.Sets/src/mage/cards/k/KnollspineDragon.java index 47a41ac230..6eaf03b6c8 100644 --- a/Mage.Sets/src/mage/cards/k/KnollspineDragon.java +++ b/Mage.Sets/src/mage/cards/k/KnollspineDragon.java @@ -93,7 +93,7 @@ class KnollspineDragonEffect extends OneShotEffect { if (controller != null) { new DiscardHandControllerEffect().apply(game, source); if (targetOpponent != null) { - AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatchers().get("AmountOfDamageReceivedThisTurn"); + AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatchers().get(AmountOfDamageAPlayerReceivedThisTurnWatcher.class.getSimpleName()); if (watcher != null) { int drawAmount = watcher.getAmountOfDamageReceivedThisTurn(targetOpponent.getId()); controller.drawCards(drawAmount, game); diff --git a/Mage.Sets/src/mage/cards/k/KumanosBlessing.java b/Mage.Sets/src/mage/cards/k/KumanosBlessing.java index 6dca519262..08a1365722 100644 --- a/Mage.Sets/src/mage/cards/k/KumanosBlessing.java +++ b/Mage.Sets/src/mage/cards/k/KumanosBlessing.java @@ -120,7 +120,7 @@ class KumanosBlessingEffect extends ReplacementEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { ZoneChangeEvent zce = (ZoneChangeEvent) event; if (zce.isDiesEvent()) { - DamagedByEnchantedWatcher watcher = (DamagedByEnchantedWatcher) game.getState().getWatchers().get("DamagedByEnchantedWatcher", source.getSourceId()); + DamagedByEnchantedWatcher watcher = (DamagedByEnchantedWatcher) game.getState().getWatchers().get(DamagedByEnchantedWatcher.class.getSimpleName(), source.getSourceId()); if (watcher != null) { return watcher.wasDamaged(zce.getTarget(), game); } @@ -135,7 +135,7 @@ class DamagedByEnchantedWatcher extends Watcher { private final Set damagedCreatures = new HashSet<>(); public DamagedByEnchantedWatcher() { - super("DamagedByEnchantedWatcher", WatcherScope.CARD); + super(DamagedByEnchantedWatcher.class.getSimpleName(), WatcherScope.CARD); } public DamagedByEnchantedWatcher(final DamagedByEnchantedWatcher watcher) { diff --git a/Mage.Sets/src/mage/cards/k/KuonOgreAscendant.java b/Mage.Sets/src/mage/cards/k/KuonOgreAscendant.java index 86a11817c9..7c80355ae9 100644 --- a/Mage.Sets/src/mage/cards/k/KuonOgreAscendant.java +++ b/Mage.Sets/src/mage/cards/k/KuonOgreAscendant.java @@ -109,7 +109,7 @@ enum KuonOgreAscendantCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get("CreaturesDiedWatcher"); + CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get(CreaturesDiedWatcher.class.getSimpleName()); if (watcher != null) { return watcher.getAmountOfCreaturesDiesThisTurn() > 2; } diff --git a/Mage.Sets/src/mage/cards/k/KytheonHeroOfAkros.java b/Mage.Sets/src/mage/cards/k/KytheonHeroOfAkros.java index ebd9fdf4ca..6e6c91ef32 100644 --- a/Mage.Sets/src/mage/cards/k/KytheonHeroOfAkros.java +++ b/Mage.Sets/src/mage/cards/k/KytheonHeroOfAkros.java @@ -98,7 +98,7 @@ class KytheonHeroOfAkrosCondition implements Condition { public boolean apply(Game game, Ability source) { Permanent sourceObject = game.getPermanent(source.getSourceId()); if (sourceObject != null) { - AttackedOrBlockedThisCombatWatcher watcher = (AttackedOrBlockedThisCombatWatcher) game.getState().getWatchers().get(AttackedOrBlockedThisCombatWatcher.class.getName()); + AttackedOrBlockedThisCombatWatcher watcher = (AttackedOrBlockedThisCombatWatcher) game.getState().getWatchers().get(AttackedOrBlockedThisCombatWatcher.class.getSimpleName()); if (watcher != null) { boolean sourceFound = false; int number = 0; diff --git a/Mage.Sets/src/mage/cards/l/LeovoldEmissaryOfTrest.java b/Mage.Sets/src/mage/cards/l/LeovoldEmissaryOfTrest.java index 86360cee20..d11cbe93eb 100644 --- a/Mage.Sets/src/mage/cards/l/LeovoldEmissaryOfTrest.java +++ b/Mage.Sets/src/mage/cards/l/LeovoldEmissaryOfTrest.java @@ -97,7 +97,7 @@ class LeovoldEmissaryOfTrestEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - CardsAmountDrawnThisTurnWatcher watcher = (CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.BASIC_KEY); + CardsAmountDrawnThisTurnWatcher watcher = (CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName()); Player controller = game.getPlayer(source.getControllerId()); return watcher != null && controller != null && watcher.getAmountCardsDrawn(event.getPlayerId()) >= 1 && game.isOpponent(controller, event.getPlayerId()); diff --git a/Mage.Sets/src/mage/cards/l/LuminarchAscension.java b/Mage.Sets/src/mage/cards/l/LuminarchAscension.java index 8fd837cc7f..d71594e5ff 100644 --- a/Mage.Sets/src/mage/cards/l/LuminarchAscension.java +++ b/Mage.Sets/src/mage/cards/l/LuminarchAscension.java @@ -146,7 +146,7 @@ enum YouLostNoLifeThisTurnCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher"); + PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName()); if (watcher != null) { return (watcher.getLiveLost(source.getControllerId()) == 0); } diff --git a/Mage.Sets/src/mage/cards/m/MoggConscripts.java b/Mage.Sets/src/mage/cards/m/MoggConscripts.java index a6daee0180..21cf31d2c3 100644 --- a/Mage.Sets/src/mage/cards/m/MoggConscripts.java +++ b/Mage.Sets/src/mage/cards/m/MoggConscripts.java @@ -92,7 +92,7 @@ class MoggConscriptsEffect extends RestrictionEffect { @Override public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent.getId().equals(source.getSourceId())) { - PlayerCastCreatureWatcher watcher = (PlayerCastCreatureWatcher) game.getState().getWatchers().get("PlayerCastCreature"); + PlayerCastCreatureWatcher watcher = (PlayerCastCreatureWatcher) game.getState().getWatchers().get(PlayerCastCreatureWatcher.class.getSimpleName()); if (watcher != null && !watcher.playerDidCastCreatureThisTurn(source.getControllerId())) { return true; } diff --git a/Mage.Sets/src/mage/cards/m/MoltenPsyche.java b/Mage.Sets/src/mage/cards/m/MoltenPsyche.java index a5f90702b3..5798b5e07e 100644 --- a/Mage.Sets/src/mage/cards/m/MoltenPsyche.java +++ b/Mage.Sets/src/mage/cards/m/MoltenPsyche.java @@ -107,13 +107,13 @@ class MoltenPsycheEffect extends OneShotEffect { if (player != null) { player.drawCards(cardsToDraw.get(playerId), game); if (MetalcraftCondition.instance.apply(game, source) && !playerId.equals(source.getControllerId())) { - MoltenPsycheWatcher watcher = (MoltenPsycheWatcher) game.getState().getWatchers().get("CardsDrawn"); + MoltenPsycheWatcher watcher = (MoltenPsycheWatcher) game.getState().getWatchers().get(MoltenPsycheWatcher.class.getSimpleName()); player.damage(watcher.getDraws(playerId), source.getSourceId(), game, false, true); } } } if (MetalcraftCondition.instance.apply(game, source)) { - MoltenPsycheWatcher watcher = (MoltenPsycheWatcher) game.getState().getWatchers().get("CardsDrawn"); + MoltenPsycheWatcher watcher = (MoltenPsycheWatcher) game.getState().getWatchers().get(MoltenPsycheWatcher.class.getSimpleName()); for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { if (game.isOpponent(controller, playerId)) { Player player = game.getPlayer(playerId); @@ -141,7 +141,7 @@ class MoltenPsycheWatcher extends Watcher { private final Map draws = new HashMap<>(); public MoltenPsycheWatcher() { - super("CardsDrawn", WatcherScope.GAME); + super(MoltenPsycheWatcher.class.getSimpleName(), WatcherScope.GAME); } public MoltenPsycheWatcher(final MoltenPsycheWatcher watcher) { diff --git a/Mage.Sets/src/mage/cards/o/OathOfChandra.java b/Mage.Sets/src/mage/cards/o/OathOfChandra.java index 680cac01ef..5599ab43b2 100644 --- a/Mage.Sets/src/mage/cards/o/OathOfChandra.java +++ b/Mage.Sets/src/mage/cards/o/OathOfChandra.java @@ -96,7 +96,7 @@ enum OathOfChandraCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - OathOfChandraWatcher watcher = (OathOfChandraWatcher) game.getState().getWatchers().get("OathOfChandraWatcher"); + OathOfChandraWatcher watcher = (OathOfChandraWatcher) game.getState().getWatchers().get(OathOfChandraWatcher.class.getSimpleName()); return watcher != null && watcher.enteredPlaneswalkerForPlayer(source.getControllerId()); } @@ -112,7 +112,7 @@ class OathOfChandraWatcher extends Watcher { private final Set players = new HashSet<>(); public OathOfChandraWatcher() { - super("OathOfChandraWatcher", WatcherScope.GAME); + super(OathOfChandraWatcher.class.getSimpleName(), WatcherScope.GAME); } public OathOfChandraWatcher(final OathOfChandraWatcher watcher) { diff --git a/Mage.Sets/src/mage/cards/o/OpalPalace.java b/Mage.Sets/src/mage/cards/o/OpalPalace.java index b746593bde..9bb13f2cb4 100644 --- a/Mage.Sets/src/mage/cards/o/OpalPalace.java +++ b/Mage.Sets/src/mage/cards/o/OpalPalace.java @@ -93,7 +93,7 @@ class OpalPalaceWatcher extends Watcher { private final String originalId; public OpalPalaceWatcher(String originalId) { - super("ManaPaidFromOpalPalaceWatcher", WatcherScope.CARD); + super(OpalPalaceWatcher.class.getSimpleName(), WatcherScope.CARD); this.originalId = originalId; } @@ -156,7 +156,7 @@ class OpalPalaceEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - OpalPalaceWatcher watcher = (OpalPalaceWatcher) game.getState().getWatchers().get("ManaPaidFromOpalPalaceWatcher", source.getSourceId()); + OpalPalaceWatcher watcher = (OpalPalaceWatcher) game.getState().getWatchers().get(OpalPalaceWatcher.class.getSimpleName(), source.getSourceId()); return watcher != null && watcher.commanderId.contains(event.getTargetId()); } diff --git a/Mage.Sets/src/mage/cards/o/OratorOfOjutai.java b/Mage.Sets/src/mage/cards/o/OratorOfOjutai.java index eca4ad6bd0..30c0371441 100644 --- a/Mage.Sets/src/mage/cards/o/OratorOfOjutai.java +++ b/Mage.Sets/src/mage/cards/o/OratorOfOjutai.java @@ -125,7 +125,7 @@ class OratorOfOjutaiTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { //Intervening if must be checked Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(getSourceId()); - DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher"); + DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName()); return event.getTargetId().equals(getSourceId()) && watcher != null && watcher.castWithConditionTrue(sourcePermanent.getSpellAbility().getId()); @@ -165,7 +165,7 @@ class OratorOfOjutaiEffect extends OneShotEffect { if (controller != null) { Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourcePermanent != null) { - DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher"); + DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName()); if (watcher != null && watcher.castWithConditionTrue(sourcePermanent.getSpellAbility().getId())) { controller.drawCards(1, game); return true; diff --git a/Mage.Sets/src/mage/cards/o/Overmaster.java b/Mage.Sets/src/mage/cards/o/Overmaster.java index a610502ab2..ca6ea751f9 100644 --- a/Mage.Sets/src/mage/cards/o/Overmaster.java +++ b/Mage.Sets/src/mage/cards/o/Overmaster.java @@ -93,7 +93,7 @@ class OvermasterEffect extends ContinuousRuleModifyingEffectImpl { @Override public void init(Ability source, Game game) { super.init(source, game); - OvermasterWatcher watcher = (OvermasterWatcher) game.getState().getWatchers().get("overmasterWatcher", source.getControllerId()); + OvermasterWatcher watcher = (OvermasterWatcher) game.getState().getWatchers().get(OvermasterWatcher.class.getSimpleName(), source.getControllerId()); if (watcher != null) { watcher.setReady(); } @@ -132,7 +132,7 @@ class OvermasterWatcher extends Watcher { protected UUID uncounterableSpell; OvermasterWatcher() { - super("overmasterWatcher", WatcherScope.PLAYER); + super(OvermasterWatcher.class.getSimpleName(), WatcherScope.PLAYER); } OvermasterWatcher(final OvermasterWatcher watcher) { diff --git a/Mage.Sets/src/mage/cards/r/ReaperFromTheAbyss.java b/Mage.Sets/src/mage/cards/r/ReaperFromTheAbyss.java index cf41de263f..03d8472e30 100644 --- a/Mage.Sets/src/mage/cards/r/ReaperFromTheAbyss.java +++ b/Mage.Sets/src/mage/cards/r/ReaperFromTheAbyss.java @@ -46,6 +46,7 @@ import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCreaturePermanent; import mage.watchers.Watcher; +import mage.watchers.common.MorbidWatcher; /** * @@ -105,7 +106,7 @@ class ReaperFromTheAbyssAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - Watcher watcher = game.getState().getWatchers().get("Morbid"); + Watcher watcher = game.getState().getWatchers().get(MorbidWatcher.class.getSimpleName()); return watcher.conditionMet(); } diff --git a/Mage.Sets/src/mage/cards/r/Reciprocate.java b/Mage.Sets/src/mage/cards/r/Reciprocate.java index 050ca5fcd4..9ffae04e16 100644 --- a/Mage.Sets/src/mage/cards/r/Reciprocate.java +++ b/Mage.Sets/src/mage/cards/r/Reciprocate.java @@ -80,7 +80,7 @@ class ReciprocateTarget extends TargetPermanent { @Override public boolean canTarget(UUID id, Ability source, Game game) { - PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", source.getControllerId()); + PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), source.getControllerId()); if (watcher != null && watcher.hasSourceDoneDamage(id, game)) { return super.canTarget(id, source, game); } @@ -91,7 +91,7 @@ class ReciprocateTarget extends TargetPermanent { public Set possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) { Set availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game); Set possibleTargets = new HashSet<>(); - PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", sourceControllerId); + PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), sourceControllerId); for (UUID targetId : availablePossibleTargets) { Permanent permanent = game.getPermanent(targetId); if (permanent != null && watcher != null && watcher.hasSourceDoneDamage(targetId, game)) { @@ -109,7 +109,7 @@ class ReciprocateTarget extends TargetPermanent { } int count = 0; MageObject targetSource = game.getObject(sourceId); - PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", sourceControllerId); + PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), sourceControllerId); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, sourceControllerId, sourceId, game)) { if (!targets.containsKey(permanent.getId()) && permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && watcher != null && watcher.hasSourceDoneDamage(permanent.getId(), game)) { diff --git a/Mage.Sets/src/mage/cards/r/RixMaadiGuildmage.java b/Mage.Sets/src/mage/cards/r/RixMaadiGuildmage.java index 3caa4e3a58..2e63ee1e4d 100644 --- a/Mage.Sets/src/mage/cards/r/RixMaadiGuildmage.java +++ b/Mage.Sets/src/mage/cards/r/RixMaadiGuildmage.java @@ -98,7 +98,7 @@ class PlayerLostLifePredicate implements Predicate { @Override public boolean apply(Player input, Game game) { - PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher"); + PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName()); if (watcher != null) { return (0 < watcher.getLiveLost(input.getId())); } diff --git a/Mage.Sets/src/mage/cards/r/RuneflareTrap.java b/Mage.Sets/src/mage/cards/r/RuneflareTrap.java index dcab0be790..f63a24676b 100644 --- a/Mage.Sets/src/mage/cards/r/RuneflareTrap.java +++ b/Mage.Sets/src/mage/cards/r/RuneflareTrap.java @@ -107,7 +107,7 @@ enum RuneflareTrapCondition implements Condition { @Override public boolean apply(Game game, Ability source) { CardsAmountDrawnThisTurnWatcher watcher = - (CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.BASIC_KEY); + (CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName()); return watcher != null && watcher.opponentDrewXOrMoreCards(source.getControllerId(), 3, game); } diff --git a/Mage.Sets/src/mage/cards/s/SavageSummoning.java b/Mage.Sets/src/mage/cards/s/SavageSummoning.java index 3986eb2461..38a715d438 100644 --- a/Mage.Sets/src/mage/cards/s/SavageSummoning.java +++ b/Mage.Sets/src/mage/cards/s/SavageSummoning.java @@ -108,7 +108,7 @@ class SavageSummoningAsThoughEffect extends AsThoughEffectImpl { @Override public void init(Ability source, Game game) { - watcher = (SavageSummoningWatcher) game.getState().getWatchers().get("consumeSavageSummoningWatcher", source.getControllerId()); + watcher = (SavageSummoningWatcher) game.getState().getWatchers().get(SavageSummoningWatcher.class.getSimpleName(), source.getControllerId()); Card card = game.getCard(source.getSourceId()); if (watcher != null && card != null) { watcher.setSavageSummoningSpellActive(card, game); @@ -155,7 +155,7 @@ class SavageSummoningWatcher extends Watcher { private Map> cardsCastWithSavageSummoning = new LinkedHashMap<>(); public SavageSummoningWatcher() { - super("consumeSavageSummoningWatcher", WatcherScope.PLAYER); + super(SavageSummoningWatcher.class.getSimpleName(), WatcherScope.PLAYER); } public SavageSummoningWatcher(final SavageSummoningWatcher watcher) { @@ -240,7 +240,7 @@ class SavageSummoningCantCounterEffect extends ContinuousRuleModifyingEffectImpl @Override public void init(Ability source, Game game) { - watcher = (SavageSummoningWatcher) game.getState().getWatchers().get("consumeSavageSummoningWatcher", source.getControllerId()); + watcher = (SavageSummoningWatcher) game.getState().getWatchers().get(SavageSummoningWatcher.class.getSimpleName(), source.getControllerId()); Card card = game.getCard(source.getSourceId()); if (watcher == null || card == null) { throw new IllegalArgumentException("Consume Savage watcher or card could not be found"); @@ -298,7 +298,7 @@ class SavageSummoningEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public void init(Ability source, Game game) { - watcher = (SavageSummoningWatcher) game.getState().getWatchers().get("consumeSavageSummoningWatcher", source.getControllerId()); + watcher = (SavageSummoningWatcher) game.getState().getWatchers().get(SavageSummoningWatcher.class.getSimpleName(), source.getControllerId()); Card card = game.getCard(source.getSourceId()); if (watcher == null || card == null) { throw new IllegalArgumentException("Consume Savage watcher or card could not be found"); diff --git a/Mage.Sets/src/mage/cards/s/ScaleguardSentinels.java b/Mage.Sets/src/mage/cards/s/ScaleguardSentinels.java index 089bbb4244..83edeed9c9 100644 --- a/Mage.Sets/src/mage/cards/s/ScaleguardSentinels.java +++ b/Mage.Sets/src/mage/cards/s/ScaleguardSentinels.java @@ -108,7 +108,7 @@ enum ScaleguardSentinelsCondition implements Condition { public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanentEntering(source.getSourceId()); if (sourcePermanent != null) { - DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher"); + DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName()); return (watcher != null && watcher.castWithConditionTrue(sourcePermanent.getSpellAbility().getId())); } return false; diff --git a/Mage.Sets/src/mage/cards/s/ScoutsWarning.java b/Mage.Sets/src/mage/cards/s/ScoutsWarning.java index b7ad2a982f..c5ebbd30d6 100644 --- a/Mage.Sets/src/mage/cards/s/ScoutsWarning.java +++ b/Mage.Sets/src/mage/cards/s/ScoutsWarning.java @@ -91,7 +91,7 @@ class ScoutsWarningAsThoughEffect extends AsThoughEffectImpl { @Override public void init(Ability source, Game game) { - watcher = (ScoutsWarningWatcher) game.getState().getWatchers().get("consumeScoutsWarningWatcher", source.getControllerId()); + watcher = (ScoutsWarningWatcher) game.getState().getWatchers().get(ScoutsWarningWatcher.class.getSimpleName(), source.getControllerId()); Card card = game.getCard(source.getSourceId()); if (watcher != null && card != null) { zoneChangeCounter = card.getZoneChangeCounter(game); @@ -127,7 +127,7 @@ class ScoutsWarningWatcher extends Watcher { public List activeScoutsWarningSpells = new ArrayList<>(); public ScoutsWarningWatcher() { - super("consumeScoutsWarningWatcher", WatcherScope.PLAYER); + super(ScoutsWarningWatcher.class.getSimpleName(), WatcherScope.PLAYER); } public ScoutsWarningWatcher(final ScoutsWarningWatcher watcher) { diff --git a/Mage.Sets/src/mage/cards/s/SearingBlaze.java b/Mage.Sets/src/mage/cards/s/SearingBlaze.java index 79f8400cd1..56dabba7cd 100644 --- a/Mage.Sets/src/mage/cards/s/SearingBlaze.java +++ b/Mage.Sets/src/mage/cards/s/SearingBlaze.java @@ -93,7 +93,7 @@ class SearingBlazeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - LandfallWatcher watcher = (LandfallWatcher) game.getState().getWatchers().get("LandPlayed"); + LandfallWatcher watcher = (LandfallWatcher) game.getState().getWatchers().get(LandfallWatcher.class.getSimpleName()); Player player = game.getPlayer(source.getTargets().get(0).getFirstTarget()); Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); int damage = 1; diff --git a/Mage.Sets/src/mage/cards/s/SecondGuess.java b/Mage.Sets/src/mage/cards/s/SecondGuess.java index ea25f36aad..b3811482b1 100644 --- a/Mage.Sets/src/mage/cards/s/SecondGuess.java +++ b/Mage.Sets/src/mage/cards/s/SecondGuess.java @@ -76,7 +76,7 @@ class SecondSpellPredicate implements Predicate { @Override public boolean apply(Spell input, Game game) { - CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName()); + CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName()); if (watcher.getSpellOrder(new MageObjectReference(input.getId(), game), game) == 2) { return true; diff --git a/Mage.Sets/src/mage/cards/s/SecondSunrise.java b/Mage.Sets/src/mage/cards/s/SecondSunrise.java index 066c52f497..6fa5d32a70 100644 --- a/Mage.Sets/src/mage/cards/s/SecondSunrise.java +++ b/Mage.Sets/src/mage/cards/s/SecondSunrise.java @@ -82,7 +82,7 @@ class SecondSunriseEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - SecondSunriseWatcher watcher = (SecondSunriseWatcher) game.getState().getWatchers().get("SecondSunriseWatcher"); + SecondSunriseWatcher watcher = (SecondSunriseWatcher) game.getState().getWatchers().get(SecondSunriseWatcher.class.getSimpleName()); if (watcher != null) { for (UUID id : watcher.cards) { Card c = game.getCard(id); @@ -107,7 +107,7 @@ class SecondSunriseWatcher extends Watcher { ArrayList cards = new ArrayList<>(); public SecondSunriseWatcher() { - super("SecondSunriseWatcher", WatcherScope.GAME); + super(SecondSunriseWatcher.class.getSimpleName(), WatcherScope.GAME); } public SecondSunriseWatcher(final SecondSunriseWatcher watcher) { diff --git a/Mage.Sets/src/mage/cards/s/ShadowOfTheGrave.java b/Mage.Sets/src/mage/cards/s/ShadowOfTheGrave.java index 3ebf33a742..24ad465131 100644 --- a/Mage.Sets/src/mage/cards/s/ShadowOfTheGrave.java +++ b/Mage.Sets/src/mage/cards/s/ShadowOfTheGrave.java @@ -84,8 +84,7 @@ class ShadowOfTheGraveEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - CardsCycledOrDiscardedThisTurnWatcher watcher = (CardsCycledOrDiscardedThisTurnWatcher) game.getState() - .getWatchers().get(CardsCycledOrDiscardedThisTurnWatcher.class.getName()); + CardsCycledOrDiscardedThisTurnWatcher watcher = (CardsCycledOrDiscardedThisTurnWatcher) game.getState().getWatchers().get(CardsCycledOrDiscardedThisTurnWatcher.class.getSimpleName()); if (controller != null && watcher != null) { for (Card card : watcher.getCardsCycledOrDiscardedThisTurn(controller.getId()).getCards(game)) { diff --git a/Mage.Sets/src/mage/cards/s/SilentChantZubera.java b/Mage.Sets/src/mage/cards/s/SilentChantZubera.java index b54f1a403e..754bbe7c34 100644 --- a/Mage.Sets/src/mage/cards/s/SilentChantZubera.java +++ b/Mage.Sets/src/mage/cards/s/SilentChantZubera.java @@ -74,7 +74,7 @@ class SilentChantZuberaDynamicValue implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - ZuberasDiedWatcher watcher = (ZuberasDiedWatcher) game.getState().getWatchers().get("ZuberasDied"); + ZuberasDiedWatcher watcher = (ZuberasDiedWatcher) game.getState().getWatchers().get(ZuberasDiedWatcher.class.getSimpleName()); return watcher.zuberasDiedThisTurn * 2; } diff --git a/Mage.Sets/src/mage/cards/s/SilumgarsScorn.java b/Mage.Sets/src/mage/cards/s/SilumgarsScorn.java index 8ef8211f34..d54fdac63f 100644 --- a/Mage.Sets/src/mage/cards/s/SilumgarsScorn.java +++ b/Mage.Sets/src/mage/cards/s/SilumgarsScorn.java @@ -119,7 +119,7 @@ class SilumgarsScornCounterEffect extends OneShotEffect { if (spell != null) { Player player = game.getPlayer(spell.getControllerId()); if (player != null) { - DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher"); + DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName()); boolean condition = watcher != null && watcher.castWithConditionTrue(source.getId()); if (!condition) { for (Cost cost: source.getCosts()) { diff --git a/Mage.Sets/src/mage/cards/s/SkarrganFirebird.java b/Mage.Sets/src/mage/cards/s/SkarrganFirebird.java index 3c8de0e3f8..fe8687dba3 100644 --- a/Mage.Sets/src/mage/cards/s/SkarrganFirebird.java +++ b/Mage.Sets/src/mage/cards/s/SkarrganFirebird.java @@ -86,7 +86,7 @@ class OpponentWasDealtDamageCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - BloodthirstWatcher watcher = (BloodthirstWatcher) game.getState().getWatchers().get("DamagedOpponents", source.getControllerId()); + BloodthirstWatcher watcher = (BloodthirstWatcher) game.getState().getWatchers().get(BloodthirstWatcher.class.getSimpleName(), source.getControllerId()); return watcher.conditionMet(); } diff --git a/Mage.Sets/src/mage/cards/s/Skeletonize.java b/Mage.Sets/src/mage/cards/s/Skeletonize.java index db616aafb8..223759a967 100644 --- a/Mage.Sets/src/mage/cards/s/Skeletonize.java +++ b/Mage.Sets/src/mage/cards/s/Skeletonize.java @@ -122,7 +122,7 @@ class SkeletonizeDelayedTriggeredAbility extends DelayedTriggeredAbility { public boolean checkTrigger(GameEvent event, Game game) { ZoneChangeEvent zce = (ZoneChangeEvent) event; if (zce.isDiesEvent()) { - DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", this.getSourceId()); + DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get(DamagedByWatcher.class.getSimpleName(), this.getSourceId()); if (watcher != null) { return watcher.wasDamaged(zce.getTarget(), game); } diff --git a/Mage.Sets/src/mage/cards/s/SoulReap.java b/Mage.Sets/src/mage/cards/s/SoulReap.java index 08d48687ff..9fe45702ad 100644 --- a/Mage.Sets/src/mage/cards/s/SoulReap.java +++ b/Mage.Sets/src/mage/cards/s/SoulReap.java @@ -91,7 +91,7 @@ class CastBlackSpellThisTurnCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - SoulReapWatcher watcher = (SoulReapWatcher) game.getState().getWatchers().get("SoulReapWatcher", source.getControllerId()); + SoulReapWatcher watcher = (SoulReapWatcher) game.getState().getWatchers().get(SoulReapWatcher.class.getSimpleName(), source.getControllerId()); if (watcher != null) { return watcher.conditionMet(); } @@ -110,7 +110,7 @@ class SoulReapWatcher extends Watcher { private UUID cardId; public SoulReapWatcher(UUID cardId) { - super("SoulReapWatcher", WatcherScope.PLAYER); + super(SoulReapWatcher.class.getSimpleName(), WatcherScope.PLAYER); this.cardId = cardId; } diff --git a/Mage.Sets/src/mage/cards/s/SpiritOfTheLabyrinth.java b/Mage.Sets/src/mage/cards/s/SpiritOfTheLabyrinth.java index be3808944e..8f00bfe51f 100644 --- a/Mage.Sets/src/mage/cards/s/SpiritOfTheLabyrinth.java +++ b/Mage.Sets/src/mage/cards/s/SpiritOfTheLabyrinth.java @@ -74,7 +74,7 @@ class SpiritOfTheLabyrinthWatcher extends Watcher { private final HashSet playersThatDrewCard; public SpiritOfTheLabyrinthWatcher() { - super("DrewCard", WatcherScope.GAME); + super(SpiritOfTheLabyrinthWatcher.class.getSimpleName(), WatcherScope.GAME); this.playersThatDrewCard = new HashSet<>(); } @@ -137,7 +137,7 @@ class SpiritOfTheLabyrinthEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - SpiritOfTheLabyrinthWatcher watcher = (SpiritOfTheLabyrinthWatcher) game.getState().getWatchers().get("DrewCard"); + SpiritOfTheLabyrinthWatcher watcher = (SpiritOfTheLabyrinthWatcher) game.getState().getWatchers().get(SpiritOfTheLabyrinthWatcher.class.getSimpleName()); if (watcher != null && watcher.hasPlayerDrewCardThisTurn(event.getPlayerId())) { return true; } diff --git a/Mage.Sets/src/mage/cards/s/SteelHellkite.java b/Mage.Sets/src/mage/cards/s/SteelHellkite.java index cc2b6fdb1e..244697bf5e 100644 --- a/Mage.Sets/src/mage/cards/s/SteelHellkite.java +++ b/Mage.Sets/src/mage/cards/s/SteelHellkite.java @@ -28,6 +28,7 @@ package mage.cards.s; import java.util.UUID; + import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.LimitedTimesPerTurnActivatedAbility; @@ -54,7 +55,7 @@ import mage.watchers.common.PlayerDamagedBySourceWatcher; public class SteelHellkite extends CardImpl { public SteelHellkite(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{6}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{6}"); this.subtype.add("Dragon"); this.power = new MageInt(5); @@ -97,9 +98,9 @@ class SteelHellkiteDestroyEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { int xValue = source.getManaCostsToPay().getX(); - for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterNonlandPermanent(), source.getControllerId(), source.getSourceId(), game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterNonlandPermanent(), source.getControllerId(), source.getSourceId(), game)) { if (permanent.getConvertedManaCost() == xValue) { - PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", permanent.getControllerId()); + PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), permanent.getControllerId()); if (watcher != null && watcher.hasSourceDoneDamage(source.getSourceId(), game)) { permanent.destroy(source.getSourceId(), game, false); } diff --git a/Mage.Sets/src/mage/cards/s/SummoningTrap.java b/Mage.Sets/src/mage/cards/s/SummoningTrap.java index b944db576a..13f6c70749 100644 --- a/Mage.Sets/src/mage/cards/s/SummoningTrap.java +++ b/Mage.Sets/src/mage/cards/s/SummoningTrap.java @@ -87,7 +87,7 @@ enum SummoningTrapCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - SummoningTrapWatcher watcher = (SummoningTrapWatcher) game.getState().getWatchers().get("CreatureSpellCountered"); + SummoningTrapWatcher watcher = (SummoningTrapWatcher) game.getState().getWatchers().get(SummoningTrapWatcher.class.getSimpleName()); return watcher != null && watcher.creatureSpellOfPlayerWasCountered(source.getControllerId()); } @@ -102,7 +102,7 @@ class SummoningTrapWatcher extends Watcher { Set players = new HashSet<>(); public SummoningTrapWatcher() { - super("CreatureSpellCountered", WatcherScope.GAME); + super(SummoningTrapWatcher.class.getSimpleName(), WatcherScope.GAME); } public SummoningTrapWatcher(final SummoningTrapWatcher watcher) { diff --git a/Mage.Sets/src/mage/cards/t/TaintedSigil.java b/Mage.Sets/src/mage/cards/t/TaintedSigil.java index ef4522403a..8ab13f4f50 100644 --- a/Mage.Sets/src/mage/cards/t/TaintedSigil.java +++ b/Mage.Sets/src/mage/cards/t/TaintedSigil.java @@ -83,7 +83,7 @@ class AllPlayersLostLifeCount implements DynamicValue { } public int calculate(Game game, UUID controllerId) { - PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher"); + PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName()); if (watcher != null) { int amountLifeLost = 0; for (UUID playerId : game.getState().getPlayersInRange(controllerId, game)) { diff --git a/Mage.Sets/src/mage/cards/t/TapestryOfTheAges.java b/Mage.Sets/src/mage/cards/t/TapestryOfTheAges.java index 3e75be5a90..373e2bcdaf 100644 --- a/Mage.Sets/src/mage/cards/t/TapestryOfTheAges.java +++ b/Mage.Sets/src/mage/cards/t/TapestryOfTheAges.java @@ -82,7 +82,7 @@ enum PlayerCastNonCreatureSpellCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - PlayerCastNonCreatureSpellWatcher watcher = (PlayerCastNonCreatureSpellWatcher) game.getState().getWatchers().get("PlayerCastNonCreatureSpell"); + PlayerCastNonCreatureSpellWatcher watcher = (PlayerCastNonCreatureSpellWatcher) game.getState().getWatchers().get(PlayerCastNonCreatureSpellWatcher.class.getSimpleName()); return watcher != null && watcher.playerDidCastNonCreatureSpellThisTurn(source.getControllerId()); } @@ -97,7 +97,7 @@ class PlayerCastNonCreatureSpellWatcher extends Watcher { Set playerIds = new HashSet<>(); public PlayerCastNonCreatureSpellWatcher() { - super("PlayerCastNonCreatureSpell", WatcherScope.GAME); + super(PlayerCastNonCreatureSpellWatcher.class.getSimpleName(), WatcherScope.GAME); } public PlayerCastNonCreatureSpellWatcher(final PlayerCastNonCreatureSpellWatcher watcher) { diff --git a/Mage.Sets/src/mage/cards/t/TimeToReflect.java b/Mage.Sets/src/mage/cards/t/TimeToReflect.java index 4c23e0f9fc..112b440a2d 100644 --- a/Mage.Sets/src/mage/cards/t/TimeToReflect.java +++ b/Mage.Sets/src/mage/cards/t/TimeToReflect.java @@ -71,7 +71,7 @@ public class TimeToReflect extends CardImpl { if (ability instanceof SpellAbility) { List creaturesThatBlockedOrWereBlockedByAZombie = new ArrayList<>(); FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that blocked or was blocked by a Zombie this turn.").copy(); - BlockedOrWasBlockedByAZombieWatcher watcher = (BlockedOrWasBlockedByAZombieWatcher) game.getState().getWatchers().get("BlockedOrWasBlockedByAZombieWatcher"); + BlockedOrWasBlockedByAZombieWatcher watcher = (BlockedOrWasBlockedByAZombieWatcher) game.getState().getWatchers().get(BlockedOrWasBlockedByAZombieWatcher.class.getSimpleName()); if (watcher != null) { for (MageObjectReference mor : watcher.getBlockedThisTurnCreatures()) { Permanent permanent = mor.getPermanent(game); @@ -101,7 +101,7 @@ class BlockedOrWasBlockedByAZombieWatcher extends Watcher { private final Set blockedOrWasBlockedByAZombieWatcher; public BlockedOrWasBlockedByAZombieWatcher() { - super("BlockedOrWasBlockedByAZombieWatcher", WatcherScope.GAME); + super(BlockedOrWasBlockedByAZombieWatcher.class.getSimpleName(), WatcherScope.GAME); blockedOrWasBlockedByAZombieWatcher = new HashSet<>(); } diff --git a/Mage.Sets/src/mage/cards/u/UrzasMiter.java b/Mage.Sets/src/mage/cards/u/UrzasMiter.java index d9c2054bfb..2a80ece079 100644 --- a/Mage.Sets/src/mage/cards/u/UrzasMiter.java +++ b/Mage.Sets/src/mage/cards/u/UrzasMiter.java @@ -84,7 +84,7 @@ class UrzasMiterDoIfCostPaid extends DoIfCostPaid { @Override public boolean apply(Game game, Ability source) { - UrzasMiterWatcher watcher = (UrzasMiterWatcher) game.getState().getWatchers().get("UrzasMiterWatcher"); + UrzasMiterWatcher watcher = (UrzasMiterWatcher) game.getState().getWatchers().get(UrzasMiterWatcher.class.getSimpleName()); if(!watcher.cards.contains(source.getFirstTarget())) return super.apply(game, source); @@ -98,7 +98,7 @@ class UrzasMiterWatcher extends Watcher { ArrayList cards; public UrzasMiterWatcher() { - super("UrzasMiterWatcher", WatcherScope.PLAYER); + super(UrzasMiterWatcher.class.getSimpleName(), WatcherScope.PLAYER); this.cards = new ArrayList<>(); } diff --git a/Mage.Sets/src/mage/cards/v/Vengevine.java b/Mage.Sets/src/mage/cards/v/Vengevine.java index 50b5c9fee7..8001f5949e 100644 --- a/Mage.Sets/src/mage/cards/v/Vengevine.java +++ b/Mage.Sets/src/mage/cards/v/Vengevine.java @@ -95,7 +95,7 @@ class VengevineAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getPlayerId().equals(controllerId)) { - Watcher watcher = game.getState().getWatchers().get("CreatureCast", controllerId); + Watcher watcher = game.getState().getWatchers().get(VengevineWatcher.class.getSimpleName(), controllerId); if (watcher != null && watcher.conditionMet()) { return true; } @@ -116,7 +116,7 @@ class VengevineWatcher extends Watcher { int creatureSpellCount = 0; public VengevineWatcher() { - super("CreatureCast", WatcherScope.PLAYER); + super(VengevineWatcher.class.getSimpleName(), WatcherScope.PLAYER); } public VengevineWatcher(final VengevineWatcher watcher) { diff --git a/Mage.Sets/src/mage/cards/v/VileRedeemer.java b/Mage.Sets/src/mage/cards/v/VileRedeemer.java index c0618330d6..b24de752d9 100644 --- a/Mage.Sets/src/mage/cards/v/VileRedeemer.java +++ b/Mage.Sets/src/mage/cards/v/VileRedeemer.java @@ -103,7 +103,7 @@ class VileRedeemerEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - VileRedeemerNonTokenCreaturesDiedWatcher watcher = (VileRedeemerNonTokenCreaturesDiedWatcher) game.getState().getWatchers().get("VileRedeemerNonTokenCreaturesDiedWatcher"); + VileRedeemerNonTokenCreaturesDiedWatcher watcher = (VileRedeemerNonTokenCreaturesDiedWatcher) game.getState().getWatchers().get(VileRedeemerNonTokenCreaturesDiedWatcher.class.getSimpleName()); if (watcher != null) { int amount = watcher.getAmountOfNontokenCreatureDiedThisTurn(controller.getId()); if (amount > 0) { @@ -121,7 +121,7 @@ class VileRedeemerNonTokenCreaturesDiedWatcher extends Watcher { private final HashMap amountOfCreaturesThatDied = new HashMap<>(); public VileRedeemerNonTokenCreaturesDiedWatcher() { - super("VileRedeemerNonTokenCreaturesDiedWatcher", WatcherScope.GAME); + super(VileRedeemerNonTokenCreaturesDiedWatcher.class.getSimpleName(), WatcherScope.GAME); } public VileRedeemerNonTokenCreaturesDiedWatcher(final VileRedeemerNonTokenCreaturesDiedWatcher watcher) { @@ -149,7 +149,7 @@ class VileRedeemerNonTokenCreaturesDiedWatcher extends Watcher { } public int getAmountOfNontokenCreatureDiedThisTurn(UUID playerId) { - return amountOfCreaturesThatDied.containsKey(playerId) ? amountOfCreaturesThatDied.get(playerId) : 0; + return amountOfCreaturesThatDied.getOrDefault(playerId, 0); } @Override diff --git a/Mage.Sets/src/mage/cards/w/WindbriskHeights.java b/Mage.Sets/src/mage/cards/w/WindbriskHeights.java index b83cb499f7..e22981a3e8 100644 --- a/Mage.Sets/src/mage/cards/w/WindbriskHeights.java +++ b/Mage.Sets/src/mage/cards/w/WindbriskHeights.java @@ -80,7 +80,7 @@ enum WindbriskHeightsAttackersCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - PlayerAttackedWatcher watcher = (PlayerAttackedWatcher) game.getState().getWatchers().get("PlayerAttackedWatcher"); + PlayerAttackedWatcher watcher = (PlayerAttackedWatcher) game.getState().getWatchers().get(PlayerAttackedWatcher.class.getSimpleName()); return watcher != null && watcher.getNumberOfAttackersCurrentTurn(source.getControllerId()) >= 3; } diff --git a/Mage/src/main/java/mage/abilities/condition/common/MorbidCondition.java b/Mage/src/main/java/mage/abilities/condition/common/MorbidCondition.java index a03c56e163..92d4163ab7 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/MorbidCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/MorbidCondition.java @@ -31,6 +31,7 @@ import mage.abilities.Ability; import mage.abilities.condition.Condition; import mage.game.Game; import mage.watchers.Watcher; +import mage.watchers.common.MorbidWatcher; /** * @author nantuko @@ -41,7 +42,7 @@ public enum MorbidCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - Watcher watcher = game.getState().getWatchers().get("Morbid"); + Watcher watcher = game.getState().getWatchers().get(MorbidWatcher.class.getSimpleName()); return watcher.conditionMet(); } diff --git a/Mage/src/main/java/mage/abilities/condition/common/NoSpellsWereCastLastTurnCondition.java b/Mage/src/main/java/mage/abilities/condition/common/NoSpellsWereCastLastTurnCondition.java index bbd489f907..f0ab900489 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/NoSpellsWereCastLastTurnCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/NoSpellsWereCastLastTurnCondition.java @@ -49,7 +49,7 @@ public enum NoSpellsWereCastLastTurnCondition implements Condition { return false; } - CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName()); + CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName()); // if any player cast spell, return false for (Integer count : watcher.getAmountOfSpellsCastOnPrevTurn().values()) { if (count > 0) { diff --git a/Mage/src/main/java/mage/abilities/condition/common/TwoOrMoreSpellsWereCastLastTurnCondition.java b/Mage/src/main/java/mage/abilities/condition/common/TwoOrMoreSpellsWereCastLastTurnCondition.java index a2a9ea8d19..9b5bab3a3e 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/TwoOrMoreSpellsWereCastLastTurnCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/TwoOrMoreSpellsWereCastLastTurnCondition.java @@ -41,7 +41,7 @@ public enum TwoOrMoreSpellsWereCastLastTurnCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName()); + CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName()); // if any player cast more than two spells, return true for (Integer count : watcher.getAmountOfSpellsCastOnPrevTurn().values()) { if (count >= 2) { diff --git a/Mage/src/main/java/mage/abilities/keyword/StormAbility.java b/Mage/src/main/java/mage/abilities/keyword/StormAbility.java index 8b5071e590..26f4f4fb88 100644 --- a/Mage/src/main/java/mage/abilities/keyword/StormAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/StormAbility.java @@ -100,7 +100,7 @@ class StormEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { MageObjectReference spellRef = (MageObjectReference) this.getValue("StormSpellRef"); if (spellRef != null) { - CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName()); + CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName()); int stormCount = watcher.getSpellOrder(spellRef, game) - 1; if (stormCount > 0) { Spell spell = (Spell) this.getValue("StormSpell"); diff --git a/Mage/src/main/java/mage/watchers/common/AmountOfDamageAPlayerReceivedThisTurnWatcher.java b/Mage/src/main/java/mage/watchers/common/AmountOfDamageAPlayerReceivedThisTurnWatcher.java index e372d8d612..0274ab84c9 100644 --- a/Mage/src/main/java/mage/watchers/common/AmountOfDamageAPlayerReceivedThisTurnWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/AmountOfDamageAPlayerReceivedThisTurnWatcher.java @@ -47,7 +47,7 @@ public class AmountOfDamageAPlayerReceivedThisTurnWatcher extends Watcher { private final Map amountOfDamageReceivedThisTurn = new HashMap<>(); public AmountOfDamageAPlayerReceivedThisTurnWatcher() { - super("AmountOfDamageReceivedThisTurn", WatcherScope.GAME); + super(AmountOfDamageAPlayerReceivedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME); } public AmountOfDamageAPlayerReceivedThisTurnWatcher(final AmountOfDamageAPlayerReceivedThisTurnWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/AttackedOrBlockedThisCombatWatcher.java b/Mage/src/main/java/mage/watchers/common/AttackedOrBlockedThisCombatWatcher.java index e54875d681..f4e36b11e4 100644 --- a/Mage/src/main/java/mage/watchers/common/AttackedOrBlockedThisCombatWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/AttackedOrBlockedThisCombatWatcher.java @@ -23,7 +23,7 @@ public class AttackedOrBlockedThisCombatWatcher extends Watcher { public final Set blockedThisTurnCreatures = new HashSet<>(); public AttackedOrBlockedThisCombatWatcher() { - super(AttackedOrBlockedThisCombatWatcher.class.getName(), WatcherScope.GAME); + super(AttackedOrBlockedThisCombatWatcher.class.getSimpleName(), WatcherScope.GAME); } public AttackedOrBlockedThisCombatWatcher(final AttackedOrBlockedThisCombatWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/AttackedThisTurnWatcher.java b/Mage/src/main/java/mage/watchers/common/AttackedThisTurnWatcher.java index e3e6635dfe..a05882de46 100644 --- a/Mage/src/main/java/mage/watchers/common/AttackedThisTurnWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/AttackedThisTurnWatcher.java @@ -43,7 +43,7 @@ public class AttackedThisTurnWatcher extends Watcher { public final Set attackedThisTurnCreatures = new HashSet<>(); public AttackedThisTurnWatcher() { - super(AttackedThisTurnWatcher.class.getName(), WatcherScope.GAME); + super(AttackedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME); } public AttackedThisTurnWatcher(final AttackedThisTurnWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/BlockedAttackerWatcher.java b/Mage/src/main/java/mage/watchers/common/BlockedAttackerWatcher.java index 1a9aaccc35..23a15d10cd 100644 --- a/Mage/src/main/java/mage/watchers/common/BlockedAttackerWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/BlockedAttackerWatcher.java @@ -47,7 +47,7 @@ public class BlockedAttackerWatcher extends Watcher { public final HashMap> blockData = new HashMap<>(); public BlockedAttackerWatcher() { - super("BlockedAttackerWatcher", WatcherScope.GAME); + super(BlockedAttackerWatcher.class.getSimpleName(), WatcherScope.GAME); } public BlockedAttackerWatcher(final BlockedAttackerWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/BlockedThisTurnWatcher.java b/Mage/src/main/java/mage/watchers/common/BlockedThisTurnWatcher.java index fd7a1a2583..26d876f5d9 100644 --- a/Mage/src/main/java/mage/watchers/common/BlockedThisTurnWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/BlockedThisTurnWatcher.java @@ -45,7 +45,7 @@ public class BlockedThisTurnWatcher extends Watcher { private final Set blockedThisTurnCreatures; public BlockedThisTurnWatcher() { - super("BlockedThisTurn", WatcherScope.GAME); + super(BlockedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME); blockedThisTurnCreatures = new HashSet<>(); } diff --git a/Mage/src/main/java/mage/watchers/common/BloodthirstWatcher.java b/Mage/src/main/java/mage/watchers/common/BloodthirstWatcher.java index b49a62f629..b15cb2cfdd 100644 --- a/Mage/src/main/java/mage/watchers/common/BloodthirstWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/BloodthirstWatcher.java @@ -37,11 +37,12 @@ import java.util.UUID; /** * Must be installed to player for proper Bloodthirst work + * * @author Loki */ public class BloodthirstWatcher extends Watcher { public BloodthirstWatcher(UUID controllerId) { - super("DamagedOpponents", WatcherScope.PLAYER); + super(BloodthirstWatcher.class.getSimpleName(), WatcherScope.PLAYER); this.controllerId = controllerId; } @@ -55,7 +56,7 @@ public class BloodthirstWatcher extends Watcher { return; } if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; if (game.getPlayer(this.getControllerId()).hasOpponent(damageEvent.getPlayerId(), game)) { condition = true; } diff --git a/Mage/src/main/java/mage/watchers/common/CardsAmountDrawnThisTurnWatcher.java b/Mage/src/main/java/mage/watchers/common/CardsAmountDrawnThisTurnWatcher.java index 39fc825179..3a3bd0d56d 100644 --- a/Mage/src/main/java/mage/watchers/common/CardsAmountDrawnThisTurnWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CardsAmountDrawnThisTurnWatcher.java @@ -44,12 +44,11 @@ import java.util.UUID; */ public class CardsAmountDrawnThisTurnWatcher extends Watcher { - public final static String BASIC_KEY = "CardsAmountDrawnThisTurnWatcher"; private final Map amountOfCardsDrawnThisTurn = new HashMap<>(); public CardsAmountDrawnThisTurnWatcher() { - super(BASIC_KEY, WatcherScope.GAME); + super(CardsAmountDrawnThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME); } public CardsAmountDrawnThisTurnWatcher(final CardsAmountDrawnThisTurnWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/CardsCycledOrDiscardedThisTurnWatcher.java b/Mage/src/main/java/mage/watchers/common/CardsCycledOrDiscardedThisTurnWatcher.java index 975ff72157..1d9546605c 100644 --- a/Mage/src/main/java/mage/watchers/common/CardsCycledOrDiscardedThisTurnWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CardsCycledOrDiscardedThisTurnWatcher.java @@ -49,7 +49,7 @@ public class CardsCycledOrDiscardedThisTurnWatcher extends Watcher { private final Map cycledOrDiscardedCardsThisTurn = new HashMap<>(); public CardsCycledOrDiscardedThisTurnWatcher() { - super(CardsCycledOrDiscardedThisTurnWatcher.class.getName(), WatcherScope.GAME); + super(CardsCycledOrDiscardedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME); } public CardsCycledOrDiscardedThisTurnWatcher(final CardsCycledOrDiscardedThisTurnWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/CardsDrawnDuringDrawStepWatcher.java b/Mage/src/main/java/mage/watchers/common/CardsDrawnDuringDrawStepWatcher.java index 59e9a91b77..33d421fe32 100644 --- a/Mage/src/main/java/mage/watchers/common/CardsDrawnDuringDrawStepWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CardsDrawnDuringDrawStepWatcher.java @@ -50,7 +50,7 @@ public class CardsDrawnDuringDrawStepWatcher extends Watcher { private final Map amountOfCardsDrawnThisTurn = new HashMap<>(); public CardsDrawnDuringDrawStepWatcher() { - super("CardsDrawnDuringDrawStep", WatcherScope.GAME); + super(CardsDrawnDuringDrawStepWatcher.class.getSimpleName(), WatcherScope.GAME); } public CardsDrawnDuringDrawStepWatcher(final CardsDrawnDuringDrawStepWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/CardsPutIntoGraveyardWatcher.java b/Mage/src/main/java/mage/watchers/common/CardsPutIntoGraveyardWatcher.java index 24957848cf..4371d4a5ea 100644 --- a/Mage/src/main/java/mage/watchers/common/CardsPutIntoGraveyardWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CardsPutIntoGraveyardWatcher.java @@ -55,7 +55,7 @@ public class CardsPutIntoGraveyardWatcher extends Watcher { private final Set cardsPutToGraveyardFromBattlefield = new HashSet<>(); public CardsPutIntoGraveyardWatcher() { - super("CardsPutIntoGraveyardWatcher", WatcherScope.GAME); + super(CardsPutIntoGraveyardWatcher.class.getSimpleName(), WatcherScope.GAME); } public CardsPutIntoGraveyardWatcher(final CardsPutIntoGraveyardWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/CastFromGraveyardWatcher.java b/Mage/src/main/java/mage/watchers/common/CastFromGraveyardWatcher.java index 7913fd121a..cb3418baf3 100644 --- a/Mage/src/main/java/mage/watchers/common/CastFromGraveyardWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CastFromGraveyardWatcher.java @@ -49,7 +49,7 @@ public class CastFromGraveyardWatcher extends Watcher { private final Map> spellsCastFromGraveyard = new HashMap<>(); public CastFromGraveyardWatcher() { - super(CastFromGraveyardWatcher.class.getName(), WatcherScope.GAME); + super(CastFromGraveyardWatcher.class.getSimpleName(), WatcherScope.GAME); } public CastFromGraveyardWatcher(final CastFromGraveyardWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/CastFromHandWatcher.java b/Mage/src/main/java/mage/watchers/common/CastFromHandWatcher.java index b52afa6ce8..7d79471dc1 100644 --- a/Mage/src/main/java/mage/watchers/common/CastFromHandWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CastFromHandWatcher.java @@ -19,7 +19,7 @@ public class CastFromHandWatcher extends Watcher { private Step step; public CastFromHandWatcher() { - super(CastFromHandWatcher.class.getName(), WatcherScope.GAME); + super(CastFromHandWatcher.class.getSimpleName(), WatcherScope.GAME); } public CastFromHandWatcher(final CastFromHandWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/CastSpellLastTurnWatcher.java b/Mage/src/main/java/mage/watchers/common/CastSpellLastTurnWatcher.java index 27193a9dda..5caf5a5d17 100644 --- a/Mage/src/main/java/mage/watchers/common/CastSpellLastTurnWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CastSpellLastTurnWatcher.java @@ -46,7 +46,7 @@ public class CastSpellLastTurnWatcher extends Watcher { private final List spellsCastThisTurnInOrder = new ArrayList<>(); public CastSpellLastTurnWatcher() { - super(CastSpellLastTurnWatcher.class.getName(), WatcherScope.GAME); + super(CastSpellLastTurnWatcher.class.getSimpleName(), WatcherScope.GAME); } public CastSpellLastTurnWatcher(final CastSpellLastTurnWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java b/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java index f6784b84c9..95ddc869d0 100644 --- a/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java @@ -54,7 +54,7 @@ public class CommanderInfoWatcher extends Watcher { public final boolean checkCommanderDamage; public CommanderInfoWatcher(UUID commander, boolean checkCommanderDamage) { - super("CommanderCombatDamageWatcher", WatcherScope.CARD); + super(CommanderInfoWatcher.class.getSimpleName(), WatcherScope.CARD); this.sourceId = commander; this.checkCommanderDamage = checkCommanderDamage; } diff --git a/Mage/src/main/java/mage/watchers/common/CreatureWasCastWatcher.java b/Mage/src/main/java/mage/watchers/common/CreatureWasCastWatcher.java index e42d17a714..493d88495d 100644 --- a/Mage/src/main/java/mage/watchers/common/CreatureWasCastWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CreatureWasCastWatcher.java @@ -49,7 +49,7 @@ public class CreatureWasCastWatcher extends Watcher { private final Set creaturesCasted = new HashSet<>(); public CreatureWasCastWatcher() { - super("CreatureWasCast", WatcherScope.GAME); + super(CreatureWasCastWatcher.class.getSimpleName(), WatcherScope.GAME); } public CreatureWasCastWatcher(final CreatureWasCastWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java b/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java index 5905a625dd..c3537ac1e7 100644 --- a/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java @@ -45,7 +45,7 @@ public class CreaturesDiedWatcher extends Watcher { private final HashMap amountOfCreaturesThatDiedByController = new HashMap<>(); public CreaturesDiedWatcher() { - super("CreaturesDiedWatcher", WatcherScope.GAME); + super(CreaturesDiedWatcher.class.getSimpleName(), WatcherScope.GAME); } public CreaturesDiedWatcher(final CreaturesDiedWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/DamageDoneWatcher.java b/Mage/src/main/java/mage/watchers/common/DamageDoneWatcher.java index d9df669f88..3247f2ed1d 100644 --- a/Mage/src/main/java/mage/watchers/common/DamageDoneWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/DamageDoneWatcher.java @@ -27,7 +27,7 @@ public class DamageDoneWatcher extends Watcher { public final Map damagedObjects; public DamageDoneWatcher() { - super("DamageDone", WatcherScope.GAME); + super(DamageDoneWatcher.class.getSimpleName(), WatcherScope.GAME); this.damagingObjects = new HashMap<>(); this.damagedObjects = new HashMap<>(); } diff --git a/Mage/src/main/java/mage/watchers/common/DamagedByWatcher.java b/Mage/src/main/java/mage/watchers/common/DamagedByWatcher.java index 00816564e9..712d76d781 100644 --- a/Mage/src/main/java/mage/watchers/common/DamagedByWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/DamagedByWatcher.java @@ -54,7 +54,7 @@ public class DamagedByWatcher extends Watcher { } public DamagedByWatcher(boolean watchPlaneswalkers) { - super("DamagedByWatcher", WatcherScope.CARD); + super(DamagedByWatcher.class.getSimpleName(), WatcherScope.CARD); this.watchPlaneswalkers = watchPlaneswalkers; } diff --git a/Mage/src/main/java/mage/watchers/common/DragonOnTheBattlefieldWhileSpellWasCastWatcher.java b/Mage/src/main/java/mage/watchers/common/DragonOnTheBattlefieldWhileSpellWasCastWatcher.java index 51110c72ca..ec06e94af3 100644 --- a/Mage/src/main/java/mage/watchers/common/DragonOnTheBattlefieldWhileSpellWasCastWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/DragonOnTheBattlefieldWhileSpellWasCastWatcher.java @@ -51,7 +51,7 @@ public class DragonOnTheBattlefieldWhileSpellWasCastWatcher extends Watcher { private final Set castWithDragonOnTheBattlefield = new HashSet<>(); public DragonOnTheBattlefieldWhileSpellWasCastWatcher() { - super("DragonOnTheBattlefieldWhileSpellWasCastWatcher", WatcherScope.GAME); + super(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName(), WatcherScope.GAME); } public DragonOnTheBattlefieldWhileSpellWasCastWatcher(final DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/FirstSpellCastThisTurnWatcher.java b/Mage/src/main/java/mage/watchers/common/FirstSpellCastThisTurnWatcher.java index 5fb2de58c2..db98da2824 100644 --- a/Mage/src/main/java/mage/watchers/common/FirstSpellCastThisTurnWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/FirstSpellCastThisTurnWatcher.java @@ -19,7 +19,7 @@ public class FirstSpellCastThisTurnWatcher extends Watcher { private final Map playerFirstCastSpell = new HashMap<>(); public FirstSpellCastThisTurnWatcher() { - super("FirstSpellCastThisTurn", WatcherScope.GAME); + super(FirstSpellCastThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME); } public FirstSpellCastThisTurnWatcher(final FirstSpellCastThisTurnWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/FirstTimeStepWatcher.java b/Mage/src/main/java/mage/watchers/common/FirstTimeStepWatcher.java index 303f4586a2..7fb74921a1 100644 --- a/Mage/src/main/java/mage/watchers/common/FirstTimeStepWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/FirstTimeStepWatcher.java @@ -44,7 +44,7 @@ public class FirstTimeStepWatcher extends Watcher { private final EventType eventType; public FirstTimeStepWatcher(EventType eventType) { - super(eventType.toString() + FirstTimeStepWatcher.class.getName(), WatcherScope.GAME); + super(eventType.toString() + FirstTimeStepWatcher.class.getSimpleName(), WatcherScope.GAME); this.eventType = eventType; } diff --git a/Mage/src/main/java/mage/watchers/common/GravestormWatcher.java b/Mage/src/main/java/mage/watchers/common/GravestormWatcher.java index 5d8d101421..a18e185a7c 100644 --- a/Mage/src/main/java/mage/watchers/common/GravestormWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/GravestormWatcher.java @@ -45,7 +45,7 @@ public class GravestormWatcher extends Watcher { private int gravestormCount = 0; public GravestormWatcher() { - super("GravestormWatcher", WatcherScope.GAME); + super(GravestormWatcher.class.getSimpleName(), WatcherScope.GAME); } public GravestormWatcher(final GravestormWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/LandfallWatcher.java b/Mage/src/main/java/mage/watchers/common/LandfallWatcher.java index 51748037c6..f006cef8a8 100644 --- a/Mage/src/main/java/mage/watchers/common/LandfallWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/LandfallWatcher.java @@ -19,7 +19,7 @@ public class LandfallWatcher extends Watcher { final Set playerPlayedLand = new HashSet<>(); public LandfallWatcher() { - super("LandPlayed", WatcherScope.GAME); + super(LandfallWatcher.class.getSimpleName(), WatcherScope.GAME); } public LandfallWatcher(final LandfallWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/LifeLossOtherFromCombatWatcher.java b/Mage/src/main/java/mage/watchers/common/LifeLossOtherFromCombatWatcher.java index ebf698bdd4..0418c8592c 100644 --- a/Mage/src/main/java/mage/watchers/common/LifeLossOtherFromCombatWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/LifeLossOtherFromCombatWatcher.java @@ -45,7 +45,7 @@ public class LifeLossOtherFromCombatWatcher extends Watcher { private final Set players = new HashSet<>(); public LifeLossOtherFromCombatWatcher() { - super(LifeLossOtherFromCombatWatcher.class.getName(), WatcherScope.GAME); + super(LifeLossOtherFromCombatWatcher.class.getSimpleName(), WatcherScope.GAME); } public LifeLossOtherFromCombatWatcher(final LifeLossOtherFromCombatWatcher watcher) { @@ -66,7 +66,7 @@ public class LifeLossOtherFromCombatWatcher extends Watcher { public boolean opponentLostLifeOtherFromCombat(UUID playerId, Game game) { Player player = game.getPlayer(playerId); if (player != null) { - if (players.stream().anyMatch((damagedPlayerId) -> (player.hasOpponent(damagedPlayerId, game)))) { + if (players.stream().anyMatch(damagedPlayerId -> player.hasOpponent(damagedPlayerId, game))) { return true; } } diff --git a/Mage/src/main/java/mage/watchers/common/ManaSpentToCastWatcher.java b/Mage/src/main/java/mage/watchers/common/ManaSpentToCastWatcher.java index d00e66597c..917ecbe737 100644 --- a/Mage/src/main/java/mage/watchers/common/ManaSpentToCastWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/ManaSpentToCastWatcher.java @@ -46,7 +46,7 @@ public class ManaSpentToCastWatcher extends Watcher { Mana payment = null; public ManaSpentToCastWatcher() { - super("ManaSpentToCast", WatcherScope.CARD); + super(ManaSpentToCastWatcher.class.getSimpleName(), WatcherScope.CARD); } public ManaSpentToCastWatcher(final ManaSpentToCastWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/MiracleWatcher.java b/Mage/src/main/java/mage/watchers/common/MiracleWatcher.java index a3a966bd78..b4272671cb 100644 --- a/Mage/src/main/java/mage/watchers/common/MiracleWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/MiracleWatcher.java @@ -55,7 +55,7 @@ public class MiracleWatcher extends Watcher { private final Map amountOfCardsDrawnThisTurn = new HashMap<>(); public MiracleWatcher() { - super("MiracleWatcher", WatcherScope.GAME); + super(MiracleWatcher.class.getSimpleName(), WatcherScope.GAME); } public MiracleWatcher(final MiracleWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/MorbidWatcher.java b/Mage/src/main/java/mage/watchers/common/MorbidWatcher.java index e1df966f92..d69521a799 100644 --- a/Mage/src/main/java/mage/watchers/common/MorbidWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/MorbidWatcher.java @@ -44,7 +44,7 @@ import mage.watchers.Watcher; public class MorbidWatcher extends Watcher { public MorbidWatcher() { - super("Morbid", WatcherScope.GAME); + super(MorbidWatcher.class.getSimpleName(), WatcherScope.GAME); } public MorbidWatcher(final MorbidWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/NumberOfTimesPermanentTargetedATurnWatcher.java b/Mage/src/main/java/mage/watchers/common/NumberOfTimesPermanentTargetedATurnWatcher.java index b2ba609b06..1d7720e4e5 100644 --- a/Mage/src/main/java/mage/watchers/common/NumberOfTimesPermanentTargetedATurnWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/NumberOfTimesPermanentTargetedATurnWatcher.java @@ -46,7 +46,7 @@ public class NumberOfTimesPermanentTargetedATurnWatcher extends Watcher { private final Map permanentsTargeted = new HashMap<>(); public NumberOfTimesPermanentTargetedATurnWatcher() { - super(NumberOfTimesPermanentTargetedATurnWatcher.class.getName(), WatcherScope.GAME); + super(NumberOfTimesPermanentTargetedATurnWatcher.class.getSimpleName(), WatcherScope.GAME); } public NumberOfTimesPermanentTargetedATurnWatcher(final NumberOfTimesPermanentTargetedATurnWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/PermanentsEnteredBattlefieldWatcher.java b/Mage/src/main/java/mage/watchers/common/PermanentsEnteredBattlefieldWatcher.java index f73cd79471..7fdefbe7cb 100644 --- a/Mage/src/main/java/mage/watchers/common/PermanentsEnteredBattlefieldWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/PermanentsEnteredBattlefieldWatcher.java @@ -25,7 +25,7 @@ public class PermanentsEnteredBattlefieldWatcher extends Watcher { private final HashMap> enteringBattlefieldLastTurn = new HashMap<>(); public PermanentsEnteredBattlefieldWatcher() { - super(PermanentsEnteredBattlefieldWatcher.class.getName(), WatcherScope.GAME); + super(PermanentsEnteredBattlefieldWatcher.class.getSimpleName(), WatcherScope.GAME); } public PermanentsEnteredBattlefieldWatcher(final PermanentsEnteredBattlefieldWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/PermanentsSacrificedWatcher.java b/Mage/src/main/java/mage/watchers/common/PermanentsSacrificedWatcher.java index e5cb931e49..9e8119c4db 100644 --- a/Mage/src/main/java/mage/watchers/common/PermanentsSacrificedWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/PermanentsSacrificedWatcher.java @@ -24,7 +24,7 @@ public class PermanentsSacrificedWatcher extends Watcher { private final HashMap> sacrificedPermanents = new HashMap<>(); public PermanentsSacrificedWatcher() { - super(PermanentsSacrificedWatcher.class.getName(), WatcherScope.GAME); + super(PermanentsSacrificedWatcher.class.getSimpleName(), WatcherScope.GAME); } public PermanentsSacrificedWatcher(final PermanentsSacrificedWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/PlayerAttackedWatcher.java b/Mage/src/main/java/mage/watchers/common/PlayerAttackedWatcher.java index 434cbb2dc9..8937f34fb4 100644 --- a/Mage/src/main/java/mage/watchers/common/PlayerAttackedWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/PlayerAttackedWatcher.java @@ -47,7 +47,7 @@ public class PlayerAttackedWatcher extends Watcher { private final Map playerAttacked = new HashMap<>(); public PlayerAttackedWatcher() { - super("PlayerAttackedWatcher", WatcherScope.GAME); + super(PlayerAttackedWatcher.class.getSimpleName(), WatcherScope.GAME); } public PlayerAttackedWatcher(final PlayerAttackedWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/PlayerCastCreatureWatcher.java b/Mage/src/main/java/mage/watchers/common/PlayerCastCreatureWatcher.java index d5fc443f1c..e452076b71 100644 --- a/Mage/src/main/java/mage/watchers/common/PlayerCastCreatureWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/PlayerCastCreatureWatcher.java @@ -46,7 +46,7 @@ public class PlayerCastCreatureWatcher extends Watcher { final Set playerIds = new HashSet<>(); public PlayerCastCreatureWatcher() { - super("PlayerCastCreature", WatcherScope.GAME); + super(PlayerCastCreatureWatcher.class.getSimpleName(), WatcherScope.GAME); } public PlayerCastCreatureWatcher(final PlayerCastCreatureWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/PlayerDamagedBySourceWatcher.java b/Mage/src/main/java/mage/watchers/common/PlayerDamagedBySourceWatcher.java index 73020e7a5d..3f9349359a 100644 --- a/Mage/src/main/java/mage/watchers/common/PlayerDamagedBySourceWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/PlayerDamagedBySourceWatcher.java @@ -47,7 +47,7 @@ public class PlayerDamagedBySourceWatcher extends Watcher { private final Set damageSourceIds = new HashSet<>(); public PlayerDamagedBySourceWatcher(UUID playerId) { - super("PlayerDamagedBySource", WatcherScope.PLAYER); + super(PlayerLostLifeWatcher.class.getSimpleName(), WatcherScope.PLAYER); setControllerId(playerId); } diff --git a/Mage/src/main/java/mage/watchers/common/PlayerGainedLifeWatcher.java b/Mage/src/main/java/mage/watchers/common/PlayerGainedLifeWatcher.java index 8e9839e3fa..c6a7d28ceb 100644 --- a/Mage/src/main/java/mage/watchers/common/PlayerGainedLifeWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/PlayerGainedLifeWatcher.java @@ -47,7 +47,7 @@ public class PlayerGainedLifeWatcher extends Watcher { private final Map amountOfLifeGainedThisTurn = new HashMap<>(); public PlayerGainedLifeWatcher() { - super(PlayerGainedLifeWatcher.class.getName(), WatcherScope.GAME); + super(PlayerGainedLifeWatcher.class.getSimpleName(), WatcherScope.GAME); } public PlayerGainedLifeWatcher(final PlayerGainedLifeWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/PlayerLostLifeWatcher.java b/Mage/src/main/java/mage/watchers/common/PlayerLostLifeWatcher.java index 44db03d8bb..c0fd33b991 100644 --- a/Mage/src/main/java/mage/watchers/common/PlayerLostLifeWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/PlayerLostLifeWatcher.java @@ -48,7 +48,7 @@ public class PlayerLostLifeWatcher extends Watcher { private final Map amountOfLifeLostLastTurn = new HashMap<>(); public PlayerLostLifeWatcher() { - super("PlayerLostLifeWatcher", WatcherScope.GAME); + super(PlayerLostLifeWatcher.class.getSimpleName(), WatcherScope.GAME); } public PlayerLostLifeWatcher(final PlayerLostLifeWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/ProwlWatcher.java b/Mage/src/main/java/mage/watchers/common/ProwlWatcher.java index 7f6d5f86f8..e61ea01bb0 100644 --- a/Mage/src/main/java/mage/watchers/common/ProwlWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/ProwlWatcher.java @@ -55,7 +55,7 @@ public class ProwlWatcher extends Watcher { private final Set allSubtypes = new HashSet<>(); public ProwlWatcher() { - super("Prowl", WatcherScope.GAME); + super(ProwlWatcher.class.getSimpleName(), WatcherScope.GAME); } public ProwlWatcher(final ProwlWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/RevoltWatcher.java b/Mage/src/main/java/mage/watchers/common/RevoltWatcher.java index 63f9d33717..a7a4824d47 100644 --- a/Mage/src/main/java/mage/watchers/common/RevoltWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/RevoltWatcher.java @@ -48,7 +48,7 @@ public class RevoltWatcher extends Watcher { private final Set revoltActivePlayerIds = new HashSet<>(0); public RevoltWatcher() { - super(RevoltWatcher.class.getName(), WatcherScope.GAME); + super(RevoltWatcher.class.getSimpleName(), WatcherScope.GAME); } public RevoltWatcher(final RevoltWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/SourceDidDamageWatcher.java b/Mage/src/main/java/mage/watchers/common/SourceDidDamageWatcher.java index 4c5ee497b5..6c0c810799 100644 --- a/Mage/src/main/java/mage/watchers/common/SourceDidDamageWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/SourceDidDamageWatcher.java @@ -45,7 +45,7 @@ public class SourceDidDamageWatcher extends Watcher { public final Set damageSources = new HashSet<>(); public SourceDidDamageWatcher() { - super("SourceDidDamageWatcher", WatcherScope.GAME); + super(SourceDidDamageWatcher.class.getSimpleName(), WatcherScope.GAME); } public SourceDidDamageWatcher(final SourceDidDamageWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/SpellsCastWatcher.java b/Mage/src/main/java/mage/watchers/common/SpellsCastWatcher.java index e0de2c9c8f..34c2fcd1ae 100644 --- a/Mage/src/main/java/mage/watchers/common/SpellsCastWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/SpellsCastWatcher.java @@ -27,7 +27,7 @@ public class SpellsCastWatcher extends Watcher { private final HashMap> spellsCast = new HashMap<>(); public SpellsCastWatcher() { - super(SpellsCastWatcher.class.getName(), WatcherScope.GAME); + super(SpellsCastWatcher.class.getSimpleName(), WatcherScope.GAME); } public SpellsCastWatcher(final SpellsCastWatcher watcher) { diff --git a/Mage/src/main/java/mage/watchers/common/ZuberasDiedWatcher.java b/Mage/src/main/java/mage/watchers/common/ZuberasDiedWatcher.java index b82811661c..b3e3bcfea9 100644 --- a/Mage/src/main/java/mage/watchers/common/ZuberasDiedWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/ZuberasDiedWatcher.java @@ -16,7 +16,7 @@ public class ZuberasDiedWatcher extends Watcher { public int zuberasDiedThisTurn = 0; public ZuberasDiedWatcher() { - super("ZuberasDied", WatcherScope.GAME); + super(ZuberasDiedWatcher.class.getSimpleName(), WatcherScope.GAME); } public ZuberasDiedWatcher(final ZuberasDiedWatcher watcher) {