mirror of
https://github.com/magefree/mage.git
synced 2025-12-30 07:22:03 -08:00
first batch of watcher naming
This commit is contained in:
parent
20a881a374
commit
efae1251f9
111 changed files with 177 additions and 179 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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<>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue