mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
first batch of watcher naming
This commit is contained in:
parent
20a881a374
commit
efae1251f9
111 changed files with 177 additions and 179 deletions
|
@ -109,7 +109,7 @@ class ApproachOfTheSecondSunWatcher extends Watcher {
|
||||||
private Map<UUID, Integer> approachesCast = new HashMap<>();
|
private Map<UUID, Integer> approachesCast = new HashMap<>();
|
||||||
|
|
||||||
public ApproachOfTheSecondSunWatcher() {
|
public ApproachOfTheSecondSunWatcher() {
|
||||||
super(ApproachOfTheSecondSunWatcher.class.getName(), WatcherScope.GAME);
|
super(ApproachOfTheSecondSunWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApproachOfTheSecondSunWatcher(final ApproachOfTheSecondSunWatcher watcher) {
|
public ApproachOfTheSecondSunWatcher(final ApproachOfTheSecondSunWatcher watcher) {
|
||||||
|
|
|
@ -102,7 +102,7 @@ class ArchmageAscensionTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent archmage = game.getPermanent(super.getSourceId());
|
Permanent archmage = game.getPermanent(super.getSourceId());
|
||||||
CardsAmountDrawnThisTurnWatcher watcher =
|
CardsAmountDrawnThisTurnWatcher watcher =
|
||||||
(CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.BASIC_KEY);
|
(CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName());
|
||||||
return archmage != null && watcher != null && watcher.getAmountCardsDrawn(this.getControllerId()) >= 2;
|
return archmage != null && watcher != null && watcher.getAmountCardsDrawn(this.getControllerId()) >= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ class AsmiraHolyAvengerWatcher extends Watcher {
|
||||||
private int creaturesCount = 0;
|
private int creaturesCount = 0;
|
||||||
|
|
||||||
public AsmiraHolyAvengerWatcher() {
|
public AsmiraHolyAvengerWatcher() {
|
||||||
super("YourCreaturesDied", WatcherScope.PLAYER);
|
super(AsmiraHolyAvengerWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||||
condition = true;
|
condition = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ class AsmiraHolyAvengerDynamicValue implements DynamicValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
AsmiraHolyAvengerWatcher watcher = (AsmiraHolyAvengerWatcher) game.getState().getWatchers().get("YourCreaturesDied", sourceAbility.getControllerId());
|
AsmiraHolyAvengerWatcher watcher = (AsmiraHolyAvengerWatcher) game.getState().getWatchers().get(AsmiraHolyAvengerWatcher.class.getSimpleName(), sourceAbility.getControllerId());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
return watcher.getCreaturesCount();
|
return watcher.getCreaturesCount();
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ class AvengingArrowTarget extends TargetPermanent {
|
||||||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||||
Set<UUID> availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game);
|
Set<UUID> availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game);
|
||||||
Set<UUID> possibleTargets = new HashSet<>();
|
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) {
|
if (watcher != null) {
|
||||||
for (UUID targetId : availablePossibleTargets) {
|
for (UUID targetId : availablePossibleTargets) {
|
||||||
Permanent permanent = game.getPermanent(targetId);
|
Permanent permanent = game.getPermanent(targetId);
|
||||||
|
|
|
@ -96,7 +96,7 @@ class BloodcrazedGoblinEffect extends RestrictionEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
if (permanent.getId().equals(source.getSourceId())) {
|
if (permanent.getId().equals(source.getSourceId())) {
|
||||||
BloodthirstWatcher watcher = (BloodthirstWatcher) game.getState().getWatchers().get("DamagedOpponents", source.getControllerId()); // BloodthirstWatcher
|
BloodthirstWatcher watcher = (BloodthirstWatcher) game.getState().getWatchers().get(BloodthirstWatcher.class.getSimpleName(), source.getControllerId()); // BloodthirstWatcher
|
||||||
return !watcher.conditionMet();
|
return !watcher.conditionMet();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -134,7 +134,7 @@ class BontuTheGlorifiedRestrictionEffect extends RestrictionEffect {
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
if (permanent.getId().equals(source.getSourceId())) {
|
if (permanent.getId().equals(source.getSourceId())) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get("CreaturesDiedWatcher");
|
CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get(CreaturesDiedWatcher.class.getSimpleName());
|
||||||
if (controller != null
|
if (controller != null
|
||||||
&& watcher != null) {
|
&& watcher != null) {
|
||||||
return (watcher.getAmountOfCreaturesDiesThisTurn(controller.getId()) == 0);
|
return (watcher.getAmountOfCreaturesDiesThisTurn(controller.getId()) == 0);
|
||||||
|
|
|
@ -158,7 +158,7 @@ class BoseijuWhoSheltersAllCantCounterEffect extends ContinuousRuleModifyingEffe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
BoseijuWhoSheltersAllWatcher watcher = (BoseijuWhoSheltersAllWatcher) game.getState().getWatchers().get("ManaPaidFromBoseijuWhoSheltersAllWatcher");
|
BoseijuWhoSheltersAllWatcher watcher = (BoseijuWhoSheltersAllWatcher) game.getState().getWatchers().get(BoseijuWhoSheltersAllWatcher.class.getSimpleName());
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null && watcher.spells.contains(spell.getId())) {
|
if (spell != null && watcher.spells.contains(spell.getId())) {
|
||||||
if (filter.match(spell.getCard(), game)) {
|
if (filter.match(spell.getCard(), game)) {
|
||||||
|
|
|
@ -38,6 +38,7 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCreatureOrPlayer;
|
import mage.target.common.TargetCreatureOrPlayer;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
import mage.watchers.common.MorbidWatcher;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@ class BrimstoneVolleyEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
int damage = 3;
|
int damage = 3;
|
||||||
Watcher watcher = game.getState().getWatchers().get("Morbid");
|
Watcher watcher = game.getState().getWatchers().get(MorbidWatcher.class.getSimpleName());
|
||||||
if (watcher.conditionMet()) {
|
if (watcher.conditionMet()) {
|
||||||
damage = 5;
|
damage = 5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,18 +40,15 @@ import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author BetaSteward
|
* @author BetaSteward
|
||||||
*/
|
*/
|
||||||
public class CathedralMembrane extends CardImpl {
|
public class CathedralMembrane extends CardImpl {
|
||||||
|
|
||||||
public CathedralMembrane(UUID ownerId, CardSetInfo setInfo) {
|
public CathedralMembrane(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{1}{W/P}");
|
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{1}{W/P}");
|
||||||
this.subtype.add("Wall");
|
this.subtype.add("Wall");
|
||||||
|
|
||||||
this.power = new MageInt(0);
|
this.power = new MageInt(0);
|
||||||
|
@ -94,7 +91,7 @@ class CathedralMembraneAbility extends ZoneChangeTriggeredAbility {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (super.checkTrigger(event, game)) {
|
if (super.checkTrigger(event, game)) {
|
||||||
if (game.getPhase().getType() == TurnPhase.COMBAT) {
|
if (game.getPhase().getType() == TurnPhase.COMBAT) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -120,7 +117,7 @@ class CathedralMembraneEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
CathedralMembraneWatcher watcher = (CathedralMembraneWatcher) game.getState().getWatchers().get("CathedralMembraneWatcher", source.getSourceId());
|
CathedralMembraneWatcher watcher = (CathedralMembraneWatcher) game.getState().getWatchers().get(CathedralMembraneWatcher.class.getSimpleName(), source.getSourceId());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
for (UUID uuid : watcher.blockedCreatures) {
|
for (UUID uuid : watcher.blockedCreatures) {
|
||||||
Permanent permanent = game.getPermanent(uuid);
|
Permanent permanent = game.getPermanent(uuid);
|
||||||
|
@ -135,10 +132,10 @@ class CathedralMembraneEffect extends OneShotEffect {
|
||||||
|
|
||||||
class CathedralMembraneWatcher extends Watcher {
|
class CathedralMembraneWatcher extends Watcher {
|
||||||
|
|
||||||
public List<UUID> blockedCreatures = new ArrayList<>();
|
public Set<UUID> blockedCreatures = new HashSet<>();
|
||||||
|
|
||||||
public CathedralMembraneWatcher() {
|
public CathedralMembraneWatcher() {
|
||||||
super("CathedralMembraneWatcher", WatcherScope.CARD);
|
super(CathedralMembraneWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CathedralMembraneWatcher(final CathedralMembraneWatcher watcher) {
|
public CathedralMembraneWatcher(final CathedralMembraneWatcher watcher) {
|
||||||
|
@ -154,9 +151,7 @@ class CathedralMembraneWatcher extends Watcher {
|
||||||
@Override
|
@Override
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED && event.getSourceId().equals(sourceId)) {
|
if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED && event.getSourceId().equals(sourceId)) {
|
||||||
if (!blockedCreatures.contains(event.getTargetId())) {
|
blockedCreatures.add(event.getTargetId());
|
||||||
blockedCreatures.add(event.getTargetId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ class CavernOfSoulsWatcher extends Watcher {
|
||||||
private final String originalId;
|
private final String originalId;
|
||||||
|
|
||||||
public CavernOfSoulsWatcher(UUID originalId) {
|
public CavernOfSoulsWatcher(UUID originalId) {
|
||||||
super("ManaPaidFromCavernOfSoulsWatcher", WatcherScope.CARD);
|
super(CavernOfSoulsWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||||
this.originalId = originalId.toString();
|
this.originalId = originalId.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ class CavernOfSoulsCantCounterEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
CavernOfSoulsWatcher watcher = (CavernOfSoulsWatcher) game.getState().getWatchers().get("ManaPaidFromCavernOfSoulsWatcher", source.getSourceId());
|
CavernOfSoulsWatcher watcher = (CavernOfSoulsWatcher) game.getState().getWatchers().get(CavernOfSoulsWatcher.class.getSimpleName(), source.getSourceId());
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
return spell != null && watcher != null && watcher.spellCantBeCountered(spell.getId());
|
return spell != null && watcher != null && watcher.spellCantBeCountered(spell.getId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ class ChainsOfMephistophelesReplacementEffect extends ReplacementEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getPhase().getStep().getType() == PhaseStep.DRAW) {
|
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) {
|
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ class SourceControllerLostLifeCount implements DynamicValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher");
|
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
return watcher.getLiveLost(sourceAbility.getControllerId());
|
return watcher.getLiveLost(sourceAbility.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class CivilizedScholar extends CardImpl {
|
||||||
class HomicidalBruteWatcher extends Watcher {
|
class HomicidalBruteWatcher extends Watcher {
|
||||||
|
|
||||||
public HomicidalBruteWatcher() {
|
public HomicidalBruteWatcher() {
|
||||||
super("HomicidalBruteAttacked", WatcherScope.CARD);
|
super(HomicidalBruteWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HomicidalBruteWatcher(final HomicidalBruteWatcher watcher) {
|
public HomicidalBruteWatcher(final HomicidalBruteWatcher watcher) {
|
||||||
|
|
|
@ -101,7 +101,7 @@ class ConduitOfRuinWatcher extends Watcher {
|
||||||
int spellCount = 0;
|
int spellCount = 0;
|
||||||
|
|
||||||
public ConduitOfRuinWatcher() {
|
public ConduitOfRuinWatcher() {
|
||||||
super("FirstCreatureSpellCastThisTurn", WatcherScope.GAME);
|
super(ConduitOfRuinWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
playerCreatureSpells = new HashMap<>();
|
playerCreatureSpells = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ class FirstCastCreatureSpellPredicate implements ObjectPlayerPredicate<ObjectPla
|
||||||
public boolean apply(ObjectPlayer<Controllable> input, Game game) {
|
public boolean apply(ObjectPlayer<Controllable> input, Game game) {
|
||||||
if (input.getObject() instanceof Spell
|
if (input.getObject() instanceof Spell
|
||||||
&& ((Spell) input.getObject()).isCreature()) {
|
&& ((Spell) input.getObject()).isCreature()) {
|
||||||
ConduitOfRuinWatcher watcher = (ConduitOfRuinWatcher) game.getState().getWatchers().get("FirstCreatureSpellCastThisTurn");
|
ConduitOfRuinWatcher watcher = (ConduitOfRuinWatcher) game.getState().getWatchers().get(ConduitOfRuinWatcher.class.getSimpleName());
|
||||||
return watcher != null && watcher.creatureSpellsCastThisTurn(input.getPlayerId()) == 0;
|
return watcher != null && watcher.creatureSpellsCastThisTurn(input.getPlayerId()) == 0;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -107,7 +107,7 @@ class CurseOfExhaustionEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||||
Player player = game.getPlayer(enchantment.getAttachedTo());
|
Player player = game.getPlayer(enchantment.getAttachedTo());
|
||||||
if (player != null && event.getPlayerId().equals(player.getId())) {
|
if (player != null && event.getPlayerId().equals(player.getId())) {
|
||||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||||
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) > 0) {
|
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ class DraconicRoarEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher");
|
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName());
|
||||||
if (watcher != null && watcher.castWithConditionTrue(source.getId())) {
|
if (watcher != null && watcher.castWithConditionTrue(source.getId())) {
|
||||||
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
|
|
|
@ -134,7 +134,7 @@ class NoMoreThanOneCreatureCanBlockEachTurnEffect extends RestrictionEffect {
|
||||||
if (!game.getCombat().getBlockers().isEmpty()) {
|
if (!game.getCombat().getBlockers().isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
BlockedThisTurnWatcher watcher = (BlockedThisTurnWatcher) game.getState().getWatchers().get("BlockedThisTurn");
|
BlockedThisTurnWatcher watcher = (BlockedThisTurnWatcher) game.getState().getWatchers().get(BlockedThisTurnWatcher.class.getSimpleName());
|
||||||
Set<MageObjectReference> blockedThisTurnCreatures = watcher.getBlockedThisTurnCreatures();
|
Set<MageObjectReference> blockedThisTurnCreatures = watcher.getBlockedThisTurnCreatures();
|
||||||
MageObjectReference blockerReference = new MageObjectReference(blocker.getId(), blocker.getZoneChangeCounter(game), game);
|
MageObjectReference blockerReference = new MageObjectReference(blocker.getId(), blocker.getZoneChangeCounter(game), game);
|
||||||
return blockedThisTurnCreatures.isEmpty()
|
return blockedThisTurnCreatures.isEmpty()
|
||||||
|
|
|
@ -82,7 +82,7 @@ class FaithsRewardEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
FaithsRewardWatcher watcher = (FaithsRewardWatcher) game.getState().getWatchers().get("FaithsRewardWatcher");
|
FaithsRewardWatcher watcher = (FaithsRewardWatcher) game.getState().getWatchers().get(FaithsRewardWatcher.class.getSimpleName());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
for (UUID id : watcher.cards) {
|
for (UUID id : watcher.cards) {
|
||||||
Card c = game.getCard(id);
|
Card c = game.getCard(id);
|
||||||
|
@ -105,7 +105,7 @@ class FaithsRewardWatcher extends Watcher {
|
||||||
ArrayList<UUID> cards = new ArrayList<>();
|
ArrayList<UUID> cards = new ArrayList<>();
|
||||||
|
|
||||||
public FaithsRewardWatcher() {
|
public FaithsRewardWatcher() {
|
||||||
super("FaithsRewardWatcher", WatcherScope.GAME);
|
super(FaithsRewardWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FaithsRewardWatcher(final FaithsRewardWatcher watcher) {
|
public FaithsRewardWatcher(final FaithsRewardWatcher watcher) {
|
||||||
|
|
|
@ -81,7 +81,7 @@ enum FeastOnTheFallenCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher");
|
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||||
if (watcher.getLiveLostLastTurn(opponentId) > 0) {
|
if (watcher.getLiveLostLastTurn(opponentId) > 0) {
|
||||||
|
|
|
@ -84,7 +84,7 @@ class FirstResponseEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher");
|
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
if (watcher.getLiveLostLastTurn(source.getControllerId()) > 0) {
|
if (watcher.getLiveLostLastTurn(source.getControllerId()) > 0) {
|
||||||
return new CreateTokenEffect(new SoldierToken()).apply(game, source);
|
return new CreateTokenEffect(new SoldierToken()).apply(game, source);
|
||||||
|
|
|
@ -103,7 +103,7 @@ class FlamebreakCantRegenerateEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.REGENERATE) {
|
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) {
|
if (watcher != null) {
|
||||||
return watcher.wasDamaged(event.getTargetId(), game);
|
return watcher.wasDamaged(event.getTargetId(), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ class FoulTongueInvocationEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher");
|
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName());
|
||||||
if (watcher != null && watcher.castWithConditionTrue(source.getId())) {
|
if (watcher != null && watcher.castWithConditionTrue(source.getId())) {
|
||||||
controller.gainLife(4, game);
|
controller.gainLife(4, game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ class FreshMeatDynamicValue implements DynamicValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get("CreaturesDiedWatcher");
|
CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get(CreaturesDiedWatcher.class.getSimpleName());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
return watcher.getAmountOfCreaturesDiesThisTurn(sourceAbility.getControllerId());
|
return watcher.getAmountOfCreaturesDiesThisTurn(sourceAbility.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,13 +49,12 @@ import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class GiltspireAvenger extends CardImpl {
|
public class GiltspireAvenger extends CardImpl {
|
||||||
|
|
||||||
public GiltspireAvenger(UUID ownerId, CardSetInfo setInfo) {
|
public GiltspireAvenger(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}{W}{U}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{W}{U}");
|
||||||
this.subtype.add("Human");
|
this.subtype.add("Human");
|
||||||
this.subtype.add("Soldier");
|
this.subtype.add("Soldier");
|
||||||
|
|
||||||
|
@ -97,7 +96,7 @@ class GiltspireAvengerTarget extends TargetPermanent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||||
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource",source.getControllerId());
|
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), source.getControllerId());
|
||||||
if (watcher != null && watcher.hasSourceDoneDamage(id, game)) {
|
if (watcher != null && watcher.hasSourceDoneDamage(id, game)) {
|
||||||
return super.canTarget(id, source, game);
|
return super.canTarget(id, source, game);
|
||||||
}
|
}
|
||||||
|
@ -108,10 +107,10 @@ class GiltspireAvengerTarget extends TargetPermanent {
|
||||||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||||
Set<UUID> availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game);
|
Set<UUID> availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game);
|
||||||
Set<UUID> possibleTargets = new HashSet<>();
|
Set<UUID> possibleTargets = new HashSet<>();
|
||||||
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", sourceControllerId);
|
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), sourceControllerId);
|
||||||
for (UUID targetId : availablePossibleTargets) {
|
for (UUID targetId : availablePossibleTargets) {
|
||||||
Permanent permanent = game.getPermanent(targetId);
|
Permanent permanent = game.getPermanent(targetId);
|
||||||
if(permanent != null && watcher != null && watcher.hasSourceDoneDamage(targetId, game)){
|
if (permanent != null && watcher != null && watcher.hasSourceDoneDamage(targetId, game)) {
|
||||||
possibleTargets.add(targetId);
|
possibleTargets.add(targetId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,15 +125,15 @@ class GiltspireAvengerTarget extends TargetPermanent {
|
||||||
}
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
MageObject targetSource = game.getObject(sourceId);
|
MageObject targetSource = game.getObject(sourceId);
|
||||||
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", sourceControllerId);
|
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), sourceControllerId);
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, sourceControllerId, sourceId, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, sourceControllerId, sourceId, game)) {
|
||||||
if (!targets.containsKey(permanent.getId()) && permanent.canBeTargetedBy(targetSource, sourceControllerId, game)
|
if (!targets.containsKey(permanent.getId()) && permanent.canBeTargetedBy(targetSource, sourceControllerId, game)
|
||||||
&& watcher != null && watcher.hasSourceDoneDamage(permanent.getId(), game)) {
|
&& watcher != null && watcher.hasSourceDoneDamage(permanent.getId(), game)) {
|
||||||
count++;
|
count++;
|
||||||
if (count >= remainingTargets) {
|
if (count >= remainingTargets) {
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ class GomazoaEffect extends OneShotEffect {
|
||||||
players.add(gomazoa.getOwnerId());
|
players.add(gomazoa.getOwnerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockedByWatcher watcher = (BlockedByWatcher) game.getState().getWatchers().get("BlockedByWatcher", source.getSourceId());
|
BlockedByWatcher watcher = (BlockedByWatcher) game.getState().getWatchers().get(BlockedByWatcher.class.getSimpleName(), source.getSourceId());
|
||||||
creaturesBlocked = watcher.blockedByWatcher;
|
creaturesBlocked = watcher.blockedByWatcher;
|
||||||
|
|
||||||
for (UUID blockedById : creaturesBlocked) {
|
for (UUID blockedById : creaturesBlocked) {
|
||||||
|
@ -143,7 +143,7 @@ class BlockedByWatcher extends Watcher {
|
||||||
public List<UUID> blockedByWatcher = new ArrayList<>();
|
public List<UUID> blockedByWatcher = new ArrayList<>();
|
||||||
|
|
||||||
public BlockedByWatcher() {
|
public BlockedByWatcher() {
|
||||||
super("BlockedByWatcher", WatcherScope.CARD);
|
super(BlockedByWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockedByWatcher(final BlockedByWatcher watcher) {
|
public BlockedByWatcher(final BlockedByWatcher watcher) {
|
||||||
|
|
|
@ -109,7 +109,7 @@ class HallowedMoonlightEffect extends ReplacementEffectImpl {
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
EntersTheBattlefieldEvent entersTheBattlefieldEvent = (EntersTheBattlefieldEvent) event;
|
EntersTheBattlefieldEvent entersTheBattlefieldEvent = (EntersTheBattlefieldEvent) event;
|
||||||
if (entersTheBattlefieldEvent.getTarget().isCreature()) {
|
if (entersTheBattlefieldEvent.getTarget().isCreature()) {
|
||||||
CreatureWasCastWatcher watcher = (CreatureWasCastWatcher) game.getState().getWatchers().get("CreatureWasCast");
|
CreatureWasCastWatcher watcher = (CreatureWasCastWatcher) game.getState().getWatchers().get(CreatureWasCastWatcher.class.getSimpleName());
|
||||||
if (watcher != null && !watcher.wasCreatureCastThisTurn(event.getTargetId())) {
|
if (watcher != null && !watcher.wasCreatureCastThisTurn(event.getTargetId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import mage.abilities.effects.common.TapSourceEffect;
|
||||||
import mage.abilities.effects.common.TransformSourceEffect;
|
import mage.abilities.effects.common.TransformSourceEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.cards.c.CivilizedScholar;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
@ -98,7 +99,7 @@ class HomicidalBruteTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getPlayerId().equals(this.controllerId)) {
|
if (event.getPlayerId().equals(this.controllerId)) {
|
||||||
Watcher watcher = game.getState().getWatchers().get("HomicidalBruteAttacked", sourceId);
|
Watcher watcher = game.getState().getWatchers().get("HomicidalBruteWatcher", sourceId);
|
||||||
if (watcher == null || !watcher.conditionMet()) {
|
if (watcher == null || !watcher.conditionMet()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.cards.i;
|
package mage.cards.i;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
|
@ -45,18 +46,17 @@ import mage.game.stack.Spell;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author fireshoes
|
* @author fireshoes
|
||||||
*/
|
*/
|
||||||
public class Insist extends CardImpl {
|
public class Insist extends CardImpl {
|
||||||
|
|
||||||
public Insist(UUID ownerId, CardSetInfo setInfo) {
|
public Insist(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{G}");
|
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}");
|
||||||
|
|
||||||
// The next creature spell you cast this turn can't be countered by spells or abilities.
|
// The next creature spell you cast this turn can't be countered by spells or abilities.
|
||||||
this.getSpellAbility().addEffect(new InsistEffect());
|
this.getSpellAbility().addEffect(new InsistEffect());
|
||||||
this.getSpellAbility().addWatcher(new InsistWatcher());
|
this.getSpellAbility().addWatcher(new InsistWatcher());
|
||||||
|
|
||||||
// Draw a card.
|
// Draw a card.
|
||||||
Effect effect = new DrawCardSourceControllerEffect(1);
|
Effect effect = new DrawCardSourceControllerEffect(1);
|
||||||
effect.setText("<br><br>Draw a card");
|
effect.setText("<br><br>Draw a card");
|
||||||
|
@ -74,7 +74,7 @@ public class Insist extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
class InsistEffect extends ContinuousRuleModifyingEffectImpl {
|
class InsistEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
InsistEffect() {
|
InsistEffect() {
|
||||||
super(Duration.EndOfTurn, Outcome.Benefit);
|
super(Duration.EndOfTurn, Outcome.Benefit);
|
||||||
staticText = "The next creature spell you cast this turn can't be countered by spells or abilities";
|
staticText = "The next creature spell you cast this turn can't be countered by spells or abilities";
|
||||||
|
@ -92,10 +92,10 @@ class InsistEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
InsistWatcher watcher = (InsistWatcher) game.getState().getWatchers().get("insistWatcher", source.getControllerId());
|
InsistWatcher watcher = (InsistWatcher) game.getState().getWatchers().get(InsistWatcher.class.getSimpleName(), source.getControllerId());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
watcher.setReady();
|
watcher.setReady();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -111,16 +111,16 @@ class InsistEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checksEventType(GameEvent event, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == GameEvent.EventType.COUNTER;
|
return event.getType() == GameEvent.EventType.COUNTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
InsistWatcher watcher = (InsistWatcher) game.getState().getWatchers().get("insistWatcher", source.getControllerId());
|
InsistWatcher watcher = (InsistWatcher) game.getState().getWatchers().get(InsistWatcher.class.getSimpleName(), source.getControllerId());
|
||||||
return spell != null && watcher != null && watcher.isUncounterable(spell.getId());
|
return spell != null && watcher != null && watcher.isUncounterable(spell.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ class InsistWatcher extends Watcher {
|
||||||
protected UUID uncounterableSpell;
|
protected UUID uncounterableSpell;
|
||||||
|
|
||||||
InsistWatcher() {
|
InsistWatcher() {
|
||||||
super("insistWatcher", WatcherScope.PLAYER);
|
super(InsistWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||||
}
|
}
|
||||||
|
|
||||||
InsistWatcher(final InsistWatcher watcher) {
|
InsistWatcher(final InsistWatcher watcher) {
|
||||||
|
@ -160,7 +160,7 @@ class InsistWatcher extends Watcher {
|
||||||
public boolean isUncounterable(UUID spellId) {
|
public boolean isUncounterable(UUID spellId) {
|
||||||
return spellId.equals(uncounterableSpell);
|
return spellId.equals(uncounterableSpell);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReady() {
|
public void setReady() {
|
||||||
ready = true;
|
ready = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ class KeranosGodOfStormsTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||||
if (game.getActivePlayerId().equals(this.getControllerId())) {
|
if (game.getActivePlayerId().equals(this.getControllerId())) {
|
||||||
CardsAmountDrawnThisTurnWatcher watcher =
|
CardsAmountDrawnThisTurnWatcher watcher =
|
||||||
(CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.BASIC_KEY);
|
(CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName());
|
||||||
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) != 1) {
|
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) != 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ class KnollspineDragonEffect extends OneShotEffect {
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
new DiscardHandControllerEffect().apply(game, source);
|
new DiscardHandControllerEffect().apply(game, source);
|
||||||
if (targetOpponent != null) {
|
if (targetOpponent != null) {
|
||||||
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatchers().get("AmountOfDamageReceivedThisTurn");
|
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatchers().get(AmountOfDamageAPlayerReceivedThisTurnWatcher.class.getSimpleName());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
int drawAmount = watcher.getAmountOfDamageReceivedThisTurn(targetOpponent.getId());
|
int drawAmount = watcher.getAmountOfDamageReceivedThisTurn(targetOpponent.getId());
|
||||||
controller.drawCards(drawAmount, game);
|
controller.drawCards(drawAmount, game);
|
||||||
|
|
|
@ -120,7 +120,7 @@ class KumanosBlessingEffect extends ReplacementEffectImpl {
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
ZoneChangeEvent zce = (ZoneChangeEvent) event;
|
ZoneChangeEvent zce = (ZoneChangeEvent) event;
|
||||||
if (zce.isDiesEvent()) {
|
if (zce.isDiesEvent()) {
|
||||||
DamagedByEnchantedWatcher watcher = (DamagedByEnchantedWatcher) game.getState().getWatchers().get("DamagedByEnchantedWatcher", source.getSourceId());
|
DamagedByEnchantedWatcher watcher = (DamagedByEnchantedWatcher) game.getState().getWatchers().get(DamagedByEnchantedWatcher.class.getSimpleName(), source.getSourceId());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
return watcher.wasDamaged(zce.getTarget(), game);
|
return watcher.wasDamaged(zce.getTarget(), game);
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ class DamagedByEnchantedWatcher extends Watcher {
|
||||||
private final Set<MageObjectReference> damagedCreatures = new HashSet<>();
|
private final Set<MageObjectReference> damagedCreatures = new HashSet<>();
|
||||||
|
|
||||||
public DamagedByEnchantedWatcher() {
|
public DamagedByEnchantedWatcher() {
|
||||||
super("DamagedByEnchantedWatcher", WatcherScope.CARD);
|
super(DamagedByEnchantedWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DamagedByEnchantedWatcher(final DamagedByEnchantedWatcher watcher) {
|
public DamagedByEnchantedWatcher(final DamagedByEnchantedWatcher watcher) {
|
||||||
|
|
|
@ -109,7 +109,7 @@ enum KuonOgreAscendantCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get("CreaturesDiedWatcher");
|
CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get(CreaturesDiedWatcher.class.getSimpleName());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
return watcher.getAmountOfCreaturesDiesThisTurn() > 2;
|
return watcher.getAmountOfCreaturesDiesThisTurn() > 2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ class KytheonHeroOfAkrosCondition implements Condition {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent sourceObject = game.getPermanent(source.getSourceId());
|
Permanent sourceObject = game.getPermanent(source.getSourceId());
|
||||||
if (sourceObject != null) {
|
if (sourceObject != null) {
|
||||||
AttackedOrBlockedThisCombatWatcher watcher = (AttackedOrBlockedThisCombatWatcher) game.getState().getWatchers().get(AttackedOrBlockedThisCombatWatcher.class.getName());
|
AttackedOrBlockedThisCombatWatcher watcher = (AttackedOrBlockedThisCombatWatcher) game.getState().getWatchers().get(AttackedOrBlockedThisCombatWatcher.class.getSimpleName());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
boolean sourceFound = false;
|
boolean sourceFound = false;
|
||||||
int number = 0;
|
int number = 0;
|
||||||
|
|
|
@ -97,7 +97,7 @@ class LeovoldEmissaryOfTrestEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
CardsAmountDrawnThisTurnWatcher watcher = (CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.BASIC_KEY);
|
CardsAmountDrawnThisTurnWatcher watcher = (CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName());
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
return watcher != null && controller != null && watcher.getAmountCardsDrawn(event.getPlayerId()) >= 1
|
return watcher != null && controller != null && watcher.getAmountCardsDrawn(event.getPlayerId()) >= 1
|
||||||
&& game.isOpponent(controller, event.getPlayerId());
|
&& game.isOpponent(controller, event.getPlayerId());
|
||||||
|
|
|
@ -146,7 +146,7 @@ enum YouLostNoLifeThisTurnCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher");
|
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
return (watcher.getLiveLost(source.getControllerId()) == 0);
|
return (watcher.getLiveLost(source.getControllerId()) == 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ class MoggConscriptsEffect extends RestrictionEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
if (permanent.getId().equals(source.getSourceId())) {
|
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())) {
|
if (watcher != null && !watcher.playerDidCastCreatureThisTurn(source.getControllerId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,13 +107,13 @@ class MoltenPsycheEffect extends OneShotEffect {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.drawCards(cardsToDraw.get(playerId), game);
|
player.drawCards(cardsToDraw.get(playerId), game);
|
||||||
if (MetalcraftCondition.instance.apply(game, source) && !playerId.equals(source.getControllerId())) {
|
if (MetalcraftCondition.instance.apply(game, source) && !playerId.equals(source.getControllerId())) {
|
||||||
MoltenPsycheWatcher watcher = (MoltenPsycheWatcher) game.getState().getWatchers().get("CardsDrawn");
|
MoltenPsycheWatcher watcher = (MoltenPsycheWatcher) game.getState().getWatchers().get(MoltenPsycheWatcher.class.getSimpleName());
|
||||||
player.damage(watcher.getDraws(playerId), source.getSourceId(), game, false, true);
|
player.damage(watcher.getDraws(playerId), source.getSourceId(), game, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (MetalcraftCondition.instance.apply(game, source)) {
|
if (MetalcraftCondition.instance.apply(game, source)) {
|
||||||
MoltenPsycheWatcher watcher = (MoltenPsycheWatcher) game.getState().getWatchers().get("CardsDrawn");
|
MoltenPsycheWatcher watcher = (MoltenPsycheWatcher) game.getState().getWatchers().get(MoltenPsycheWatcher.class.getSimpleName());
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
if (game.isOpponent(controller, playerId)) {
|
if (game.isOpponent(controller, playerId)) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
|
@ -141,7 +141,7 @@ class MoltenPsycheWatcher extends Watcher {
|
||||||
private final Map<UUID, Integer> draws = new HashMap<>();
|
private final Map<UUID, Integer> draws = new HashMap<>();
|
||||||
|
|
||||||
public MoltenPsycheWatcher() {
|
public MoltenPsycheWatcher() {
|
||||||
super("CardsDrawn", WatcherScope.GAME);
|
super(MoltenPsycheWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MoltenPsycheWatcher(final MoltenPsycheWatcher watcher) {
|
public MoltenPsycheWatcher(final MoltenPsycheWatcher watcher) {
|
||||||
|
|
|
@ -96,7 +96,7 @@ enum OathOfChandraCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
OathOfChandraWatcher watcher = (OathOfChandraWatcher) game.getState().getWatchers().get("OathOfChandraWatcher");
|
OathOfChandraWatcher watcher = (OathOfChandraWatcher) game.getState().getWatchers().get(OathOfChandraWatcher.class.getSimpleName());
|
||||||
return watcher != null && watcher.enteredPlaneswalkerForPlayer(source.getControllerId());
|
return watcher != null && watcher.enteredPlaneswalkerForPlayer(source.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ class OathOfChandraWatcher extends Watcher {
|
||||||
private final Set<UUID> players = new HashSet<>();
|
private final Set<UUID> players = new HashSet<>();
|
||||||
|
|
||||||
public OathOfChandraWatcher() {
|
public OathOfChandraWatcher() {
|
||||||
super("OathOfChandraWatcher", WatcherScope.GAME);
|
super(OathOfChandraWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OathOfChandraWatcher(final OathOfChandraWatcher watcher) {
|
public OathOfChandraWatcher(final OathOfChandraWatcher watcher) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ class OpalPalaceWatcher extends Watcher {
|
||||||
private final String originalId;
|
private final String originalId;
|
||||||
|
|
||||||
public OpalPalaceWatcher(String originalId) {
|
public OpalPalaceWatcher(String originalId) {
|
||||||
super("ManaPaidFromOpalPalaceWatcher", WatcherScope.CARD);
|
super(OpalPalaceWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||||
this.originalId = originalId;
|
this.originalId = originalId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ class OpalPalaceEntersBattlefieldEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
OpalPalaceWatcher watcher = (OpalPalaceWatcher) game.getState().getWatchers().get("ManaPaidFromOpalPalaceWatcher", source.getSourceId());
|
OpalPalaceWatcher watcher = (OpalPalaceWatcher) game.getState().getWatchers().get(OpalPalaceWatcher.class.getSimpleName(), source.getSourceId());
|
||||||
return watcher != null
|
return watcher != null
|
||||||
&& watcher.commanderId.contains(event.getTargetId());
|
&& watcher.commanderId.contains(event.getTargetId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ class OratorOfOjutaiTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
//Intervening if must be checked
|
//Intervening if must be checked
|
||||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(getSourceId());
|
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(getSourceId());
|
||||||
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher");
|
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName());
|
||||||
return event.getTargetId().equals(getSourceId())
|
return event.getTargetId().equals(getSourceId())
|
||||||
&& watcher != null
|
&& watcher != null
|
||||||
&& watcher.castWithConditionTrue(sourcePermanent.getSpellAbility().getId());
|
&& watcher.castWithConditionTrue(sourcePermanent.getSpellAbility().getId());
|
||||||
|
@ -165,7 +165,7 @@ class OratorOfOjutaiEffect extends OneShotEffect {
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||||
if (sourcePermanent != null) {
|
if (sourcePermanent != null) {
|
||||||
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher");
|
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName());
|
||||||
if (watcher != null && watcher.castWithConditionTrue(sourcePermanent.getSpellAbility().getId())) {
|
if (watcher != null && watcher.castWithConditionTrue(sourcePermanent.getSpellAbility().getId())) {
|
||||||
controller.drawCards(1, game);
|
controller.drawCards(1, game);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -93,7 +93,7 @@ class OvermasterEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
OvermasterWatcher watcher = (OvermasterWatcher) game.getState().getWatchers().get("overmasterWatcher", source.getControllerId());
|
OvermasterWatcher watcher = (OvermasterWatcher) game.getState().getWatchers().get(OvermasterWatcher.class.getSimpleName(), source.getControllerId());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
watcher.setReady();
|
watcher.setReady();
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ class OvermasterWatcher extends Watcher {
|
||||||
protected UUID uncounterableSpell;
|
protected UUID uncounterableSpell;
|
||||||
|
|
||||||
OvermasterWatcher() {
|
OvermasterWatcher() {
|
||||||
super("overmasterWatcher", WatcherScope.PLAYER);
|
super(OvermasterWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||||
}
|
}
|
||||||
|
|
||||||
OvermasterWatcher(final OvermasterWatcher watcher) {
|
OvermasterWatcher(final OvermasterWatcher watcher) {
|
||||||
|
|
|
@ -46,6 +46,7 @@ import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
import mage.watchers.common.MorbidWatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -105,7 +106,7 @@ class ReaperFromTheAbyssAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Watcher watcher = game.getState().getWatchers().get("Morbid");
|
Watcher watcher = game.getState().getWatchers().get(MorbidWatcher.class.getSimpleName());
|
||||||
return watcher.conditionMet();
|
return watcher.conditionMet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ class ReciprocateTarget extends TargetPermanent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||||
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", source.getControllerId());
|
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), source.getControllerId());
|
||||||
if (watcher != null && watcher.hasSourceDoneDamage(id, game)) {
|
if (watcher != null && watcher.hasSourceDoneDamage(id, game)) {
|
||||||
return super.canTarget(id, source, game);
|
return super.canTarget(id, source, game);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ class ReciprocateTarget extends TargetPermanent {
|
||||||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||||
Set<UUID> availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game);
|
Set<UUID> availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game);
|
||||||
Set<UUID> possibleTargets = new HashSet<>();
|
Set<UUID> possibleTargets = new HashSet<>();
|
||||||
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", sourceControllerId);
|
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), sourceControllerId);
|
||||||
for (UUID targetId : availablePossibleTargets) {
|
for (UUID targetId : availablePossibleTargets) {
|
||||||
Permanent permanent = game.getPermanent(targetId);
|
Permanent permanent = game.getPermanent(targetId);
|
||||||
if (permanent != null && watcher != null && watcher.hasSourceDoneDamage(targetId, game)) {
|
if (permanent != null && watcher != null && watcher.hasSourceDoneDamage(targetId, game)) {
|
||||||
|
@ -109,7 +109,7 @@ class ReciprocateTarget extends TargetPermanent {
|
||||||
}
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
MageObject targetSource = game.getObject(sourceId);
|
MageObject targetSource = game.getObject(sourceId);
|
||||||
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", sourceControllerId);
|
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), sourceControllerId);
|
||||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, sourceControllerId, sourceId, game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, sourceControllerId, sourceId, game)) {
|
||||||
if (!targets.containsKey(permanent.getId()) && permanent.canBeTargetedBy(targetSource, sourceControllerId, game)
|
if (!targets.containsKey(permanent.getId()) && permanent.canBeTargetedBy(targetSource, sourceControllerId, game)
|
||||||
&& watcher != null && watcher.hasSourceDoneDamage(permanent.getId(), game)) {
|
&& watcher != null && watcher.hasSourceDoneDamage(permanent.getId(), game)) {
|
||||||
|
|
|
@ -98,7 +98,7 @@ class PlayerLostLifePredicate implements Predicate<Player> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Player input, Game game) {
|
public boolean apply(Player input, Game game) {
|
||||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher");
|
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
return (0 < watcher.getLiveLost(input.getId()));
|
return (0 < watcher.getLiveLost(input.getId()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ enum RuneflareTrapCondition implements Condition {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
CardsAmountDrawnThisTurnWatcher watcher =
|
CardsAmountDrawnThisTurnWatcher watcher =
|
||||||
(CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.BASIC_KEY);
|
(CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName());
|
||||||
return watcher != null && watcher.opponentDrewXOrMoreCards(source.getControllerId(), 3, game);
|
return watcher != null && watcher.opponentDrewXOrMoreCards(source.getControllerId(), 3, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ class SavageSummoningAsThoughEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
watcher = (SavageSummoningWatcher) game.getState().getWatchers().get("consumeSavageSummoningWatcher", source.getControllerId());
|
watcher = (SavageSummoningWatcher) game.getState().getWatchers().get(SavageSummoningWatcher.class.getSimpleName(), source.getControllerId());
|
||||||
Card card = game.getCard(source.getSourceId());
|
Card card = game.getCard(source.getSourceId());
|
||||||
if (watcher != null && card != null) {
|
if (watcher != null && card != null) {
|
||||||
watcher.setSavageSummoningSpellActive(card, game);
|
watcher.setSavageSummoningSpellActive(card, game);
|
||||||
|
@ -155,7 +155,7 @@ class SavageSummoningWatcher extends Watcher {
|
||||||
private Map<String, Set<String>> cardsCastWithSavageSummoning = new LinkedHashMap<>();
|
private Map<String, Set<String>> cardsCastWithSavageSummoning = new LinkedHashMap<>();
|
||||||
|
|
||||||
public SavageSummoningWatcher() {
|
public SavageSummoningWatcher() {
|
||||||
super("consumeSavageSummoningWatcher", WatcherScope.PLAYER);
|
super(SavageSummoningWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SavageSummoningWatcher(final SavageSummoningWatcher watcher) {
|
public SavageSummoningWatcher(final SavageSummoningWatcher watcher) {
|
||||||
|
@ -240,7 +240,7 @@ class SavageSummoningCantCounterEffect extends ContinuousRuleModifyingEffectImpl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
watcher = (SavageSummoningWatcher) game.getState().getWatchers().get("consumeSavageSummoningWatcher", source.getControllerId());
|
watcher = (SavageSummoningWatcher) game.getState().getWatchers().get(SavageSummoningWatcher.class.getSimpleName(), source.getControllerId());
|
||||||
Card card = game.getCard(source.getSourceId());
|
Card card = game.getCard(source.getSourceId());
|
||||||
if (watcher == null || card == null) {
|
if (watcher == null || card == null) {
|
||||||
throw new IllegalArgumentException("Consume Savage watcher or card could not be found");
|
throw new IllegalArgumentException("Consume Savage watcher or card could not be found");
|
||||||
|
@ -298,7 +298,7 @@ class SavageSummoningEntersBattlefieldEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
watcher = (SavageSummoningWatcher) game.getState().getWatchers().get("consumeSavageSummoningWatcher", source.getControllerId());
|
watcher = (SavageSummoningWatcher) game.getState().getWatchers().get(SavageSummoningWatcher.class.getSimpleName(), source.getControllerId());
|
||||||
Card card = game.getCard(source.getSourceId());
|
Card card = game.getCard(source.getSourceId());
|
||||||
if (watcher == null || card == null) {
|
if (watcher == null || card == null) {
|
||||||
throw new IllegalArgumentException("Consume Savage watcher or card could not be found");
|
throw new IllegalArgumentException("Consume Savage watcher or card could not be found");
|
||||||
|
|
|
@ -108,7 +108,7 @@ enum ScaleguardSentinelsCondition implements Condition {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent sourcePermanent = game.getPermanentEntering(source.getSourceId());
|
Permanent sourcePermanent = game.getPermanentEntering(source.getSourceId());
|
||||||
if (sourcePermanent != null) {
|
if (sourcePermanent != null) {
|
||||||
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher");
|
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName());
|
||||||
return (watcher != null && watcher.castWithConditionTrue(sourcePermanent.getSpellAbility().getId()));
|
return (watcher != null && watcher.castWithConditionTrue(sourcePermanent.getSpellAbility().getId()));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -91,7 +91,7 @@ class ScoutsWarningAsThoughEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
watcher = (ScoutsWarningWatcher) game.getState().getWatchers().get("consumeScoutsWarningWatcher", source.getControllerId());
|
watcher = (ScoutsWarningWatcher) game.getState().getWatchers().get(ScoutsWarningWatcher.class.getSimpleName(), source.getControllerId());
|
||||||
Card card = game.getCard(source.getSourceId());
|
Card card = game.getCard(source.getSourceId());
|
||||||
if (watcher != null && card != null) {
|
if (watcher != null && card != null) {
|
||||||
zoneChangeCounter = card.getZoneChangeCounter(game);
|
zoneChangeCounter = card.getZoneChangeCounter(game);
|
||||||
|
@ -127,7 +127,7 @@ class ScoutsWarningWatcher extends Watcher {
|
||||||
public List<String> activeScoutsWarningSpells = new ArrayList<>();
|
public List<String> activeScoutsWarningSpells = new ArrayList<>();
|
||||||
|
|
||||||
public ScoutsWarningWatcher() {
|
public ScoutsWarningWatcher() {
|
||||||
super("consumeScoutsWarningWatcher", WatcherScope.PLAYER);
|
super(ScoutsWarningWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScoutsWarningWatcher(final ScoutsWarningWatcher watcher) {
|
public ScoutsWarningWatcher(final ScoutsWarningWatcher watcher) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ class SearingBlazeEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
LandfallWatcher watcher = (LandfallWatcher) game.getState().getWatchers().get("LandPlayed");
|
LandfallWatcher watcher = (LandfallWatcher) game.getState().getWatchers().get(LandfallWatcher.class.getSimpleName());
|
||||||
Player player = game.getPlayer(source.getTargets().get(0).getFirstTarget());
|
Player player = game.getPlayer(source.getTargets().get(0).getFirstTarget());
|
||||||
Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||||
int damage = 1;
|
int damage = 1;
|
||||||
|
|
|
@ -76,7 +76,7 @@ class SecondSpellPredicate implements Predicate<Spell> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Spell input, Game game) {
|
public boolean apply(Spell input, Game game) {
|
||||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||||
|
|
||||||
if (watcher.getSpellOrder(new MageObjectReference(input.getId(), game), game) == 2) {
|
if (watcher.getSpellOrder(new MageObjectReference(input.getId(), game), game) == 2) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -82,7 +82,7 @@ class SecondSunriseEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
SecondSunriseWatcher watcher = (SecondSunriseWatcher) game.getState().getWatchers().get("SecondSunriseWatcher");
|
SecondSunriseWatcher watcher = (SecondSunriseWatcher) game.getState().getWatchers().get(SecondSunriseWatcher.class.getSimpleName());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
for (UUID id : watcher.cards) {
|
for (UUID id : watcher.cards) {
|
||||||
Card c = game.getCard(id);
|
Card c = game.getCard(id);
|
||||||
|
@ -107,7 +107,7 @@ class SecondSunriseWatcher extends Watcher {
|
||||||
ArrayList<UUID> cards = new ArrayList<>();
|
ArrayList<UUID> cards = new ArrayList<>();
|
||||||
|
|
||||||
public SecondSunriseWatcher() {
|
public SecondSunriseWatcher() {
|
||||||
super("SecondSunriseWatcher", WatcherScope.GAME);
|
super(SecondSunriseWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SecondSunriseWatcher(final SecondSunriseWatcher watcher) {
|
public SecondSunriseWatcher(final SecondSunriseWatcher watcher) {
|
||||||
|
|
|
@ -84,8 +84,7 @@ class ShadowOfTheGraveEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
CardsCycledOrDiscardedThisTurnWatcher watcher = (CardsCycledOrDiscardedThisTurnWatcher) game.getState()
|
CardsCycledOrDiscardedThisTurnWatcher watcher = (CardsCycledOrDiscardedThisTurnWatcher) game.getState().getWatchers().get(CardsCycledOrDiscardedThisTurnWatcher.class.getSimpleName());
|
||||||
.getWatchers().get(CardsCycledOrDiscardedThisTurnWatcher.class.getName());
|
|
||||||
if (controller != null
|
if (controller != null
|
||||||
&& watcher != null) {
|
&& watcher != null) {
|
||||||
for (Card card : watcher.getCardsCycledOrDiscardedThisTurn(controller.getId()).getCards(game)) {
|
for (Card card : watcher.getCardsCycledOrDiscardedThisTurn(controller.getId()).getCards(game)) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ class SilentChantZuberaDynamicValue implements DynamicValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
ZuberasDiedWatcher watcher = (ZuberasDiedWatcher) game.getState().getWatchers().get("ZuberasDied");
|
ZuberasDiedWatcher watcher = (ZuberasDiedWatcher) game.getState().getWatchers().get(ZuberasDiedWatcher.class.getSimpleName());
|
||||||
return watcher.zuberasDiedThisTurn * 2;
|
return watcher.zuberasDiedThisTurn * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ class SilumgarsScornCounterEffect extends OneShotEffect {
|
||||||
if (spell != null) {
|
if (spell != null) {
|
||||||
Player player = game.getPlayer(spell.getControllerId());
|
Player player = game.getPlayer(spell.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher");
|
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName());
|
||||||
boolean condition = watcher != null && watcher.castWithConditionTrue(source.getId());
|
boolean condition = watcher != null && watcher.castWithConditionTrue(source.getId());
|
||||||
if (!condition) {
|
if (!condition) {
|
||||||
for (Cost cost: source.getCosts()) {
|
for (Cost cost: source.getCosts()) {
|
||||||
|
|
|
@ -86,7 +86,7 @@ class OpponentWasDealtDamageCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
BloodthirstWatcher watcher = (BloodthirstWatcher) game.getState().getWatchers().get("DamagedOpponents", source.getControllerId());
|
BloodthirstWatcher watcher = (BloodthirstWatcher) game.getState().getWatchers().get(BloodthirstWatcher.class.getSimpleName(), source.getControllerId());
|
||||||
return watcher.conditionMet();
|
return watcher.conditionMet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ class SkeletonizeDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
ZoneChangeEvent zce = (ZoneChangeEvent) event;
|
ZoneChangeEvent zce = (ZoneChangeEvent) event;
|
||||||
if (zce.isDiesEvent()) {
|
if (zce.isDiesEvent()) {
|
||||||
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", this.getSourceId());
|
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get(DamagedByWatcher.class.getSimpleName(), this.getSourceId());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
return watcher.wasDamaged(zce.getTarget(), game);
|
return watcher.wasDamaged(zce.getTarget(), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ class CastBlackSpellThisTurnCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
SoulReapWatcher watcher = (SoulReapWatcher) game.getState().getWatchers().get("SoulReapWatcher", source.getControllerId());
|
SoulReapWatcher watcher = (SoulReapWatcher) game.getState().getWatchers().get(SoulReapWatcher.class.getSimpleName(), source.getControllerId());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
return watcher.conditionMet();
|
return watcher.conditionMet();
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ class SoulReapWatcher extends Watcher {
|
||||||
private UUID cardId;
|
private UUID cardId;
|
||||||
|
|
||||||
public SoulReapWatcher(UUID cardId) {
|
public SoulReapWatcher(UUID cardId) {
|
||||||
super("SoulReapWatcher", WatcherScope.PLAYER);
|
super(SoulReapWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||||
this.cardId = cardId;
|
this.cardId = cardId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ class SpiritOfTheLabyrinthWatcher extends Watcher {
|
||||||
private final HashSet<UUID> playersThatDrewCard;
|
private final HashSet<UUID> playersThatDrewCard;
|
||||||
|
|
||||||
public SpiritOfTheLabyrinthWatcher() {
|
public SpiritOfTheLabyrinthWatcher() {
|
||||||
super("DrewCard", WatcherScope.GAME);
|
super(SpiritOfTheLabyrinthWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
this.playersThatDrewCard = new HashSet<>();
|
this.playersThatDrewCard = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ class SpiritOfTheLabyrinthEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
SpiritOfTheLabyrinthWatcher watcher = (SpiritOfTheLabyrinthWatcher) game.getState().getWatchers().get("DrewCard");
|
SpiritOfTheLabyrinthWatcher watcher = (SpiritOfTheLabyrinthWatcher) game.getState().getWatchers().get(SpiritOfTheLabyrinthWatcher.class.getSimpleName());
|
||||||
if (watcher != null && watcher.hasPlayerDrewCardThisTurn(event.getPlayerId())) {
|
if (watcher != null && watcher.hasPlayerDrewCardThisTurn(event.getPlayerId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
|
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
|
||||||
|
@ -54,7 +55,7 @@ import mage.watchers.common.PlayerDamagedBySourceWatcher;
|
||||||
public class SteelHellkite extends CardImpl {
|
public class SteelHellkite extends CardImpl {
|
||||||
|
|
||||||
public SteelHellkite(UUID ownerId, CardSetInfo setInfo) {
|
public SteelHellkite(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{6}");
|
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{6}");
|
||||||
this.subtype.add("Dragon");
|
this.subtype.add("Dragon");
|
||||||
|
|
||||||
this.power = new MageInt(5);
|
this.power = new MageInt(5);
|
||||||
|
@ -97,9 +98,9 @@ class SteelHellkiteDestroyEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
int xValue = source.getManaCostsToPay().getX();
|
int xValue = source.getManaCostsToPay().getX();
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterNonlandPermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterNonlandPermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (permanent.getConvertedManaCost() == xValue) {
|
if (permanent.getConvertedManaCost() == xValue) {
|
||||||
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", permanent.getControllerId());
|
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), permanent.getControllerId());
|
||||||
if (watcher != null && watcher.hasSourceDoneDamage(source.getSourceId(), game)) {
|
if (watcher != null && watcher.hasSourceDoneDamage(source.getSourceId(), game)) {
|
||||||
permanent.destroy(source.getSourceId(), game, false);
|
permanent.destroy(source.getSourceId(), game, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ enum SummoningTrapCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
SummoningTrapWatcher watcher = (SummoningTrapWatcher) game.getState().getWatchers().get("CreatureSpellCountered");
|
SummoningTrapWatcher watcher = (SummoningTrapWatcher) game.getState().getWatchers().get(SummoningTrapWatcher.class.getSimpleName());
|
||||||
return watcher != null && watcher.creatureSpellOfPlayerWasCountered(source.getControllerId());
|
return watcher != null && watcher.creatureSpellOfPlayerWasCountered(source.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class SummoningTrapWatcher extends Watcher {
|
||||||
Set<UUID> players = new HashSet<>();
|
Set<UUID> players = new HashSet<>();
|
||||||
|
|
||||||
public SummoningTrapWatcher() {
|
public SummoningTrapWatcher() {
|
||||||
super("CreatureSpellCountered", WatcherScope.GAME);
|
super(SummoningTrapWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SummoningTrapWatcher(final SummoningTrapWatcher watcher) {
|
public SummoningTrapWatcher(final SummoningTrapWatcher watcher) {
|
||||||
|
|
|
@ -83,7 +83,7 @@ class AllPlayersLostLifeCount implements DynamicValue {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int calculate(Game game, UUID controllerId) {
|
public int calculate(Game game, UUID controllerId) {
|
||||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher");
|
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
int amountLifeLost = 0;
|
int amountLifeLost = 0;
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(controllerId, game)) {
|
for (UUID playerId : game.getState().getPlayersInRange(controllerId, game)) {
|
||||||
|
|
|
@ -82,7 +82,7 @@ enum PlayerCastNonCreatureSpellCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
PlayerCastNonCreatureSpellWatcher watcher = (PlayerCastNonCreatureSpellWatcher) game.getState().getWatchers().get("PlayerCastNonCreatureSpell");
|
PlayerCastNonCreatureSpellWatcher watcher = (PlayerCastNonCreatureSpellWatcher) game.getState().getWatchers().get(PlayerCastNonCreatureSpellWatcher.class.getSimpleName());
|
||||||
return watcher != null && watcher.playerDidCastNonCreatureSpellThisTurn(source.getControllerId());
|
return watcher != null && watcher.playerDidCastNonCreatureSpellThisTurn(source.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ class PlayerCastNonCreatureSpellWatcher extends Watcher {
|
||||||
Set<UUID> playerIds = new HashSet<>();
|
Set<UUID> playerIds = new HashSet<>();
|
||||||
|
|
||||||
public PlayerCastNonCreatureSpellWatcher() {
|
public PlayerCastNonCreatureSpellWatcher() {
|
||||||
super("PlayerCastNonCreatureSpell", WatcherScope.GAME);
|
super(PlayerCastNonCreatureSpellWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerCastNonCreatureSpellWatcher(final PlayerCastNonCreatureSpellWatcher watcher) {
|
public PlayerCastNonCreatureSpellWatcher(final PlayerCastNonCreatureSpellWatcher watcher) {
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class TimeToReflect extends CardImpl {
|
||||||
if (ability instanceof SpellAbility) {
|
if (ability instanceof SpellAbility) {
|
||||||
List<PermanentIdPredicate> creaturesThatBlockedOrWereBlockedByAZombie = new ArrayList<>();
|
List<PermanentIdPredicate> creaturesThatBlockedOrWereBlockedByAZombie = new ArrayList<>();
|
||||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that blocked or was blocked by a Zombie this turn.").copy();
|
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that blocked or was blocked by a Zombie this turn.").copy();
|
||||||
BlockedOrWasBlockedByAZombieWatcher watcher = (BlockedOrWasBlockedByAZombieWatcher) game.getState().getWatchers().get("BlockedOrWasBlockedByAZombieWatcher");
|
BlockedOrWasBlockedByAZombieWatcher watcher = (BlockedOrWasBlockedByAZombieWatcher) game.getState().getWatchers().get(BlockedOrWasBlockedByAZombieWatcher.class.getSimpleName());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
for (MageObjectReference mor : watcher.getBlockedThisTurnCreatures()) {
|
for (MageObjectReference mor : watcher.getBlockedThisTurnCreatures()) {
|
||||||
Permanent permanent = mor.getPermanent(game);
|
Permanent permanent = mor.getPermanent(game);
|
||||||
|
@ -101,7 +101,7 @@ class BlockedOrWasBlockedByAZombieWatcher extends Watcher {
|
||||||
private final Set<MageObjectReference> blockedOrWasBlockedByAZombieWatcher;
|
private final Set<MageObjectReference> blockedOrWasBlockedByAZombieWatcher;
|
||||||
|
|
||||||
public BlockedOrWasBlockedByAZombieWatcher() {
|
public BlockedOrWasBlockedByAZombieWatcher() {
|
||||||
super("BlockedOrWasBlockedByAZombieWatcher", WatcherScope.GAME);
|
super(BlockedOrWasBlockedByAZombieWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
blockedOrWasBlockedByAZombieWatcher = new HashSet<>();
|
blockedOrWasBlockedByAZombieWatcher = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ class UrzasMiterDoIfCostPaid extends DoIfCostPaid {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
UrzasMiterWatcher watcher = (UrzasMiterWatcher) game.getState().getWatchers().get("UrzasMiterWatcher");
|
UrzasMiterWatcher watcher = (UrzasMiterWatcher) game.getState().getWatchers().get(UrzasMiterWatcher.class.getSimpleName());
|
||||||
if(!watcher.cards.contains(source.getFirstTarget()))
|
if(!watcher.cards.contains(source.getFirstTarget()))
|
||||||
return super.apply(game, source);
|
return super.apply(game, source);
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class UrzasMiterWatcher extends Watcher {
|
||||||
ArrayList<UUID> cards;
|
ArrayList<UUID> cards;
|
||||||
|
|
||||||
public UrzasMiterWatcher() {
|
public UrzasMiterWatcher() {
|
||||||
super("UrzasMiterWatcher", WatcherScope.PLAYER);
|
super(UrzasMiterWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||||
this.cards = new ArrayList<>();
|
this.cards = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ class VengevineAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getPlayerId().equals(controllerId)) {
|
if (event.getPlayerId().equals(controllerId)) {
|
||||||
Watcher watcher = game.getState().getWatchers().get("CreatureCast", controllerId);
|
Watcher watcher = game.getState().getWatchers().get(VengevineWatcher.class.getSimpleName(), controllerId);
|
||||||
if (watcher != null && watcher.conditionMet()) {
|
if (watcher != null && watcher.conditionMet()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ class VengevineWatcher extends Watcher {
|
||||||
int creatureSpellCount = 0;
|
int creatureSpellCount = 0;
|
||||||
|
|
||||||
public VengevineWatcher() {
|
public VengevineWatcher() {
|
||||||
super("CreatureCast", WatcherScope.PLAYER);
|
super(VengevineWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VengevineWatcher(final VengevineWatcher watcher) {
|
public VengevineWatcher(final VengevineWatcher watcher) {
|
||||||
|
|
|
@ -103,7 +103,7 @@ class VileRedeemerEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
VileRedeemerNonTokenCreaturesDiedWatcher watcher = (VileRedeemerNonTokenCreaturesDiedWatcher) game.getState().getWatchers().get("VileRedeemerNonTokenCreaturesDiedWatcher");
|
VileRedeemerNonTokenCreaturesDiedWatcher watcher = (VileRedeemerNonTokenCreaturesDiedWatcher) game.getState().getWatchers().get(VileRedeemerNonTokenCreaturesDiedWatcher.class.getSimpleName());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
int amount = watcher.getAmountOfNontokenCreatureDiedThisTurn(controller.getId());
|
int amount = watcher.getAmountOfNontokenCreatureDiedThisTurn(controller.getId());
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
|
@ -121,7 +121,7 @@ class VileRedeemerNonTokenCreaturesDiedWatcher extends Watcher {
|
||||||
private final HashMap<UUID, Integer> amountOfCreaturesThatDied = new HashMap<>();
|
private final HashMap<UUID, Integer> amountOfCreaturesThatDied = new HashMap<>();
|
||||||
|
|
||||||
public VileRedeemerNonTokenCreaturesDiedWatcher() {
|
public VileRedeemerNonTokenCreaturesDiedWatcher() {
|
||||||
super("VileRedeemerNonTokenCreaturesDiedWatcher", WatcherScope.GAME);
|
super(VileRedeemerNonTokenCreaturesDiedWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VileRedeemerNonTokenCreaturesDiedWatcher(final VileRedeemerNonTokenCreaturesDiedWatcher watcher) {
|
public VileRedeemerNonTokenCreaturesDiedWatcher(final VileRedeemerNonTokenCreaturesDiedWatcher watcher) {
|
||||||
|
@ -149,7 +149,7 @@ class VileRedeemerNonTokenCreaturesDiedWatcher extends Watcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAmountOfNontokenCreatureDiedThisTurn(UUID playerId) {
|
public int getAmountOfNontokenCreatureDiedThisTurn(UUID playerId) {
|
||||||
return amountOfCreaturesThatDied.containsKey(playerId) ? amountOfCreaturesThatDied.get(playerId) : 0;
|
return amountOfCreaturesThatDied.getOrDefault(playerId, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -80,7 +80,7 @@ enum WindbriskHeightsAttackersCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
PlayerAttackedWatcher watcher = (PlayerAttackedWatcher) game.getState().getWatchers().get("PlayerAttackedWatcher");
|
PlayerAttackedWatcher watcher = (PlayerAttackedWatcher) game.getState().getWatchers().get(PlayerAttackedWatcher.class.getSimpleName());
|
||||||
return watcher != null && watcher.getNumberOfAttackersCurrentTurn(source.getControllerId()) >= 3;
|
return watcher != null && watcher.getNumberOfAttackersCurrentTurn(source.getControllerId()) >= 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.condition.Condition;
|
import mage.abilities.condition.Condition;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
import mage.watchers.common.MorbidWatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
|
@ -41,7 +42,7 @@ public enum MorbidCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Watcher watcher = game.getState().getWatchers().get("Morbid");
|
Watcher watcher = game.getState().getWatchers().get(MorbidWatcher.class.getSimpleName());
|
||||||
return watcher.conditionMet();
|
return watcher.conditionMet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ public enum NoSpellsWereCastLastTurnCondition implements Condition {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||||
// if any player cast spell, return false
|
// if any player cast spell, return false
|
||||||
for (Integer count : watcher.getAmountOfSpellsCastOnPrevTurn().values()) {
|
for (Integer count : watcher.getAmountOfSpellsCastOnPrevTurn().values()) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ public enum TwoOrMoreSpellsWereCastLastTurnCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||||
// if any player cast more than two spells, return true
|
// if any player cast more than two spells, return true
|
||||||
for (Integer count : watcher.getAmountOfSpellsCastOnPrevTurn().values()) {
|
for (Integer count : watcher.getAmountOfSpellsCastOnPrevTurn().values()) {
|
||||||
if (count >= 2) {
|
if (count >= 2) {
|
||||||
|
|
|
@ -100,7 +100,7 @@ class StormEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
MageObjectReference spellRef = (MageObjectReference) this.getValue("StormSpellRef");
|
MageObjectReference spellRef = (MageObjectReference) this.getValue("StormSpellRef");
|
||||||
if (spellRef != null) {
|
if (spellRef != null) {
|
||||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||||
int stormCount = watcher.getSpellOrder(spellRef, game) - 1;
|
int stormCount = watcher.getSpellOrder(spellRef, game) - 1;
|
||||||
if (stormCount > 0) {
|
if (stormCount > 0) {
|
||||||
Spell spell = (Spell) this.getValue("StormSpell");
|
Spell spell = (Spell) this.getValue("StormSpell");
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class AmountOfDamageAPlayerReceivedThisTurnWatcher extends Watcher {
|
||||||
private final Map<UUID, Integer> amountOfDamageReceivedThisTurn = new HashMap<>();
|
private final Map<UUID, Integer> amountOfDamageReceivedThisTurn = new HashMap<>();
|
||||||
|
|
||||||
public AmountOfDamageAPlayerReceivedThisTurnWatcher() {
|
public AmountOfDamageAPlayerReceivedThisTurnWatcher() {
|
||||||
super("AmountOfDamageReceivedThisTurn", WatcherScope.GAME);
|
super(AmountOfDamageAPlayerReceivedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AmountOfDamageAPlayerReceivedThisTurnWatcher(final AmountOfDamageAPlayerReceivedThisTurnWatcher watcher) {
|
public AmountOfDamageAPlayerReceivedThisTurnWatcher(final AmountOfDamageAPlayerReceivedThisTurnWatcher watcher) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class AttackedOrBlockedThisCombatWatcher extends Watcher {
|
||||||
public final Set<MageObjectReference> blockedThisTurnCreatures = new HashSet<>();
|
public final Set<MageObjectReference> blockedThisTurnCreatures = new HashSet<>();
|
||||||
|
|
||||||
public AttackedOrBlockedThisCombatWatcher() {
|
public AttackedOrBlockedThisCombatWatcher() {
|
||||||
super(AttackedOrBlockedThisCombatWatcher.class.getName(), WatcherScope.GAME);
|
super(AttackedOrBlockedThisCombatWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AttackedOrBlockedThisCombatWatcher(final AttackedOrBlockedThisCombatWatcher watcher) {
|
public AttackedOrBlockedThisCombatWatcher(final AttackedOrBlockedThisCombatWatcher watcher) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class AttackedThisTurnWatcher extends Watcher {
|
||||||
public final Set<MageObjectReference> attackedThisTurnCreatures = new HashSet<>();
|
public final Set<MageObjectReference> attackedThisTurnCreatures = new HashSet<>();
|
||||||
|
|
||||||
public AttackedThisTurnWatcher() {
|
public AttackedThisTurnWatcher() {
|
||||||
super(AttackedThisTurnWatcher.class.getName(), WatcherScope.GAME);
|
super(AttackedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AttackedThisTurnWatcher(final AttackedThisTurnWatcher watcher) {
|
public AttackedThisTurnWatcher(final AttackedThisTurnWatcher watcher) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class BlockedAttackerWatcher extends Watcher {
|
||||||
public final HashMap<MageObjectReference, Set<MageObjectReference>> blockData = new HashMap<>();
|
public final HashMap<MageObjectReference, Set<MageObjectReference>> blockData = new HashMap<>();
|
||||||
|
|
||||||
public BlockedAttackerWatcher() {
|
public BlockedAttackerWatcher() {
|
||||||
super("BlockedAttackerWatcher", WatcherScope.GAME);
|
super(BlockedAttackerWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockedAttackerWatcher(final BlockedAttackerWatcher watcher) {
|
public BlockedAttackerWatcher(final BlockedAttackerWatcher watcher) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class BlockedThisTurnWatcher extends Watcher {
|
||||||
private final Set<MageObjectReference> blockedThisTurnCreatures;
|
private final Set<MageObjectReference> blockedThisTurnCreatures;
|
||||||
|
|
||||||
public BlockedThisTurnWatcher() {
|
public BlockedThisTurnWatcher() {
|
||||||
super("BlockedThisTurn", WatcherScope.GAME);
|
super(BlockedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
blockedThisTurnCreatures = new HashSet<>();
|
blockedThisTurnCreatures = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,11 +37,12 @@ import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Must be installed to player for proper Bloodthirst work
|
* Must be installed to player for proper Bloodthirst work
|
||||||
|
*
|
||||||
* @author Loki
|
* @author Loki
|
||||||
*/
|
*/
|
||||||
public class BloodthirstWatcher extends Watcher {
|
public class BloodthirstWatcher extends Watcher {
|
||||||
public BloodthirstWatcher(UUID controllerId) {
|
public BloodthirstWatcher(UUID controllerId) {
|
||||||
super("DamagedOpponents", WatcherScope.PLAYER);
|
super(BloodthirstWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||||
this.controllerId = controllerId;
|
this.controllerId = controllerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ public class BloodthirstWatcher extends Watcher {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
|
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
|
||||||
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
|
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
|
||||||
if (game.getPlayer(this.getControllerId()).hasOpponent(damageEvent.getPlayerId(), game)) {
|
if (game.getPlayer(this.getControllerId()).hasOpponent(damageEvent.getPlayerId(), game)) {
|
||||||
condition = true;
|
condition = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,12 +44,11 @@ import java.util.UUID;
|
||||||
*/
|
*/
|
||||||
public class CardsAmountDrawnThisTurnWatcher extends Watcher {
|
public class CardsAmountDrawnThisTurnWatcher extends Watcher {
|
||||||
|
|
||||||
public final static String BASIC_KEY = "CardsAmountDrawnThisTurnWatcher";
|
|
||||||
|
|
||||||
private final Map<UUID, Integer> amountOfCardsDrawnThisTurn = new HashMap<>();
|
private final Map<UUID, Integer> amountOfCardsDrawnThisTurn = new HashMap<>();
|
||||||
|
|
||||||
public CardsAmountDrawnThisTurnWatcher() {
|
public CardsAmountDrawnThisTurnWatcher() {
|
||||||
super(BASIC_KEY, WatcherScope.GAME);
|
super(CardsAmountDrawnThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardsAmountDrawnThisTurnWatcher(final CardsAmountDrawnThisTurnWatcher watcher) {
|
public CardsAmountDrawnThisTurnWatcher(final CardsAmountDrawnThisTurnWatcher watcher) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class CardsCycledOrDiscardedThisTurnWatcher extends Watcher {
|
||||||
private final Map<UUID, Cards> cycledOrDiscardedCardsThisTurn = new HashMap<>();
|
private final Map<UUID, Cards> cycledOrDiscardedCardsThisTurn = new HashMap<>();
|
||||||
|
|
||||||
public CardsCycledOrDiscardedThisTurnWatcher() {
|
public CardsCycledOrDiscardedThisTurnWatcher() {
|
||||||
super(CardsCycledOrDiscardedThisTurnWatcher.class.getName(), WatcherScope.GAME);
|
super(CardsCycledOrDiscardedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardsCycledOrDiscardedThisTurnWatcher(final CardsCycledOrDiscardedThisTurnWatcher watcher) {
|
public CardsCycledOrDiscardedThisTurnWatcher(final CardsCycledOrDiscardedThisTurnWatcher watcher) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class CardsDrawnDuringDrawStepWatcher extends Watcher {
|
||||||
private final Map<UUID, Integer> amountOfCardsDrawnThisTurn = new HashMap<>();
|
private final Map<UUID, Integer> amountOfCardsDrawnThisTurn = new HashMap<>();
|
||||||
|
|
||||||
public CardsDrawnDuringDrawStepWatcher() {
|
public CardsDrawnDuringDrawStepWatcher() {
|
||||||
super("CardsDrawnDuringDrawStep", WatcherScope.GAME);
|
super(CardsDrawnDuringDrawStepWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardsDrawnDuringDrawStepWatcher(final CardsDrawnDuringDrawStepWatcher watcher) {
|
public CardsDrawnDuringDrawStepWatcher(final CardsDrawnDuringDrawStepWatcher watcher) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class CardsPutIntoGraveyardWatcher extends Watcher {
|
||||||
private final Set<MageObjectReference> cardsPutToGraveyardFromBattlefield = new HashSet<>();
|
private final Set<MageObjectReference> cardsPutToGraveyardFromBattlefield = new HashSet<>();
|
||||||
|
|
||||||
public CardsPutIntoGraveyardWatcher() {
|
public CardsPutIntoGraveyardWatcher() {
|
||||||
super("CardsPutIntoGraveyardWatcher", WatcherScope.GAME);
|
super(CardsPutIntoGraveyardWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardsPutIntoGraveyardWatcher(final CardsPutIntoGraveyardWatcher watcher) {
|
public CardsPutIntoGraveyardWatcher(final CardsPutIntoGraveyardWatcher watcher) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class CastFromGraveyardWatcher extends Watcher {
|
||||||
private final Map<UUID, HashSet<Integer>> spellsCastFromGraveyard = new HashMap<>();
|
private final Map<UUID, HashSet<Integer>> spellsCastFromGraveyard = new HashMap<>();
|
||||||
|
|
||||||
public CastFromGraveyardWatcher() {
|
public CastFromGraveyardWatcher() {
|
||||||
super(CastFromGraveyardWatcher.class.getName(), WatcherScope.GAME);
|
super(CastFromGraveyardWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CastFromGraveyardWatcher(final CastFromGraveyardWatcher watcher) {
|
public CastFromGraveyardWatcher(final CastFromGraveyardWatcher watcher) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class CastFromHandWatcher extends Watcher {
|
||||||
private Step step;
|
private Step step;
|
||||||
|
|
||||||
public CastFromHandWatcher() {
|
public CastFromHandWatcher() {
|
||||||
super(CastFromHandWatcher.class.getName(), WatcherScope.GAME);
|
super(CastFromHandWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CastFromHandWatcher(final CastFromHandWatcher watcher) {
|
public CastFromHandWatcher(final CastFromHandWatcher watcher) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class CastSpellLastTurnWatcher extends Watcher {
|
||||||
private final List<MageObjectReference> spellsCastThisTurnInOrder = new ArrayList<>();
|
private final List<MageObjectReference> spellsCastThisTurnInOrder = new ArrayList<>();
|
||||||
|
|
||||||
public CastSpellLastTurnWatcher() {
|
public CastSpellLastTurnWatcher() {
|
||||||
super(CastSpellLastTurnWatcher.class.getName(), WatcherScope.GAME);
|
super(CastSpellLastTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CastSpellLastTurnWatcher(final CastSpellLastTurnWatcher watcher) {
|
public CastSpellLastTurnWatcher(final CastSpellLastTurnWatcher watcher) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class CommanderInfoWatcher extends Watcher {
|
||||||
public final boolean checkCommanderDamage;
|
public final boolean checkCommanderDamage;
|
||||||
|
|
||||||
public CommanderInfoWatcher(UUID commander, boolean checkCommanderDamage) {
|
public CommanderInfoWatcher(UUID commander, boolean checkCommanderDamage) {
|
||||||
super("CommanderCombatDamageWatcher", WatcherScope.CARD);
|
super(CommanderInfoWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||||
this.sourceId = commander;
|
this.sourceId = commander;
|
||||||
this.checkCommanderDamage = checkCommanderDamage;
|
this.checkCommanderDamage = checkCommanderDamage;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class CreatureWasCastWatcher extends Watcher {
|
||||||
private final Set<UUID> creaturesCasted = new HashSet<>();
|
private final Set<UUID> creaturesCasted = new HashSet<>();
|
||||||
|
|
||||||
public CreatureWasCastWatcher() {
|
public CreatureWasCastWatcher() {
|
||||||
super("CreatureWasCast", WatcherScope.GAME);
|
super(CreatureWasCastWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CreatureWasCastWatcher(final CreatureWasCastWatcher watcher) {
|
public CreatureWasCastWatcher(final CreatureWasCastWatcher watcher) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class CreaturesDiedWatcher extends Watcher {
|
||||||
private final HashMap<UUID, Integer> amountOfCreaturesThatDiedByController = new HashMap<>();
|
private final HashMap<UUID, Integer> amountOfCreaturesThatDiedByController = new HashMap<>();
|
||||||
|
|
||||||
public CreaturesDiedWatcher() {
|
public CreaturesDiedWatcher() {
|
||||||
super("CreaturesDiedWatcher", WatcherScope.GAME);
|
super(CreaturesDiedWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CreaturesDiedWatcher(final CreaturesDiedWatcher watcher) {
|
public CreaturesDiedWatcher(final CreaturesDiedWatcher watcher) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class DamageDoneWatcher extends Watcher {
|
||||||
public final Map<MageObjectReference, Integer> damagedObjects;
|
public final Map<MageObjectReference, Integer> damagedObjects;
|
||||||
|
|
||||||
public DamageDoneWatcher() {
|
public DamageDoneWatcher() {
|
||||||
super("DamageDone", WatcherScope.GAME);
|
super(DamageDoneWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
this.damagingObjects = new HashMap<>();
|
this.damagingObjects = new HashMap<>();
|
||||||
this.damagedObjects = new HashMap<>();
|
this.damagedObjects = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class DamagedByWatcher extends Watcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
public DamagedByWatcher(boolean watchPlaneswalkers) {
|
public DamagedByWatcher(boolean watchPlaneswalkers) {
|
||||||
super("DamagedByWatcher", WatcherScope.CARD);
|
super(DamagedByWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||||
this.watchPlaneswalkers = watchPlaneswalkers;
|
this.watchPlaneswalkers = watchPlaneswalkers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class DragonOnTheBattlefieldWhileSpellWasCastWatcher extends Watcher {
|
||||||
private final Set<UUID> castWithDragonOnTheBattlefield = new HashSet<>();
|
private final Set<UUID> castWithDragonOnTheBattlefield = new HashSet<>();
|
||||||
|
|
||||||
public DragonOnTheBattlefieldWhileSpellWasCastWatcher() {
|
public DragonOnTheBattlefieldWhileSpellWasCastWatcher() {
|
||||||
super("DragonOnTheBattlefieldWhileSpellWasCastWatcher", WatcherScope.GAME);
|
super(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DragonOnTheBattlefieldWhileSpellWasCastWatcher(final DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher) {
|
public DragonOnTheBattlefieldWhileSpellWasCastWatcher(final DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class FirstSpellCastThisTurnWatcher extends Watcher {
|
||||||
private final Map<UUID, UUID> playerFirstCastSpell = new HashMap<>();
|
private final Map<UUID, UUID> playerFirstCastSpell = new HashMap<>();
|
||||||
|
|
||||||
public FirstSpellCastThisTurnWatcher() {
|
public FirstSpellCastThisTurnWatcher() {
|
||||||
super("FirstSpellCastThisTurn", WatcherScope.GAME);
|
super(FirstSpellCastThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FirstSpellCastThisTurnWatcher(final FirstSpellCastThisTurnWatcher watcher) {
|
public FirstSpellCastThisTurnWatcher(final FirstSpellCastThisTurnWatcher watcher) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class FirstTimeStepWatcher extends Watcher {
|
||||||
private final EventType eventType;
|
private final EventType eventType;
|
||||||
|
|
||||||
public FirstTimeStepWatcher(EventType eventType) {
|
public FirstTimeStepWatcher(EventType eventType) {
|
||||||
super(eventType.toString() + FirstTimeStepWatcher.class.getName(), WatcherScope.GAME);
|
super(eventType.toString() + FirstTimeStepWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
this.eventType = eventType;
|
this.eventType = eventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class GravestormWatcher extends Watcher {
|
||||||
private int gravestormCount = 0;
|
private int gravestormCount = 0;
|
||||||
|
|
||||||
public GravestormWatcher() {
|
public GravestormWatcher() {
|
||||||
super("GravestormWatcher", WatcherScope.GAME);
|
super(GravestormWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GravestormWatcher(final GravestormWatcher watcher) {
|
public GravestormWatcher(final GravestormWatcher watcher) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class LandfallWatcher extends Watcher {
|
||||||
final Set<UUID> playerPlayedLand = new HashSet<>();
|
final Set<UUID> playerPlayedLand = new HashSet<>();
|
||||||
|
|
||||||
public LandfallWatcher() {
|
public LandfallWatcher() {
|
||||||
super("LandPlayed", WatcherScope.GAME);
|
super(LandfallWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LandfallWatcher(final LandfallWatcher watcher) {
|
public LandfallWatcher(final LandfallWatcher watcher) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class LifeLossOtherFromCombatWatcher extends Watcher {
|
||||||
private final Set<UUID> players = new HashSet<>();
|
private final Set<UUID> players = new HashSet<>();
|
||||||
|
|
||||||
public LifeLossOtherFromCombatWatcher() {
|
public LifeLossOtherFromCombatWatcher() {
|
||||||
super(LifeLossOtherFromCombatWatcher.class.getName(), WatcherScope.GAME);
|
super(LifeLossOtherFromCombatWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LifeLossOtherFromCombatWatcher(final LifeLossOtherFromCombatWatcher watcher) {
|
public LifeLossOtherFromCombatWatcher(final LifeLossOtherFromCombatWatcher watcher) {
|
||||||
|
@ -66,7 +66,7 @@ public class LifeLossOtherFromCombatWatcher extends Watcher {
|
||||||
public boolean opponentLostLifeOtherFromCombat(UUID playerId, Game game) {
|
public boolean opponentLostLifeOtherFromCombat(UUID playerId, Game game) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (players.stream().anyMatch((damagedPlayerId) -> (player.hasOpponent(damagedPlayerId, game)))) {
|
if (players.stream().anyMatch(damagedPlayerId -> player.hasOpponent(damagedPlayerId, game))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class ManaSpentToCastWatcher extends Watcher {
|
||||||
Mana payment = null;
|
Mana payment = null;
|
||||||
|
|
||||||
public ManaSpentToCastWatcher() {
|
public ManaSpentToCastWatcher() {
|
||||||
super("ManaSpentToCast", WatcherScope.CARD);
|
super(ManaSpentToCastWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ManaSpentToCastWatcher(final ManaSpentToCastWatcher watcher) {
|
public ManaSpentToCastWatcher(final ManaSpentToCastWatcher watcher) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class MiracleWatcher extends Watcher {
|
||||||
private final Map<UUID, Integer> amountOfCardsDrawnThisTurn = new HashMap<>();
|
private final Map<UUID, Integer> amountOfCardsDrawnThisTurn = new HashMap<>();
|
||||||
|
|
||||||
public MiracleWatcher() {
|
public MiracleWatcher() {
|
||||||
super("MiracleWatcher", WatcherScope.GAME);
|
super(MiracleWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MiracleWatcher(final MiracleWatcher watcher) {
|
public MiracleWatcher(final MiracleWatcher watcher) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ import mage.watchers.Watcher;
|
||||||
public class MorbidWatcher extends Watcher {
|
public class MorbidWatcher extends Watcher {
|
||||||
|
|
||||||
public MorbidWatcher() {
|
public MorbidWatcher() {
|
||||||
super("Morbid", WatcherScope.GAME);
|
super(MorbidWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MorbidWatcher(final MorbidWatcher watcher) {
|
public MorbidWatcher(final MorbidWatcher watcher) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class NumberOfTimesPermanentTargetedATurnWatcher extends Watcher {
|
||||||
private final Map<MageObjectReference, Integer> permanentsTargeted = new HashMap<>();
|
private final Map<MageObjectReference, Integer> permanentsTargeted = new HashMap<>();
|
||||||
|
|
||||||
public NumberOfTimesPermanentTargetedATurnWatcher() {
|
public NumberOfTimesPermanentTargetedATurnWatcher() {
|
||||||
super(NumberOfTimesPermanentTargetedATurnWatcher.class.getName(), WatcherScope.GAME);
|
super(NumberOfTimesPermanentTargetedATurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NumberOfTimesPermanentTargetedATurnWatcher(final NumberOfTimesPermanentTargetedATurnWatcher watcher) {
|
public NumberOfTimesPermanentTargetedATurnWatcher(final NumberOfTimesPermanentTargetedATurnWatcher watcher) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class PermanentsEnteredBattlefieldWatcher extends Watcher {
|
||||||
private final HashMap<UUID, List<Permanent>> enteringBattlefieldLastTurn = new HashMap<>();
|
private final HashMap<UUID, List<Permanent>> enteringBattlefieldLastTurn = new HashMap<>();
|
||||||
|
|
||||||
public PermanentsEnteredBattlefieldWatcher() {
|
public PermanentsEnteredBattlefieldWatcher() {
|
||||||
super(PermanentsEnteredBattlefieldWatcher.class.getName(), WatcherScope.GAME);
|
super(PermanentsEnteredBattlefieldWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PermanentsEnteredBattlefieldWatcher(final PermanentsEnteredBattlefieldWatcher watcher) {
|
public PermanentsEnteredBattlefieldWatcher(final PermanentsEnteredBattlefieldWatcher watcher) {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue