mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
finish rewriting watchers
This commit is contained in:
parent
efae1251f9
commit
b6fe6f772a
146 changed files with 233 additions and 235 deletions
|
@ -197,7 +197,7 @@ public class GameView implements Serializable {
|
|||
this.special = false;
|
||||
}
|
||||
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
spellsCastCurrentTurn = watcher.getAmountOfSpellsAllPlayersCastOnCurrentTurn();
|
||||
} else {
|
||||
|
|
|
@ -77,7 +77,7 @@ class AetherfluxReservoirDynamicValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
return watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(sourceAbility.getControllerId());
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ class AggravateRequirementEffect extends RequirementEffect {
|
|||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
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(permanent, game);
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ class AlhammarretsArchiveReplacementEffect extends ReplacementEffectImpl {
|
|||
if (event.getPlayerId().equals(source.getControllerId())) {
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ class AngelicArbiterCantAttackTargetEffect extends RestrictionEffect {
|
|||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
if (game.getActivePlayerId().equals(permanent.getControllerId()) && game.getOpponents(source.getControllerId()).contains(permanent.getControllerId())) {
|
||||
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(permanent.getControllerId()) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ class AngelicArbiterEffect2 extends ContinuousRuleModifyingEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||
AngelicArbiterWatcher2 watcher = (AngelicArbiterWatcher2) game.getState().getWatchers().get("PlayerAttacked");
|
||||
AngelicArbiterWatcher2 watcher = (AngelicArbiterWatcher2) game.getState().getWatchers().get(AngelicArbiterWatcher2.class.getSimpleName());
|
||||
if (watcher != null && watcher.hasPlayerAttackedThisTurn(event.getPlayerId())) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ class AngelsTrumpetTapEffect extends OneShotEffect {
|
|||
continue;
|
||||
}
|
||||
// Creatures that attacked are safe.
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getName());
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(creature, game))) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ class ApproachOfTheSecondSunEffect extends OneShotEffect {
|
|||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (controller != null && spell != null) {
|
||||
ApproachOfTheSecondSunWatcher watcher
|
||||
= (ApproachOfTheSecondSunWatcher) game.getState().getWatchers().get(ApproachOfTheSecondSunWatcher.class.getName());
|
||||
= (ApproachOfTheSecondSunWatcher) game.getState().getWatchers().get(ApproachOfTheSecondSunWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.getApproachesCast(controller.getId()) > 1 && spell.getFromZone() == Zone.HAND) {
|
||||
// Win the game
|
||||
controller.won(game);
|
||||
|
|
|
@ -80,7 +80,7 @@ class ArchiveTrapWatcher extends Watcher {
|
|||
Set<UUID> playerIds = new HashSet<>();
|
||||
|
||||
public ArchiveTrapWatcher() {
|
||||
super("LibrarySearched", WatcherScope.GAME);
|
||||
super(ArchiveTrapWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public ArchiveTrapWatcher(final ArchiveTrapWatcher watcher) {
|
||||
|
@ -118,7 +118,7 @@ enum OpponentSearchesLibCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
ArchiveTrapWatcher watcher = (ArchiveTrapWatcher) game.getState().getWatchers().get("LibrarySearched");
|
||||
ArchiveTrapWatcher watcher = (ArchiveTrapWatcher) game.getState().getWatchers().get(ArchiveTrapWatcher.class.getSimpleName());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && watcher != null) {
|
||||
for (UUID playerId : watcher.getPlayersSearchedLibrary()) {
|
||||
|
|
|
@ -52,28 +52,26 @@ import mage.target.common.TargetCreatureOrPlayerAmount;
|
|||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* GATECRASH FAQ 11.01.2013
|
||||
*
|
||||
* <p>
|
||||
* You announce the value of X and how the damage will be divided as part of
|
||||
* casting Aurelia's Fury. Each chosen target must receive at least 1 damage.
|
||||
*
|
||||
* <p>
|
||||
* Aurelia's Fury can't deal damage to both a planeswalker and that
|
||||
* planeswalker's controller. If damage dealt by Aurelia's Fury is redirected
|
||||
* from a player to a planeswalker he or she controls, that player will be able
|
||||
* to cast noncreature spells that turn. If you want to stop a player from
|
||||
* casting noncreature spells this turn, you can't choose to redirect the
|
||||
* damage to a planeswalker he or she controls.
|
||||
*
|
||||
* <p>
|
||||
* If Aurelia's Fury has multiple targets, and some but not all of them are
|
||||
* illegal targets when Aurelia's Fury resolves, Aurelia's Fury will still
|
||||
* deal damage to the remaining legal targets according to the original damage
|
||||
* division.
|
||||
*
|
||||
* <p>
|
||||
* If all of the targets are illegal when Aurelia's Fury tries to resolve,
|
||||
* it will be countered and none of its effects will happen. No creature or
|
||||
* player will be dealt damage.
|
||||
|
@ -83,7 +81,7 @@ import java.util.UUID;
|
|||
public class AureliasFury extends CardImpl {
|
||||
|
||||
public AureliasFury(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{X}{R}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{R}{W}");
|
||||
|
||||
|
||||
// Aurelia's Fury deals X damage divided as you choose among any number of target creatures and/or players.
|
||||
|
@ -107,39 +105,39 @@ public class AureliasFury extends CardImpl {
|
|||
}
|
||||
|
||||
class AureliasFuryEffect extends OneShotEffect {
|
||||
|
||||
|
||||
public AureliasFuryEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "Tap each creature dealt damage this way. Players dealt damage this way can't cast noncreature spells this turn";
|
||||
}
|
||||
|
||||
|
||||
public AureliasFuryEffect(final AureliasFuryEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AureliasFuryEffect copy() {
|
||||
return new AureliasFuryEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
AureliasFuryDamagedByWatcher watcher = (AureliasFuryDamagedByWatcher) game.getState().getWatchers().get("AureliasFuryDamagedByWatcher", source.getSourceId());
|
||||
AureliasFuryDamagedByWatcher watcher = (AureliasFuryDamagedByWatcher) game.getState().getWatchers().get(AureliasFuryDamagedByWatcher.class.getSimpleName(), source.getSourceId());
|
||||
if (watcher != null) {
|
||||
for(UUID creatureId : watcher.damagedCreatures) {
|
||||
for (UUID creatureId : watcher.damagedCreatures) {
|
||||
Permanent permanent = game.getPermanent(creatureId);
|
||||
if (permanent != null) {
|
||||
permanent.tap(game);
|
||||
}
|
||||
}
|
||||
for(UUID playerId : watcher.damagedPlayers) {
|
||||
for (UUID playerId : watcher.damagedPlayers) {
|
||||
ContinuousEffect effect = new AureliasFuryCantCastEffect();
|
||||
effect.setTargetPointer(new FixedTarget(playerId));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
watcher.reset();
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +176,7 @@ class AureliasFuryCantCastEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.CAST_SPELL;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
|
@ -194,11 +192,11 @@ class AureliasFuryCantCastEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
|
||||
class AureliasFuryDamagedByWatcher extends Watcher {
|
||||
|
||||
public List<UUID> damagedCreatures = new ArrayList<>();
|
||||
public List<UUID> damagedPlayers = new ArrayList<>();
|
||||
public Set<UUID> damagedCreatures = new HashSet<>();
|
||||
public Set<UUID> damagedPlayers = new HashSet<>();
|
||||
|
||||
public AureliasFuryDamagedByWatcher() {
|
||||
super("AureliasFuryDamagedByWatcher", WatcherScope.CARD);
|
||||
super(AureliasFuryDamagedByWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
}
|
||||
|
||||
public AureliasFuryDamagedByWatcher(final AureliasFuryDamagedByWatcher watcher) {
|
||||
|
@ -217,7 +215,7 @@ class AureliasFuryDamagedByWatcher extends Watcher {
|
|||
if (event.getType() == EventType.DAMAGED_CREATURE) {
|
||||
MageObject obj = game.getObject(event.getSourceId());
|
||||
if (obj instanceof Spell) {
|
||||
if (sourceId.equals(((Spell) obj).getSourceId()) && !damagedCreatures.contains(event.getTargetId())) {
|
||||
if (sourceId.equals(((Spell) obj).getSourceId())) {
|
||||
damagedCreatures.add(event.getTargetId());
|
||||
}
|
||||
}
|
||||
|
@ -225,7 +223,7 @@ class AureliasFuryDamagedByWatcher extends Watcher {
|
|||
if (event.getType() == EventType.DAMAGED_PLAYER) {
|
||||
MageObject obj = game.getObject(event.getSourceId());
|
||||
if (obj instanceof Spell) {
|
||||
if (sourceId.equals(((Spell) obj).getSourceId()) && !damagedPlayers.contains(event.getTargetId())) {
|
||||
if (sourceId.equals(((Spell) obj).getSourceId())) {
|
||||
damagedPlayers.add(event.getTargetId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ class AvengingArrowTarget extends TargetPermanent {
|
|||
|
||||
@Override
|
||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get("SourceDidDamageWatcher");
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get(SourceDidDamageWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
if (watcher.damageSources.contains(id)) {
|
||||
return super.canTarget(id, source, game);
|
||||
|
|
|
@ -75,7 +75,7 @@ enum BalothCageTrapCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatchers().get(PermanentsEnteredBattlefieldWatcher.class.getName());
|
||||
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatchers().get(PermanentsEnteredBattlefieldWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
List<Permanent> permanents = watcher.getThisTurnEnteringPermanents(opponentId);
|
||||
|
|
|
@ -102,7 +102,7 @@ class BerserkReplacementEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.CAST_SPELL && event.getSourceId().equals(source.getSourceId())) {
|
||||
CombatDamageStepStartedWatcher watcher = (CombatDamageStepStartedWatcher) game.getState().getWatchers().get("CombatDamageStepStarted");
|
||||
CombatDamageStepStartedWatcher watcher = (CombatDamageStepStartedWatcher) game.getState().getWatchers().get(CombatDamageStepStartedWatcher.class.getSimpleName());
|
||||
return watcher == null || watcher.conditionMet();
|
||||
}
|
||||
return false;
|
||||
|
@ -122,7 +122,7 @@ class BerserkReplacementEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
class CombatDamageStepStartedWatcher extends Watcher {
|
||||
|
||||
public CombatDamageStepStartedWatcher() {
|
||||
super("CombatDamageStepStarted", WatcherScope.GAME);
|
||||
super(CombatDamageStepStartedWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public CombatDamageStepStartedWatcher(final CombatDamageStepStartedWatcher watcher) {
|
||||
|
@ -196,7 +196,7 @@ class BerserkDelayedDestroyEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
Watcher watcher = game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getName());
|
||||
Watcher watcher = game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher instanceof AttackedThisTurnWatcher) {
|
||||
if (((AttackedThisTurnWatcher) watcher).getAttackedThisTurnCreatures().contains(new MageObjectReference(permanent, game))) {
|
||||
return permanent.destroy(source.getSourceId(), game, false);
|
||||
|
|
|
@ -89,7 +89,7 @@ class BoseijuWhoSheltersAllWatcher extends Watcher {
|
|||
public List<UUID> spells = new ArrayList<>();
|
||||
|
||||
public BoseijuWhoSheltersAllWatcher() {
|
||||
super("ManaPaidFromBoseijuWhoSheltersAllWatcher", WatcherScope.GAME);
|
||||
super(BoseijuWhoSheltersAllWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public BoseijuWhoSheltersAllWatcher(final BoseijuWhoSheltersAllWatcher watcher) {
|
||||
|
|
|
@ -83,7 +83,7 @@ enum BriarbridgePatrolCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
PermanentsSacrificedWatcher watcher = (PermanentsSacrificedWatcher) game.getState().getWatchers().get(PermanentsSacrificedWatcher.class.getName());
|
||||
PermanentsSacrificedWatcher watcher = (PermanentsSacrificedWatcher) game.getState().getWatchers().get(PermanentsSacrificedWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
List<Permanent> sacrificedPermanents = watcher.getThisTurnSacrificedPermanents(source.getControllerId());
|
||||
if (sacrificedPermanents != null && !sacrificedPermanents.isEmpty()) {
|
||||
|
|
|
@ -86,7 +86,7 @@ class CallerOfTheClawWatcher extends Watcher {
|
|||
private int creaturesCount = 0;
|
||||
|
||||
public CallerOfTheClawWatcher() {
|
||||
super(CallerOfTheClawWatcher.class.getName(), WatcherScope.PLAYER);
|
||||
super(CallerOfTheClawWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||
condition = true;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ class CallerOfTheClawDynamicValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
CallerOfTheClawWatcher watcher = (CallerOfTheClawWatcher) game.getState().getWatchers().get(CallerOfTheClawWatcher.class.getName(), sourceAbility.getControllerId());
|
||||
CallerOfTheClawWatcher watcher = (CallerOfTheClawWatcher) game.getState().getWatchers().get(CallerOfTheClawWatcher.class.getSimpleName(), sourceAbility.getControllerId());
|
||||
if (watcher != null) {
|
||||
return watcher.getCreaturesCount();
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ class CerebralVortexEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (targetPlayer != null) {
|
||||
CerebralVortexWatcher watcher = (CerebralVortexWatcher) game.getState().getWatchers().get("CerebralVortexWatcher");
|
||||
CerebralVortexWatcher watcher = (CerebralVortexWatcher) game.getState().getWatchers().get(CerebralVortexWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
targetPlayer.damage(watcher.getDraws(targetPlayer.getId()), source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
|
@ -108,7 +108,7 @@ class CerebralVortexWatcher extends Watcher {
|
|||
private final Map<UUID, Integer> draws = new HashMap<>();
|
||||
|
||||
CerebralVortexWatcher() {
|
||||
super("CerebralVortexWatcher", WatcherScope.GAME);
|
||||
super(CerebralVortexWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
CerebralVortexWatcher(final CerebralVortexWatcher watcher) {
|
||||
|
|
|
@ -88,8 +88,8 @@ class ChargingCinderhornCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getName());
|
||||
if (watcher != null && watcher instanceof AttackedThisTurnWatcher) {
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
return watcher.getAttackedThisTurnCreatures().isEmpty();
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -80,7 +80,7 @@ enum CobraTrapCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
CobraTrapWatcher watcher = (CobraTrapWatcher) game.getState().getWatchers().get(CobraTrapWatcher.class.getName());
|
||||
CobraTrapWatcher watcher = (CobraTrapWatcher) game.getState().getWatchers().get(CobraTrapWatcher.class.getSimpleName());
|
||||
return watcher != null && watcher.conditionMet(source.getControllerId());
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ class CobraTrapWatcher extends Watcher {
|
|||
Set<UUID> players = new HashSet<>();
|
||||
|
||||
public CobraTrapWatcher() {
|
||||
super(CobraTrapWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(CobraTrapWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public CobraTrapWatcher(final CobraTrapWatcher watcher) {
|
||||
|
|
|
@ -128,7 +128,7 @@ class ContainmentPriestReplacementEffect extends ReplacementEffectImpl {
|
|||
card = card.getSecondCardFace();
|
||||
}
|
||||
if (card.isCreature()) { // TODO: Bestow Card cast as Enchantment probably not handled correctly
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ class CyclopeanTombEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObjectReference mor = new MageObjectReference(source.getSourceId(), source.getSourceObjectZoneChangeCounter(), game);
|
||||
CyclopeanTombCounterWatcher watcher = (CyclopeanTombCounterWatcher) game.getState().getWatchers().get(CyclopeanTombCounterWatcher.class.getName());
|
||||
CyclopeanTombCounterWatcher watcher = (CyclopeanTombCounterWatcher) game.getState().getWatchers().get(CyclopeanTombCounterWatcher.class.getSimpleName());
|
||||
if (controller != null && watcher != null) {
|
||||
|
||||
Set<MageObjectReference> landRef = watcher.landMiredByCyclopeanTombInstance(mor, game);
|
||||
|
@ -221,7 +221,7 @@ class CyclopeanTombCounterWatcher extends Watcher {
|
|||
public HashMap<MageObjectReference, Set<MageObjectReference>> counterData = new HashMap<>();
|
||||
|
||||
public CyclopeanTombCounterWatcher() {
|
||||
super(CyclopeanTombCounterWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(CyclopeanTombCounterWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public CyclopeanTombCounterWatcher(final CyclopeanTombCounterWatcher watcher) {
|
||||
|
|
|
@ -76,7 +76,7 @@ class CardsDiscardedThisTurnWatcher extends Watcher {
|
|||
private final Map<UUID, Integer> amountOfCardsDiscardedThisTurn = new HashMap<>();
|
||||
|
||||
public CardsDiscardedThisTurnWatcher() {
|
||||
super("CardsDiscardedThisTurnWatcher", WatcherScope.GAME);
|
||||
super(CardsDiscardedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public CardsDiscardedThisTurnWatcher(final CardsDiscardedThisTurnWatcher watcher) {
|
||||
|
@ -129,7 +129,7 @@ class DreamSalvageEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
CardsDiscardedThisTurnWatcher watcher = (CardsDiscardedThisTurnWatcher) game.getState().getWatchers().get("CardsDiscardedThisTurnWatcher");
|
||||
CardsDiscardedThisTurnWatcher watcher = (CardsDiscardedThisTurnWatcher) game.getState().getWatchers().get(CardsDiscardedThisTurnWatcher.class.getSimpleName());
|
||||
Player targetOpponent = game.getPlayer(source.getFirstTarget());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (targetOpponent != null
|
||||
|
|
|
@ -82,7 +82,7 @@ class CastBlueSpellThisTurnCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getName());
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (Spell spell : watcher.getSpellsCastThisTurn(source.getControllerId())) {
|
||||
if (!spell.getSourceId().equals(source.getSourceId()) && spell.getColor(game).isBlue()) {
|
||||
|
|
|
@ -100,7 +100,7 @@ class NoMoreThanOneCreatureCanAttackEachTurnEffect extends RestrictionEffect {
|
|||
if (!game.getCombat().getAttackers().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getName());
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
|
||||
Set<MageObjectReference> attackedThisTurnCreatures = watcher.getAttackedThisTurnCreatures();
|
||||
return attackedThisTurnCreatures.isEmpty()
|
||||
|| (attackedThisTurnCreatures.size() == 1 && attackedThisTurnCreatures.contains(new MageObjectReference(attacker, game)));
|
||||
|
|
|
@ -95,7 +95,7 @@ enum HadAnotherCreatureEnterTheBattlefieldCondition implements Condition {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatchers().get(PermanentsEnteredBattlefieldWatcher.class.getName());
|
||||
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatchers().get(PermanentsEnteredBattlefieldWatcher.class.getSimpleName());
|
||||
return sourcePermanent != null
|
||||
&& watcher != null
|
||||
&& watcher.AnotherCreatureEnteredBattlefieldUnderPlayersControlLastTurn(sourcePermanent, game);
|
||||
|
|
|
@ -104,7 +104,7 @@ class ErayoSoratamiAscendantTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
return watcher != null && watcher.getAmountOfSpellsAllPlayersCastOnCurrentTurn() == 4;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ class ErayosEssenceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.getOpponents(getControllerId()).contains(event.getPlayerId())) {
|
||||
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()) == 1) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
|
|
|
@ -90,7 +90,7 @@ class ErdwalIlluminatorTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
InvestigatedWatcher watcher = (InvestigatedWatcher) game.getState().getWatchers().get(InvestigatedWatcher.class.getName());
|
||||
InvestigatedWatcher watcher = (InvestigatedWatcher) game.getState().getWatchers().get(InvestigatedWatcher.class.getSimpleName());
|
||||
return watcher != null && watcher.getTimesInvestigated(getControllerId()) == 1;
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ class InvestigatedWatcher extends Watcher {
|
|||
private final HashMap<UUID, Integer> timesInvestigated = new HashMap<>();
|
||||
|
||||
public InvestigatedWatcher() {
|
||||
super(InvestigatedWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(InvestigatedWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public InvestigatedWatcher(final InvestigatedWatcher watcher) {
|
||||
|
|
|
@ -80,7 +80,7 @@ class ErgRaidersCondition implements Condition {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent raiders = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getName());
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
|
||||
// wasControlledFromStartOfControllerTurn should be checked during resolution I guess, but shouldn't be relevant
|
||||
return raiders.wasControlledFromStartOfControllerTurn() && !watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(raiders, game));
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ class EtherswornCanonistWatcher extends Watcher {
|
|||
private Set<UUID> castNonartifactSpell = new HashSet<>();
|
||||
|
||||
public EtherswornCanonistWatcher() {
|
||||
super(EtherswornCanonistWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(EtherswornCanonistWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public EtherswornCanonistWatcher(final EtherswornCanonistWatcher watcher) {
|
||||
|
@ -143,7 +143,7 @@ class EtherswornCanonistReplacementEffect extends ContinuousRuleModifyingEffectI
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Card card = game.getCard(event.getSourceId());
|
||||
if (card != null && !card.isArtifact()) {
|
||||
EtherswornCanonistWatcher watcher = (EtherswornCanonistWatcher) game.getState().getWatchers().get(EtherswornCanonistWatcher.class.getName());
|
||||
EtherswornCanonistWatcher watcher = (EtherswornCanonistWatcher) game.getState().getWatchers().get(EtherswornCanonistWatcher.class.getSimpleName());
|
||||
return watcher != null && watcher.castNonArtifactSpell(event.getPlayerId());
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -84,7 +84,7 @@ class TargetCreaturePermanentThatDealtDamageThisTurn extends TargetPermanent {
|
|||
|
||||
@Override
|
||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get("SourceDidDamageWatcher");
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get(SourceDidDamageWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
if (watcher.damageSources.contains(id)) {
|
||||
return super.canTarget(id, source, game);
|
||||
|
@ -101,7 +101,7 @@ class TargetCreaturePermanentThatDealtDamageThisTurn extends TargetPermanent {
|
|||
}
|
||||
int count = 0;
|
||||
MageObject targetSource = game.getObject(sourceId);
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get("SourceDidDamageWatcher");
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get(SourceDidDamageWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, sourceControllerId, sourceId, game)) {
|
||||
if (!targets.containsKey(permanent.getId()) && watcher.damageSources.contains(permanent.getId())) {
|
||||
|
@ -121,7 +121,7 @@ class TargetCreaturePermanentThatDealtDamageThisTurn 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);
|
||||
|
|
|
@ -83,7 +83,7 @@ enum FairgroundsTrumpeterCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
FairgroundsTrumpeterWatcher watcher = (FairgroundsTrumpeterWatcher) game.getState().getWatchers().get(FairgroundsTrumpeterWatcher.class.getName());
|
||||
FairgroundsTrumpeterWatcher watcher = (FairgroundsTrumpeterWatcher) game.getState().getWatchers().get(FairgroundsTrumpeterWatcher.class.getSimpleName());
|
||||
return watcher != null && watcher.p1p1AddedToPermanent(source.getControllerId());
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ class FairgroundsTrumpeterWatcher extends Watcher {
|
|||
private final Set<UUID> players = new HashSet<>();
|
||||
|
||||
public FairgroundsTrumpeterWatcher() {
|
||||
super(FairgroundsTrumpeterWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(FairgroundsTrumpeterWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public FairgroundsTrumpeterWatcher(final FairgroundsTrumpeterWatcher watcher) {
|
||||
|
|
|
@ -98,7 +98,7 @@ class FellShepherdWatcher extends Watcher {
|
|||
private Set<UUID> creatureIds = new HashSet<>();
|
||||
|
||||
public FellShepherdWatcher() {
|
||||
super("YourCreaturesPutToGraveFromBattlefield", WatcherScope.PLAYER);
|
||||
super(FellShepherdWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||
condition = true;
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ class FellShepherdEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
FellShepherdWatcher watcher = (FellShepherdWatcher) game.getState().getWatchers().get("YourCreaturesPutToGraveFromBattlefield", source.getControllerId());
|
||||
FellShepherdWatcher watcher = (FellShepherdWatcher) game.getState().getWatchers().get(FellShepherdWatcher.class.getSimpleName(), source.getControllerId());
|
||||
if (watcher != null) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (UUID creatureId : watcher.getCreaturesIds()) {
|
||||
|
|
|
@ -72,7 +72,7 @@ class FinalPunishmentAmount implements DynamicValue {
|
|||
@Override
|
||||
public int calculate(Game game, Ability source, Effect effect) {
|
||||
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher
|
||||
= (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatchers().get("AmountOfDamageReceivedThisTurn");
|
||||
= (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatchers().get(AmountOfDamageAPlayerReceivedThisTurnWatcher.class.getSimpleName());
|
||||
if(watcher != null) {
|
||||
return watcher.getAmountOfDamageReceivedThisTurn(source.getFirstTarget());
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ class FleshAllergyWatcher extends Watcher {
|
|||
public int creaturesDiedThisTurn = 0;
|
||||
|
||||
public FleshAllergyWatcher() {
|
||||
super("CreaturesDied", WatcherScope.GAME);
|
||||
super(FleshAllergyWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public FleshAllergyWatcher(final FleshAllergyWatcher watcher) {
|
||||
|
@ -131,7 +131,7 @@ class FleshAllergyEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
FleshAllergyWatcher watcher = (FleshAllergyWatcher) game.getState().getWatchers().get("CreaturesDied");
|
||||
FleshAllergyWatcher watcher = (FleshAllergyWatcher) game.getState().getWatchers().get(FleshAllergyWatcher.class.getSimpleName());
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null && watcher != null) {
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
|
|
|
@ -90,7 +90,7 @@ class GeneratorServantWatcher extends Watcher {
|
|||
public List<UUID> creatures = new ArrayList<>();
|
||||
|
||||
public GeneratorServantWatcher() {
|
||||
super("GeneratorServantWatcher", WatcherScope.CARD);
|
||||
super(GeneratorServantWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
}
|
||||
|
||||
public GeneratorServantWatcher(final GeneratorServantWatcher watcher) {
|
||||
|
@ -141,7 +141,7 @@ class GeneratorServantHasteEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
GeneratorServantWatcher watcher = (GeneratorServantWatcher) game.getState().getWatchers().get("GeneratorServantWatcher", source.getSourceId());
|
||||
GeneratorServantWatcher watcher = (GeneratorServantWatcher) game.getState().getWatchers().get(GeneratorServantWatcher.class.getSimpleName(), source.getSourceId());
|
||||
if (watcher != null) {
|
||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents()) {
|
||||
if (watcher.creatures.contains(perm.getId())) {
|
||||
|
|
|
@ -143,7 +143,7 @@ class GisaAndGeralfCastFromGraveyardEffect extends AsThoughEffectImpl {
|
|||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
if (objectId.equals(getTargetPointer().getFirst(game, source))) {
|
||||
if (affectedControllerId.equals(source.getControllerId())) {
|
||||
GisaAndGeralfWatcher watcher = (GisaAndGeralfWatcher) game.getState().getWatchers().get("GisaAndGeralfWatcher", source.getSourceId());
|
||||
GisaAndGeralfWatcher watcher = (GisaAndGeralfWatcher) game.getState().getWatchers().get(GisaAndGeralfWatcher.class.getSimpleName(), source.getSourceId());
|
||||
return !watcher.isAbilityUsed();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ class GleancrawlerEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
CardsPutIntoGraveyardWatcher watcher = (CardsPutIntoGraveyardWatcher) game.getState().getWatchers().get("CardsPutIntoGraveyardWatcher");
|
||||
CardsPutIntoGraveyardWatcher watcher = (CardsPutIntoGraveyardWatcher) game.getState().getWatchers().get(CardsPutIntoGraveyardWatcher.class.getSimpleName());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && watcher != null) {
|
||||
Set<MageObjectReference> cardsToGraveyardThisTurn = watcher.getCardsPutToGraveyardFromBattlefield();
|
||||
|
|
|
@ -104,7 +104,7 @@ class GlyphKeeperAbility extends TriggeredAbilityImpl {
|
|||
if (event.getTargetId().equals(this.getSourceId())) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.isCreature()) {
|
||||
NumberOfTimesPermanentTargetedATurnWatcher watcher = (NumberOfTimesPermanentTargetedATurnWatcher) game.getState().getWatchers().get(NumberOfTimesPermanentTargetedATurnWatcher.class.getName());
|
||||
NumberOfTimesPermanentTargetedATurnWatcher watcher = (NumberOfTimesPermanentTargetedATurnWatcher) game.getState().getWatchers().get(NumberOfTimesPermanentTargetedATurnWatcher.class.getSimpleName());
|
||||
if (watcher != null
|
||||
&& watcher.notMoreThanOnceTargetedThisTurn(permanent, game)) {
|
||||
for (Effect effect : getEffects()) {
|
||||
|
|
|
@ -95,7 +95,7 @@ class GoblinCohortEffect 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;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ class GontisMachinationsTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(getControllerId())) {
|
||||
GontisMachinationsFirstLostLifeThisTurnWatcher watcher
|
||||
= (GontisMachinationsFirstLostLifeThisTurnWatcher) game.getState().getWatchers().get(GontisMachinationsFirstLostLifeThisTurnWatcher.class.getName());
|
||||
= (GontisMachinationsFirstLostLifeThisTurnWatcher) game.getState().getWatchers().get(GontisMachinationsFirstLostLifeThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.timesLostLifeThisTurn(event.getTargetId()) < 2) {
|
||||
return true;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ class GontisMachinationsFirstLostLifeThisTurnWatcher extends Watcher {
|
|||
private final Map<UUID, Integer> playersLostLife = new HashMap<>();
|
||||
|
||||
public GontisMachinationsFirstLostLifeThisTurnWatcher() {
|
||||
super(GontisMachinationsFirstLostLifeThisTurnWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(GontisMachinationsFirstLostLifeThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public GontisMachinationsFirstLostLifeThisTurnWatcher(final GontisMachinationsFirstLostLifeThisTurnWatcher watcher) {
|
||||
|
|
|
@ -76,7 +76,7 @@ public class GrimReturn extends CardImpl {
|
|||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
CardsPutIntoGraveyardWatcher watcher = (CardsPutIntoGraveyardWatcher) game.getState().getWatchers().get("CardsPutIntoGraveyardWatcher");
|
||||
CardsPutIntoGraveyardWatcher watcher = (CardsPutIntoGraveyardWatcher) game.getState().getWatchers().get(CardsPutIntoGraveyardWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
FilterCard filter = new FilterCreatureCard(textFilter);
|
||||
List<CardIdPredicate> uuidPredicates = new ArrayList<>();
|
||||
|
|
|
@ -87,7 +87,7 @@ class HardenedBerserkerSpellsCostReductionEffect extends CostModificationEffectI
|
|||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
spellsCast = watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId());
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ class HardenedBerserkerSpellsCostReductionEffect extends CostModificationEffectI
|
|||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
if (watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId()) > spellsCast) {
|
||||
discard(); // only one use
|
||||
|
|
|
@ -86,7 +86,7 @@ class HarnessTheStormTriggeredAbility extends SpellCastControllerTriggeredAbilit
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (super.checkTrigger(event, game)) {
|
||||
CastFromHandWatcher watcher = (CastFromHandWatcher) game.getState().getWatchers().get(CastFromHandWatcher.class.getName());
|
||||
CastFromHandWatcher watcher = (CastFromHandWatcher) game.getState().getWatchers().get(CastFromHandWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.spellWasCastFromHand(event.getSourceId())) {
|
||||
Spell spell = game.getState().getStack().getSpell(event.getSourceId());
|
||||
if (spell != null) {
|
||||
|
|
|
@ -161,7 +161,7 @@ class HopeOfGhirapurPlayerLostLifePredicate implements Predicate<Player> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Player input, Game game) {
|
||||
HopeOfGhirapurCombatDamageWatcher watcher = (HopeOfGhirapurCombatDamageWatcher) game.getState().getWatchers().get(HopeOfGhirapurCombatDamageWatcher.class.getName());
|
||||
HopeOfGhirapurCombatDamageWatcher watcher = (HopeOfGhirapurCombatDamageWatcher) game.getState().getWatchers().get(HopeOfGhirapurCombatDamageWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
return watcher.playerGotCombatDamage(sourceReference, input.getId());
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ class HopeOfGhirapurCombatDamageWatcher extends Watcher {
|
|||
private final HashMap<MageObjectReference, Set<UUID>> combatDamagedPlayers = new HashMap<>();
|
||||
|
||||
public HopeOfGhirapurCombatDamageWatcher() {
|
||||
super(HopeOfGhirapurCombatDamageWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(HopeOfGhirapurCombatDamageWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public HopeOfGhirapurCombatDamageWatcher(final HopeOfGhirapurCombatDamageWatcher watcher) {
|
||||
|
|
|
@ -87,7 +87,7 @@ class CastRedSpellThisTurnCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
HotHeadedGiantWatcher watcher = (HotHeadedGiantWatcher) game.getState().getWatchers().get("HotHeadedGiantWatcher", source.getControllerId());
|
||||
HotHeadedGiantWatcher watcher = (HotHeadedGiantWatcher) game.getState().getWatchers().get(HotHeadedGiantWatcher.class.getSimpleName(), source.getControllerId());
|
||||
if (watcher != null) {
|
||||
return watcher.conditionMet();
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ class HotHeadedGiantWatcher extends Watcher {
|
|||
private UUID cardId;
|
||||
|
||||
public HotHeadedGiantWatcher(UUID cardId) {
|
||||
super("HotHeadedGiantWatcher", WatcherScope.PLAYER);
|
||||
super(HotHeadedGiantWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||
this.cardId = cardId;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ enum GreatestAmountOfDamageDealtValue implements DynamicValue, MageSingleton {
|
|||
}
|
||||
|
||||
public int calculate(Game game, UUID controllerId) {
|
||||
GreatestAmountOfDamageWatcher watcher = (GreatestAmountOfDamageWatcher) game.getState().getWatchers().get("GreatestAmountOfDamage");
|
||||
GreatestAmountOfDamageWatcher watcher = (GreatestAmountOfDamageWatcher) game.getState().getWatchers().get(GreatestAmountOfDamageWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
return watcher.getGreatestAmountOfDamage();
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ class GreatestAmountOfDamageWatcher extends Watcher {
|
|||
private int damageAmount;
|
||||
|
||||
public GreatestAmountOfDamageWatcher() {
|
||||
super("GreatestAmountOfDamage", WatcherScope.GAME);
|
||||
super(GreatestAmountOfDamageWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public GreatestAmountOfDamageWatcher(final GreatestAmountOfDamageWatcher watcher) {
|
||||
|
|
|
@ -72,7 +72,7 @@ class ImpatienceCondition 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());
|
||||
return watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(game.getActivePlayerId()) == 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ class IncinerateEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ class IncursionTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(controllerId)) {
|
||||
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()) == 2) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ enum InfernoTrapCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
InfernoTrapWatcher watcher = (InfernoTrapWatcher) game.getState().getWatchers().get(InfernoTrapWatcher.class.getName());
|
||||
InfernoTrapWatcher watcher = (InfernoTrapWatcher) game.getState().getWatchers().get(InfernoTrapWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
Set<MageObjectReference> damagingCreatures = watcher.getDamagingCreatures(source.getControllerId());
|
||||
return damagingCreatures.size() > 1;
|
||||
|
@ -101,7 +101,7 @@ class InfernoTrapWatcher extends Watcher {
|
|||
Map<UUID, Set<MageObjectReference>> playerDamagedByCreature = new HashMap<>();
|
||||
|
||||
public InfernoTrapWatcher() {
|
||||
super(InfernoTrapWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(InfernoTrapWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public InfernoTrapWatcher(final InfernoTrapWatcher watcher) {
|
||||
|
|
|
@ -87,7 +87,7 @@ class InsatiableRakghoulEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
NonArtifactCreaturesDiedWatcher watcher = (NonArtifactCreaturesDiedWatcher) game.getState().getWatchers().get("NonArtifactCreaturesDiedWatcher");
|
||||
NonArtifactCreaturesDiedWatcher watcher = (NonArtifactCreaturesDiedWatcher) game.getState().getWatchers().get(NonArtifactCreaturesDiedWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.conditionMet()) {
|
||||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
|
@ -108,7 +108,7 @@ class InsatiableRakghoulEffect extends OneShotEffect {
|
|||
class NonArtifactCreaturesDiedWatcher extends Watcher {
|
||||
|
||||
public NonArtifactCreaturesDiedWatcher() {
|
||||
super("NonArtifactCreaturesDiedWatcher", WatcherScope.GAME);
|
||||
super(NonArtifactCreaturesDiedWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public NonArtifactCreaturesDiedWatcher(final NonArtifactCreaturesDiedWatcher watcher) {
|
||||
|
|
|
@ -125,7 +125,7 @@ class JaceUnravelerOfSecretsTriggeredAbility extends SpellCastOpponentTriggeredA
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (super.checkTrigger(event, game)) {
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getName());
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
List<Spell> spells = watcher.getSpellsCastThisTurn(event.getPlayerId());
|
||||
if (spells != null && spells.size() == 1) {
|
||||
|
|
|
@ -93,7 +93,7 @@ class DiscardAndDrawEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
JandorsRingWatcher watcher = (JandorsRingWatcher) game.getState().getWatchers().get("JandorsRingWatcher");
|
||||
JandorsRingWatcher watcher = (JandorsRingWatcher) game.getState().getWatchers().get(JandorsRingWatcher.class.getSimpleName());
|
||||
|
||||
FilterCard filter = new FilterCard(game.getCard(watcher.lastDrawnCard).getName());
|
||||
filter.add(new CardIdPredicate(watcher.lastDrawnCard));
|
||||
|
@ -114,7 +114,7 @@ class JandorsRingWatcher extends Watcher {
|
|||
UUID lastDrawnCard;
|
||||
|
||||
public JandorsRingWatcher() {
|
||||
super("JandorsRingWatcher", WatcherScope.PLAYER);
|
||||
super(JandorsRingWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||
this.lastDrawnCard = null;
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ enum WatchedCardInHandCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
JandorsRingWatcher watcher = (JandorsRingWatcher) game.getState().getWatchers().get("JandorsRingWatcher");
|
||||
JandorsRingWatcher watcher = (JandorsRingWatcher) game.getState().getWatchers().get(JandorsRingWatcher.class.getSimpleName());
|
||||
|
||||
return watcher.lastDrawnCard != null && game.getPlayer(source.getControllerId()).getHand().contains(watcher.lastDrawnCard);
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ class CantRegenerateEffect 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);
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ class JelevaNephaliasScourgeEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (controller != null && sourceCard != null) {
|
||||
JelevaNephaliasWatcher watcher = (JelevaNephaliasWatcher) game.getState().getWatchers().get("ManaPaidToCastJelevaNephalias", source.getSourceId());
|
||||
JelevaNephaliasWatcher watcher = (JelevaNephaliasWatcher) game.getState().getWatchers().get(JelevaNephaliasWatcher.class.getSimpleName(), source.getSourceId());
|
||||
if (watcher != null) {
|
||||
int xValue = watcher.getManaSpentToCastLastTime(sourceCard.getZoneChangeCounter(game) - 1);
|
||||
if (xValue > 0) {
|
||||
|
@ -176,7 +176,7 @@ class JelevaNephaliasWatcher extends Watcher {
|
|||
private final Map<Integer, Integer> manaSpendToCast = new HashMap<>(); // cast
|
||||
|
||||
public JelevaNephaliasWatcher() {
|
||||
super("ManaPaidToCastJelevaNephalias", WatcherScope.CARD);
|
||||
super(JelevaNephaliasWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
}
|
||||
|
||||
public JelevaNephaliasWatcher(final JelevaNephaliasWatcher watcher) {
|
||||
|
|
|
@ -93,7 +93,7 @@ class JoriEnTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(controllerId)) {
|
||||
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()) == 2) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ class KaradorGhostChieftainCastFromGraveyardEffect extends AsThoughEffectImpl {
|
|||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
if (objectId.equals(getTargetPointer().getFirst(game, source))) {
|
||||
if (affectedControllerId.equals(source.getControllerId())) {
|
||||
KaradorGhostChieftainWatcher watcher = (KaradorGhostChieftainWatcher) game.getState().getWatchers().get("KaradorGhostChieftainWatcher", source.getSourceId());
|
||||
KaradorGhostChieftainWatcher watcher = (KaradorGhostChieftainWatcher) game.getState().getWatchers().get(KaradorGhostChieftainWatcher.class.getSimpleName(), source.getSourceId());
|
||||
return !watcher.isAbilityUsed();
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ class KaradorGhostChieftainWatcher extends Watcher {
|
|||
boolean abilityUsed = false;
|
||||
|
||||
KaradorGhostChieftainWatcher() {
|
||||
super("KaradorGhostChieftainWatcher", WatcherScope.CARD);
|
||||
super(KaradorGhostChieftainWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
}
|
||||
|
||||
KaradorGhostChieftainWatcher(final KaradorGhostChieftainWatcher watcher) {
|
||||
|
|
|
@ -108,7 +108,7 @@ class KiraGreatGlassSpinnerAbility extends TriggeredAbilityImpl {
|
|||
if (event.getTargetId().equals(this.getSourceId())) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.isCreature()) {
|
||||
NumberOfTimesPermanentTargetedATurnWatcher watcher = (NumberOfTimesPermanentTargetedATurnWatcher) game.getState().getWatchers().get(NumberOfTimesPermanentTargetedATurnWatcher.class.getName());
|
||||
NumberOfTimesPermanentTargetedATurnWatcher watcher = (NumberOfTimesPermanentTargetedATurnWatcher) game.getState().getWatchers().get(NumberOfTimesPermanentTargetedATurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.notMoreThanOnceTargetedThisTurn(permanent, game)) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
|
||||
|
|
|
@ -110,7 +110,7 @@ class BecomesMonarchTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkInterveningIfClause(Game game) {
|
||||
MonarchAtTurnStartWatcher watcher = (MonarchAtTurnStartWatcher) game.getState().getWatchers().get("MonarchAtTurnStartWatcher");
|
||||
MonarchAtTurnStartWatcher watcher = (MonarchAtTurnStartWatcher) game.getState().getWatchers().get(MonarchAtTurnStartWatcher.class.getSimpleName());
|
||||
return watcher != null && getControllerId().equals(watcher.getMonarchIdAtTurnStart());
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ class MonarchAtTurnStartWatcher extends Watcher {
|
|||
private UUID monarchIdAtTurnStart;
|
||||
|
||||
public MonarchAtTurnStartWatcher() {
|
||||
super("MonarchAtTurnStartWatcher", WatcherScope.GAME);
|
||||
super(MonarchAtTurnStartWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public MonarchAtTurnStartWatcher(final MonarchAtTurnStartWatcher watcher) {
|
||||
|
|
|
@ -106,7 +106,7 @@ class KraumLudevicsOpusTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
|
||||
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()) == 2) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ class CardsDrawnThisTurnDynamicValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
KydeleCardsDrawnThisTurnWatcher watcher = (KydeleCardsDrawnThisTurnWatcher) game.getState().getWatchers().get(KydeleCardsDrawnThisTurnWatcher.class.getName());
|
||||
KydeleCardsDrawnThisTurnWatcher watcher = (KydeleCardsDrawnThisTurnWatcher) game.getState().getWatchers().get(KydeleCardsDrawnThisTurnWatcher.class.getSimpleName());
|
||||
return watcher.getCardsDrawnThisTurn(sourceAbility.getControllerId()).size();
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ class KydeleCardsDrawnThisTurnWatcher extends Watcher {
|
|||
private final Map<UUID, Set<UUID>> cardsDrawnThisTurn = new HashMap<>();
|
||||
|
||||
public KydeleCardsDrawnThisTurnWatcher() {
|
||||
super(KydeleCardsDrawnThisTurnWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(KydeleCardsDrawnThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public KydeleCardsDrawnThisTurnWatcher(final KydeleCardsDrawnThisTurnWatcher watcher) {
|
||||
|
|
|
@ -81,7 +81,7 @@ enum LavaballTrapCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatchers().get(PermanentsEnteredBattlefieldWatcher.class.getName());
|
||||
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatchers().get(PermanentsEnteredBattlefieldWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
List<Permanent> permanents = watcher.getThisTurnEnteringPermanents(opponentId);
|
||||
|
|
|
@ -80,7 +80,7 @@ class LudevicNecroAlchemistCondition 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());
|
||||
UUID player = game.getActivePlayerId();
|
||||
PlayerList playerList = game.getState().getPlayerList().copy();
|
||||
Player currentPlayer = null;
|
||||
|
|
|
@ -95,7 +95,7 @@ class MaelstromNexusGainCascadeFirstSpellEffect extends ContinuousEffectImpl {
|
|||
// only spells cast, so no copies of spells
|
||||
if ((stackObject instanceof Spell) && !stackObject.isCopy() && stackObject.getControllerId().equals(source.getControllerId())) {
|
||||
Spell spell = (Spell) stackObject;
|
||||
FirstSpellCastThisTurnWatcher watcher = (FirstSpellCastThisTurnWatcher) game.getState().getWatchers().get("FirstSpellCastThisTurn");
|
||||
FirstSpellCastThisTurnWatcher watcher = (FirstSpellCastThisTurnWatcher) game.getState().getWatchers().get(FirstSpellCastThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && spell.getId().equals(watcher.getIdOfFirstCastSpell(source.getControllerId()))) {
|
||||
game.getState().addOtherAbility(spell.getCard(), cascadeAbility);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class ManaMazeEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Card card = game.getCard(event.getSourceId());
|
||||
if (card != null) {
|
||||
LastSpellCastWatcher watcher = (LastSpellCastWatcher) game.getState().getWatchers().get(LastSpellCastWatcher.class.getName());
|
||||
LastSpellCastWatcher watcher = (LastSpellCastWatcher) game.getState().getWatchers().get(LastSpellCastWatcher.class.getSimpleName());
|
||||
if (watcher != null
|
||||
&& watcher.lastSpellCast != null) {
|
||||
return card.getColor(game).contains(watcher.lastSpellCast.getColor(game));
|
||||
|
@ -115,7 +115,7 @@ class LastSpellCastWatcher extends Watcher {
|
|||
Spell lastSpellCast = null;
|
||||
|
||||
public LastSpellCastWatcher() {
|
||||
super(LastSpellCastWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(LastSpellCastWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public LastSpellCastWatcher(final LastSpellCastWatcher watcher) {
|
||||
|
|
|
@ -77,7 +77,7 @@ enum MindbreakTrapCondition 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 (watcher != null) {
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
if (watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(opponentId) > 2) {
|
||||
|
|
|
@ -90,7 +90,7 @@ class MindsDilationTriggeredAbility extends SpellCastOpponentTriggeredAbility {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (super.checkTrigger(event, game)) {
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getName());
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
List<Spell> spells = watcher.getSpellsCastThisTurn(event.getPlayerId());
|
||||
if (spells != null && spells.size() == 1) {
|
||||
|
|
|
@ -85,7 +85,7 @@ class DamagedThisTurnPredicate implements Predicate<MageItem> {
|
|||
|
||||
@Override
|
||||
public boolean apply(MageItem input, Game game) {
|
||||
DamageDoneWatcher watcher = (DamageDoneWatcher) game.getState().getWatchers().get("DamageDone");
|
||||
DamageDoneWatcher watcher = (DamageDoneWatcher) game.getState().getWatchers().get(DamageDoneWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
if (input instanceof MageObject) {
|
||||
return watcher.isDamaged(input.getId(), ((MageObject) input).getZoneChangeCounter(game), game);
|
||||
|
|
|
@ -76,7 +76,7 @@ enum NeedlebiteTrapCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
PlayerGainedLifeWatcher watcher = (PlayerGainedLifeWatcher) game.getState().getWatchers().get(PlayerGainedLifeWatcher.class.getName());
|
||||
PlayerGainedLifeWatcher watcher = (PlayerGainedLifeWatcher) game.getState().getWatchers().get(PlayerGainedLifeWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
if (watcher.getLiveGained(opponentId) > 0) {
|
||||
|
|
|
@ -86,7 +86,7 @@ class NoRestForTheWickedEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
NoRestForTheWickedWatcher watcher = (NoRestForTheWickedWatcher) game.getState().getWatchers().get("NoRestForTheWickedWatcher");
|
||||
NoRestForTheWickedWatcher watcher = (NoRestForTheWickedWatcher) game.getState().getWatchers().get(NoRestForTheWickedWatcher.class.getSimpleName());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (watcher != null && controller != null) {
|
||||
Cards cardsToHand = new CardsImpl();
|
||||
|
@ -118,7 +118,7 @@ class NoRestForTheWickedWatcher extends Watcher {
|
|||
ArrayList<UUID> cards;
|
||||
|
||||
public NoRestForTheWickedWatcher() {
|
||||
super("NoRestForTheWickedWatcher", WatcherScope.GAME);
|
||||
super(NoRestForTheWickedWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
this.cards = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ class NotionThiefReplacementEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||
if (game.getActivePlayerId().equals(event.getPlayerId()) && game.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;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ class NotoriousThrongEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatchers().get("AmountOfDamageReceivedThisTurn");
|
||||
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatchers().get(AmountOfDamageAPlayerReceivedThisTurnWatcher.class.getSimpleName());
|
||||
if(controller != null && watcher != null) {
|
||||
int numTokens = 0;
|
||||
for(UUID opponentId: game.getOpponents(controller.getId())) {
|
||||
|
|
|
@ -84,7 +84,7 @@ enum OathOfLilianaCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
OathOfLilianaWatcher watcher = (OathOfLilianaWatcher) game.getState().getWatchers().get("OathOfLilianaWatcher");
|
||||
OathOfLilianaWatcher watcher = (OathOfLilianaWatcher) game.getState().getWatchers().get(OathOfLilianaWatcher.class.getSimpleName());
|
||||
return watcher != null && watcher.enteredPlaneswalkerForPlayer(source.getControllerId());
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ class OathOfLilianaWatcher extends Watcher {
|
|||
private final Set<UUID> players = new HashSet<>();
|
||||
|
||||
public OathOfLilianaWatcher() {
|
||||
super("OathOfLilianaWatcher", WatcherScope.GAME);
|
||||
super(OathOfLilianaWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public OathOfLilianaWatcher(final OathOfLilianaWatcher watcher) {
|
||||
|
|
|
@ -268,7 +268,7 @@ class OracleEnVecDestroyEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getName());
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (UUID targetId : chosenCreatures) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
|
|
|
@ -121,7 +121,7 @@ class OvermasterEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
OvermasterWatcher watcher = (OvermasterWatcher) game.getState().getWatchers().get("overmasterWatcher", source.getControllerId());
|
||||
OvermasterWatcher watcher = (OvermasterWatcher) game.getState().getWatchers().get(OvermasterWatcher.class.getSimpleName(), source.getControllerId());
|
||||
return spell != null && watcher != null && watcher.isUncounterable(spell.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ class ParadoxHazeTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (permanent != null) {
|
||||
Player player = game.getPlayer(permanent.getAttachedTo());
|
||||
if (player != null && game.getActivePlayerId().equals(player.getId())) {
|
||||
FirstTimeStepWatcher watcher = (FirstTimeStepWatcher) game.getState().getWatchers().get(EventType.UPKEEP_STEP_POST.toString() + FirstTimeStepWatcher.class.getName());
|
||||
FirstTimeStepWatcher watcher = (FirstTimeStepWatcher) game.getState().getWatchers().get(EventType.UPKEEP_STEP_POST.toString() + FirstTimeStepWatcher.class.getSimpleName());
|
||||
if (watcher != null && !watcher.conditionMet()) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
|
||||
return true;
|
||||
|
|
|
@ -77,7 +77,7 @@ class CastWhiteSpellThisTurnCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
PatriciansScornWatcher watcher = (PatriciansScornWatcher) game.getState().getWatchers().get("PatriciansScornWatcher", source.getSourceId());
|
||||
PatriciansScornWatcher watcher = (PatriciansScornWatcher) game.getState().getWatchers().get(PatriciansScornWatcher.class.getSimpleName(), source.getSourceId());
|
||||
if (watcher != null) {
|
||||
return watcher.conditionMet();
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ class PatriciansScornWatcher extends Watcher {
|
|||
}
|
||||
|
||||
public PatriciansScornWatcher() {
|
||||
super("PatriciansScornWatcher", WatcherScope.CARD);
|
||||
super(PatriciansScornWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
}
|
||||
|
||||
public PatriciansScornWatcher(final PatriciansScornWatcher watcher) {
|
||||
|
|
|
@ -78,7 +78,7 @@ enum PermafrostTrapCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatchers().get(PermanentsEnteredBattlefieldWatcher.class.getName());
|
||||
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatchers().get(PermanentsEnteredBattlefieldWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
List<Permanent> permanents = watcher.getThisTurnEnteringPermanents(opponentId);
|
||||
|
|
|
@ -90,7 +90,7 @@ class PowerSurgeDamageEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
PowerSurgeWatcher watcher = (PowerSurgeWatcher) game.getState().getWatchers().get(PowerSurgeWatcher.class.getName());
|
||||
PowerSurgeWatcher watcher = (PowerSurgeWatcher) game.getState().getWatchers().get(PowerSurgeWatcher.class.getSimpleName());
|
||||
int damage = watcher.getUntappedLandCount();
|
||||
player.damage(damage, source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
|
@ -115,7 +115,7 @@ class PowerSurgeWatcher extends Watcher {
|
|||
private int untappedLandCount;
|
||||
|
||||
public PowerSurgeWatcher() {
|
||||
super(PowerSurgeWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(PowerSurgeWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public PowerSurgeWatcher(final PowerSurgeWatcher watcher) {
|
||||
|
|
|
@ -78,7 +78,7 @@ class DidNotCastCreatureCondition implements Condition {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent p = game.getPermanent(source.getSourceId());
|
||||
if (p != null) {
|
||||
Watcher watcher = game.getState().getWatchers().get("CastCreature", source.getSourceId());
|
||||
Watcher watcher = game.getState().getWatchers().get(CastCreatureWatcher.class.getSimpleName(), source.getSourceId());
|
||||
if (watcher != null && !watcher.conditionMet()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ class DidNotCastCreatureCondition implements Condition {
|
|||
class CastCreatureWatcher extends Watcher {
|
||||
|
||||
public CastCreatureWatcher() {
|
||||
super("CastCreature", WatcherScope.CARD);
|
||||
super(CastCreatureWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
}
|
||||
|
||||
public CastCreatureWatcher(final CastCreatureWatcher watcher) {
|
||||
|
|
|
@ -114,7 +114,7 @@ class PrizedAmalgamTriggerdAbility extends EntersBattlefieldAllTriggeredAbility
|
|||
if (entersEvent.getFromZone() == Zone.GRAVEYARD) {
|
||||
result = true;
|
||||
} else if (entersEvent.getFromZone() == Zone.STACK && entersEvent.getTarget().getControllerId().equals(getControllerId())) {
|
||||
CastFromGraveyardWatcher watcher = (CastFromGraveyardWatcher) game.getState().getWatchers().get(CastFromGraveyardWatcher.class.getName());
|
||||
CastFromGraveyardWatcher watcher = (CastFromGraveyardWatcher) game.getState().getWatchers().get(CastFromGraveyardWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
int zcc = game.getState().getZoneChangeCounter(event.getSourceId());
|
||||
result = watcher.spellWasCastFromGraveyard(event.getSourceId(), zcc - 1);
|
||||
|
|
|
@ -89,7 +89,7 @@ class PyromancersAssaultTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(controllerId)) {
|
||||
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()) == 2) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ package mage.cards.q;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
|
@ -47,14 +48,12 @@ import mage.game.stack.Spell;
|
|||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*
|
||||
*/
|
||||
public class Quicken extends CardImpl {
|
||||
|
||||
public Quicken(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}");
|
||||
|
||||
// The next sorcery card you cast this turn can be cast as though it had flash.
|
||||
this.getSpellAbility().addEffect(new QuickenAsThoughEffect());
|
||||
|
@ -92,7 +91,7 @@ class QuickenAsThoughEffect extends AsThoughEffectImpl {
|
|||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
quickenWatcher = (QuickenWatcher) game.getState().getWatchers().get("consumeQuickenWatcher");
|
||||
quickenWatcher = (QuickenWatcher) game.getState().getWatchers().get(QuickenWatcher.class.getSimpleName());
|
||||
Card card = game.getCard(source.getSourceId());
|
||||
if (quickenWatcher != null && card != null) {
|
||||
zoneChangeCounter = card.getZoneChangeCounter(game);
|
||||
|
@ -128,7 +127,7 @@ class QuickenWatcher extends Watcher {
|
|||
public List<String> activeQuickenSpells = new ArrayList<>();
|
||||
|
||||
public QuickenWatcher() {
|
||||
super("consumeQuickenWatcher", WatcherScope.GAME);
|
||||
super(QuickenWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public QuickenWatcher(final QuickenWatcher watcher) {
|
||||
|
|
|
@ -95,7 +95,7 @@ class RashmiEternitiesCrafterTriggeredAbility extends SpellCastControllerTrigger
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (super.checkTrigger(event, game)) {
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getName());
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
List<Spell> spells = watcher.getSpellsCastThisTurn(event.getPlayerId());
|
||||
if (spells != null && spells.size() == 1) {
|
||||
|
|
|
@ -107,7 +107,7 @@ enum RasputinDreamweaverStartedUntappedCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
RasputinDreamweaverStartedUntappedWatcher watcher = (RasputinDreamweaverStartedUntappedWatcher) game.getState().getWatchers().get(RasputinDreamweaverStartedUntappedWatcher.class.getName());
|
||||
RasputinDreamweaverStartedUntappedWatcher watcher = (RasputinDreamweaverStartedUntappedWatcher) game.getState().getWatchers().get(RasputinDreamweaverStartedUntappedWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
return watcher.startedUntapped(source.getSourceId());
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ class RasputinDreamweaverStartedUntappedWatcher extends Watcher {
|
|||
private final Set<UUID> startedUntapped = new HashSet<>(0);
|
||||
|
||||
RasputinDreamweaverStartedUntappedWatcher() {
|
||||
super(RasputinDreamweaverStartedUntappedWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(RasputinDreamweaverStartedUntappedWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
RasputinDreamweaverStartedUntappedWatcher(final RasputinDreamweaverStartedUntappedWatcher watcher) {
|
||||
|
|
|
@ -74,7 +74,7 @@ enum RavenousTrapCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
CardsPutIntoGraveyardWatcher watcher = (CardsPutIntoGraveyardWatcher) game.getState().getWatchers().get("CardsPutIntoGraveyardWatcher");
|
||||
CardsPutIntoGraveyardWatcher watcher = (CardsPutIntoGraveyardWatcher) game.getState().getWatchers().get(CardsPutIntoGraveyardWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
if (watcher.getAmountCardsPutToGraveyard(opponentId) > 2) {
|
||||
|
|
|
@ -84,7 +84,7 @@ enum RefractionTrapCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getName());
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
List<Spell> spells = watcher.getSpellsCastThisTurn(opponentId);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
|
@ -40,13 +41,12 @@ import mage.game.permanent.Permanent;
|
|||
import mage.watchers.common.SourceDidDamageWatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class RestoreThePeace extends CardImpl {
|
||||
|
||||
public RestoreThePeace(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{W}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}{U}");
|
||||
|
||||
|
||||
// Return each creature that dealt damage this turn to its owner's hand.
|
||||
|
@ -66,33 +66,33 @@ public class RestoreThePeace extends CardImpl {
|
|||
}
|
||||
|
||||
class RestoreThePeaceEffect extends OneShotEffect {
|
||||
|
||||
|
||||
public RestoreThePeaceEffect() {
|
||||
super(Outcome.ReturnToHand);
|
||||
this.staticText = "Return each creature that dealt damage this turn to its owner's hand";
|
||||
}
|
||||
|
||||
|
||||
public RestoreThePeaceEffect(final RestoreThePeaceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RestoreThePeaceEffect copy() {
|
||||
return new RestoreThePeaceEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get("SourceDidDamageWatcher");
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get(SourceDidDamageWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (UUID permId :watcher.damageSources) {
|
||||
for (UUID permId : watcher.damageSources) {
|
||||
Permanent perm = game.getPermanent(permId);
|
||||
if (perm != null) {
|
||||
perm.moveToZone(Zone.HAND, source.getSourceId(), game, true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ enum LostLifeCondition 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());
|
||||
UUID player = source.getControllerId();
|
||||
if (watcher != null && player != null) {
|
||||
return watcher.getLiveLost(player) > 0;
|
||||
|
|
|
@ -86,7 +86,7 @@ enum RicochetTrapCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getName());
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
List<Spell> spells = watcher.getSpellsCastThisTurn(opponentId);
|
||||
|
|
|
@ -82,7 +82,7 @@ class RocketLauncherWatcher extends Watcher {
|
|||
UUID cardId = null;
|
||||
|
||||
public RocketLauncherWatcher(UUID cardId) {
|
||||
super("RocketLauncherWatcher", WatcherScope.GAME);
|
||||
super(RocketLauncherWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
this.changedControllerOR1stTurn = true;
|
||||
this.cardId = cardId;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ enum ControlledTurnCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
RocketLauncherWatcher watcher = (RocketLauncherWatcher) game.getState().getWatchers().get("RocketLauncherWatcher");
|
||||
RocketLauncherWatcher watcher = (RocketLauncherWatcher) game.getState().getWatchers().get(RocketLauncherWatcher.class.getSimpleName());
|
||||
|
||||
return !watcher.changedControllerOR1stTurn;
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ class CastNonCreatureSpellCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getName());
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
List<Spell> spellsCast = watcher.getSpellsCastThisTurn(source.getControllerId());
|
||||
if (spellsCast != null) {
|
||||
|
|
|
@ -90,7 +90,7 @@ class SiftThroughSandsCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
SiftThroughSandsWatcher watcher = (SiftThroughSandsWatcher) game.getState().getWatchers().get("SiftThroughSandsWatcher", source.getControllerId());
|
||||
SiftThroughSandsWatcher watcher = (SiftThroughSandsWatcher) game.getState().getWatchers().get(SiftThroughSandsWatcher.class.getSimpleName(), source.getControllerId());
|
||||
if (watcher != null) {
|
||||
return watcher.conditionMet();
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class SiftThroughSandsWatcher extends Watcher {
|
|||
boolean castReachThroughMists = false;
|
||||
|
||||
public SiftThroughSandsWatcher() {
|
||||
super("SiftThroughSandsWatcher", WatcherScope.PLAYER);
|
||||
super(SiftThroughSandsWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||
}
|
||||
|
||||
public SiftThroughSandsWatcher(final SiftThroughSandsWatcher watcher) {
|
||||
|
|
|
@ -94,7 +94,7 @@ class SilburlindSnapperEffect extends RestrictionEffect {
|
|||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
if (permanent.getId().equals(source.getSourceId())) {
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getName());
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
List<Spell> spellsCast = watcher.getSpellsCastThisTurn(source.getControllerId());
|
||||
if (spellsCast != null) {
|
||||
|
|
|
@ -73,7 +73,7 @@ class SimulacrumAmount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability source, Effect effect) {
|
||||
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatchers().get("AmountOfDamageReceivedThisTurn");
|
||||
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatchers().get(AmountOfDamageAPlayerReceivedThisTurnWatcher.class.getSimpleName());
|
||||
if(watcher != null) {
|
||||
return watcher.getAmountOfDamageReceivedThisTurn(source.getControllerId());
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ class SirensCallDestroyEffect extends OneShotEffect {
|
|||
continue;
|
||||
}
|
||||
// Creatures that attacked are safe.
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getName());
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(permanent, game))) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ class SpinerockKnollCondition extends IntCompareCondition {
|
|||
@Override
|
||||
protected int getInputValue(Game game, Ability source) {
|
||||
int maxDamageReceived = 0;
|
||||
SpinerockKnollWatcher watcher = (SpinerockKnollWatcher) game.getState().getWatchers().get("SpinerockKnollWatcher", source.getSourceId());
|
||||
SpinerockKnollWatcher watcher = (SpinerockKnollWatcher) game.getState().getWatchers().get(SpinerockKnollWatcher.class.getSimpleName(), source.getSourceId());
|
||||
if (watcher != null) {
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
int damageReceived = watcher.getDamageReceived(opponentId);
|
||||
|
@ -118,7 +118,7 @@ class SpinerockKnollWatcher extends Watcher {
|
|||
private final Map<UUID, Integer> amountOfDamageReceivedThisTurn = new HashMap<>(1);
|
||||
|
||||
SpinerockKnollWatcher() {
|
||||
super("SpinerockKnollWatcher", WatcherScope.CARD);
|
||||
super(SpinerockKnollWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
}
|
||||
|
||||
SpinerockKnollWatcher(final SpinerockKnollWatcher watcher) {
|
||||
|
|
|
@ -87,7 +87,7 @@ class SpoilsOfBloodEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
CreaturesDiedThisTurnWatcher watcher = (CreaturesDiedThisTurnWatcher) game.getState().getWatchers().get("CreaturesDied");
|
||||
CreaturesDiedThisTurnWatcher watcher = (CreaturesDiedThisTurnWatcher) game.getState().getWatchers().get(CreaturesDiedThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
new CreateTokenEffect(new SpoilsOfBloodHorrorToken(watcher.creaturesDiedThisTurn)).apply(game, source);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ class CreaturesDiedThisTurnWatcher extends Watcher {
|
|||
public int creaturesDiedThisTurn = 0;
|
||||
|
||||
public CreaturesDiedThisTurnWatcher() {
|
||||
super("CreaturesDied", WatcherScope.GAME);
|
||||
super(CreaturesDiedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public CreaturesDiedThisTurnWatcher(final CreaturesDiedThisTurnWatcher watcher) {
|
||||
|
|
|
@ -79,7 +79,7 @@ class OtherSpellsCastThisTurnCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
return watcher.getAmountOfSpellsAllPlayersCastOnCurrentTurn() - 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ class SylvanLibraryEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
controller.drawCards(2, game);
|
||||
SylvanLibraryCardsDrawnThisTurnWatcher watcher = (SylvanLibraryCardsDrawnThisTurnWatcher) game.getState().getWatchers().get("SylvanLibraryCardsDrawnThisTurnWatcher");
|
||||
SylvanLibraryCardsDrawnThisTurnWatcher watcher = (SylvanLibraryCardsDrawnThisTurnWatcher) game.getState().getWatchers().get(SylvanLibraryCardsDrawnThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
Set<UUID> cardsDrawnThisTurn = watcher.getCardsDrawnThisTurn(controller.getId());
|
||||
|
@ -146,7 +146,7 @@ class SylvanLibraryCardsDrawnThisTurnWatcher extends Watcher {
|
|||
private final Map<UUID, Set<UUID>> cardsDrawnThisTurn = new HashMap<>();
|
||||
|
||||
public SylvanLibraryCardsDrawnThisTurnWatcher() {
|
||||
super("SylvanLibraryCardsDrawnThisTurnWatcher", WatcherScope.GAME);
|
||||
super(SylvanLibraryCardsDrawnThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public SylvanLibraryCardsDrawnThisTurnWatcher(final SylvanLibraryCardsDrawnThisTurnWatcher watcher) {
|
||||
|
|
|
@ -119,7 +119,7 @@ class CastGreenSpellThisTurnCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
TalarasBattalionWatcher watcher = (TalarasBattalionWatcher) game.getState().getWatchers().get("TalarasBattalionWatcher", source.getControllerId());
|
||||
TalarasBattalionWatcher watcher = (TalarasBattalionWatcher) game.getState().getWatchers().get(TalarasBattalionWatcher.class.getSimpleName(), source.getControllerId());
|
||||
if (watcher != null) {
|
||||
return watcher.conditionMet();
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ class TalarasBattalionWatcher extends Watcher {
|
|||
private final UUID cardId;
|
||||
|
||||
public TalarasBattalionWatcher(UUID cardId) {
|
||||
super("TalarasBattalionWatcher", WatcherScope.PLAYER);
|
||||
super(TalarasBattalionWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||
this.cardId = cardId;
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue