changed the constructor for a Watcher. Before, you had to explictly pass the name of the watcher as an argument. But most of the time this was the name of the class itself. So the watcher now determines internally its name. The method 'getBasicKey' can be overridden. Also updated some encapsulation

This commit is contained in:
Ingmar Goudt 2019-03-16 08:35:26 +01:00
parent 5c1f41f3a7
commit c4eeec1bb2
178 changed files with 313 additions and 296 deletions

View file

@ -135,7 +135,7 @@ class AbandonedSarcophagusWatcher extends Watcher {
private final Map<UUID, Cards> cycledCardsThisTurn = new HashMap<>(); private final Map<UUID, Cards> cycledCardsThisTurn = new HashMap<>();
AbandonedSarcophagusWatcher() { AbandonedSarcophagusWatcher() {
super(AbandonedSarcophagusWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
private AbandonedSarcophagusWatcher(final AbandonedSarcophagusWatcher watcher) { private AbandonedSarcophagusWatcher(final AbandonedSarcophagusWatcher watcher) {

View file

@ -71,7 +71,7 @@ class DamagedByPiratesWatcher extends Watcher {
private final Map<UUID, Set<UUID>> damageSourceIds = new HashMap<>(); private final Map<UUID, Set<UUID>> damageSourceIds = new HashMap<>();
public DamagedByPiratesWatcher() { public DamagedByPiratesWatcher() {
super(DamagedByPiratesWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
private DamagedByPiratesWatcher(final DamagedByPiratesWatcher watcher) { private DamagedByPiratesWatcher(final DamagedByPiratesWatcher watcher) {

View file

@ -96,7 +96,7 @@ class ApproachOfTheSecondSunWatcher extends Watcher {
private Map<UUID, Integer> approachesCast = new HashMap<>(); private Map<UUID, Integer> approachesCast = new HashMap<>();
public ApproachOfTheSecondSunWatcher() { public ApproachOfTheSecondSunWatcher() {
super(ApproachOfTheSecondSunWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public ApproachOfTheSecondSunWatcher(final ApproachOfTheSecondSunWatcher watcher) { public ApproachOfTheSecondSunWatcher(final ApproachOfTheSecondSunWatcher watcher) {

View file

@ -54,7 +54,7 @@ class ArchiveTrapWatcher extends Watcher {
private Set<UUID> playerIds = new HashSet<>(); private Set<UUID> playerIds = new HashSet<>();
public ArchiveTrapWatcher() { public ArchiveTrapWatcher() {
super(ArchiveTrapWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
private ArchiveTrapWatcher(final ArchiveTrapWatcher watcher) { private ArchiveTrapWatcher(final ArchiveTrapWatcher watcher) {

View file

@ -84,7 +84,7 @@ class ArclightPhoenixWatcher extends Watcher {
private final Map<UUID, Integer> instantSorceryCount = new HashMap<>(); private final Map<UUID, Integer> instantSorceryCount = new HashMap<>();
public ArclightPhoenixWatcher() { public ArclightPhoenixWatcher() {
super(ArclightPhoenixWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public ArclightPhoenixWatcher(final ArclightPhoenixWatcher watcher) { public ArclightPhoenixWatcher(final ArclightPhoenixWatcher watcher) {

View file

@ -56,7 +56,7 @@ class AsmiraHolyAvengerWatcher extends Watcher {
private int creaturesCount = 0; private int creaturesCount = 0;
public AsmiraHolyAvengerWatcher() { public AsmiraHolyAvengerWatcher() {
super(AsmiraHolyAvengerWatcher.class.getSimpleName(), WatcherScope.PLAYER); super(WatcherScope.PLAYER);
condition = true; condition = true;
} }

View file

@ -172,7 +172,7 @@ class AureliasFuryDamagedByWatcher extends Watcher {
private final Set<UUID> damagedPlayers = new HashSet<>(); private final Set<UUID> damagedPlayers = new HashSet<>();
AureliasFuryDamagedByWatcher() { AureliasFuryDamagedByWatcher() {
super(AureliasFuryDamagedByWatcher.class.getSimpleName(), WatcherScope.CARD); super(WatcherScope.CARD);
} }
private AureliasFuryDamagedByWatcher(final AureliasFuryDamagedByWatcher watcher) { private AureliasFuryDamagedByWatcher(final AureliasFuryDamagedByWatcher watcher) {

View file

@ -96,7 +96,7 @@ class BerserkReplacementEffect extends ContinuousRuleModifyingEffectImpl {
class CombatDamageStepStartedWatcher extends Watcher { class CombatDamageStepStartedWatcher extends Watcher {
public CombatDamageStepStartedWatcher() { public CombatDamageStepStartedWatcher() {
super(CombatDamageStepStartedWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public CombatDamageStepStartedWatcher(final CombatDamageStepStartedWatcher watcher) { public CombatDamageStepStartedWatcher(final CombatDamageStepStartedWatcher watcher) {

View file

@ -81,10 +81,10 @@ enum BlazingEffigyCount implements DynamicValue {
class BlazingEffigyWatcher extends Watcher { class BlazingEffigyWatcher extends Watcher {
public final Map<MageObjectReference, Integer> damagedObjects = new HashMap<>(); private final Map<MageObjectReference, Integer> damagedObjects = new HashMap<>();
public BlazingEffigyWatcher() { public BlazingEffigyWatcher() {
super(BlazingEffigyWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public BlazingEffigyWatcher(final BlazingEffigyWatcher watcher) { public BlazingEffigyWatcher(final BlazingEffigyWatcher watcher) {

View file

@ -62,7 +62,7 @@ class BoseijuWhoSheltersAllWatcher extends Watcher {
private final String originalId; private final String originalId;
public BoseijuWhoSheltersAllWatcher(UUID originalId) { public BoseijuWhoSheltersAllWatcher(UUID originalId) {
super(BoseijuWhoSheltersAllWatcher.class, WatcherScope.CARD); super(WatcherScope.CARD);
this.originalId = originalId.toString(); this.originalId = originalId.toString();
} }

View file

@ -201,7 +201,7 @@ class BurningCinderFuryOfCrimsonChaosFireWatcher extends Watcher {
private final Set<UUID> tappedActivePlayerIds = new HashSet<>(); private final Set<UUID> tappedActivePlayerIds = new HashSet<>();
public BurningCinderFuryOfCrimsonChaosFireWatcher() { public BurningCinderFuryOfCrimsonChaosFireWatcher() {
super(BurningCinderFuryOfCrimsonChaosFireWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public BurningCinderFuryOfCrimsonChaosFireWatcher(final BurningCinderFuryOfCrimsonChaosFireWatcher watcher) { public BurningCinderFuryOfCrimsonChaosFireWatcher(final BurningCinderFuryOfCrimsonChaosFireWatcher watcher) {

View file

@ -60,7 +60,7 @@ class CallerOfTheClawWatcher extends Watcher {
private int creaturesCount = 0; private int creaturesCount = 0;
public CallerOfTheClawWatcher() { public CallerOfTheClawWatcher() {
super(CallerOfTheClawWatcher.class.getSimpleName(), WatcherScope.PLAYER); super(WatcherScope.PLAYER);
condition = true; condition = true;
} }

View file

@ -111,7 +111,7 @@ class CathedralMembraneWatcher extends Watcher {
private final Set<UUID> blockedCreatures = new HashSet<>(); private final Set<UUID> blockedCreatures = new HashSet<>();
CathedralMembraneWatcher() { CathedralMembraneWatcher() {
super(CathedralMembraneWatcher.class.getSimpleName(), WatcherScope.CARD); super(WatcherScope.CARD);
} }
private CathedralMembraneWatcher(final CathedralMembraneWatcher watcher) { private CathedralMembraneWatcher(final CathedralMembraneWatcher watcher) {

View file

@ -125,7 +125,7 @@ class CavernOfSoulsWatcher extends Watcher {
private final String originalId; private final String originalId;
public CavernOfSoulsWatcher(UUID originalId) { public CavernOfSoulsWatcher(UUID originalId) {
super(CavernOfSoulsWatcher.class.getSimpleName(), WatcherScope.CARD); super(WatcherScope.CARD);
this.originalId = originalId.toString(); this.originalId = originalId.toString();
} }

View file

@ -81,7 +81,7 @@ class CerebralVortexWatcher extends Watcher {
private final Map<UUID, Integer> draws = new HashMap<>(); private final Map<UUID, Integer> draws = new HashMap<>();
CerebralVortexWatcher() { CerebralVortexWatcher() {
super(CerebralVortexWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
CerebralVortexWatcher(final CerebralVortexWatcher watcher) { CerebralVortexWatcher(final CerebralVortexWatcher watcher) {

View file

@ -68,10 +68,10 @@ enum CobraTrapCondition implements Condition {
class CobraTrapWatcher extends Watcher { class CobraTrapWatcher extends Watcher {
Set<UUID> players = new HashSet<>(); private Set<UUID> players = new HashSet<>();
public CobraTrapWatcher() { public CobraTrapWatcher() {
super(CobraTrapWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public CobraTrapWatcher(final CobraTrapWatcher watcher) { public CobraTrapWatcher(final CobraTrapWatcher watcher) {

View file

@ -74,7 +74,7 @@ class ConduitOfRuinWatcher extends Watcher {
private Map<UUID, Integer> playerCreatureSpells; private Map<UUID, Integer> playerCreatureSpells;
public ConduitOfRuinWatcher() { public ConduitOfRuinWatcher() {
super(ConduitOfRuinWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
playerCreatureSpells = new HashMap<>(); playerCreatureSpells = new HashMap<>();
} }

View file

@ -122,7 +122,7 @@ class CorrosiveOozeCombatWatcher extends Watcher {
private final Map<MageObjectReference, Set<MageObjectReference>> oozeEquipmentsToDestroy = new HashMap<>(); private final Map<MageObjectReference, Set<MageObjectReference>> oozeEquipmentsToDestroy = new HashMap<>();
public CorrosiveOozeCombatWatcher() { public CorrosiveOozeCombatWatcher() {
super(CorrosiveOozeCombatWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public CorrosiveOozeCombatWatcher(final CorrosiveOozeCombatWatcher watcher) { public CorrosiveOozeCombatWatcher(final CorrosiveOozeCombatWatcher watcher) {
@ -132,7 +132,7 @@ class CorrosiveOozeCombatWatcher extends Watcher {
oozeBlocksOrBlocked.put(entry.getKey(), newSet); oozeBlocksOrBlocked.put(entry.getKey(), newSet);
} }
for (Map.Entry<MageObjectReference, Set<MageObjectReference>> entry : watcher.oozeEquipmentsToDestroy.entrySet()) { for (Map.Entry<MageObjectReference, Set<MageObjectReference>> entry : watcher.oozeEquipmentsToDestroy.entrySet()) {
HashSet<MageObjectReference> newSet = new HashSet<>(entry.getValue()); Set<MageObjectReference> newSet = new HashSet<>(entry.getValue());
oozeEquipmentsToDestroy.put(entry.getKey(), newSet); oozeEquipmentsToDestroy.put(entry.getKey(), newSet);
} }
} }

View file

@ -25,10 +25,7 @@ import mage.target.common.TargetCardInYourGraveyard;
import mage.target.targetadjustment.TargetAdjuster; import mage.target.targetadjustment.TargetAdjuster;
import mage.watchers.Watcher; import mage.watchers.Watcher;
import java.util.HashMap; import java.util.*;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/** /**
* @author L_J * @author L_J
@ -83,10 +80,10 @@ enum CustodiSoulcallerAdjuster implements TargetAdjuster {
class CustodiSoulcallerWatcher extends Watcher { class CustodiSoulcallerWatcher extends Watcher {
private final HashMap<UUID, Set<UUID>> playersAttacked = new HashMap<>(0); private final Map<UUID, Set<UUID>> playersAttacked = new HashMap<>(0);
CustodiSoulcallerWatcher() { CustodiSoulcallerWatcher() {
super("CustodiSoulcallerWatcher", WatcherScope.GAME); super(WatcherScope.GAME);
} }
CustodiSoulcallerWatcher(final CustodiSoulcallerWatcher watcher) { CustodiSoulcallerWatcher(final CustodiSoulcallerWatcher watcher) {

View file

@ -190,7 +190,7 @@ class CyclopeanTombCounterWatcher extends Watcher {
private final Map<MageObjectReference, Set<MageObjectReference>> counterData = new HashMap<>(); private final Map<MageObjectReference, Set<MageObjectReference>> counterData = new HashMap<>();
CyclopeanTombCounterWatcher() { CyclopeanTombCounterWatcher() {
super(CyclopeanTombCounterWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
private CyclopeanTombCounterWatcher(final CyclopeanTombCounterWatcher watcher) { private CyclopeanTombCounterWatcher(final CyclopeanTombCounterWatcher watcher) {

View file

@ -85,7 +85,7 @@ class DarkbladeAgentWatcher extends Watcher {
private final Set<UUID> surveiledThisTurn = new HashSet<>(); private final Set<UUID> surveiledThisTurn = new HashSet<>();
public DarkbladeAgentWatcher() { public DarkbladeAgentWatcher() {
super(DarkbladeAgentWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public DarkbladeAgentWatcher(final DarkbladeAgentWatcher watcher) { public DarkbladeAgentWatcher(final DarkbladeAgentWatcher watcher) {

View file

@ -106,7 +106,7 @@ class DesolationWatcher extends Watcher {
private final Set<UUID> tappedForManaThisTurnPlayers = new HashSet<>(); private final Set<UUID> tappedForManaThisTurnPlayers = new HashSet<>();
public DesolationWatcher() { public DesolationWatcher() {
super(DesolationWatcher.class.getSimpleName(), WatcherScope.GAME); super( WatcherScope.GAME);
} }
public DesolationWatcher(final DesolationWatcher watcher) { public DesolationWatcher(final DesolationWatcher watcher) {

View file

@ -137,7 +137,7 @@ class DiseasedVerminWatcher extends Watcher {
private final Set<UUID> damagedPlayers; private final Set<UUID> damagedPlayers;
public DiseasedVerminWatcher() { public DiseasedVerminWatcher() {
super(DiseasedVerminWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
damagedPlayers = new HashSet<>(); damagedPlayers = new HashSet<>();
} }

View file

@ -49,7 +49,7 @@ class CardsDiscardedThisTurnWatcher extends Watcher {
private final Map<UUID, Integer> amountOfCardsDiscardedThisTurn = new HashMap<>(); private final Map<UUID, Integer> amountOfCardsDiscardedThisTurn = new HashMap<>();
public CardsDiscardedThisTurnWatcher() { public CardsDiscardedThisTurnWatcher() {
super(CardsDiscardedThisTurnWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public CardsDiscardedThisTurnWatcher(final CardsDiscardedThisTurnWatcher watcher) { public CardsDiscardedThisTurnWatcher(final CardsDiscardedThisTurnWatcher watcher) {

View file

@ -131,7 +131,7 @@ class DungeonGeistsEffect extends ContinuousRuleModifyingEffectImpl {
class DungeonGeistsWatcher extends Watcher { class DungeonGeistsWatcher extends Watcher {
DungeonGeistsWatcher() { DungeonGeistsWatcher() {
super("ControlLost", WatcherScope.CARD); super(WatcherScope.CARD);
} }
DungeonGeistsWatcher(DungeonGeistsWatcher watcher) { DungeonGeistsWatcher(DungeonGeistsWatcher watcher) {

View file

@ -86,7 +86,7 @@ class InvestigatedWatcher extends Watcher {
private final Map<UUID, Integer> timesInvestigated = new HashMap<>(); private final Map<UUID, Integer> timesInvestigated = new HashMap<>();
public InvestigatedWatcher() { public InvestigatedWatcher() {
super(InvestigatedWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public InvestigatedWatcher(final InvestigatedWatcher watcher) { public InvestigatedWatcher(final InvestigatedWatcher watcher) {

View file

@ -51,7 +51,7 @@ class EtherswornCanonistWatcher extends Watcher {
private Set<UUID> castNonartifactSpell = new HashSet<>(); private Set<UUID> castNonartifactSpell = new HashSet<>();
public EtherswornCanonistWatcher() { public EtherswornCanonistWatcher() {
super(EtherswornCanonistWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public EtherswornCanonistWatcher(final EtherswornCanonistWatcher watcher) { public EtherswornCanonistWatcher(final EtherswornCanonistWatcher watcher) {

View file

@ -73,7 +73,7 @@ class FairgroundsTrumpeterWatcher extends Watcher {
private final Set<UUID> players = new HashSet<>(); private final Set<UUID> players = new HashSet<>();
public FairgroundsTrumpeterWatcher() { public FairgroundsTrumpeterWatcher() {
super(FairgroundsTrumpeterWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public FairgroundsTrumpeterWatcher(final FairgroundsTrumpeterWatcher watcher) { public FairgroundsTrumpeterWatcher(final FairgroundsTrumpeterWatcher watcher) {

View file

@ -80,7 +80,7 @@ class FaithsRewardWatcher extends Watcher {
private List<UUID> cards = new ArrayList<>(); private List<UUID> cards = new ArrayList<>();
public FaithsRewardWatcher() { public FaithsRewardWatcher() {
super(FaithsRewardWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public FaithsRewardWatcher(final FaithsRewardWatcher watcher) { public FaithsRewardWatcher(final FaithsRewardWatcher watcher) {

View file

@ -65,7 +65,7 @@ class FellShepherdWatcher extends Watcher {
private Set<UUID> creatureIds = new HashSet<>(); private Set<UUID> creatureIds = new HashSet<>();
public FellShepherdWatcher() { public FellShepherdWatcher() {
super(FellShepherdWatcher.class, WatcherScope.PLAYER); super(WatcherScope.PLAYER);
condition = true; condition = true;
} }

View file

@ -57,7 +57,7 @@ class FleshAllergyWatcher extends Watcher {
private int creaturesDiedThisTurn = 0; private int creaturesDiedThisTurn = 0;
public FleshAllergyWatcher() { public FleshAllergyWatcher() {
super(FleshAllergyWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
private FleshAllergyWatcher(final FleshAllergyWatcher watcher) { private FleshAllergyWatcher(final FleshAllergyWatcher watcher) {

View file

@ -98,7 +98,7 @@ class FreeRangeChickenWatcher extends Watcher {
private final Map<UUID, Integer> totalRolls = new HashMap<>(); private final Map<UUID, Integer> totalRolls = new HashMap<>();
public FreeRangeChickenWatcher() { public FreeRangeChickenWatcher() {
super(FreeRangeChickenWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public FreeRangeChickenWatcher(final FreeRangeChickenWatcher watcher) { public FreeRangeChickenWatcher(final FreeRangeChickenWatcher watcher) {

View file

@ -109,7 +109,7 @@ class GarnaTheBloodflameWatcher extends Watcher {
private final Set<UUID> cards = new HashSet<>(); private final Set<UUID> cards = new HashSet<>();
public GarnaTheBloodflameWatcher() { public GarnaTheBloodflameWatcher() {
super(GarnaTheBloodflameWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public GarnaTheBloodflameWatcher(final GarnaTheBloodflameWatcher watcher) { public GarnaTheBloodflameWatcher(final GarnaTheBloodflameWatcher watcher) {

View file

@ -63,7 +63,7 @@ class GeneratorServantWatcher extends Watcher {
private List<UUID> creatures = new ArrayList<>(); private List<UUID> creatures = new ArrayList<>();
public GeneratorServantWatcher() { public GeneratorServantWatcher() {
super(GeneratorServantWatcher.class, WatcherScope.CARD); super(WatcherScope.CARD);
} }
private GeneratorServantWatcher(final GeneratorServantWatcher watcher) { private GeneratorServantWatcher(final GeneratorServantWatcher watcher) {

View file

@ -133,7 +133,7 @@ class GisaAndGeralfWatcher extends Watcher {
private boolean abilityUsed = false; private boolean abilityUsed = false;
GisaAndGeralfWatcher() { GisaAndGeralfWatcher() {
super("GisaAndGeralfWatcher", WatcherScope.CARD); super(WatcherScope.CARD);
} }
GisaAndGeralfWatcher(final GisaAndGeralfWatcher watcher) { GisaAndGeralfWatcher(final GisaAndGeralfWatcher watcher) {

View file

@ -120,7 +120,7 @@ class BlockedByWatcher extends Watcher {
private List<UUID> blockedByWatcher = new ArrayList<>(); private List<UUID> blockedByWatcher = new ArrayList<>();
public BlockedByWatcher() { public BlockedByWatcher() {
super(BlockedByWatcher.class.getSimpleName(), WatcherScope.CARD); super(WatcherScope.CARD);
} }
private BlockedByWatcher(final BlockedByWatcher watcher) { private BlockedByWatcher(final BlockedByWatcher watcher) {

View file

@ -97,7 +97,7 @@ class GontisMachinationsFirstLostLifeThisTurnWatcher extends Watcher {
private final Map<UUID, Integer> playersLostLife = new HashMap<>(); private final Map<UUID, Integer> playersLostLife = new HashMap<>();
public GontisMachinationsFirstLostLifeThisTurnWatcher() { public GontisMachinationsFirstLostLifeThisTurnWatcher() {
super(GontisMachinationsFirstLostLifeThisTurnWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public GontisMachinationsFirstLostLifeThisTurnWatcher(final GontisMachinationsFirstLostLifeThisTurnWatcher watcher) { public GontisMachinationsFirstLostLifeThisTurnWatcher(final GontisMachinationsFirstLostLifeThisTurnWatcher watcher) {

View file

@ -62,10 +62,10 @@ public final class GrandWarlordRadha extends CardImpl {
class CreaturesAttackedWatcher extends Watcher { class CreaturesAttackedWatcher extends Watcher {
public final Set<MageObjectReference> attackedThisTurnCreatures = new HashSet<>(); private final Set<MageObjectReference> attackedThisTurnCreatures = new HashSet<>();
public CreaturesAttackedWatcher() { public CreaturesAttackedWatcher() {
super(CreaturesAttackedWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public CreaturesAttackedWatcher(final CreaturesAttackedWatcher watcher) { public CreaturesAttackedWatcher(final CreaturesAttackedWatcher watcher) {

View file

@ -116,7 +116,7 @@ class GrimReminderWatcher extends Watcher {
private final Map<String, Set<UUID>> playersCastSpell = new HashMap<>(); private final Map<String, Set<UUID>> playersCastSpell = new HashMap<>();
public GrimReminderWatcher() { public GrimReminderWatcher() {
super(GrimReminderWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public GrimReminderWatcher(final GrimReminderWatcher watcher) { public GrimReminderWatcher(final GrimReminderWatcher watcher) {

View file

@ -171,7 +171,7 @@ class GrothamaAllDevouringWatcher extends Watcher {
private Map<MageObjectReference, Map<UUID, Integer>> damageMap = new HashMap<>(); private Map<MageObjectReference, Map<UUID, Integer>> damageMap = new HashMap<>();
GrothamaAllDevouringWatcher() { GrothamaAllDevouringWatcher() {
super(GrothamaAllDevouringWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
GrothamaAllDevouringWatcher(final GrothamaAllDevouringWatcher watcher) { GrothamaAllDevouringWatcher(final GrothamaAllDevouringWatcher watcher) {

View file

@ -58,7 +58,7 @@ class GuildmagesForumWatcher extends Watcher {
private final Ability source; private final Ability source;
GuildmagesForumWatcher(Ability source) { GuildmagesForumWatcher(Ability source) {
super("GuildmagesForumWatcher", WatcherScope.CARD); super(WatcherScope.CARD);
this.source = source; this.source = source;
} }

View file

@ -66,7 +66,7 @@ class HallOfTheBanditLordWatcher extends Watcher {
private final List<UUID> creatures = new ArrayList<>(); private final List<UUID> creatures = new ArrayList<>();
HallOfTheBanditLordWatcher(Ability source) { HallOfTheBanditLordWatcher(Ability source) {
super("HallOfTheBanditLordWatcher", WatcherScope.CARD); super(WatcherScope.CARD);
this.source = source; this.source = source;
} }

View file

@ -8,7 +8,7 @@ import mage.watchers.Watcher;
public class HomicidalBruteWatcher extends Watcher { public class HomicidalBruteWatcher extends Watcher {
public HomicidalBruteWatcher() { public HomicidalBruteWatcher() {
super(HomicidalBruteWatcher.class.getSimpleName(), WatcherScope.CARD); super(WatcherScope.CARD);
} }
public HomicidalBruteWatcher(final HomicidalBruteWatcher watcher) { public HomicidalBruteWatcher(final HomicidalBruteWatcher watcher) {

View file

@ -1,10 +1,8 @@
package mage.cards.h; package mage.cards.h;
import java.util.HashMap; import java.util.*;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.MageObjectReference; import mage.MageObjectReference;
@ -138,10 +136,10 @@ class HopeOfGhirapurPlayerLostLifePredicate implements ObjectSourcePlayerPredica
class HopeOfGhirapurCombatDamageWatcher extends Watcher { class HopeOfGhirapurCombatDamageWatcher extends Watcher {
private final HashMap<MageObjectReference, Set<UUID>> combatDamagedPlayers = new HashMap<>(); private final Map<MageObjectReference, Set<UUID>> combatDamagedPlayers = new HashMap<>();
public HopeOfGhirapurCombatDamageWatcher() { public HopeOfGhirapurCombatDamageWatcher() {
super(HopeOfGhirapurCombatDamageWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public HopeOfGhirapurCombatDamageWatcher(final HopeOfGhirapurCombatDamageWatcher watcher) { public HopeOfGhirapurCombatDamageWatcher(final HopeOfGhirapurCombatDamageWatcher watcher) {

View file

@ -81,7 +81,7 @@ class HotHeadedGiantWatcher extends Watcher {
private UUID cardId; private UUID cardId;
public HotHeadedGiantWatcher(UUID cardId) { public HotHeadedGiantWatcher(UUID cardId) {
super(HotHeadedGiantWatcher.class.getSimpleName(), WatcherScope.PLAYER); super(WatcherScope.PLAYER);
this.cardId = cardId; this.cardId = cardId;
} }

View file

@ -143,7 +143,7 @@ class IcefallRegentEffect extends ContinuousRuleModifyingEffectImpl {
class IcefallRegentWatcher extends Watcher { class IcefallRegentWatcher extends Watcher {
IcefallRegentWatcher() { IcefallRegentWatcher() {
super("ControlLost", WatcherScope.CARD); super(WatcherScope.CARD);
} }
IcefallRegentWatcher(IcefallRegentWatcher watcher) { IcefallRegentWatcher(IcefallRegentWatcher watcher) {

View file

@ -97,7 +97,7 @@ class IchneumonDruidWatcher extends Watcher {
private final Map<UUID, Integer> playerInstantCount = new HashMap<>(); private final Map<UUID, Integer> playerInstantCount = new HashMap<>();
public IchneumonDruidWatcher() { public IchneumonDruidWatcher() {
super(IchneumonDruidWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public IchneumonDruidWatcher(final IchneumonDruidWatcher watcher) { public IchneumonDruidWatcher(final IchneumonDruidWatcher watcher) {

View file

@ -90,7 +90,7 @@ class GreatestAmountOfDamageWatcher extends Watcher {
private int damageAmount; private int damageAmount;
public GreatestAmountOfDamageWatcher() { public GreatestAmountOfDamageWatcher() {
super(GreatestAmountOfDamageWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public GreatestAmountOfDamageWatcher(final GreatestAmountOfDamageWatcher watcher) { public GreatestAmountOfDamageWatcher(final GreatestAmountOfDamageWatcher watcher) {

View file

@ -69,10 +69,10 @@ enum InfernoTrapCondition implements Condition {
class InfernoTrapWatcher extends Watcher { class InfernoTrapWatcher extends Watcher {
Map<UUID, Set<MageObjectReference>> playerDamagedByCreature = new HashMap<>(); private Map<UUID, Set<MageObjectReference>> playerDamagedByCreature = new HashMap<>();
public InfernoTrapWatcher() { public InfernoTrapWatcher() {
super(InfernoTrapWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public InfernoTrapWatcher(final InfernoTrapWatcher watcher) { public InfernoTrapWatcher(final InfernoTrapWatcher watcher) {

View file

@ -83,7 +83,7 @@ class InsatiableRakghoulEffect extends OneShotEffect {
class NonArtifactCreaturesDiedWatcher extends Watcher { class NonArtifactCreaturesDiedWatcher extends Watcher {
public NonArtifactCreaturesDiedWatcher() { public NonArtifactCreaturesDiedWatcher() {
super(NonArtifactCreaturesDiedWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public NonArtifactCreaturesDiedWatcher(final NonArtifactCreaturesDiedWatcher watcher) { public NonArtifactCreaturesDiedWatcher(final NonArtifactCreaturesDiedWatcher watcher) {

View file

@ -104,7 +104,7 @@ class InsistWatcher extends Watcher {
protected UUID uncounterableSpell; protected UUID uncounterableSpell;
InsistWatcher() { InsistWatcher() {
super(InsistWatcher.class, WatcherScope.PLAYER); super(WatcherScope.PLAYER);
} }
InsistWatcher(final InsistWatcher watcher) { InsistWatcher(final InsistWatcher watcher) {

View file

@ -94,10 +94,10 @@ class JandorsRingEffect extends OneShotEffect {
class JandorsRingWatcher extends Watcher { class JandorsRingWatcher extends Watcher {
Map<UUID, UUID> lastDrawnCards = new HashMap<>(); private Map<UUID, UUID> lastDrawnCards = new HashMap<>();
public JandorsRingWatcher() { public JandorsRingWatcher() {
super(JandorsRingWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public JandorsRingWatcher(final JandorsRingWatcher watcher) { public JandorsRingWatcher(final JandorsRingWatcher watcher) {
@ -137,7 +137,7 @@ enum WatchedCardInHandCondition implements Condition {
JandorsRingWatcher watcher = game.getState().getWatcher(JandorsRingWatcher.class); JandorsRingWatcher watcher = game.getState().getWatcher(JandorsRingWatcher.class);
return watcher != null return watcher != null
&& watcher.lastDrawnCards != null && game.getPlayer(source.getControllerId()).getHand().contains(watcher.getLastDrewCard(source.getControllerId())); && game.getPlayer(source.getControllerId()).getHand().contains(watcher.getLastDrewCard(source.getControllerId()));
} }
@Override @Override

View file

@ -144,7 +144,7 @@ class JelevaNephaliasWatcher extends Watcher {
private final Map<String, Integer> manaSpendToCast = new HashMap<>(); // cast private final Map<String, Integer> manaSpendToCast = new HashMap<>(); // cast
public JelevaNephaliasWatcher() { public JelevaNephaliasWatcher() {
super(JelevaNephaliasWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public JelevaNephaliasWatcher(final JelevaNephaliasWatcher watcher) { public JelevaNephaliasWatcher(final JelevaNephaliasWatcher watcher) {

View file

@ -163,10 +163,10 @@ class KaradorGhostChieftainCastFromGraveyardEffect extends AsThoughEffectImpl {
class KaradorGhostChieftainWatcher extends Watcher { class KaradorGhostChieftainWatcher extends Watcher {
boolean abilityUsed = false; private boolean abilityUsed = false;
KaradorGhostChieftainWatcher() { KaradorGhostChieftainWatcher() {
super(KaradorGhostChieftainWatcher.class, WatcherScope.CARD); super(WatcherScope.CARD);
} }
KaradorGhostChieftainWatcher(final KaradorGhostChieftainWatcher watcher) { KaradorGhostChieftainWatcher(final KaradorGhostChieftainWatcher watcher) {

View file

@ -159,7 +159,7 @@ class KessDissidentMageWatcher extends Watcher {
private final Map<MageObjectReference, UUID> castSpells = new HashMap<>(); private final Map<MageObjectReference, UUID> castSpells = new HashMap<>();
KessDissidentMageWatcher() { KessDissidentMageWatcher() {
super(KessDissidentMageWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
private KessDissidentMageWatcher(final KessDissidentMageWatcher watcher) { private KessDissidentMageWatcher(final KessDissidentMageWatcher watcher) {

View file

@ -105,7 +105,7 @@ class MonarchAtTurnStartWatcher extends Watcher {
private UUID monarchIdAtTurnStart; private UUID monarchIdAtTurnStart;
public MonarchAtTurnStartWatcher() { public MonarchAtTurnStartWatcher() {
super(MonarchAtTurnStartWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public MonarchAtTurnStartWatcher(final MonarchAtTurnStartWatcher watcher) { public MonarchAtTurnStartWatcher(final MonarchAtTurnStartWatcher watcher) {

View file

@ -115,7 +115,7 @@ enum KrovikanVampireInterveningIfCondition implements Condition {
KrovikanVampireCreaturesDiedWatcher watcherDied = game.getState().getWatcher(KrovikanVampireCreaturesDiedWatcher.class); KrovikanVampireCreaturesDiedWatcher watcherDied = game.getState().getWatcher(KrovikanVampireCreaturesDiedWatcher.class);
KrovikanVampireCreaturesDamagedWatcher watcherDamaged = game.getState().getWatcher(KrovikanVampireCreaturesDamagedWatcher.class); KrovikanVampireCreaturesDamagedWatcher watcherDamaged = game.getState().getWatcher(KrovikanVampireCreaturesDamagedWatcher.class);
if (watcherDied != null) { if (watcherDied != null) {
Set<UUID> creaturesThatDiedThisTurn = watcherDied.diedThisTurn; Set<UUID> creaturesThatDiedThisTurn = watcherDied.getDiedThisTurn();
for (UUID mor : creaturesThatDiedThisTurn) { for (UUID mor : creaturesThatDiedThisTurn) {
if (watcherDamaged != null) { if (watcherDamaged != null) {
for (UUID mor2 : watcherDamaged.getDamagedBySource()) { for (UUID mor2 : watcherDamaged.getDamagedBySource()) {
@ -143,10 +143,10 @@ enum KrovikanVampireInterveningIfCondition implements Condition {
class KrovikanVampireCreaturesDamagedWatcher extends Watcher { class KrovikanVampireCreaturesDamagedWatcher extends Watcher {
public final Set<UUID> damagedBySource = new HashSet<>(); private final Set<UUID> damagedBySource = new HashSet<>();
public KrovikanVampireCreaturesDamagedWatcher() { public KrovikanVampireCreaturesDamagedWatcher() {
super(KrovikanVampireCreaturesDamagedWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public KrovikanVampireCreaturesDamagedWatcher(final KrovikanVampireCreaturesDamagedWatcher watcher) { public KrovikanVampireCreaturesDamagedWatcher(final KrovikanVampireCreaturesDamagedWatcher watcher) {
@ -179,10 +179,10 @@ class KrovikanVampireCreaturesDamagedWatcher extends Watcher {
class KrovikanVampireCreaturesDiedWatcher extends Watcher { class KrovikanVampireCreaturesDiedWatcher extends Watcher {
public final Set<UUID> diedThisTurn = new HashSet<>(); private final Set<UUID> diedThisTurn = new HashSet<>();
public KrovikanVampireCreaturesDiedWatcher() { public KrovikanVampireCreaturesDiedWatcher() {
super(KrovikanVampireCreaturesDiedWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public KrovikanVampireCreaturesDiedWatcher(final KrovikanVampireCreaturesDiedWatcher watcher) { public KrovikanVampireCreaturesDiedWatcher(final KrovikanVampireCreaturesDiedWatcher watcher) {

View file

@ -109,7 +109,7 @@ class DamagedByEnchantedWatcher extends Watcher {
private final Set<MageObjectReference> damagedCreatures = new HashSet<>(); private final Set<MageObjectReference> damagedCreatures = new HashSet<>();
public DamagedByEnchantedWatcher() { public DamagedByEnchantedWatcher() {
super(DamagedByEnchantedWatcher.class, WatcherScope.CARD); super(WatcherScope.CARD);
} }
public DamagedByEnchantedWatcher(final DamagedByEnchantedWatcher watcher) { public DamagedByEnchantedWatcher(final DamagedByEnchantedWatcher watcher) {

View file

@ -85,7 +85,7 @@ class KydeleCardsDrawnThisTurnWatcher extends Watcher {
private final Map<UUID, Integer> cardsDrawnThisTurn = new HashMap<>(); private final Map<UUID, Integer> cardsDrawnThisTurn = new HashMap<>();
public KydeleCardsDrawnThisTurnWatcher() { public KydeleCardsDrawnThisTurnWatcher() {
super(KydeleCardsDrawnThisTurnWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public KydeleCardsDrawnThisTurnWatcher(final KydeleCardsDrawnThisTurnWatcher watcher) { public KydeleCardsDrawnThisTurnWatcher(final KydeleCardsDrawnThisTurnWatcher watcher) {

View file

@ -64,8 +64,8 @@ class ManaMazeEffect extends ContinuousRuleModifyingEffectImpl {
Card card = game.getCard(event.getSourceId()); Card card = game.getCard(event.getSourceId());
if (card != null) { if (card != null) {
LastSpellCastWatcher watcher = game.getState().getWatcher(LastSpellCastWatcher.class); LastSpellCastWatcher watcher = game.getState().getWatcher(LastSpellCastWatcher.class);
if (watcher != null && watcher.lastSpellCast != null) { if (watcher != null && watcher.getLastSpellCast() != null) {
return !card.getColor(game).intersection(watcher.lastSpellCast.getColor(game)).isColorless(); return !card.getColor(game).intersection(watcher.getLastSpellCast().getColor(game)).isColorless();
} }
} }
return false; return false;
@ -84,15 +84,15 @@ class ManaMazeEffect extends ContinuousRuleModifyingEffectImpl {
class LastSpellCastWatcher extends Watcher { class LastSpellCastWatcher extends Watcher {
Spell lastSpellCast = null; private Spell lastSpellCast = null;
public LastSpellCastWatcher() { public LastSpellCastWatcher() {
super(LastSpellCastWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public LastSpellCastWatcher(final LastSpellCastWatcher watcher) { public LastSpellCastWatcher(final LastSpellCastWatcher watcher) {
super(watcher); super(watcher);
this.lastSpellCast = watcher.lastSpellCast; this.lastSpellCast = watcher.getLastSpellCast();
} }
@Override @Override
@ -121,4 +121,8 @@ class LastSpellCastWatcher extends Watcher {
super.reset(); super.reset();
lastSpellCast = null; lastSpellCast = null;
} }
public Spell getLastSpellCast() {
return lastSpellCast;
}
} }

View file

@ -254,7 +254,7 @@ class MasterWarcraftCastWatcher extends Watcher {
public int copyCountApply = 0; public int copyCountApply = 0;
public MasterWarcraftCastWatcher() { public MasterWarcraftCastWatcher() {
super(MasterWarcraftCastWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public MasterWarcraftCastWatcher(final MasterWarcraftCastWatcher watcher) { public MasterWarcraftCastWatcher(final MasterWarcraftCastWatcher watcher) {

View file

@ -80,7 +80,7 @@ class MindstormCrownWatcher extends Watcher {
private int cardsInHandCount; private int cardsInHandCount;
public MindstormCrownWatcher() { public MindstormCrownWatcher() {
super(MindstormCrownWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public MindstormCrownWatcher(final MindstormCrownWatcher watcher) { public MindstormCrownWatcher(final MindstormCrownWatcher watcher) {

View file

@ -111,7 +111,7 @@ class MoltenPsycheWatcher extends Watcher {
private final Map<UUID, Integer> draws = new HashMap<>(); private final Map<UUID, Integer> draws = new HashMap<>();
public MoltenPsycheWatcher() { public MoltenPsycheWatcher() {
super(MoltenPsycheWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public MoltenPsycheWatcher(final MoltenPsycheWatcher watcher) { public MoltenPsycheWatcher(final MoltenPsycheWatcher watcher) {

View file

@ -112,7 +112,7 @@ class MuldrothaTheGravetideCastFromGraveyardEffect extends AsThoughEffectImpl {
*/ */
class MuldrothaTheGravetideWatcher extends Watcher { class MuldrothaTheGravetideWatcher extends Watcher {
final HashMap<MageObjectReference, Set<CardType>> sourcePlayedPermanentTypes = new HashMap<>(); // source that played permanent types from graveyard private final HashMap<MageObjectReference, Set<CardType>> sourcePlayedPermanentTypes = new HashMap<>(); // source that played permanent types from graveyard
// final HashMap<UUID, Set<CardType>> playerPlayedPermanentTypes = new HashMap<>(); // player that played permanent types from graveyard // final HashMap<UUID, Set<CardType>> playerPlayedPermanentTypes = new HashMap<>(); // player that played permanent types from graveyard
// 4/27/2018 If multiple effects allow you to play a card from your graveyard, such as those of Gisa and Geralf and Karador, // 4/27/2018 If multiple effects allow you to play a card from your graveyard, such as those of Gisa and Geralf and Karador,
// Ghost Chieftain, you must announce which permission you're using as you begin to play the card. // Ghost Chieftain, you must announce which permission you're using as you begin to play the card.
@ -121,7 +121,7 @@ class MuldrothaTheGravetideWatcher extends Watcher {
private Zone fromZone; private Zone fromZone;
public MuldrothaTheGravetideWatcher() { public MuldrothaTheGravetideWatcher() {
super(MuldrothaTheGravetideWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public MuldrothaTheGravetideWatcher(final MuldrothaTheGravetideWatcher watcher) { public MuldrothaTheGravetideWatcher(final MuldrothaTheGravetideWatcher watcher) {

View file

@ -1,10 +1,8 @@
package mage.cards.m; package mage.cards.m;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -74,10 +72,10 @@ class MultanisPresenceTriggeredAbility extends TriggeredAbilityImpl {
class MultanisPresenceWatcher extends Watcher { class MultanisPresenceWatcher extends Watcher {
private final HashMap<UUID, List<UUID>> spellsCast = new HashMap<>(); private final Map<UUID, List<UUID>> spellsCast = new HashMap<>();
public MultanisPresenceWatcher() { public MultanisPresenceWatcher() {
super(MultanisPresenceWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public MultanisPresenceWatcher(final MultanisPresenceWatcher watcher) { public MultanisPresenceWatcher(final MultanisPresenceWatcher watcher) {

View file

@ -62,7 +62,7 @@ class NoRestForTheWickedEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (watcher != null && controller != null) { if (watcher != null && controller != null) {
Cards cardsToHand = new CardsImpl(); Cards cardsToHand = new CardsImpl();
for (UUID cardId : watcher.cards) { for (UUID cardId : watcher.getCards()) {
Card c = game.getCard(cardId); Card c = game.getCard(cardId);
if (c != null) { if (c != null) {
if (game.getState().getZone(cardId) == Zone.GRAVEYARD if (game.getState().getZone(cardId) == Zone.GRAVEYARD
@ -87,10 +87,14 @@ class NoRestForTheWickedEffect extends OneShotEffect {
class NoRestForTheWickedWatcher extends Watcher { class NoRestForTheWickedWatcher extends Watcher {
List<UUID> cards; public List<UUID> getCards() {
return cards;
}
private List<UUID> cards;
public NoRestForTheWickedWatcher() { public NoRestForTheWickedWatcher() {
super(NoRestForTheWickedWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
this.cards = new ArrayList<>(); this.cards = new ArrayList<>();
} }

View file

@ -85,7 +85,7 @@ class OathOfChandraWatcher extends Watcher {
private final Set<UUID> players = new HashSet<>(); private final Set<UUID> players = new HashSet<>();
public OathOfChandraWatcher() { public OathOfChandraWatcher() {
super(OathOfChandraWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public OathOfChandraWatcher(final OathOfChandraWatcher watcher) { public OathOfChandraWatcher(final OathOfChandraWatcher watcher) {

View file

@ -73,7 +73,7 @@ class OathOfLilianaWatcher extends Watcher {
private final Set<UUID> players = new HashSet<>(); private final Set<UUID> players = new HashSet<>();
public OathOfLilianaWatcher() { public OathOfLilianaWatcher() {
super(OathOfLilianaWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public OathOfLilianaWatcher(final OathOfLilianaWatcher watcher) { public OathOfLilianaWatcher(final OathOfLilianaWatcher watcher) {

View file

@ -67,7 +67,7 @@ class OpalPalaceWatcher extends Watcher {
private final String originalId; private final String originalId;
public OpalPalaceWatcher(String originalId) { public OpalPalaceWatcher(String originalId) {
super(OpalPalaceWatcher.class, WatcherScope.CARD); super(WatcherScope.CARD);
this.originalId = originalId; this.originalId = originalId;
} }

View file

@ -106,7 +106,7 @@ class OvermasterWatcher extends Watcher {
protected UUID uncounterableSpell; protected UUID uncounterableSpell;
OvermasterWatcher() { OvermasterWatcher() {
super(OvermasterWatcher.class, WatcherScope.PLAYER); super(WatcherScope.PLAYER);
} }
OvermasterWatcher(final OvermasterWatcher watcher) { OvermasterWatcher(final OvermasterWatcher watcher) {

View file

@ -94,7 +94,7 @@ class PalladiaMorsTheRuinerWatcher extends Watcher {
private final Set<MageObjectReference> damagers = new HashSet<>(); private final Set<MageObjectReference> damagers = new HashSet<>();
public PalladiaMorsTheRuinerWatcher() { public PalladiaMorsTheRuinerWatcher() {
super(PalladiaMorsTheRuinerWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public PalladiaMorsTheRuinerWatcher(final PalladiaMorsTheRuinerWatcher watcher) { public PalladiaMorsTheRuinerWatcher(final PalladiaMorsTheRuinerWatcher watcher) {

View file

@ -73,7 +73,7 @@ class PatriciansScornWatcher extends Watcher {
} }
public PatriciansScornWatcher() { public PatriciansScornWatcher() {
super(PatriciansScornWatcher.class, WatcherScope.CARD); super(WatcherScope.CARD);
} }
public PatriciansScornWatcher(final PatriciansScornWatcher watcher) { public PatriciansScornWatcher(final PatriciansScornWatcher watcher) {

View file

@ -2,6 +2,7 @@
package mage.cards.p; package mage.cards.p;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObjectReference; import mage.MageObjectReference;
@ -87,11 +88,11 @@ class PetrifiedWoodKinEffect extends OneShotEffect {
if (player == null || watcher == null || permanent == null) { if (player == null || watcher == null || permanent == null) {
return false; return false;
} }
ArrayList<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
int amount = 0; int amount = 0;
for (UUID opponentId : game.getOpponents(player.getId())) { for (UUID opponentId : game.getOpponents(player.getId())) {
MageObjectReference mor = new MageObjectReference(opponentId, game); MageObjectReference mor = new MageObjectReference(opponentId, game);
amount += watcher.damagedObjects.getOrDefault(mor, 0); amount += watcher.getDamagedObjects().getOrDefault(mor, 0);
} }
permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game, appliedEffects); permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game, appliedEffects);
return true; return true;

View file

@ -91,7 +91,7 @@ class PowerSurgeWatcher extends Watcher {
private int untappedLandCount; private int untappedLandCount;
public PowerSurgeWatcher() { public PowerSurgeWatcher() {
super(PowerSurgeWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public PowerSurgeWatcher(final PowerSurgeWatcher watcher) { public PowerSurgeWatcher(final PowerSurgeWatcher watcher) {

View file

@ -65,7 +65,7 @@ class DidNotCastCreatureCondition implements Condition {
class CastCreatureWatcher extends Watcher { class CastCreatureWatcher extends Watcher {
public CastCreatureWatcher() { public CastCreatureWatcher() {
super(CastCreatureWatcher.class, WatcherScope.CARD); super(WatcherScope.CARD);
} }
public CastCreatureWatcher(final CastCreatureWatcher watcher) { public CastCreatureWatcher(final CastCreatureWatcher watcher) {

View file

@ -103,7 +103,7 @@ class ETBSinceYourLastTurnWatcher extends Watcher {
private final Map<UUID, Set<MageObjectReference>> playerToETBMap; private final Map<UUID, Set<MageObjectReference>> playerToETBMap;
public ETBSinceYourLastTurnWatcher() { public ETBSinceYourLastTurnWatcher() {
super(ETBSinceYourLastTurnWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
this.playerToETBMap = new HashMap<>(); this.playerToETBMap = new HashMap<>();
} }

View file

@ -100,7 +100,7 @@ class QuickenWatcher extends Watcher {
private List<String> activeQuickenSpells = new ArrayList<>(); private List<String> activeQuickenSpells = new ArrayList<>();
public QuickenWatcher() { public QuickenWatcher() {
super(QuickenWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
private QuickenWatcher(final QuickenWatcher watcher) { private QuickenWatcher(final QuickenWatcher watcher) {

View file

@ -104,7 +104,7 @@ class RasputinDreamweaverStartedUntappedWatcher extends Watcher {
private final Set<UUID> startedUntapped = new HashSet<>(0); private final Set<UUID> startedUntapped = new HashSet<>(0);
RasputinDreamweaverStartedUntappedWatcher() { RasputinDreamweaverStartedUntappedWatcher() {
super(RasputinDreamweaverStartedUntappedWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
RasputinDreamweaverStartedUntappedWatcher(final RasputinDreamweaverStartedUntappedWatcher watcher) { RasputinDreamweaverStartedUntappedWatcher(final RasputinDreamweaverStartedUntappedWatcher watcher) {

View file

@ -69,7 +69,7 @@ class ReversePolarityWatcher extends Watcher {
private final Map<UUID, Integer> artifactDamageReceivedThisTurn = new HashMap<>(); private final Map<UUID, Integer> artifactDamageReceivedThisTurn = new HashMap<>();
public ReversePolarityWatcher() { public ReversePolarityWatcher() {
super(ReversePolarityWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
} }
public ReversePolarityWatcher(final ReversePolarityWatcher watcher) { public ReversePolarityWatcher(final ReversePolarityWatcher watcher) {

View file

@ -52,18 +52,18 @@ public final class RocketLauncher extends CardImpl {
class RocketLauncherWatcher extends Watcher { class RocketLauncherWatcher extends Watcher {
boolean changedControllerOR1stTurn; private boolean changedControllerOR1stTurn;
UUID cardId = null; private UUID cardId = null;
public RocketLauncherWatcher(UUID cardId) { public RocketLauncherWatcher(UUID cardId) {
super(RocketLauncherWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
this.changedControllerOR1stTurn = true; this.changedControllerOR1stTurn = true;
this.cardId = cardId; this.cardId = cardId;
} }
public RocketLauncherWatcher(final RocketLauncherWatcher watcher) { public RocketLauncherWatcher(final RocketLauncherWatcher watcher) {
super(watcher); super(watcher);
this.changedControllerOR1stTurn = watcher.changedControllerOR1stTurn; this.changedControllerOR1stTurn = watcher.isChangedControllerOR1stTurn();
this.cardId = watcher.cardId; this.cardId = watcher.cardId;
} }
@ -88,6 +88,10 @@ class RocketLauncherWatcher extends Watcher {
super.reset(); super.reset();
changedControllerOR1stTurn = true; //when is this reset called? may cause problems if in mid-life changedControllerOR1stTurn = true; //when is this reset called? may cause problems if in mid-life
} }
public boolean isChangedControllerOR1stTurn() {
return changedControllerOR1stTurn;
}
} }
enum ControlledTurnCondition implements Condition { enum ControlledTurnCondition implements Condition {
@ -99,7 +103,7 @@ enum ControlledTurnCondition implements Condition {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
RocketLauncherWatcher watcher = game.getState().getWatcher(RocketLauncherWatcher.class); RocketLauncherWatcher watcher = game.getState().getWatcher(RocketLauncherWatcher.class);
return watcher != null && !watcher.changedControllerOR1stTurn; return watcher != null && !watcher.isChangedControllerOR1stTurn();
} }
@Override @Override

View file

@ -122,7 +122,7 @@ class SavageSummoningWatcher extends Watcher {
private Map<String, Set<String>> cardsCastWithSavageSummoning = new LinkedHashMap<>(); private Map<String, Set<String>> cardsCastWithSavageSummoning = new LinkedHashMap<>();
public SavageSummoningWatcher() { public SavageSummoningWatcher() {
super(SavageSummoningWatcher.class, WatcherScope.PLAYER); super(WatcherScope.PLAYER);
} }
public SavageSummoningWatcher(final SavageSummoningWatcher watcher) { public SavageSummoningWatcher(final SavageSummoningWatcher watcher) {

View file

@ -101,7 +101,7 @@ class ScoutsWarningWatcher extends Watcher {
private List<String> activeScoutsWarningSpells = new ArrayList<>(); private List<String> activeScoutsWarningSpells = new ArrayList<>();
public ScoutsWarningWatcher() { public ScoutsWarningWatcher() {
super(ScoutsWarningWatcher.class.getSimpleName(), WatcherScope.PLAYER); super(WatcherScope.PLAYER);
} }
public ScoutsWarningWatcher(final ScoutsWarningWatcher watcher) { public ScoutsWarningWatcher(final ScoutsWarningWatcher watcher) {

View file

@ -58,7 +58,7 @@ class SeaTrollWatcher extends Watcher {
private final Set<MageObjectReference> blockedOrBlockedByBlueThisTurnCreatures; private final Set<MageObjectReference> blockedOrBlockedByBlueThisTurnCreatures;
public SeaTrollWatcher() { public SeaTrollWatcher() {
super(SeaTrollWatcher.class.getSimpleName(), WatcherScope.GAME); super( WatcherScope.GAME);
blockedOrBlockedByBlueThisTurnCreatures = new HashSet<>(); blockedOrBlockedByBlueThisTurnCreatures = new HashSet<>();
} }

View file

@ -109,10 +109,10 @@ class SeasonOfTheWitchEffect extends OneShotEffect {
class CouldAttackThisTurnWatcher extends Watcher { class CouldAttackThisTurnWatcher extends Watcher {
public final Set<MageObjectReference> couldAttackThisTurnCreatures = new HashSet<>(); private final Set<MageObjectReference> couldAttackThisTurnCreatures = new HashSet<>();
public CouldAttackThisTurnWatcher() { public CouldAttackThisTurnWatcher() {
super(CouldAttackThisTurnWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public CouldAttackThisTurnWatcher(final CouldAttackThisTurnWatcher watcher) { public CouldAttackThisTurnWatcher(final CouldAttackThisTurnWatcher watcher) {

View file

@ -59,7 +59,7 @@ class SecondSunriseEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
SecondSunriseWatcher watcher = game.getState().getWatcher(SecondSunriseWatcher.class); SecondSunriseWatcher watcher = game.getState().getWatcher(SecondSunriseWatcher.class);
if (watcher != null) { if (watcher != null) {
for (UUID id : watcher.cards) { for (UUID id : watcher.getCards()) {
Card c = game.getCard(id); Card c = game.getCard(id);
if (c != null && game.getState().getZone(id) == Zone.GRAVEYARD) { if (c != null && game.getState().getZone(id) == Zone.GRAVEYARD) {
if (c.isArtifact() || c.isCreature() || if (c.isArtifact() || c.isCreature() ||
@ -79,10 +79,10 @@ class SecondSunriseEffect extends OneShotEffect {
} }
class SecondSunriseWatcher extends Watcher { class SecondSunriseWatcher extends Watcher {
List<UUID> cards = new ArrayList<>(); private List<UUID> cards = new ArrayList<>();
public SecondSunriseWatcher() { public SecondSunriseWatcher() {
super(SecondSunriseWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public SecondSunriseWatcher(final SecondSunriseWatcher watcher) { public SecondSunriseWatcher(final SecondSunriseWatcher watcher) {
@ -107,4 +107,8 @@ class SecondSunriseWatcher extends Watcher {
super.reset(); super.reset();
cards.clear(); cards.clear();
} }
public List<UUID> getCards(){
return cards;
}
} }

View file

@ -101,7 +101,7 @@ class SentinelTowerWatcher extends Watcher {
private final List<MageObjectReference> spellsThisTurn; private final List<MageObjectReference> spellsThisTurn;
SentinelTowerWatcher() { SentinelTowerWatcher() {
super(SentinelTowerWatcher.class, WatcherScope.GAME); super( WatcherScope.GAME);
this.spellsThisTurn = new ArrayList<>(); this.spellsThisTurn = new ArrayList<>();
} }

View file

@ -95,7 +95,7 @@ class AttackedOrBlockedSinceYourLastUpkeepWatcher extends Watcher{
private final Map<UUID, Set<MageObjectReference>> attackedOrBlockedCreatures = new HashMap<>(); private final Map<UUID, Set<MageObjectReference>> attackedOrBlockedCreatures = new HashMap<>();
public AttackedOrBlockedSinceYourLastUpkeepWatcher() { public AttackedOrBlockedSinceYourLastUpkeepWatcher() {
super(AttackedOrBlockedSinceYourLastUpkeepWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public AttackedOrBlockedSinceYourLastUpkeepWatcher(AttackedOrBlockedSinceYourLastUpkeepWatcher watcher) { public AttackedOrBlockedSinceYourLastUpkeepWatcher(AttackedOrBlockedSinceYourLastUpkeepWatcher watcher) {

View file

@ -121,7 +121,7 @@ class ShipbreakerKrakenReplacementEffect extends ContinuousRuleModifyingEffectIm
class ShipbreakerKrakenWatcher extends Watcher { class ShipbreakerKrakenWatcher extends Watcher {
ShipbreakerKrakenWatcher () { ShipbreakerKrakenWatcher () {
super("ControlLost", WatcherScope.CARD); super(WatcherScope.CARD);
} }
ShipbreakerKrakenWatcher(ShipbreakerKrakenWatcher watcher) { ShipbreakerKrakenWatcher(ShipbreakerKrakenWatcher watcher) {

View file

@ -80,7 +80,7 @@ class SiftThroughSandsWatcher extends Watcher {
boolean castReachThroughMists = false; boolean castReachThroughMists = false;
public SiftThroughSandsWatcher() { public SiftThroughSandsWatcher() {
super(SiftThroughSandsWatcher.class, WatcherScope.PLAYER); super(WatcherScope.PLAYER);
} }
public SiftThroughSandsWatcher(final SiftThroughSandsWatcher watcher) { public SiftThroughSandsWatcher(final SiftThroughSandsWatcher watcher) {

View file

@ -84,7 +84,7 @@ class SoulReapWatcher extends Watcher {
private UUID cardId; private UUID cardId;
public SoulReapWatcher(UUID cardId) { public SoulReapWatcher(UUID cardId) {
super(SoulReapWatcher.class, WatcherScope.PLAYER); super(WatcherScope.PLAYER);
this.cardId = cardId; this.cardId = cardId;
} }

View file

@ -91,7 +91,7 @@ class SpinerockKnollWatcher extends Watcher {
private final Map<UUID, Integer> amountOfDamageReceivedThisTurn = new HashMap<>(1); private final Map<UUID, Integer> amountOfDamageReceivedThisTurn = new HashMap<>(1);
SpinerockKnollWatcher() { SpinerockKnollWatcher() {
super(SpinerockKnollWatcher.class.getSimpleName(), WatcherScope.CARD); super(WatcherScope.CARD);
} }
SpinerockKnollWatcher(final SpinerockKnollWatcher watcher) { SpinerockKnollWatcher(final SpinerockKnollWatcher watcher) {

View file

@ -88,7 +88,7 @@ class SpinyStarfishWatcher extends Watcher {
private final Map<UUID, Integer> regeneratedCount = new HashMap<>(); private final Map<UUID, Integer> regeneratedCount = new HashMap<>();
public SpinyStarfishWatcher() { public SpinyStarfishWatcher() {
super(SpinyStarfishWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public SpinyStarfishWatcher(final SpinyStarfishWatcher watcher) { public SpinyStarfishWatcher(final SpinyStarfishWatcher watcher) {

View file

@ -50,7 +50,7 @@ class SpiritOfTheLabyrinthWatcher extends Watcher {
private final Set<UUID> playersThatDrewCard; private final Set<UUID> playersThatDrewCard;
public SpiritOfTheLabyrinthWatcher() { public SpiritOfTheLabyrinthWatcher() {
super(SpiritOfTheLabyrinthWatcher.class.getSimpleName(), WatcherScope.GAME); super(WatcherScope.GAME);
this.playersThatDrewCard = new HashSet<>(); this.playersThatDrewCard = new HashSet<>();
} }

View file

@ -61,7 +61,7 @@ class SpoilsOfBloodEffect extends OneShotEffect {
if (controller != null) { if (controller != null) {
CreaturesDiedThisTurnWatcher watcher = game.getState().getWatcher(CreaturesDiedThisTurnWatcher.class); CreaturesDiedThisTurnWatcher watcher = game.getState().getWatcher(CreaturesDiedThisTurnWatcher.class);
if (watcher != null) { if (watcher != null) {
new CreateTokenEffect(new SpoilsOfBloodHorrorToken(watcher.creaturesDiedThisTurn)).apply(game, source); new CreateTokenEffect(new SpoilsOfBloodHorrorToken(watcher.getCreaturesDiedThisTurn())).apply(game, source);
} }
return true; return true;
} }
@ -77,10 +77,14 @@ class SpoilsOfBloodEffect extends OneShotEffect {
class CreaturesDiedThisTurnWatcher extends Watcher { class CreaturesDiedThisTurnWatcher extends Watcher {
public int creaturesDiedThisTurn = 0; public int getCreaturesDiedThisTurn() {
return creaturesDiedThisTurn;
}
private int creaturesDiedThisTurn = 0;
public CreaturesDiedThisTurnWatcher() { public CreaturesDiedThisTurnWatcher() {
super(CreaturesDiedThisTurnWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public CreaturesDiedThisTurnWatcher(final CreaturesDiedThisTurnWatcher watcher) { public CreaturesDiedThisTurnWatcher(final CreaturesDiedThisTurnWatcher watcher) {

View file

@ -104,7 +104,7 @@ class SteelHellkiteWatcher extends Watcher {
private final Map<UUID, Set<UUID>> damageMap = new HashMap<>(); private final Map<UUID, Set<UUID>> damageMap = new HashMap<>();
public SteelHellkiteWatcher() { public SteelHellkiteWatcher() {
super(SteelHellkiteWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public SteelHellkiteWatcher(final SteelHellkiteWatcher watcher) { public SteelHellkiteWatcher(final SteelHellkiteWatcher watcher) {

View file

@ -67,10 +67,10 @@ enum SummoningTrapCondition implements Condition {
class SummoningTrapWatcher extends Watcher { class SummoningTrapWatcher extends Watcher {
Set<UUID> players = new HashSet<>(); private Set<UUID> players = new HashSet<>();
public SummoningTrapWatcher() { public SummoningTrapWatcher() {
super(SummoningTrapWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public SummoningTrapWatcher(final SummoningTrapWatcher watcher) { public SummoningTrapWatcher(final SummoningTrapWatcher watcher) {

View file

@ -119,7 +119,7 @@ class SylvanLibraryCardsDrawnThisTurnWatcher extends Watcher {
private final Map<UUID, Set<UUID>> cardsDrawnThisTurn = new HashMap<>(); private final Map<UUID, Set<UUID>> cardsDrawnThisTurn = new HashMap<>();
public SylvanLibraryCardsDrawnThisTurnWatcher() { public SylvanLibraryCardsDrawnThisTurnWatcher() {
super(SylvanLibraryCardsDrawnThisTurnWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public SylvanLibraryCardsDrawnThisTurnWatcher(final SylvanLibraryCardsDrawnThisTurnWatcher watcher) { public SylvanLibraryCardsDrawnThisTurnWatcher(final SylvanLibraryCardsDrawnThisTurnWatcher watcher) {

View file

@ -112,7 +112,7 @@ class TalarasBattalionWatcher extends Watcher {
private final UUID cardId; private final UUID cardId;
public TalarasBattalionWatcher(UUID cardId) { public TalarasBattalionWatcher(UUID cardId) {
super(TalarasBattalionWatcher.class, WatcherScope.PLAYER); super(WatcherScope.PLAYER);
this.cardId = cardId; this.cardId = cardId;
} }

View file

@ -68,10 +68,10 @@ enum PlayerCastNonCreatureSpellCondition implements Condition {
class PlayerCastNonCreatureSpellWatcher extends Watcher { class PlayerCastNonCreatureSpellWatcher extends Watcher {
Set<UUID> playerIds = new HashSet<>(); private Set<UUID> playerIds = new HashSet<>();
public PlayerCastNonCreatureSpellWatcher() { public PlayerCastNonCreatureSpellWatcher() {
super(PlayerCastNonCreatureSpellWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public PlayerCastNonCreatureSpellWatcher(final PlayerCastNonCreatureSpellWatcher watcher) { public PlayerCastNonCreatureSpellWatcher(final PlayerCastNonCreatureSpellWatcher watcher) {

View file

@ -70,7 +70,7 @@ class AttackedLastCombatWatcher extends Watcher {
public final Map<UUID, Map<MageObjectReference, UUID>> attackedLastCombatPlayers = new HashMap<>(); public final Map<UUID, Map<MageObjectReference, UUID>> attackedLastCombatPlayers = new HashMap<>();
public AttackedLastCombatWatcher() { public AttackedLastCombatWatcher() {
super(AttackedLastCombatWatcher.class, WatcherScope.GAME); super(WatcherScope.GAME);
} }
public AttackedLastCombatWatcher(final AttackedLastCombatWatcher watcher) { public AttackedLastCombatWatcher(final AttackedLastCombatWatcher watcher) {

Some files were not shown because too many files have changed in this diff Show more