first batch of watcher naming

This commit is contained in:
igoudt 2017-04-29 08:33:10 +02:00
parent 20a881a374
commit efae1251f9
111 changed files with 177 additions and 179 deletions

View file

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

View file

@ -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;
}

View file

@ -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();
}

View file

@ -94,7 +94,7 @@ class AvengingArrowTarget extends TargetPermanent {
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
Set<UUID> availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game);
Set<UUID> 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);

View file

@ -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;

View file

@ -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);

View file

@ -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)) {

View file

@ -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;
}

View file

@ -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<UUID> blockedCreatures = new ArrayList<>();
public Set<UUID> 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());
}
}

View file

@ -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());
}

View file

@ -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;
}

View file

@ -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());
}

View file

@ -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) {

View file

@ -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<ObjectPla
public boolean apply(ObjectPlayer<Controllable> 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;

View file

@ -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;
}

View file

@ -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) {

View file

@ -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<MageObjectReference> blockedThisTurnCreatures = watcher.getBlockedThisTurnCreatures();
MageObjectReference blockerReference = new MageObjectReference(blocker.getId(), blocker.getZoneChangeCounter(game), game);
return blockedThisTurnCreatures.isEmpty()

View file

@ -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<UUID> cards = new ArrayList<>();
public FaithsRewardWatcher() {
super("FaithsRewardWatcher", WatcherScope.GAME);
super(FaithsRewardWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public FaithsRewardWatcher(final FaithsRewardWatcher watcher) {

View file

@ -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) {

View file

@ -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);

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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());
}

View file

@ -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<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
Set<UUID> availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game);
Set<UUID> 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;
}

View file

@ -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<UUID> blockedByWatcher = new ArrayList<>();
public BlockedByWatcher() {
super("BlockedByWatcher", WatcherScope.CARD);
super(BlockedByWatcher.class.getSimpleName(), WatcherScope.CARD);
}
public BlockedByWatcher(final BlockedByWatcher watcher) {

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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("<br><br>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;
}

View file

@ -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;
}

View file

@ -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);

View file

@ -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<MageObjectReference> damagedCreatures = new HashSet<>();
public DamagedByEnchantedWatcher() {
super("DamagedByEnchantedWatcher", WatcherScope.CARD);
super(DamagedByEnchantedWatcher.class.getSimpleName(), WatcherScope.CARD);
}
public DamagedByEnchantedWatcher(final DamagedByEnchantedWatcher watcher) {

View file

@ -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;
}

View file

@ -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;

View file

@ -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());

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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<UUID, Integer> draws = new HashMap<>();
public MoltenPsycheWatcher() {
super("CardsDrawn", WatcherScope.GAME);
super(MoltenPsycheWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public MoltenPsycheWatcher(final MoltenPsycheWatcher watcher) {

View file

@ -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<UUID> players = new HashSet<>();
public OathOfChandraWatcher() {
super("OathOfChandraWatcher", WatcherScope.GAME);
super(OathOfChandraWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public OathOfChandraWatcher(final OathOfChandraWatcher watcher) {

View file

@ -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());
}

View file

@ -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;

View file

@ -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) {

View file

@ -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();
}

View file

@ -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<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
Set<UUID> availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game);
Set<UUID> 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)) {

View file

@ -98,7 +98,7 @@ class PlayerLostLifePredicate implements Predicate<Player> {
@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()));
}

View file

@ -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);
}

View file

@ -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<String, Set<String>> 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");

View file

@ -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;

View file

@ -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<String> activeScoutsWarningSpells = new ArrayList<>();
public ScoutsWarningWatcher() {
super("consumeScoutsWarningWatcher", WatcherScope.PLAYER);
super(ScoutsWarningWatcher.class.getSimpleName(), WatcherScope.PLAYER);
}
public ScoutsWarningWatcher(final ScoutsWarningWatcher watcher) {

View file

@ -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;

View file

@ -76,7 +76,7 @@ class SecondSpellPredicate implements Predicate<Spell> {
@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;

View file

@ -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<UUID> cards = new ArrayList<>();
public SecondSunriseWatcher() {
super("SecondSunriseWatcher", WatcherScope.GAME);
super(SecondSunriseWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public SecondSunriseWatcher(final SecondSunriseWatcher watcher) {

View file

@ -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)) {

View file

@ -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;
}

View file

@ -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()) {

View file

@ -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();
}

View file

@ -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);
}

View file

@ -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;
}

View file

@ -74,7 +74,7 @@ class SpiritOfTheLabyrinthWatcher extends Watcher {
private final HashSet<UUID> 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;
}

View file

@ -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);
}

View file

@ -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<UUID> players = new HashSet<>();
public SummoningTrapWatcher() {
super("CreatureSpellCountered", WatcherScope.GAME);
super(SummoningTrapWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public SummoningTrapWatcher(final SummoningTrapWatcher watcher) {

View file

@ -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)) {

View file

@ -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<UUID> playerIds = new HashSet<>();
public PlayerCastNonCreatureSpellWatcher() {
super("PlayerCastNonCreatureSpell", WatcherScope.GAME);
super(PlayerCastNonCreatureSpellWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public PlayerCastNonCreatureSpellWatcher(final PlayerCastNonCreatureSpellWatcher watcher) {

View file

@ -71,7 +71,7 @@ public class TimeToReflect extends CardImpl {
if (ability instanceof SpellAbility) {
List<PermanentIdPredicate> 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<MageObjectReference> blockedOrWasBlockedByAZombieWatcher;
public BlockedOrWasBlockedByAZombieWatcher() {
super("BlockedOrWasBlockedByAZombieWatcher", WatcherScope.GAME);
super(BlockedOrWasBlockedByAZombieWatcher.class.getSimpleName(), WatcherScope.GAME);
blockedOrWasBlockedByAZombieWatcher = new HashSet<>();
}

View file

@ -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<UUID> cards;
public UrzasMiterWatcher() {
super("UrzasMiterWatcher", WatcherScope.PLAYER);
super(UrzasMiterWatcher.class.getSimpleName(), WatcherScope.PLAYER);
this.cards = new ArrayList<>();
}

View file

@ -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) {

View file

@ -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<UUID, Integer> 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

View file

@ -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;
}

View file

@ -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();
}

View file

@ -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) {

View file

@ -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) {

View file

@ -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");

View file

@ -47,7 +47,7 @@ public class AmountOfDamageAPlayerReceivedThisTurnWatcher extends Watcher {
private final Map<UUID, Integer> amountOfDamageReceivedThisTurn = new HashMap<>();
public AmountOfDamageAPlayerReceivedThisTurnWatcher() {
super("AmountOfDamageReceivedThisTurn", WatcherScope.GAME);
super(AmountOfDamageAPlayerReceivedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public AmountOfDamageAPlayerReceivedThisTurnWatcher(final AmountOfDamageAPlayerReceivedThisTurnWatcher watcher) {

View file

@ -23,7 +23,7 @@ public class AttackedOrBlockedThisCombatWatcher extends Watcher {
public final Set<MageObjectReference> blockedThisTurnCreatures = new HashSet<>();
public AttackedOrBlockedThisCombatWatcher() {
super(AttackedOrBlockedThisCombatWatcher.class.getName(), WatcherScope.GAME);
super(AttackedOrBlockedThisCombatWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public AttackedOrBlockedThisCombatWatcher(final AttackedOrBlockedThisCombatWatcher watcher) {

View file

@ -43,7 +43,7 @@ public class AttackedThisTurnWatcher extends Watcher {
public final Set<MageObjectReference> attackedThisTurnCreatures = new HashSet<>();
public AttackedThisTurnWatcher() {
super(AttackedThisTurnWatcher.class.getName(), WatcherScope.GAME);
super(AttackedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public AttackedThisTurnWatcher(final AttackedThisTurnWatcher watcher) {

View file

@ -47,7 +47,7 @@ public class BlockedAttackerWatcher extends Watcher {
public final HashMap<MageObjectReference, Set<MageObjectReference>> blockData = new HashMap<>();
public BlockedAttackerWatcher() {
super("BlockedAttackerWatcher", WatcherScope.GAME);
super(BlockedAttackerWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public BlockedAttackerWatcher(final BlockedAttackerWatcher watcher) {

View file

@ -45,7 +45,7 @@ public class BlockedThisTurnWatcher extends Watcher {
private final Set<MageObjectReference> blockedThisTurnCreatures;
public BlockedThisTurnWatcher() {
super("BlockedThisTurn", WatcherScope.GAME);
super(BlockedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
blockedThisTurnCreatures = new HashSet<>();
}

View file

@ -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;
}

View file

@ -44,12 +44,11 @@ import java.util.UUID;
*/
public class CardsAmountDrawnThisTurnWatcher extends Watcher {
public final static String BASIC_KEY = "CardsAmountDrawnThisTurnWatcher";
private final Map<UUID, Integer> amountOfCardsDrawnThisTurn = new HashMap<>();
public CardsAmountDrawnThisTurnWatcher() {
super(BASIC_KEY, WatcherScope.GAME);
super(CardsAmountDrawnThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public CardsAmountDrawnThisTurnWatcher(final CardsAmountDrawnThisTurnWatcher watcher) {

View file

@ -49,7 +49,7 @@ public class CardsCycledOrDiscardedThisTurnWatcher extends Watcher {
private final Map<UUID, Cards> cycledOrDiscardedCardsThisTurn = new HashMap<>();
public CardsCycledOrDiscardedThisTurnWatcher() {
super(CardsCycledOrDiscardedThisTurnWatcher.class.getName(), WatcherScope.GAME);
super(CardsCycledOrDiscardedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public CardsCycledOrDiscardedThisTurnWatcher(final CardsCycledOrDiscardedThisTurnWatcher watcher) {

View file

@ -50,7 +50,7 @@ public class CardsDrawnDuringDrawStepWatcher extends Watcher {
private final Map<UUID, Integer> amountOfCardsDrawnThisTurn = new HashMap<>();
public CardsDrawnDuringDrawStepWatcher() {
super("CardsDrawnDuringDrawStep", WatcherScope.GAME);
super(CardsDrawnDuringDrawStepWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public CardsDrawnDuringDrawStepWatcher(final CardsDrawnDuringDrawStepWatcher watcher) {

View file

@ -55,7 +55,7 @@ public class CardsPutIntoGraveyardWatcher extends Watcher {
private final Set<MageObjectReference> cardsPutToGraveyardFromBattlefield = new HashSet<>();
public CardsPutIntoGraveyardWatcher() {
super("CardsPutIntoGraveyardWatcher", WatcherScope.GAME);
super(CardsPutIntoGraveyardWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public CardsPutIntoGraveyardWatcher(final CardsPutIntoGraveyardWatcher watcher) {

View file

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

View file

@ -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) {

View file

@ -46,7 +46,7 @@ public class CastSpellLastTurnWatcher extends Watcher {
private final List<MageObjectReference> spellsCastThisTurnInOrder = new ArrayList<>();
public CastSpellLastTurnWatcher() {
super(CastSpellLastTurnWatcher.class.getName(), WatcherScope.GAME);
super(CastSpellLastTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public CastSpellLastTurnWatcher(final CastSpellLastTurnWatcher watcher) {

View file

@ -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;
}

View file

@ -49,7 +49,7 @@ public class CreatureWasCastWatcher extends Watcher {
private final Set<UUID> creaturesCasted = new HashSet<>();
public CreatureWasCastWatcher() {
super("CreatureWasCast", WatcherScope.GAME);
super(CreatureWasCastWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public CreatureWasCastWatcher(final CreatureWasCastWatcher watcher) {

View file

@ -45,7 +45,7 @@ public class CreaturesDiedWatcher extends Watcher {
private final HashMap<UUID, Integer> amountOfCreaturesThatDiedByController = new HashMap<>();
public CreaturesDiedWatcher() {
super("CreaturesDiedWatcher", WatcherScope.GAME);
super(CreaturesDiedWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public CreaturesDiedWatcher(final CreaturesDiedWatcher watcher) {

View file

@ -27,7 +27,7 @@ public class DamageDoneWatcher extends Watcher {
public final Map<MageObjectReference, Integer> damagedObjects;
public DamageDoneWatcher() {
super("DamageDone", WatcherScope.GAME);
super(DamageDoneWatcher.class.getSimpleName(), WatcherScope.GAME);
this.damagingObjects = new HashMap<>();
this.damagedObjects = new HashMap<>();
}

View file

@ -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;
}

View file

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

View file

@ -19,7 +19,7 @@ public class FirstSpellCastThisTurnWatcher extends Watcher {
private final Map<UUID, UUID> playerFirstCastSpell = new HashMap<>();
public FirstSpellCastThisTurnWatcher() {
super("FirstSpellCastThisTurn", WatcherScope.GAME);
super(FirstSpellCastThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public FirstSpellCastThisTurnWatcher(final FirstSpellCastThisTurnWatcher watcher) {

View file

@ -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;
}

View file

@ -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) {

View file

@ -19,7 +19,7 @@ public class LandfallWatcher extends Watcher {
final Set<UUID> playerPlayedLand = new HashSet<>();
public LandfallWatcher() {
super("LandPlayed", WatcherScope.GAME);
super(LandfallWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public LandfallWatcher(final LandfallWatcher watcher) {

View file

@ -45,7 +45,7 @@ public class LifeLossOtherFromCombatWatcher extends Watcher {
private final Set<UUID> 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;
}
}

View file

@ -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) {

View file

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

View file

@ -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) {

View file

@ -46,7 +46,7 @@ public class NumberOfTimesPermanentTargetedATurnWatcher extends Watcher {
private final Map<MageObjectReference, Integer> permanentsTargeted = new HashMap<>();
public NumberOfTimesPermanentTargetedATurnWatcher() {
super(NumberOfTimesPermanentTargetedATurnWatcher.class.getName(), WatcherScope.GAME);
super(NumberOfTimesPermanentTargetedATurnWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public NumberOfTimesPermanentTargetedATurnWatcher(final NumberOfTimesPermanentTargetedATurnWatcher watcher) {

View file

@ -25,7 +25,7 @@ public class PermanentsEnteredBattlefieldWatcher extends Watcher {
private final HashMap<UUID, List<Permanent>> enteringBattlefieldLastTurn = new HashMap<>();
public PermanentsEnteredBattlefieldWatcher() {
super(PermanentsEnteredBattlefieldWatcher.class.getName(), WatcherScope.GAME);
super(PermanentsEnteredBattlefieldWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public PermanentsEnteredBattlefieldWatcher(final PermanentsEnteredBattlefieldWatcher watcher) {

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