mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Merge pull request #3267 from ingmargoudt/random_cleanups
Random cleanups
This commit is contained in:
commit
be03cf7a8f
279 changed files with 655 additions and 941 deletions
|
@ -197,7 +197,7 @@ public class GameView implements Serializable {
|
|||
this.special = false;
|
||||
}
|
||||
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
spellsCastCurrentTurn = watcher.getAmountOfSpellsAllPlayersCastOnCurrentTurn();
|
||||
} else {
|
||||
|
|
|
@ -77,7 +77,7 @@ class AetherfluxReservoirDynamicValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
return watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(sourceAbility.getControllerId());
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ class AggravateRequirementEffect extends RequirementEffect {
|
|||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId());
|
||||
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get(DamagedByWatcher.class.getSimpleName(), source.getSourceId());
|
||||
if (watcher != null) {
|
||||
return watcher.wasDamaged(permanent, game);
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ class AlhammarretsArchiveReplacementEffect extends ReplacementEffectImpl {
|
|||
if (event.getPlayerId().equals(source.getControllerId())) {
|
||||
if (game.getActivePlayerId().equals(event.getPlayerId())
|
||||
&& game.getPhase().getStep().getType() == PhaseStep.DRAW) {
|
||||
CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get("CardsDrawnDuringDrawStep");
|
||||
CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get(CardsDrawnDuringDrawStepWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -47,13 +47,12 @@ import mage.util.CardUtil;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class AlphaAuthority extends CardImpl {
|
||||
|
||||
public AlphaAuthority(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
|
||||
|
||||
this.subtype.add("Aura");
|
||||
|
||||
|
@ -66,7 +65,7 @@ public class AlphaAuthority extends CardImpl {
|
|||
|
||||
// Enchanted creature has hexproof and can't be blocked by more than one creature.
|
||||
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(HexproofAbility.getInstance(), AttachmentType.AURA, Duration.WhileOnBattlefield));
|
||||
Effect effect = new CantBeBlockedByMoreThanOneAttachedEffect(AttachmentType.AURA,1);
|
||||
Effect effect = new CantBeBlockedByMoreThanOneAttachedEffect(AttachmentType.AURA, 1);
|
||||
effect.setText("and can't be blocked by more than one creature");
|
||||
ability.addEffect(effect);
|
||||
this.addAbility(ability);
|
||||
|
@ -95,7 +94,7 @@ class CantBeBlockedByMoreThanOneAttachedEffect extends ContinuousEffectImpl {
|
|||
super(duration, Outcome.Benefit);
|
||||
this.amount = amount;
|
||||
this.attachmentType = attachmentType;
|
||||
staticText = (attachmentType == AttachmentType.AURA ? "Enchanted" : "Equipped") + " creature can't be blocked by more than " + CardUtil.numberToText(amount) + " creature" + (amount==1 ?"":"s");
|
||||
staticText = attachmentType.verb() + " creature can't be blocked by more than " + CardUtil.numberToText(amount) + " creature" + (amount == 1 ? "" : "s");
|
||||
}
|
||||
|
||||
public CantBeBlockedByMoreThanOneAttachedEffect(final CantBeBlockedByMoreThanOneAttachedEffect effect) {
|
||||
|
|
|
@ -137,7 +137,7 @@ class AngelicArbiterCantAttackTargetEffect extends RestrictionEffect {
|
|||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
if (game.getActivePlayerId().equals(permanent.getControllerId()) && game.getOpponents(source.getControllerId()).contains(permanent.getControllerId())) {
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(permanent.getControllerId()) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ class AngelicArbiterEffect2 extends ContinuousRuleModifyingEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||
AngelicArbiterWatcher2 watcher = (AngelicArbiterWatcher2) game.getState().getWatchers().get("PlayerAttacked");
|
||||
AngelicArbiterWatcher2 watcher = (AngelicArbiterWatcher2) game.getState().getWatchers().get(AngelicArbiterWatcher2.class.getSimpleName());
|
||||
if (watcher != null && watcher.hasPlayerAttackedThisTurn(event.getPlayerId())) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ class AngelsTrumpetTapEffect extends OneShotEffect {
|
|||
continue;
|
||||
}
|
||||
// Creatures that attacked are safe.
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getName());
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(creature, game))) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ class ApproachOfTheSecondSunEffect extends OneShotEffect {
|
|||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (controller != null && spell != null) {
|
||||
ApproachOfTheSecondSunWatcher watcher
|
||||
= (ApproachOfTheSecondSunWatcher) game.getState().getWatchers().get(ApproachOfTheSecondSunWatcher.class.getName());
|
||||
= (ApproachOfTheSecondSunWatcher) game.getState().getWatchers().get(ApproachOfTheSecondSunWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.getApproachesCast(controller.getId()) > 1 && spell.getFromZone() == Zone.HAND) {
|
||||
// Win the game
|
||||
controller.won(game);
|
||||
|
@ -109,7 +109,7 @@ class ApproachOfTheSecondSunWatcher extends Watcher {
|
|||
private Map<UUID, Integer> approachesCast = new HashMap<>();
|
||||
|
||||
public ApproachOfTheSecondSunWatcher() {
|
||||
super(ApproachOfTheSecondSunWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(ApproachOfTheSecondSunWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public ApproachOfTheSecondSunWatcher(final ApproachOfTheSecondSunWatcher watcher) {
|
||||
|
|
|
@ -58,7 +58,7 @@ public class ArchiveTrap extends CardImpl {
|
|||
this.subtype.add("Trap");
|
||||
|
||||
// If an opponent searched his or her library this turn, you may pay {0} rather than pay Archive Trap's mana cost.
|
||||
this.addAbility(new AlternativeCostSourceAbility(new GenericManaCost(0), OpponentSearchesLibCondition.getInstance()), new ArchiveTrapWatcher());
|
||||
this.addAbility(new AlternativeCostSourceAbility(new GenericManaCost(0), OpponentSearchesLibCondition.instance), new ArchiveTrapWatcher());
|
||||
|
||||
// Target opponent puts the top thirteen cards of his or her library into his or her graveyard.
|
||||
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||
|
@ -80,7 +80,7 @@ class ArchiveTrapWatcher extends Watcher {
|
|||
Set<UUID> playerIds = new HashSet<>();
|
||||
|
||||
public ArchiveTrapWatcher() {
|
||||
super("LibrarySearched", WatcherScope.GAME);
|
||||
super(ArchiveTrapWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public ArchiveTrapWatcher(final ArchiveTrapWatcher watcher) {
|
||||
|
@ -112,17 +112,13 @@ class ArchiveTrapWatcher extends Watcher {
|
|||
}
|
||||
}
|
||||
|
||||
class OpponentSearchesLibCondition implements Condition {
|
||||
enum OpponentSearchesLibCondition implements Condition {
|
||||
|
||||
private static final OpponentSearchesLibCondition instance = new OpponentSearchesLibCondition();
|
||||
|
||||
public static Condition getInstance() {
|
||||
return instance;
|
||||
}
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
ArchiveTrapWatcher watcher = (ArchiveTrapWatcher) game.getState().getWatchers().get("LibrarySearched");
|
||||
ArchiveTrapWatcher watcher = (ArchiveTrapWatcher) game.getState().getWatchers().get(ArchiveTrapWatcher.class.getSimpleName());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && watcher != null) {
|
||||
for (UUID playerId : watcher.getPlayersSearchedLibrary()) {
|
||||
|
|
|
@ -102,7 +102,7 @@ class ArchmageAscensionTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent archmage = game.getPermanent(super.getSourceId());
|
||||
CardsAmountDrawnThisTurnWatcher watcher =
|
||||
(CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.BASIC_KEY);
|
||||
(CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName());
|
||||
return archmage != null && watcher != null && watcher.getAmountCardsDrawn(this.getControllerId()) >= 2;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,11 +47,11 @@ import java.util.UUID;
|
|||
public class ArrowVolleyTrap extends CardImpl {
|
||||
|
||||
public ArrowVolleyTrap(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{W}{W}");
|
||||
this.subtype.add("Trap");
|
||||
|
||||
// If four or more creatures are attacking, you may pay {1}{W} rather than pay Arrow Volley Trap's mana cost.
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{1}{W}"), ArrowVolleyTrapCondition.getInstance()));
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{1}{W}"), ArrowVolleyTrapCondition.instance));
|
||||
|
||||
// Arrow Volley Trap deals 5 damage divided as you choose among any number of target attacking creatures.
|
||||
this.getSpellAbility().addEffect(new DamageMultiEffect(5));
|
||||
|
@ -69,13 +69,9 @@ public class ArrowVolleyTrap extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class ArrowVolleyTrapCondition implements Condition {
|
||||
enum ArrowVolleyTrapCondition implements Condition {
|
||||
|
||||
private static final ArrowVolleyTrapCondition instance = new ArrowVolleyTrapCondition();
|
||||
|
||||
public static Condition getInstance() {
|
||||
return instance;
|
||||
}
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
|
|
|
@ -83,7 +83,7 @@ class AsmiraHolyAvengerWatcher extends Watcher {
|
|||
private int creaturesCount = 0;
|
||||
|
||||
public AsmiraHolyAvengerWatcher() {
|
||||
super("YourCreaturesDied", WatcherScope.PLAYER);
|
||||
super(AsmiraHolyAvengerWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||
condition = true;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ class AsmiraHolyAvengerDynamicValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
AsmiraHolyAvengerWatcher watcher = (AsmiraHolyAvengerWatcher) game.getState().getWatchers().get("YourCreaturesDied", sourceAbility.getControllerId());
|
||||
AsmiraHolyAvengerWatcher watcher = (AsmiraHolyAvengerWatcher) game.getState().getWatchers().get(AsmiraHolyAvengerWatcher.class.getSimpleName(), sourceAbility.getControllerId());
|
||||
if (watcher != null) {
|
||||
return watcher.getCreaturesCount();
|
||||
}
|
||||
|
|
|
@ -52,28 +52,26 @@ import mage.target.common.TargetCreatureOrPlayerAmount;
|
|||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* GATECRASH FAQ 11.01.2013
|
||||
*
|
||||
* <p>
|
||||
* You announce the value of X and how the damage will be divided as part of
|
||||
* casting Aurelia's Fury. Each chosen target must receive at least 1 damage.
|
||||
*
|
||||
* <p>
|
||||
* Aurelia's Fury can't deal damage to both a planeswalker and that
|
||||
* planeswalker's controller. If damage dealt by Aurelia's Fury is redirected
|
||||
* from a player to a planeswalker he or she controls, that player will be able
|
||||
* to cast noncreature spells that turn. If you want to stop a player from
|
||||
* casting noncreature spells this turn, you can't choose to redirect the
|
||||
* damage to a planeswalker he or she controls.
|
||||
*
|
||||
* <p>
|
||||
* If Aurelia's Fury has multiple targets, and some but not all of them are
|
||||
* illegal targets when Aurelia's Fury resolves, Aurelia's Fury will still
|
||||
* deal damage to the remaining legal targets according to the original damage
|
||||
* division.
|
||||
*
|
||||
* <p>
|
||||
* If all of the targets are illegal when Aurelia's Fury tries to resolve,
|
||||
* it will be countered and none of its effects will happen. No creature or
|
||||
* player will be dealt damage.
|
||||
|
@ -83,7 +81,7 @@ import java.util.UUID;
|
|||
public class AureliasFury extends CardImpl {
|
||||
|
||||
public AureliasFury(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{X}{R}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{R}{W}");
|
||||
|
||||
|
||||
// Aurelia's Fury deals X damage divided as you choose among any number of target creatures and/or players.
|
||||
|
@ -124,15 +122,15 @@ class AureliasFuryEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
AureliasFuryDamagedByWatcher watcher = (AureliasFuryDamagedByWatcher) game.getState().getWatchers().get("AureliasFuryDamagedByWatcher", source.getSourceId());
|
||||
AureliasFuryDamagedByWatcher watcher = (AureliasFuryDamagedByWatcher) game.getState().getWatchers().get(AureliasFuryDamagedByWatcher.class.getSimpleName(), source.getSourceId());
|
||||
if (watcher != null) {
|
||||
for(UUID creatureId : watcher.damagedCreatures) {
|
||||
for (UUID creatureId : watcher.damagedCreatures) {
|
||||
Permanent permanent = game.getPermanent(creatureId);
|
||||
if (permanent != null) {
|
||||
permanent.tap(game);
|
||||
}
|
||||
}
|
||||
for(UUID playerId : watcher.damagedPlayers) {
|
||||
for (UUID playerId : watcher.damagedPlayers) {
|
||||
ContinuousEffect effect = new AureliasFuryCantCastEffect();
|
||||
effect.setTargetPointer(new FixedTarget(playerId));
|
||||
game.addEffect(effect, source);
|
||||
|
@ -194,11 +192,11 @@ class AureliasFuryCantCastEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
|
||||
class AureliasFuryDamagedByWatcher extends Watcher {
|
||||
|
||||
public List<UUID> damagedCreatures = new ArrayList<>();
|
||||
public List<UUID> damagedPlayers = new ArrayList<>();
|
||||
public Set<UUID> damagedCreatures = new HashSet<>();
|
||||
public Set<UUID> damagedPlayers = new HashSet<>();
|
||||
|
||||
public AureliasFuryDamagedByWatcher() {
|
||||
super("AureliasFuryDamagedByWatcher", WatcherScope.CARD);
|
||||
super(AureliasFuryDamagedByWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
}
|
||||
|
||||
public AureliasFuryDamagedByWatcher(final AureliasFuryDamagedByWatcher watcher) {
|
||||
|
@ -217,7 +215,7 @@ class AureliasFuryDamagedByWatcher extends Watcher {
|
|||
if (event.getType() == EventType.DAMAGED_CREATURE) {
|
||||
MageObject obj = game.getObject(event.getSourceId());
|
||||
if (obj instanceof Spell) {
|
||||
if (sourceId.equals(((Spell) obj).getSourceId()) && !damagedCreatures.contains(event.getTargetId())) {
|
||||
if (sourceId.equals(((Spell) obj).getSourceId())) {
|
||||
damagedCreatures.add(event.getTargetId());
|
||||
}
|
||||
}
|
||||
|
@ -225,7 +223,7 @@ class AureliasFuryDamagedByWatcher extends Watcher {
|
|||
if (event.getType() == EventType.DAMAGED_PLAYER) {
|
||||
MageObject obj = game.getObject(event.getSourceId());
|
||||
if (obj instanceof Spell) {
|
||||
if (sourceId.equals(((Spell) obj).getSourceId()) && !damagedPlayers.contains(event.getTargetId())) {
|
||||
if (sourceId.equals(((Spell) obj).getSourceId())) {
|
||||
damagedPlayers.add(event.getTargetId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ class AvengingArrowTarget extends TargetPermanent {
|
|||
|
||||
@Override
|
||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get("SourceDidDamageWatcher");
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get(SourceDidDamageWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
if (watcher.damageSources.contains(id)) {
|
||||
return super.canTarget(id, source, game);
|
||||
|
@ -94,7 +94,7 @@ class AvengingArrowTarget extends TargetPermanent {
|
|||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
Set<UUID> availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game);
|
||||
Set<UUID> possibleTargets = new HashSet<>();
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get("SourceDidDamageWatcher");
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get(SourceDidDamageWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (UUID targetId : availablePossibleTargets) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
|
|
|
@ -44,17 +44,16 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class BalothCageTrap extends CardImpl {
|
||||
|
||||
public BalothCageTrap(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{G}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{G}{G}");
|
||||
this.subtype.add("Trap");
|
||||
|
||||
// If an opponent had an artifact enter the battlefield under his or her control this turn, you may pay {1}{G} rather than pay Baloth Cage Trap's mana cost.
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{1}{G}"), BalothCageTrapCondition.getInstance()), new PermanentsEnteredBattlefieldWatcher());
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{1}{G}"), BalothCageTrapCondition.instance), new PermanentsEnteredBattlefieldWatcher());
|
||||
|
||||
// Create a 4/4 green Beast creature token.
|
||||
this.getSpellAbility().addEffect(new CreateTokenEffect(new BeastToken2()));
|
||||
|
@ -70,17 +69,13 @@ public class BalothCageTrap extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class BalothCageTrapCondition implements Condition {
|
||||
enum BalothCageTrapCondition implements Condition {
|
||||
|
||||
private static final BalothCageTrapCondition instance = new BalothCageTrapCondition();
|
||||
|
||||
public static Condition getInstance() {
|
||||
return instance;
|
||||
}
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatchers().get(PermanentsEnteredBattlefieldWatcher.class.getName());
|
||||
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatchers().get(PermanentsEnteredBattlefieldWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
List<Permanent> permanents = watcher.getThisTurnEnteringPermanents(opponentId);
|
||||
|
|
|
@ -102,7 +102,7 @@ class BerserkReplacementEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.CAST_SPELL && event.getSourceId().equals(source.getSourceId())) {
|
||||
CombatDamageStepStartedWatcher watcher = (CombatDamageStepStartedWatcher) game.getState().getWatchers().get("CombatDamageStepStarted");
|
||||
CombatDamageStepStartedWatcher watcher = (CombatDamageStepStartedWatcher) game.getState().getWatchers().get(CombatDamageStepStartedWatcher.class.getSimpleName());
|
||||
return watcher == null || watcher.conditionMet();
|
||||
}
|
||||
return false;
|
||||
|
@ -122,7 +122,7 @@ class BerserkReplacementEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
class CombatDamageStepStartedWatcher extends Watcher {
|
||||
|
||||
public CombatDamageStepStartedWatcher() {
|
||||
super("CombatDamageStepStarted", WatcherScope.GAME);
|
||||
super(CombatDamageStepStartedWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public CombatDamageStepStartedWatcher(final CombatDamageStepStartedWatcher watcher) {
|
||||
|
@ -196,7 +196,7 @@ class BerserkDelayedDestroyEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
Watcher watcher = game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getName());
|
||||
Watcher watcher = game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher instanceof AttackedThisTurnWatcher) {
|
||||
if (((AttackedThisTurnWatcher) watcher).getAttackedThisTurnCreatures().contains(new MageObjectReference(permanent, game))) {
|
||||
return permanent.destroy(source.getSourceId(), game, false);
|
||||
|
|
|
@ -50,7 +50,6 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class BloodLust extends CardImpl {
|
||||
|
@ -62,12 +61,12 @@ public class BloodLust extends CardImpl {
|
|||
}
|
||||
|
||||
public BloodLust(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}");
|
||||
|
||||
// If target creature has toughness 5 or greater, it gets +4/-4 until end of turn. Otherwise, it gets +4/-X until end of turn, where X is its toughness minus 1.
|
||||
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(
|
||||
new BoostTargetEffect(4, -4, Duration.EndOfTurn),
|
||||
new BoostTargetEffect(new StaticValue(4), new SignInversionDynamicValue(new TargetPermanentToughnessMinus1Value()), Duration.WhileOnBattlefield),
|
||||
new BoostTargetEffect(new StaticValue(4), new SignInversionDynamicValue(TargetPermanentToughnessMinus1Value.instance), Duration.WhileOnBattlefield),
|
||||
new TargetMatchesFilterCondition(filter),
|
||||
"If target creature has toughness 5 or greater, it gets +4/-4 until end of turn. Otherwise, it gets +4/-X until end of turn, where X is its toughness minus 1"));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
|
@ -104,13 +103,9 @@ class TargetMatchesFilterCondition implements Condition {
|
|||
}
|
||||
}
|
||||
|
||||
class TargetPermanentToughnessMinus1Value implements DynamicValue {
|
||||
enum TargetPermanentToughnessMinus1Value implements DynamicValue {
|
||||
|
||||
private static final TargetPermanentToughnessMinus1Value instance = new TargetPermanentToughnessMinus1Value();
|
||||
|
||||
public static TargetPermanentToughnessMinus1Value getInstance() {
|
||||
return instance;
|
||||
}
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
|
@ -123,7 +118,7 @@ class TargetPermanentToughnessMinus1Value implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public TargetPermanentToughnessMinus1Value copy() {
|
||||
return new TargetPermanentToughnessMinus1Value();
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -96,7 +96,7 @@ class BloodcrazedGoblinEffect extends RestrictionEffect {
|
|||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
if (permanent.getId().equals(source.getSourceId())) {
|
||||
BloodthirstWatcher watcher = (BloodthirstWatcher) game.getState().getWatchers().get("DamagedOpponents", source.getControllerId()); // BloodthirstWatcher
|
||||
BloodthirstWatcher watcher = (BloodthirstWatcher) game.getState().getWatchers().get(BloodthirstWatcher.class.getSimpleName(), source.getControllerId()); // BloodthirstWatcher
|
||||
return !watcher.conditionMet();
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -134,7 +134,7 @@ class BontuTheGlorifiedRestrictionEffect extends RestrictionEffect {
|
|||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
if (permanent.getId().equals(source.getSourceId())) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get("CreaturesDiedWatcher");
|
||||
CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get(CreaturesDiedWatcher.class.getSimpleName());
|
||||
if (controller != null
|
||||
&& watcher != null) {
|
||||
return (watcher.getAmountOfCreaturesDiesThisTurn(controller.getId()) == 0);
|
||||
|
|
|
@ -89,7 +89,7 @@ class BoseijuWhoSheltersAllWatcher extends Watcher {
|
|||
public List<UUID> spells = new ArrayList<>();
|
||||
|
||||
public BoseijuWhoSheltersAllWatcher() {
|
||||
super("ManaPaidFromBoseijuWhoSheltersAllWatcher", WatcherScope.GAME);
|
||||
super(BoseijuWhoSheltersAllWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public BoseijuWhoSheltersAllWatcher(final BoseijuWhoSheltersAllWatcher watcher) {
|
||||
|
@ -158,7 +158,7 @@ class BoseijuWhoSheltersAllCantCounterEffect extends ContinuousRuleModifyingEffe
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
BoseijuWhoSheltersAllWatcher watcher = (BoseijuWhoSheltersAllWatcher) game.getState().getWatchers().get("ManaPaidFromBoseijuWhoSheltersAllWatcher");
|
||||
BoseijuWhoSheltersAllWatcher watcher = (BoseijuWhoSheltersAllWatcher) game.getState().getWatchers().get(BoseijuWhoSheltersAllWatcher.class.getSimpleName());
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && watcher.spells.contains(spell.getId())) {
|
||||
if (filter.match(spell.getCard(), game)) {
|
||||
|
|
|
@ -48,13 +48,12 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class BriarbridgePatrol extends CardImpl {
|
||||
|
||||
public BriarbridgePatrol(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
|
||||
this.subtype.add("Human");
|
||||
this.subtype.add("Warrior");
|
||||
this.power = new MageInt(3);
|
||||
|
@ -64,7 +63,7 @@ public class BriarbridgePatrol extends CardImpl {
|
|||
this.addAbility(new DealsDamageToOneOrMoreCreaturesTriggeredAbility(new InvestigateEffect(), false, false, false));
|
||||
// At the beginning of each end step, if you sacrificed three or more Clues this turn, you may put a creature card from your hand onto the battlefield.
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(new FilterCreatureCard("a creature card")), TargetController.ANY,
|
||||
BriarbridgePatrolCondition.getInstance(), true), new PermanentsSacrificedWatcher());
|
||||
BriarbridgePatrolCondition.instance, true), new PermanentsSacrificedWatcher());
|
||||
|
||||
}
|
||||
|
||||
|
@ -78,17 +77,13 @@ public class BriarbridgePatrol extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class BriarbridgePatrolCondition implements Condition {
|
||||
enum BriarbridgePatrolCondition implements Condition {
|
||||
|
||||
private static final BriarbridgePatrolCondition instance = new BriarbridgePatrolCondition();
|
||||
|
||||
public static Condition getInstance() {
|
||||
return instance;
|
||||
}
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
PermanentsSacrificedWatcher watcher = (PermanentsSacrificedWatcher) game.getState().getWatchers().get(PermanentsSacrificedWatcher.class.getName());
|
||||
PermanentsSacrificedWatcher watcher = (PermanentsSacrificedWatcher) game.getState().getWatchers().get(PermanentsSacrificedWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
List<Permanent> sacrificedPermanents = watcher.getThisTurnSacrificedPermanents(source.getControllerId());
|
||||
if (sacrificedPermanents != null && !sacrificedPermanents.isEmpty()) {
|
||||
|
@ -109,4 +104,4 @@ class BriarbridgePatrolCondition implements Condition {
|
|||
return "if you sacrificed three or more Clues this turn";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreatureOrPlayer;
|
||||
import mage.watchers.Watcher;
|
||||
import mage.watchers.common.MorbidWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -80,7 +81,7 @@ class BrimstoneVolleyEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int damage = 3;
|
||||
Watcher watcher = game.getState().getWatchers().get("Morbid");
|
||||
Watcher watcher = game.getState().getWatchers().get(MorbidWatcher.class.getSimpleName());
|
||||
if (watcher.conditionMet()) {
|
||||
damage = 5;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class CallerOfTheClawWatcher extends Watcher {
|
|||
private int creaturesCount = 0;
|
||||
|
||||
public CallerOfTheClawWatcher() {
|
||||
super(CallerOfTheClawWatcher.class.getName(), WatcherScope.PLAYER);
|
||||
super(CallerOfTheClawWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||
condition = true;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ class CallerOfTheClawDynamicValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
CallerOfTheClawWatcher watcher = (CallerOfTheClawWatcher) game.getState().getWatchers().get(CallerOfTheClawWatcher.class.getName(), sourceAbility.getControllerId());
|
||||
CallerOfTheClawWatcher watcher = (CallerOfTheClawWatcher) game.getState().getWatchers().get(CallerOfTheClawWatcher.class.getSimpleName(), sourceAbility.getControllerId());
|
||||
if (watcher != null) {
|
||||
return watcher.getCreaturesCount();
|
||||
}
|
||||
|
|
|
@ -40,18 +40,15 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward
|
||||
*/
|
||||
public class CathedralMembrane extends CardImpl {
|
||||
|
||||
public CathedralMembrane(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{1}{W/P}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{1}{W/P}");
|
||||
this.subtype.add("Wall");
|
||||
|
||||
this.power = new MageInt(0);
|
||||
|
@ -120,7 +117,7 @@ class CathedralMembraneEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
CathedralMembraneWatcher watcher = (CathedralMembraneWatcher) game.getState().getWatchers().get("CathedralMembraneWatcher", source.getSourceId());
|
||||
CathedralMembraneWatcher watcher = (CathedralMembraneWatcher) game.getState().getWatchers().get(CathedralMembraneWatcher.class.getSimpleName(), source.getSourceId());
|
||||
if (watcher != null) {
|
||||
for (UUID uuid : watcher.blockedCreatures) {
|
||||
Permanent permanent = game.getPermanent(uuid);
|
||||
|
@ -135,10 +132,10 @@ class CathedralMembraneEffect extends OneShotEffect {
|
|||
|
||||
class CathedralMembraneWatcher extends Watcher {
|
||||
|
||||
public List<UUID> blockedCreatures = new ArrayList<>();
|
||||
public Set<UUID> blockedCreatures = new HashSet<>();
|
||||
|
||||
public CathedralMembraneWatcher() {
|
||||
super("CathedralMembraneWatcher", WatcherScope.CARD);
|
||||
super(CathedralMembraneWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
}
|
||||
|
||||
public CathedralMembraneWatcher(final CathedralMembraneWatcher watcher) {
|
||||
|
@ -154,11 +151,9 @@ class CathedralMembraneWatcher extends Watcher {
|
|||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED && event.getSourceId().equals(sourceId)) {
|
||||
if (!blockedCreatures.contains(event.getTargetId())) {
|
||||
blockedCreatures.add(event.getTargetId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
|
|
|
@ -152,7 +152,7 @@ class CavernOfSoulsWatcher extends Watcher {
|
|||
private final String originalId;
|
||||
|
||||
public CavernOfSoulsWatcher(UUID originalId) {
|
||||
super("ManaPaidFromCavernOfSoulsWatcher", WatcherScope.CARD);
|
||||
super(CavernOfSoulsWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
this.originalId = originalId.toString();
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ class CavernOfSoulsCantCounterEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
CavernOfSoulsWatcher watcher = (CavernOfSoulsWatcher) game.getState().getWatchers().get("ManaPaidFromCavernOfSoulsWatcher", source.getSourceId());
|
||||
CavernOfSoulsWatcher watcher = (CavernOfSoulsWatcher) game.getState().getWatchers().get(CavernOfSoulsWatcher.class.getSimpleName(), source.getSourceId());
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
return spell != null && watcher != null && watcher.spellCantBeCountered(spell.getId());
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ class CerebralVortexEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (targetPlayer != null) {
|
||||
CerebralVortexWatcher watcher = (CerebralVortexWatcher) game.getState().getWatchers().get("CerebralVortexWatcher");
|
||||
CerebralVortexWatcher watcher = (CerebralVortexWatcher) game.getState().getWatchers().get(CerebralVortexWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
targetPlayer.damage(watcher.getDraws(targetPlayer.getId()), source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
|
@ -108,7 +108,7 @@ class CerebralVortexWatcher extends Watcher {
|
|||
private final Map<UUID, Integer> draws = new HashMap<>();
|
||||
|
||||
CerebralVortexWatcher() {
|
||||
super("CerebralVortexWatcher", WatcherScope.GAME);
|
||||
super(CerebralVortexWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
CerebralVortexWatcher(final CerebralVortexWatcher watcher) {
|
||||
|
@ -136,10 +136,7 @@ class CerebralVortexWatcher extends Watcher {
|
|||
}
|
||||
|
||||
public int getDraws(UUID playerId) {
|
||||
if (draws.containsKey(playerId)) {
|
||||
return draws.get(playerId);
|
||||
}
|
||||
return 0;
|
||||
return draws.getOrDefault(playerId, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -113,7 +113,7 @@ class ChainsOfMephistophelesReplacementEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getPhase().getStep().getType() == PhaseStep.DRAW) {
|
||||
CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get("CardsDrawnDuringDrawStep");
|
||||
CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get(CardsDrawnDuringDrawStepWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -88,8 +88,8 @@ class ChargingCinderhornCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getName());
|
||||
if (watcher != null && watcher instanceof AttackedThisTurnWatcher) {
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
return watcher.getAttackedThisTurnCreatures().isEmpty();
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -78,7 +78,7 @@ class SourceControllerLostLifeCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher");
|
||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
return watcher.getLiveLost(sourceAbility.getControllerId());
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public class CivilizedScholar extends CardImpl {
|
|||
class HomicidalBruteWatcher extends Watcher {
|
||||
|
||||
public HomicidalBruteWatcher() {
|
||||
super("HomicidalBruteAttacked", WatcherScope.CARD);
|
||||
super(HomicidalBruteWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
}
|
||||
|
||||
public HomicidalBruteWatcher(final HomicidalBruteWatcher watcher) {
|
||||
|
|
|
@ -49,17 +49,16 @@ import java.util.Set;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rafbill
|
||||
*/
|
||||
public class CobraTrap extends CardImpl {
|
||||
|
||||
public CobraTrap(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{4}{G}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{G}{G}");
|
||||
this.subtype.add("Trap");
|
||||
|
||||
// If a noncreature permanent under your control was destroyed this turn by a spell or ability an opponent controlled, you may pay {G} rather than pay Cobra Trap's mana cost.
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{G}"), CobraTrapCondition.getInstance()), new CobraTrapWatcher());
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{G}"), CobraTrapCondition.instance), new CobraTrapWatcher());
|
||||
|
||||
// Create four 1/1 green Snake creature tokens.
|
||||
this.getSpellAbility().addEffect(new CreateTokenEffect(new SnakeToken(), 4));
|
||||
|
@ -75,17 +74,13 @@ public class CobraTrap extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class CobraTrapCondition implements Condition {
|
||||
enum CobraTrapCondition implements Condition {
|
||||
|
||||
private static final CobraTrapCondition instance = new CobraTrapCondition();
|
||||
|
||||
public static Condition getInstance() {
|
||||
return instance;
|
||||
}
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
CobraTrapWatcher watcher = (CobraTrapWatcher) game.getState().getWatchers().get(CobraTrapWatcher.class.getName());
|
||||
CobraTrapWatcher watcher = (CobraTrapWatcher) game.getState().getWatchers().get(CobraTrapWatcher.class.getSimpleName());
|
||||
return watcher != null && watcher.conditionMet(source.getControllerId());
|
||||
}
|
||||
|
||||
|
@ -101,7 +96,7 @@ class CobraTrapWatcher extends Watcher {
|
|||
Set<UUID> players = new HashSet<>();
|
||||
|
||||
public CobraTrapWatcher() {
|
||||
super(CobraTrapWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(CobraTrapWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public CobraTrapWatcher(final CobraTrapWatcher watcher) {
|
||||
|
|
|
@ -56,7 +56,6 @@ import java.util.Map;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ConduitOfRuin extends CardImpl {
|
||||
|
@ -71,7 +70,7 @@ public class ConduitOfRuin extends CardImpl {
|
|||
}
|
||||
|
||||
public ConduitOfRuin(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{6}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}");
|
||||
this.subtype.add("Eldrazi");
|
||||
this.power = new MageInt(5);
|
||||
this.toughness = new MageInt(5);
|
||||
|
@ -102,7 +101,7 @@ class ConduitOfRuinWatcher extends Watcher {
|
|||
int spellCount = 0;
|
||||
|
||||
public ConduitOfRuinWatcher() {
|
||||
super("FirstCreatureSpellCastThisTurn", WatcherScope.GAME);
|
||||
super(ConduitOfRuinWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
playerCreatureSpells = new HashMap<>();
|
||||
}
|
||||
|
||||
|
@ -117,20 +116,13 @@ class ConduitOfRuinWatcher extends Watcher {
|
|||
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
||||
Spell spell = (Spell) game.getObject(event.getTargetId());
|
||||
if (spell != null && spell.isCreature()) {
|
||||
if (playerCreatureSpells.containsKey(event.getPlayerId())) {
|
||||
playerCreatureSpells.put(event.getPlayerId(), playerCreatureSpells.get(event.getPlayerId()) + 1);
|
||||
} else {
|
||||
playerCreatureSpells.put(event.getPlayerId(), 1);
|
||||
}
|
||||
playerCreatureSpells.put(event.getPlayerId(), creatureSpellsCastThisTurn(event.getPlayerId()) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int creatureSpellsCastThisTurn(UUID playerId) {
|
||||
if (playerCreatureSpells.containsKey(playerId)) {
|
||||
return playerCreatureSpells.get(playerId);
|
||||
}
|
||||
return 0;
|
||||
return playerCreatureSpells.getOrDefault(playerId, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -151,7 +143,7 @@ class FirstCastCreatureSpellPredicate implements ObjectPlayerPredicate<ObjectPla
|
|||
public boolean apply(ObjectPlayer<Controllable> input, Game game) {
|
||||
if (input.getObject() instanceof Spell
|
||||
&& ((Spell) input.getObject()).isCreature()) {
|
||||
ConduitOfRuinWatcher watcher = (ConduitOfRuinWatcher) game.getState().getWatchers().get("FirstCreatureSpellCastThisTurn");
|
||||
ConduitOfRuinWatcher watcher = (ConduitOfRuinWatcher) game.getState().getWatchers().get(ConduitOfRuinWatcher.class.getSimpleName());
|
||||
return watcher != null && watcher.creatureSpellsCastThisTurn(input.getPlayerId()) == 0;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -128,7 +128,7 @@ class ContainmentPriestReplacementEffect extends ReplacementEffectImpl {
|
|||
card = card.getSecondCardFace();
|
||||
}
|
||||
if (card.isCreature()) { // TODO: Bestow Card cast as Enchantment probably not handled correctly
|
||||
CreatureWasCastWatcher watcher = (CreatureWasCastWatcher) game.getState().getWatchers().get("CreatureWasCast");
|
||||
CreatureWasCastWatcher watcher = (CreatureWasCastWatcher) game.getState().getWatchers().get(CreatureWasCastWatcher.class.getSimpleName());
|
||||
if (watcher != null && !watcher.wasCreatureCastThisTurn(event.getTargetId())) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ class CurseOfExhaustionEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||
Player player = game.getPlayer(enchantment.getAttachedTo());
|
||||
if (player != null && event.getPlayerId().equals(player.getId())) {
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ class CyclopeanTombEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObjectReference mor = new MageObjectReference(source.getSourceId(), source.getSourceObjectZoneChangeCounter(), game);
|
||||
CyclopeanTombCounterWatcher watcher = (CyclopeanTombCounterWatcher) game.getState().getWatchers().get(CyclopeanTombCounterWatcher.class.getName());
|
||||
CyclopeanTombCounterWatcher watcher = (CyclopeanTombCounterWatcher) game.getState().getWatchers().get(CyclopeanTombCounterWatcher.class.getSimpleName());
|
||||
if (controller != null && watcher != null) {
|
||||
|
||||
Set<MageObjectReference> landRef = watcher.landMiredByCyclopeanTombInstance(mor, game);
|
||||
|
@ -221,7 +221,7 @@ class CyclopeanTombCounterWatcher extends Watcher {
|
|||
public HashMap<MageObjectReference, Set<MageObjectReference>> counterData = new HashMap<>();
|
||||
|
||||
public CyclopeanTombCounterWatcher() {
|
||||
super(CyclopeanTombCounterWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(CyclopeanTombCounterWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public CyclopeanTombCounterWatcher(final CyclopeanTombCounterWatcher watcher) {
|
||||
|
|
|
@ -68,7 +68,7 @@ public class DeathSpark extends CardImpl {
|
|||
new DoIfCostPaid(new ReturnSourceFromGraveyardToHandEffect(), new GenericManaCost(1)),
|
||||
TargetController.YOU,
|
||||
false),
|
||||
new DeathSparkCondition(),
|
||||
DeathSparkCondition.instance,
|
||||
"At the beginning of your upkeep, if {this} is in your graveyard with a creature card directly above it, you may pay {1}. If you do, return {this} to your hand."));
|
||||
}
|
||||
|
||||
|
@ -82,13 +82,9 @@ public class DeathSpark extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class DeathSparkCondition implements Condition {
|
||||
enum DeathSparkCondition implements Condition {
|
||||
|
||||
private static final DeathSparkCondition instance = new DeathSparkCondition();
|
||||
|
||||
public static Condition getInstance() {
|
||||
return instance;
|
||||
}
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
|
|
|
@ -44,13 +44,12 @@ import java.util.HashMap;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class DescentOfTheDragons extends CardImpl {
|
||||
|
||||
public DescentOfTheDragons(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{R}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{R}{R}");
|
||||
|
||||
// Destroy any number of target creatures. For each creature destroyed this way, its controller creates a 4/4 red Dragon creature token with flying.
|
||||
this.getSpellAbility().addEffect(new DescentOfTheDragonsEffect());
|
||||
|
@ -95,18 +94,15 @@ class DescentOfTheDragonsEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
UUID controllerOfTargetId = permanent.getControllerId();
|
||||
if (permanent.destroy(source.getSourceId(), game, false)) {
|
||||
if(playersWithTargets.containsKey(controllerOfTargetId)) {
|
||||
playersWithTargets.put(controllerOfTargetId, playersWithTargets.get(controllerOfTargetId) + 1);
|
||||
}
|
||||
else {
|
||||
playersWithTargets.put(controllerOfTargetId, 1);
|
||||
}
|
||||
int count = playersWithTargets.getOrDefault(controllerOfTargetId, 0);
|
||||
playersWithTargets.put(controllerOfTargetId, count + 1);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DragonToken dragonToken = new DragonToken();
|
||||
for(UUID playerId : playersWithTargets.keySet()) {
|
||||
for (UUID playerId : playersWithTargets.keySet()) {
|
||||
dragonToken.putOntoBattlefield(playersWithTargets.get(playerId), game, source.getSourceId(), playerId);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -116,7 +116,7 @@ class DraconicRoarEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher");
|
||||
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.castWithConditionTrue(source.getId())) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
|
|
|
@ -46,13 +46,12 @@ import java.util.Map.Entry;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class DreamSalvage extends CardImpl {
|
||||
|
||||
public DreamSalvage(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{U/B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U/B}");
|
||||
|
||||
|
||||
// Draw cards equal to the number of cards target opponent discarded this turn.
|
||||
|
@ -77,7 +76,7 @@ class CardsDiscardedThisTurnWatcher extends Watcher {
|
|||
private final Map<UUID, Integer> amountOfCardsDiscardedThisTurn = new HashMap<>();
|
||||
|
||||
public CardsDiscardedThisTurnWatcher() {
|
||||
super("CardsDiscardedThisTurnWatcher", WatcherScope.GAME);
|
||||
super(CardsDiscardedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public CardsDiscardedThisTurnWatcher(final CardsDiscardedThisTurnWatcher watcher) {
|
||||
|
@ -92,23 +91,13 @@ class CardsDiscardedThisTurnWatcher extends Watcher {
|
|||
if (event.getType() == GameEvent.EventType.DISCARDED_CARD) {
|
||||
UUID playerId = event.getPlayerId();
|
||||
if (playerId != null) {
|
||||
Integer amount = amountOfCardsDiscardedThisTurn.get(playerId);
|
||||
if (amount == null) {
|
||||
amount = 1;
|
||||
} else {
|
||||
amount++;
|
||||
}
|
||||
amountOfCardsDiscardedThisTurn.put(playerId, amount);
|
||||
amountOfCardsDiscardedThisTurn.put(playerId, getAmountCardsDiscarded(playerId) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getAmountCardsDiscarded(UUID playerId) {
|
||||
Integer amount = amountOfCardsDiscardedThisTurn.get(playerId);
|
||||
if (amount != null) {
|
||||
return amount;
|
||||
}
|
||||
return 0;
|
||||
return amountOfCardsDiscardedThisTurn.getOrDefault(playerId, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -140,7 +129,7 @@ class DreamSalvageEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
CardsDiscardedThisTurnWatcher watcher = (CardsDiscardedThisTurnWatcher) game.getState().getWatchers().get("CardsDiscardedThisTurnWatcher");
|
||||
CardsDiscardedThisTurnWatcher watcher = (CardsDiscardedThisTurnWatcher) game.getState().getWatchers().get(CardsDiscardedThisTurnWatcher.class.getSimpleName());
|
||||
Player targetOpponent = game.getPlayer(source.getFirstTarget());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (targetOpponent != null
|
||||
|
|
|
@ -82,7 +82,7 @@ class CastBlueSpellThisTurnCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getName());
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (Spell spell : watcher.getSpellsCastThisTurn(source.getControllerId())) {
|
||||
if (!spell.getSourceId().equals(source.getSourceId()) && spell.getColor(game).isBlue()) {
|
||||
|
|
|
@ -100,7 +100,7 @@ class NoMoreThanOneCreatureCanAttackEachTurnEffect extends RestrictionEffect {
|
|||
if (!game.getCombat().getAttackers().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getName());
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
|
||||
Set<MageObjectReference> attackedThisTurnCreatures = watcher.getAttackedThisTurnCreatures();
|
||||
return attackedThisTurnCreatures.isEmpty()
|
||||
|| (attackedThisTurnCreatures.size() == 1 && attackedThisTurnCreatures.contains(new MageObjectReference(attacker, game)));
|
||||
|
@ -134,7 +134,7 @@ class NoMoreThanOneCreatureCanBlockEachTurnEffect extends RestrictionEffect {
|
|||
if (!game.getCombat().getBlockers().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
BlockedThisTurnWatcher watcher = (BlockedThisTurnWatcher) game.getState().getWatchers().get("BlockedThisTurn");
|
||||
BlockedThisTurnWatcher watcher = (BlockedThisTurnWatcher) game.getState().getWatchers().get(BlockedThisTurnWatcher.class.getSimpleName());
|
||||
Set<MageObjectReference> blockedThisTurnCreatures = watcher.getBlockedThisTurnCreatures();
|
||||
MageObjectReference blockerReference = new MageObjectReference(blocker.getId(), blocker.getZoneChangeCounter(game), game);
|
||||
return blockedThisTurnCreatures.isEmpty()
|
||||
|
|
|
@ -95,7 +95,7 @@ enum HadAnotherCreatureEnterTheBattlefieldCondition implements Condition {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatchers().get(PermanentsEnteredBattlefieldWatcher.class.getName());
|
||||
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatchers().get(PermanentsEnteredBattlefieldWatcher.class.getSimpleName());
|
||||
return sourcePermanent != null
|
||||
&& watcher != null
|
||||
&& watcher.AnotherCreatureEnteredBattlefieldUnderPlayersControlLastTurn(sourcePermanent, game);
|
||||
|
|
|
@ -104,7 +104,7 @@ class ErayoSoratamiAscendantTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
return watcher != null && watcher.getAmountOfSpellsAllPlayersCastOnCurrentTurn() == 4;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ class ErayosEssenceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.getOpponents(getControllerId()).contains(event.getPlayerId())) {
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 1) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
|
|
|
@ -45,13 +45,12 @@ import java.util.HashMap;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ErdwalIlluminator extends CardImpl {
|
||||
|
||||
public ErdwalIlluminator(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
|
||||
this.subtype.add("Spirit");
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(3);
|
||||
|
@ -91,7 +90,7 @@ class ErdwalIlluminatorTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
InvestigatedWatcher watcher = (InvestigatedWatcher) game.getState().getWatchers().get(InvestigatedWatcher.class.getName());
|
||||
InvestigatedWatcher watcher = (InvestigatedWatcher) game.getState().getWatchers().get(InvestigatedWatcher.class.getSimpleName());
|
||||
return watcher != null && watcher.getTimesInvestigated(getControllerId()) == 1;
|
||||
}
|
||||
|
||||
|
@ -111,7 +110,7 @@ class InvestigatedWatcher extends Watcher {
|
|||
private final HashMap<UUID, Integer> timesInvestigated = new HashMap<>();
|
||||
|
||||
public InvestigatedWatcher() {
|
||||
super(InvestigatedWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(InvestigatedWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public InvestigatedWatcher(final InvestigatedWatcher watcher) {
|
||||
|
@ -126,11 +125,8 @@ class InvestigatedWatcher extends Watcher {
|
|||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == EventType.INVESTIGATED) {
|
||||
if (!timesInvestigated.containsKey(event.getPlayerId())) {
|
||||
timesInvestigated.put(event.getPlayerId(), 1);
|
||||
} else {
|
||||
timesInvestigated.put(event.getPlayerId(), timesInvestigated.get(event.getPlayerId()) + 1);
|
||||
}
|
||||
timesInvestigated.put(event.getPlayerId(), getTimesInvestigated(event.getPlayerId()) + 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,9 +137,6 @@ class InvestigatedWatcher extends Watcher {
|
|||
}
|
||||
|
||||
public int getTimesInvestigated(UUID playerId) {
|
||||
if (timesInvestigated.containsKey(playerId)) {
|
||||
return timesInvestigated.get(playerId);
|
||||
}
|
||||
return 0;
|
||||
return timesInvestigated.getOrDefault(playerId, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ class ErgRaidersCondition implements Condition {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent raiders = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getName());
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
|
||||
// wasControlledFromStartOfControllerTurn should be checked during resolution I guess, but shouldn't be relevant
|
||||
return raiders.wasControlledFromStartOfControllerTurn() && !watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(raiders, game));
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ class EtherswornCanonistWatcher extends Watcher {
|
|||
private Set<UUID> castNonartifactSpell = new HashSet<>();
|
||||
|
||||
public EtherswornCanonistWatcher() {
|
||||
super(EtherswornCanonistWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(EtherswornCanonistWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public EtherswornCanonistWatcher(final EtherswornCanonistWatcher watcher) {
|
||||
|
@ -143,7 +143,7 @@ class EtherswornCanonistReplacementEffect extends ContinuousRuleModifyingEffectI
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Card card = game.getCard(event.getSourceId());
|
||||
if (card != null && !card.isArtifact()) {
|
||||
EtherswornCanonistWatcher watcher = (EtherswornCanonistWatcher) game.getState().getWatchers().get(EtherswornCanonistWatcher.class.getName());
|
||||
EtherswornCanonistWatcher watcher = (EtherswornCanonistWatcher) game.getState().getWatchers().get(EtherswornCanonistWatcher.class.getSimpleName());
|
||||
return watcher != null && watcher.castNonArtifactSpell(event.getPlayerId());
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -84,7 +84,7 @@ class TargetCreaturePermanentThatDealtDamageThisTurn extends TargetPermanent {
|
|||
|
||||
@Override
|
||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get("SourceDidDamageWatcher");
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get(SourceDidDamageWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
if (watcher.damageSources.contains(id)) {
|
||||
return super.canTarget(id, source, game);
|
||||
|
@ -101,7 +101,7 @@ class TargetCreaturePermanentThatDealtDamageThisTurn extends TargetPermanent {
|
|||
}
|
||||
int count = 0;
|
||||
MageObject targetSource = game.getObject(sourceId);
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get("SourceDidDamageWatcher");
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get(SourceDidDamageWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, sourceControllerId, sourceId, game)) {
|
||||
if (!targets.containsKey(permanent.getId()) && watcher.damageSources.contains(permanent.getId())) {
|
||||
|
@ -121,7 +121,7 @@ class TargetCreaturePermanentThatDealtDamageThisTurn extends TargetPermanent {
|
|||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
Set<UUID> availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game);
|
||||
Set<UUID> possibleTargets = new HashSet<>();
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get("SourceDidDamageWatcher");
|
||||
SourceDidDamageWatcher watcher = (SourceDidDamageWatcher) game.getState().getWatchers().get(SourceDidDamageWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (UUID targetId : availablePossibleTargets) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
|
|
|
@ -49,7 +49,6 @@ import java.util.Set;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author spjspj
|
||||
*/
|
||||
public class FairgroundsTrumpeter extends CardImpl {
|
||||
|
@ -63,7 +62,7 @@ public class FairgroundsTrumpeter extends CardImpl {
|
|||
// At the beginning of each end step, if a +1/+1 counter was placed on a permanent under your control this turn, put a +1/+1 counter on Fairgrounds Trumpeter.
|
||||
this.addAbility(new ConditionalTriggeredAbility(new BeginningOfEndStepTriggeredAbility(
|
||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance()),
|
||||
TargetController.ANY, false), FairgroundsTrumpeterCondition.getInstance(),
|
||||
TargetController.ANY, false), FairgroundsTrumpeterCondition.instance,
|
||||
"At the beginning of each end step, if a +1/+1 counter was placed on a permanent under your control this turn, put a +1/+1 counter on {this}."),
|
||||
new FairgroundsTrumpeterWatcher());
|
||||
}
|
||||
|
@ -78,17 +77,13 @@ public class FairgroundsTrumpeter extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class FairgroundsTrumpeterCondition implements Condition {
|
||||
enum FairgroundsTrumpeterCondition implements Condition {
|
||||
|
||||
private static final FairgroundsTrumpeterCondition instance = new FairgroundsTrumpeterCondition();
|
||||
|
||||
public static Condition getInstance() {
|
||||
return instance;
|
||||
}
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
FairgroundsTrumpeterWatcher watcher = (FairgroundsTrumpeterWatcher) game.getState().getWatchers().get(FairgroundsTrumpeterWatcher.class.getName());
|
||||
FairgroundsTrumpeterWatcher watcher = (FairgroundsTrumpeterWatcher) game.getState().getWatchers().get(FairgroundsTrumpeterWatcher.class.getSimpleName());
|
||||
return watcher != null && watcher.p1p1AddedToPermanent(source.getControllerId());
|
||||
}
|
||||
|
||||
|
@ -104,7 +99,7 @@ class FairgroundsTrumpeterWatcher extends Watcher {
|
|||
private final Set<UUID> players = new HashSet<>();
|
||||
|
||||
public FairgroundsTrumpeterWatcher() {
|
||||
super(FairgroundsTrumpeterWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(FairgroundsTrumpeterWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public FairgroundsTrumpeterWatcher(final FairgroundsTrumpeterWatcher watcher) {
|
||||
|
|
|
@ -82,7 +82,7 @@ class FaithsRewardEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
FaithsRewardWatcher watcher = (FaithsRewardWatcher) game.getState().getWatchers().get("FaithsRewardWatcher");
|
||||
FaithsRewardWatcher watcher = (FaithsRewardWatcher) game.getState().getWatchers().get(FaithsRewardWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (UUID id : watcher.cards) {
|
||||
Card c = game.getCard(id);
|
||||
|
@ -105,7 +105,7 @@ class FaithsRewardWatcher extends Watcher {
|
|||
ArrayList<UUID> cards = new ArrayList<>();
|
||||
|
||||
public FaithsRewardWatcher() {
|
||||
super("FaithsRewardWatcher", WatcherScope.GAME);
|
||||
super(FaithsRewardWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public FaithsRewardWatcher(final FaithsRewardWatcher watcher) {
|
||||
|
|
|
@ -59,7 +59,7 @@ public class FeastOnTheFallen extends CardImpl {
|
|||
new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD,
|
||||
new AddCountersTargetEffect(CounterType.P1P1.createInstance()),
|
||||
TargetController.ANY, false),
|
||||
FeastOnTheFallenCondition.getInstance(),
|
||||
FeastOnTheFallenCondition.instance,
|
||||
"At the beginning of each upkeep, if an opponent lost life last turn, put a +1/+1 counter on target creature you control.");
|
||||
ability.addTarget(new TargetControlledCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
|
@ -75,17 +75,13 @@ public class FeastOnTheFallen extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class FeastOnTheFallenCondition implements Condition {
|
||||
enum FeastOnTheFallenCondition implements Condition {
|
||||
|
||||
private static final FeastOnTheFallenCondition instance = new FeastOnTheFallenCondition();
|
||||
|
||||
public static FeastOnTheFallenCondition getInstance() {
|
||||
return instance;
|
||||
}
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher");
|
||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
if (watcher.getLiveLostLastTurn(opponentId) > 0) {
|
||||
|
|
|
@ -98,7 +98,7 @@ class FellShepherdWatcher extends Watcher {
|
|||
private Set<UUID> creatureIds = new HashSet<>();
|
||||
|
||||
public FellShepherdWatcher() {
|
||||
super("YourCreaturesPutToGraveFromBattlefield", WatcherScope.PLAYER);
|
||||
super(FellShepherdWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||
condition = true;
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ class FellShepherdEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
FellShepherdWatcher watcher = (FellShepherdWatcher) game.getState().getWatchers().get("YourCreaturesPutToGraveFromBattlefield", source.getControllerId());
|
||||
FellShepherdWatcher watcher = (FellShepherdWatcher) game.getState().getWatchers().get(FellShepherdWatcher.class.getSimpleName(), source.getControllerId());
|
||||
if (watcher != null) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (UUID creatureId : watcher.getCreaturesIds()) {
|
||||
|
|
|
@ -72,7 +72,7 @@ class FinalPunishmentAmount implements DynamicValue {
|
|||
@Override
|
||||
public int calculate(Game game, Ability source, Effect effect) {
|
||||
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher
|
||||
= (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatchers().get("AmountOfDamageReceivedThisTurn");
|
||||
= (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatchers().get(AmountOfDamageAPlayerReceivedThisTurnWatcher.class.getSimpleName());
|
||||
if(watcher != null) {
|
||||
return watcher.getAmountOfDamageReceivedThisTurn(source.getFirstTarget());
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public class FiremaneAngel extends CardImpl {
|
|||
// At the beginning of your upkeep, if Firemane Angel is in your graveyard or on the battlefield, you may gain 1 life.
|
||||
Ability ability = new ConditionalTriggeredAbility(
|
||||
new BeginningOfUpkeepTriggeredAbility(Zone.ALL, new GainLifeEffect(1), TargetController.YOU, true),
|
||||
SourceOnBattelfieldOrGraveyardCondition.getInstance(),
|
||||
SourceOnBattlefieldOrGraveyardCondition.instance,
|
||||
"At the beginning of your upkeep, if {this} is in your graveyard or on the battlefield, you may gain 1 life");
|
||||
this.addAbility(ability);
|
||||
// {6}{R}{R}{W}{W}: Return Firemane Angel from your graveyard to the battlefield. Activate this ability only during your upkeep.
|
||||
|
@ -87,13 +87,9 @@ public class FiremaneAngel extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class SourceOnBattelfieldOrGraveyardCondition implements Condition {
|
||||
enum SourceOnBattlefieldOrGraveyardCondition implements Condition {
|
||||
|
||||
private static final SourceOnBattelfieldOrGraveyardCondition instance = new SourceOnBattelfieldOrGraveyardCondition();
|
||||
|
||||
public static SourceOnBattelfieldOrGraveyardCondition getInstance() {
|
||||
return instance;
|
||||
}
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
|
|
|
@ -84,7 +84,7 @@ class FirstResponseEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher");
|
||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
if (watcher.getLiveLostLastTurn(source.getControllerId()) > 0) {
|
||||
return new CreateTokenEffect(new SoldierToken()).apply(game, source);
|
||||
|
|
|
@ -103,7 +103,7 @@ class FlamebreakCantRegenerateEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == EventType.REGENERATE) {
|
||||
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId());
|
||||
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get(DamagedByWatcher.class.getSimpleName(), source.getSourceId());
|
||||
if (watcher != null) {
|
||||
return watcher.wasDamaged(event.getTargetId(), game);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ class FleshAllergyWatcher extends Watcher {
|
|||
public int creaturesDiedThisTurn = 0;
|
||||
|
||||
public FleshAllergyWatcher() {
|
||||
super("CreaturesDied", WatcherScope.GAME);
|
||||
super(FleshAllergyWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public FleshAllergyWatcher(final FleshAllergyWatcher watcher) {
|
||||
|
@ -131,7 +131,7 @@ class FleshAllergyEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
FleshAllergyWatcher watcher = (FleshAllergyWatcher) game.getState().getWatchers().get("CreaturesDied");
|
||||
FleshAllergyWatcher watcher = (FleshAllergyWatcher) game.getState().getWatchers().get(FleshAllergyWatcher.class.getSimpleName());
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null && watcher != null) {
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
|
|
|
@ -116,7 +116,7 @@ class FoulTongueInvocationEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher");
|
||||
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.castWithConditionTrue(source.getId())) {
|
||||
controller.gainLife(4, game);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ class FreshMeatDynamicValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get("CreaturesDiedWatcher");
|
||||
CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get(CreaturesDiedWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
return watcher.getAmountOfCreaturesDiesThisTurn(sourceAbility.getControllerId());
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class GeneratorServantWatcher extends Watcher {
|
|||
public List<UUID> creatures = new ArrayList<>();
|
||||
|
||||
public GeneratorServantWatcher() {
|
||||
super("GeneratorServantWatcher", WatcherScope.CARD);
|
||||
super(GeneratorServantWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
}
|
||||
|
||||
public GeneratorServantWatcher(final GeneratorServantWatcher watcher) {
|
||||
|
@ -141,7 +141,7 @@ class GeneratorServantHasteEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
GeneratorServantWatcher watcher = (GeneratorServantWatcher) game.getState().getWatchers().get("GeneratorServantWatcher", source.getSourceId());
|
||||
GeneratorServantWatcher watcher = (GeneratorServantWatcher) game.getState().getWatchers().get(GeneratorServantWatcher.class.getSimpleName(), source.getSourceId());
|
||||
if (watcher != null) {
|
||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents()) {
|
||||
if (watcher.creatures.contains(perm.getId())) {
|
||||
|
|
|
@ -49,13 +49,12 @@ import java.util.Set;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class GiltspireAvenger extends CardImpl {
|
||||
|
||||
public GiltspireAvenger(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}{W}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{W}{U}");
|
||||
this.subtype.add("Human");
|
||||
this.subtype.add("Soldier");
|
||||
|
||||
|
@ -97,7 +96,7 @@ class GiltspireAvengerTarget extends TargetPermanent {
|
|||
|
||||
@Override
|
||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource",source.getControllerId());
|
||||
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), source.getControllerId());
|
||||
if (watcher != null && watcher.hasSourceDoneDamage(id, game)) {
|
||||
return super.canTarget(id, source, game);
|
||||
}
|
||||
|
@ -108,10 +107,10 @@ class GiltspireAvengerTarget extends TargetPermanent {
|
|||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
Set<UUID> availablePossibleTargets = super.possibleTargets(sourceId, sourceControllerId, game);
|
||||
Set<UUID> possibleTargets = new HashSet<>();
|
||||
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", sourceControllerId);
|
||||
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), sourceControllerId);
|
||||
for (UUID targetId : availablePossibleTargets) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if(permanent != null && watcher != null && watcher.hasSourceDoneDamage(targetId, game)){
|
||||
if (permanent != null && watcher != null && watcher.hasSourceDoneDamage(targetId, game)) {
|
||||
possibleTargets.add(targetId);
|
||||
}
|
||||
}
|
||||
|
@ -126,8 +125,8 @@ class GiltspireAvengerTarget extends TargetPermanent {
|
|||
}
|
||||
int count = 0;
|
||||
MageObject targetSource = game.getObject(sourceId);
|
||||
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource", sourceControllerId);
|
||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, sourceControllerId, sourceId, game)) {
|
||||
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get(PlayerDamagedBySourceWatcher.class.getSimpleName(), sourceControllerId);
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, sourceControllerId, sourceId, game)) {
|
||||
if (!targets.containsKey(permanent.getId()) && permanent.canBeTargetedBy(targetSource, sourceControllerId, game)
|
||||
&& watcher != null && watcher.hasSourceDoneDamage(permanent.getId(), game)) {
|
||||
count++;
|
||||
|
|
|
@ -143,7 +143,7 @@ class GisaAndGeralfCastFromGraveyardEffect extends AsThoughEffectImpl {
|
|||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
if (objectId.equals(getTargetPointer().getFirst(game, source))) {
|
||||
if (affectedControllerId.equals(source.getControllerId())) {
|
||||
GisaAndGeralfWatcher watcher = (GisaAndGeralfWatcher) game.getState().getWatchers().get("GisaAndGeralfWatcher", source.getSourceId());
|
||||
GisaAndGeralfWatcher watcher = (GisaAndGeralfWatcher) game.getState().getWatchers().get(GisaAndGeralfWatcher.class.getSimpleName(), source.getSourceId());
|
||||
return !watcher.isAbilityUsed();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ class GleancrawlerEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
CardsPutIntoGraveyardWatcher watcher = (CardsPutIntoGraveyardWatcher) game.getState().getWatchers().get("CardsPutIntoGraveyardWatcher");
|
||||
CardsPutIntoGraveyardWatcher watcher = (CardsPutIntoGraveyardWatcher) game.getState().getWatchers().get(CardsPutIntoGraveyardWatcher.class.getSimpleName());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && watcher != null) {
|
||||
Set<MageObjectReference> cardsToGraveyardThisTurn = watcher.getCardsPutToGraveyardFromBattlefield();
|
||||
|
|
|
@ -104,7 +104,7 @@ class GlyphKeeperAbility extends TriggeredAbilityImpl {
|
|||
if (event.getTargetId().equals(this.getSourceId())) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.isCreature()) {
|
||||
NumberOfTimesPermanentTargetedATurnWatcher watcher = (NumberOfTimesPermanentTargetedATurnWatcher) game.getState().getWatchers().get(NumberOfTimesPermanentTargetedATurnWatcher.class.getName());
|
||||
NumberOfTimesPermanentTargetedATurnWatcher watcher = (NumberOfTimesPermanentTargetedATurnWatcher) game.getState().getWatchers().get(NumberOfTimesPermanentTargetedATurnWatcher.class.getSimpleName());
|
||||
if (watcher != null
|
||||
&& watcher.notMoreThanOnceTargetedThisTurn(permanent, game)) {
|
||||
for (Effect effect : getEffects()) {
|
||||
|
|
|
@ -95,7 +95,7 @@ class GoblinCohortEffect extends RestrictionEffect {
|
|||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
if (permanent.getId().equals(source.getSourceId())) {
|
||||
PlayerCastCreatureWatcher watcher = (PlayerCastCreatureWatcher) game.getState().getWatchers().get("PlayerCastCreature");
|
||||
PlayerCastCreatureWatcher watcher = (PlayerCastCreatureWatcher) game.getState().getWatchers().get(PlayerCastCreatureWatcher.class.getSimpleName());
|
||||
if (watcher != null && !watcher.playerDidCastCreatureThisTurn(source.getControllerId())) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ class GomazoaEffect extends OneShotEffect {
|
|||
players.add(gomazoa.getOwnerId());
|
||||
}
|
||||
|
||||
BlockedByWatcher watcher = (BlockedByWatcher) game.getState().getWatchers().get("BlockedByWatcher", source.getSourceId());
|
||||
BlockedByWatcher watcher = (BlockedByWatcher) game.getState().getWatchers().get(BlockedByWatcher.class.getSimpleName(), source.getSourceId());
|
||||
creaturesBlocked = watcher.blockedByWatcher;
|
||||
|
||||
for (UUID blockedById : creaturesBlocked) {
|
||||
|
@ -143,7 +143,7 @@ class BlockedByWatcher extends Watcher {
|
|||
public List<UUID> blockedByWatcher = new ArrayList<>();
|
||||
|
||||
public BlockedByWatcher() {
|
||||
super("BlockedByWatcher", WatcherScope.CARD);
|
||||
super(BlockedByWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
}
|
||||
|
||||
public BlockedByWatcher(final BlockedByWatcher watcher) {
|
||||
|
|
|
@ -96,7 +96,7 @@ class GontisMachinationsTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(getControllerId())) {
|
||||
GontisMachinationsFirstLostLifeThisTurnWatcher watcher
|
||||
= (GontisMachinationsFirstLostLifeThisTurnWatcher) game.getState().getWatchers().get(GontisMachinationsFirstLostLifeThisTurnWatcher.class.getName());
|
||||
= (GontisMachinationsFirstLostLifeThisTurnWatcher) game.getState().getWatchers().get(GontisMachinationsFirstLostLifeThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.timesLostLifeThisTurn(event.getTargetId()) < 2) {
|
||||
return true;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ class GontisMachinationsFirstLostLifeThisTurnWatcher extends Watcher {
|
|||
private final Map<UUID, Integer> playersLostLife = new HashMap<>();
|
||||
|
||||
public GontisMachinationsFirstLostLifeThisTurnWatcher() {
|
||||
super(GontisMachinationsFirstLostLifeThisTurnWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(GontisMachinationsFirstLostLifeThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public GontisMachinationsFirstLostLifeThisTurnWatcher(final GontisMachinationsFirstLostLifeThisTurnWatcher watcher) {
|
||||
|
@ -152,10 +152,7 @@ class GontisMachinationsFirstLostLifeThisTurnWatcher extends Watcher {
|
|||
}
|
||||
|
||||
public int timesLostLifeThisTurn(UUID playerId) {
|
||||
if (playersLostLife.containsKey(playerId)) {
|
||||
return playersLostLife.get(playerId);
|
||||
}
|
||||
return 0;
|
||||
return playersLostLife.getOrDefault(playerId, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ public class GrimReturn extends CardImpl {
|
|||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
CardsPutIntoGraveyardWatcher watcher = (CardsPutIntoGraveyardWatcher) game.getState().getWatchers().get("CardsPutIntoGraveyardWatcher");
|
||||
CardsPutIntoGraveyardWatcher watcher = (CardsPutIntoGraveyardWatcher) game.getState().getWatchers().get(CardsPutIntoGraveyardWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
FilterCard filter = new FilterCreatureCard(textFilter);
|
||||
List<CardIdPredicate> uuidPredicates = new ArrayList<>();
|
||||
|
|
|
@ -109,7 +109,7 @@ class HallowedMoonlightEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
EntersTheBattlefieldEvent entersTheBattlefieldEvent = (EntersTheBattlefieldEvent) event;
|
||||
if (entersTheBattlefieldEvent.getTarget().isCreature()) {
|
||||
CreatureWasCastWatcher watcher = (CreatureWasCastWatcher) game.getState().getWatchers().get("CreatureWasCast");
|
||||
CreatureWasCastWatcher watcher = (CreatureWasCastWatcher) game.getState().getWatchers().get(CreatureWasCastWatcher.class.getSimpleName());
|
||||
if (watcher != null && !watcher.wasCreatureCastThisTurn(event.getTargetId())) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ class HardenedBerserkerSpellsCostReductionEffect extends CostModificationEffectI
|
|||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
spellsCast = watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId());
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ class HardenedBerserkerSpellsCostReductionEffect extends CostModificationEffectI
|
|||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
if (watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId()) > spellsCast) {
|
||||
discard(); // only one use
|
||||
|
|
|
@ -86,7 +86,7 @@ class HarnessTheStormTriggeredAbility extends SpellCastControllerTriggeredAbilit
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (super.checkTrigger(event, game)) {
|
||||
CastFromHandWatcher watcher = (CastFromHandWatcher) game.getState().getWatchers().get(CastFromHandWatcher.class.getName());
|
||||
CastFromHandWatcher watcher = (CastFromHandWatcher) game.getState().getWatchers().get(CastFromHandWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.spellWasCastFromHand(event.getSourceId())) {
|
||||
Spell spell = game.getState().getStack().getSpell(event.getSourceId());
|
||||
if (spell != null) {
|
||||
|
|
|
@ -34,6 +34,7 @@ import mage.abilities.effects.common.TapSourceEffect;
|
|||
import mage.abilities.effects.common.TransformSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.c.CivilizedScholar;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
@ -98,7 +99,7 @@ class HomicidalBruteTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(this.controllerId)) {
|
||||
Watcher watcher = game.getState().getWatchers().get("HomicidalBruteAttacked", sourceId);
|
||||
Watcher watcher = game.getState().getWatchers().get("HomicidalBruteWatcher", sourceId);
|
||||
if (watcher == null || !watcher.conditionMet()) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ class HopeOfGhirapurPlayerLostLifePredicate implements Predicate<Player> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Player input, Game game) {
|
||||
HopeOfGhirapurCombatDamageWatcher watcher = (HopeOfGhirapurCombatDamageWatcher) game.getState().getWatchers().get(HopeOfGhirapurCombatDamageWatcher.class.getName());
|
||||
HopeOfGhirapurCombatDamageWatcher watcher = (HopeOfGhirapurCombatDamageWatcher) game.getState().getWatchers().get(HopeOfGhirapurCombatDamageWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
return watcher.playerGotCombatDamage(sourceReference, input.getId());
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ class HopeOfGhirapurCombatDamageWatcher extends Watcher {
|
|||
private final HashMap<MageObjectReference, Set<UUID>> combatDamagedPlayers = new HashMap<>();
|
||||
|
||||
public HopeOfGhirapurCombatDamageWatcher() {
|
||||
super(HopeOfGhirapurCombatDamageWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(HopeOfGhirapurCombatDamageWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public HopeOfGhirapurCombatDamageWatcher(final HopeOfGhirapurCombatDamageWatcher watcher) {
|
||||
|
|
|
@ -87,7 +87,7 @@ class CastRedSpellThisTurnCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
HotHeadedGiantWatcher watcher = (HotHeadedGiantWatcher) game.getState().getWatchers().get("HotHeadedGiantWatcher", source.getControllerId());
|
||||
HotHeadedGiantWatcher watcher = (HotHeadedGiantWatcher) game.getState().getWatchers().get(HotHeadedGiantWatcher.class.getSimpleName(), source.getControllerId());
|
||||
if (watcher != null) {
|
||||
return watcher.conditionMet();
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ class HotHeadedGiantWatcher extends Watcher {
|
|||
private UUID cardId;
|
||||
|
||||
public HotHeadedGiantWatcher(UUID cardId) {
|
||||
super("HotHeadedGiantWatcher", WatcherScope.PLAYER);
|
||||
super(HotHeadedGiantWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||
this.cardId = cardId;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ enum GreatestAmountOfDamageDealtValue implements DynamicValue, MageSingleton {
|
|||
}
|
||||
|
||||
public int calculate(Game game, UUID controllerId) {
|
||||
GreatestAmountOfDamageWatcher watcher = (GreatestAmountOfDamageWatcher) game.getState().getWatchers().get("GreatestAmountOfDamage");
|
||||
GreatestAmountOfDamageWatcher watcher = (GreatestAmountOfDamageWatcher) game.getState().getWatchers().get(GreatestAmountOfDamageWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
return watcher.getGreatestAmountOfDamage();
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ class GreatestAmountOfDamageWatcher extends Watcher {
|
|||
private int damageAmount;
|
||||
|
||||
public GreatestAmountOfDamageWatcher() {
|
||||
super("GreatestAmountOfDamage", WatcherScope.GAME);
|
||||
super(GreatestAmountOfDamageWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public GreatestAmountOfDamageWatcher(final GreatestAmountOfDamageWatcher watcher) {
|
||||
|
|
|
@ -72,7 +72,7 @@ class ImpatienceCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
return watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(game.getActivePlayerId()) == 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ class IncinerateEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId());
|
||||
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get(DamagedByWatcher.class.getSimpleName(), source.getSourceId());
|
||||
if (watcher != null) {
|
||||
return watcher.wasDamaged(event.getTargetId(), game);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ class IncursionTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(controllerId)) {
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 2) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.util.HashSet;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
|
@ -49,17 +50,16 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class InfernoTrap extends CardImpl {
|
||||
|
||||
public InfernoTrap(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{R}");
|
||||
this.subtype.add("Trap");
|
||||
|
||||
// If you've been dealt damage by two or more creatures this turn, you may pay {R} rather than pay Inferno Trap's mana cost.
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{R}"), InfernoTrapCondition.getInstance()), new InfernoTrapWatcher());
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{R}"), InfernoTrapCondition.instance), new InfernoTrapWatcher());
|
||||
|
||||
// Inferno Trap deals 4 damage to target creature.
|
||||
this.getSpellAbility().addEffect(new DamageTargetEffect(4));
|
||||
|
@ -76,20 +76,16 @@ public class InfernoTrap extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class InfernoTrapCondition implements Condition {
|
||||
enum InfernoTrapCondition implements Condition {
|
||||
|
||||
private static final InfernoTrapCondition instance = new InfernoTrapCondition();
|
||||
|
||||
public static Condition getInstance() {
|
||||
return instance;
|
||||
}
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
InfernoTrapWatcher watcher = (InfernoTrapWatcher) game.getState().getWatchers().get(InfernoTrapWatcher.class.getName());
|
||||
InfernoTrapWatcher watcher = (InfernoTrapWatcher) game.getState().getWatchers().get(InfernoTrapWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
Set<MageObjectReference> damagingCreatures = watcher.getDamagingCreatures(source.getControllerId());
|
||||
return damagingCreatures != null && damagingCreatures.size() > 1;
|
||||
return damagingCreatures.size() > 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -105,7 +101,7 @@ class InfernoTrapWatcher extends Watcher {
|
|||
Map<UUID, Set<MageObjectReference>> playerDamagedByCreature = new HashMap<>();
|
||||
|
||||
public InfernoTrapWatcher() {
|
||||
super(InfernoTrapWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(InfernoTrapWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public InfernoTrapWatcher(final InfernoTrapWatcher watcher) {
|
||||
|
@ -119,23 +115,18 @@ class InfernoTrapWatcher extends Watcher {
|
|||
&& event.getTargetId().equals(controllerId)) {
|
||||
Permanent damageBy = game.getPermanentOrLKIBattlefield(event.getSourceId());
|
||||
if (damageBy != null && damageBy.isCreature()) {
|
||||
Set<MageObjectReference> damagingCreatures;
|
||||
if (playerDamagedByCreature.containsKey(event.getTargetId())) {
|
||||
damagingCreatures = playerDamagedByCreature.get(event.getTargetId());
|
||||
} else {
|
||||
damagingCreatures = new HashSet<>();
|
||||
playerDamagedByCreature.put(event.getTargetId(), damagingCreatures);
|
||||
}
|
||||
Set<MageObjectReference> damagingCreatures = playerDamagedByCreature.getOrDefault(event.getTargetId(), new HashSet<>());
|
||||
|
||||
MageObjectReference damagingCreature = new MageObjectReference(damageBy, game);
|
||||
if (!damagingCreatures.contains(damagingCreature)) {
|
||||
damagingCreatures.add(damagingCreature);
|
||||
}
|
||||
playerDamagedByCreature.put(event.getTargetId(), damagingCreatures);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Set<MageObjectReference> getDamagingCreatures(UUID playerId) {
|
||||
return playerDamagedByCreature.get(playerId);
|
||||
return playerDamagedByCreature.getOrDefault(playerId, new HashSet<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -87,7 +87,7 @@ class InsatiableRakghoulEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
NonArtifactCreaturesDiedWatcher watcher = (NonArtifactCreaturesDiedWatcher) game.getState().getWatchers().get("NonArtifactCreaturesDiedWatcher");
|
||||
NonArtifactCreaturesDiedWatcher watcher = (NonArtifactCreaturesDiedWatcher) game.getState().getWatchers().get(NonArtifactCreaturesDiedWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.conditionMet()) {
|
||||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
|
@ -108,7 +108,7 @@ class InsatiableRakghoulEffect extends OneShotEffect {
|
|||
class NonArtifactCreaturesDiedWatcher extends Watcher {
|
||||
|
||||
public NonArtifactCreaturesDiedWatcher() {
|
||||
super("NonArtifactCreaturesDiedWatcher", WatcherScope.GAME);
|
||||
super(NonArtifactCreaturesDiedWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public NonArtifactCreaturesDiedWatcher(final NonArtifactCreaturesDiedWatcher watcher) {
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
package mage.cards.i;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||
|
@ -45,13 +46,12 @@ import mage.game.stack.Spell;
|
|||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public class Insist extends CardImpl {
|
||||
|
||||
public Insist(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}");
|
||||
|
||||
// The next creature spell you cast this turn can't be countered by spells or abilities.
|
||||
this.getSpellAbility().addEffect(new InsistEffect());
|
||||
|
@ -92,7 +92,7 @@ class InsistEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
InsistWatcher watcher = (InsistWatcher) game.getState().getWatchers().get("insistWatcher", source.getControllerId());
|
||||
InsistWatcher watcher = (InsistWatcher) game.getState().getWatchers().get(InsistWatcher.class.getSimpleName(), source.getControllerId());
|
||||
if (watcher != null) {
|
||||
watcher.setReady();
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ class InsistEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
InsistWatcher watcher = (InsistWatcher) game.getState().getWatchers().get("insistWatcher", source.getControllerId());
|
||||
InsistWatcher watcher = (InsistWatcher) game.getState().getWatchers().get(InsistWatcher.class.getSimpleName(), source.getControllerId());
|
||||
return spell != null && watcher != null && watcher.isUncounterable(spell.getId());
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ class InsistWatcher extends Watcher {
|
|||
protected UUID uncounterableSpell;
|
||||
|
||||
InsistWatcher() {
|
||||
super("insistWatcher", WatcherScope.PLAYER);
|
||||
super(InsistWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||
}
|
||||
|
||||
InsistWatcher(final InsistWatcher watcher) {
|
||||
|
|
|
@ -125,7 +125,7 @@ class JaceUnravelerOfSecretsTriggeredAbility extends SpellCastOpponentTriggeredA
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (super.checkTrigger(event, game)) {
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getName());
|
||||
SpellsCastWatcher watcher = (SpellsCastWatcher) game.getState().getWatchers().get(SpellsCastWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
List<Spell> spells = watcher.getSpellsCastThisTurn(event.getPlayerId());
|
||||
if (spells != null && spells.size() == 1) {
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
package mage.cards.j;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
|
@ -50,17 +51,16 @@ import mage.players.Player;
|
|||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author MarcoMarin
|
||||
*/
|
||||
public class JandorsRing extends CardImpl {
|
||||
|
||||
public JandorsRing(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{6}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{6}");
|
||||
|
||||
Watcher watcher = new JandorsRingWatcher();
|
||||
// {2}, {tap}, Discard the last card you drew this turn: Draw a card.
|
||||
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new DiscardAndDrawEffect(), new ManaCostsImpl("{2}"), new WatchedCardInHandCondition(), "Last drawn card still in hand?");
|
||||
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new DiscardAndDrawEffect(), new ManaCostsImpl("{2}"), WatchedCardInHandCondition.instance, "Last drawn card still in hand?");
|
||||
ability.addCost(new TapSourceCost());
|
||||
this.addAbility(ability, watcher);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class JandorsRing extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class DiscardAndDrawEffect extends OneShotEffect{
|
||||
class DiscardAndDrawEffect extends OneShotEffect {
|
||||
|
||||
|
||||
public DiscardAndDrawEffect() {
|
||||
|
@ -93,13 +93,13 @@ class DiscardAndDrawEffect extends OneShotEffect{
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
JandorsRingWatcher watcher = (JandorsRingWatcher) game.getState().getWatchers().get("JandorsRingWatcher");
|
||||
JandorsRingWatcher watcher = (JandorsRingWatcher) game.getState().getWatchers().get(JandorsRingWatcher.class.getSimpleName());
|
||||
|
||||
FilterCard filter = new FilterCard(game.getCard(watcher.lastDrawnCard).getName());
|
||||
filter.add(new CardIdPredicate(watcher.lastDrawnCard));
|
||||
DiscardCardYouChooseTargetEffect effect = new DiscardCardYouChooseTargetEffect(filter, TargetController.YOU);
|
||||
|
||||
if (effect.apply(game, source)){//Conditional was already checked, card should be in hand, but if for some weird reason it fails, the card won't be drawn, although the cost will already be paid
|
||||
if (effect.apply(game, source)) {//Conditional was already checked, card should be in hand, but if for some weird reason it fails, the card won't be drawn, although the cost will already be paid
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
controller.drawCards(1, game);
|
||||
return true;
|
||||
|
@ -114,7 +114,7 @@ class JandorsRingWatcher extends Watcher {
|
|||
UUID lastDrawnCard;
|
||||
|
||||
public JandorsRingWatcher() {
|
||||
super("JandorsRingWatcher", WatcherScope.PLAYER);
|
||||
super(JandorsRingWatcher.class.getSimpleName(), WatcherScope.PLAYER);
|
||||
this.lastDrawnCard = null;
|
||||
}
|
||||
|
||||
|
@ -145,19 +145,15 @@ class JandorsRingWatcher extends Watcher {
|
|||
}
|
||||
}
|
||||
|
||||
class WatchedCardInHandCondition implements Condition {
|
||||
enum WatchedCardInHandCondition implements Condition {
|
||||
|
||||
private static final WatchedCardInHandCondition instance = new WatchedCardInHandCondition();
|
||||
|
||||
public static WatchedCardInHandCondition getInstance() {
|
||||
return instance;
|
||||
}
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
JandorsRingWatcher watcher = (JandorsRingWatcher) game.getState().getWatchers().get("JandorsRingWatcher");
|
||||
JandorsRingWatcher watcher = (JandorsRingWatcher) game.getState().getWatchers().get(JandorsRingWatcher.class.getSimpleName());
|
||||
|
||||
return watcher.lastDrawnCard!=null && game.getPlayer(source.getControllerId()).getHand().contains(watcher.lastDrawnCard);
|
||||
return watcher.lastDrawnCard != null && game.getPlayer(source.getControllerId()).getHand().contains(watcher.lastDrawnCard);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -130,7 +130,7 @@ class CantRegenerateEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == EventType.REGENERATE) {
|
||||
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId());
|
||||
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get(DamagedByWatcher.class.getSimpleName(), source.getSourceId());
|
||||
if (watcher != null) {
|
||||
return watcher.wasDamaged(event.getTargetId(), game);
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ class JelevaNephaliasScourgeEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (controller != null && sourceCard != null) {
|
||||
JelevaNephaliasWatcher watcher = (JelevaNephaliasWatcher) game.getState().getWatchers().get("ManaPaidToCastJelevaNephalias", source.getSourceId());
|
||||
JelevaNephaliasWatcher watcher = (JelevaNephaliasWatcher) game.getState().getWatchers().get(JelevaNephaliasWatcher.class.getSimpleName(), source.getSourceId());
|
||||
if (watcher != null) {
|
||||
int xValue = watcher.getManaSpentToCastLastTime(sourceCard.getZoneChangeCounter(game) - 1);
|
||||
if (xValue > 0) {
|
||||
|
@ -176,7 +176,7 @@ class JelevaNephaliasWatcher extends Watcher {
|
|||
private final Map<Integer, Integer> manaSpendToCast = new HashMap<>(); // cast
|
||||
|
||||
public JelevaNephaliasWatcher() {
|
||||
super("ManaPaidToCastJelevaNephalias", WatcherScope.CARD);
|
||||
super(JelevaNephaliasWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
}
|
||||
|
||||
public JelevaNephaliasWatcher(final JelevaNephaliasWatcher watcher) {
|
||||
|
@ -205,10 +205,7 @@ class JelevaNephaliasWatcher extends Watcher {
|
|||
}
|
||||
|
||||
public int getManaSpentToCastLastTime(int zoneChangeCounter) {
|
||||
if (manaSpendToCast.containsKey(zoneChangeCounter)) {
|
||||
return manaSpendToCast.get(zoneChangeCounter);
|
||||
}
|
||||
return 0;
|
||||
return manaSpendToCast.getOrDefault(zoneChangeCounter, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -93,7 +93,7 @@ class JoriEnTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(controllerId)) {
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 2) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ class KaradorGhostChieftainCastFromGraveyardEffect extends AsThoughEffectImpl {
|
|||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
if (objectId.equals(getTargetPointer().getFirst(game, source))) {
|
||||
if (affectedControllerId.equals(source.getControllerId())) {
|
||||
KaradorGhostChieftainWatcher watcher = (KaradorGhostChieftainWatcher) game.getState().getWatchers().get("KaradorGhostChieftainWatcher", source.getSourceId());
|
||||
KaradorGhostChieftainWatcher watcher = (KaradorGhostChieftainWatcher) game.getState().getWatchers().get(KaradorGhostChieftainWatcher.class.getSimpleName(), source.getSourceId());
|
||||
return !watcher.isAbilityUsed();
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ class KaradorGhostChieftainWatcher extends Watcher {
|
|||
boolean abilityUsed = false;
|
||||
|
||||
KaradorGhostChieftainWatcher() {
|
||||
super("KaradorGhostChieftainWatcher", WatcherScope.CARD);
|
||||
super(KaradorGhostChieftainWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
}
|
||||
|
||||
KaradorGhostChieftainWatcher(final KaradorGhostChieftainWatcher watcher) {
|
||||
|
|
|
@ -120,7 +120,7 @@ class KeranosGodOfStormsTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||
if (game.getActivePlayerId().equals(this.getControllerId())) {
|
||||
CardsAmountDrawnThisTurnWatcher watcher =
|
||||
(CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.BASIC_KEY);
|
||||
(CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) != 1) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class KiraGreatGlassSpinnerAbility extends TriggeredAbilityImpl {
|
|||
if (event.getTargetId().equals(this.getSourceId())) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.isCreature()) {
|
||||
NumberOfTimesPermanentTargetedATurnWatcher watcher = (NumberOfTimesPermanentTargetedATurnWatcher) game.getState().getWatchers().get(NumberOfTimesPermanentTargetedATurnWatcher.class.getName());
|
||||
NumberOfTimesPermanentTargetedATurnWatcher watcher = (NumberOfTimesPermanentTargetedATurnWatcher) game.getState().getWatchers().get(NumberOfTimesPermanentTargetedATurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.notMoreThanOnceTargetedThisTurn(permanent, game)) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
|
||||
|
|
|
@ -110,7 +110,7 @@ class BecomesMonarchTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkInterveningIfClause(Game game) {
|
||||
MonarchAtTurnStartWatcher watcher = (MonarchAtTurnStartWatcher) game.getState().getWatchers().get("MonarchAtTurnStartWatcher");
|
||||
MonarchAtTurnStartWatcher watcher = (MonarchAtTurnStartWatcher) game.getState().getWatchers().get(MonarchAtTurnStartWatcher.class.getSimpleName());
|
||||
return watcher != null && getControllerId().equals(watcher.getMonarchIdAtTurnStart());
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ class MonarchAtTurnStartWatcher extends Watcher {
|
|||
private UUID monarchIdAtTurnStart;
|
||||
|
||||
public MonarchAtTurnStartWatcher() {
|
||||
super("MonarchAtTurnStartWatcher", WatcherScope.GAME);
|
||||
super(MonarchAtTurnStartWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public MonarchAtTurnStartWatcher(final MonarchAtTurnStartWatcher watcher) {
|
||||
|
|
|
@ -93,7 +93,7 @@ class KnollspineDragonEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
new DiscardHandControllerEffect().apply(game, source);
|
||||
if (targetOpponent != null) {
|
||||
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatchers().get("AmountOfDamageReceivedThisTurn");
|
||||
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatchers().get(AmountOfDamageAPlayerReceivedThisTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
int drawAmount = watcher.getAmountOfDamageReceivedThisTurn(targetOpponent.getId());
|
||||
controller.drawCards(drawAmount, game);
|
||||
|
|
|
@ -106,7 +106,7 @@ class KraumLudevicsOpusTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getName());
|
||||
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 2) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ class KumanosBlessingEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
ZoneChangeEvent zce = (ZoneChangeEvent) event;
|
||||
if (zce.isDiesEvent()) {
|
||||
DamagedByEnchantedWatcher watcher = (DamagedByEnchantedWatcher) game.getState().getWatchers().get("DamagedByEnchantedWatcher", source.getSourceId());
|
||||
DamagedByEnchantedWatcher watcher = (DamagedByEnchantedWatcher) game.getState().getWatchers().get(DamagedByEnchantedWatcher.class.getSimpleName(), source.getSourceId());
|
||||
if (watcher != null) {
|
||||
return watcher.wasDamaged(zce.getTarget(), game);
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ class DamagedByEnchantedWatcher extends Watcher {
|
|||
private final Set<MageObjectReference> damagedCreatures = new HashSet<>();
|
||||
|
||||
public DamagedByEnchantedWatcher() {
|
||||
super("DamagedByEnchantedWatcher", WatcherScope.CARD);
|
||||
super(DamagedByEnchantedWatcher.class.getSimpleName(), WatcherScope.CARD);
|
||||
}
|
||||
|
||||
public DamagedByEnchantedWatcher(final DamagedByEnchantedWatcher watcher) {
|
||||
|
|
|
@ -109,7 +109,7 @@ enum KuonOgreAscendantCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get("CreaturesDiedWatcher");
|
||||
CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatchers().get(CreaturesDiedWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
return watcher.getAmountOfCreaturesDiesThisTurn() > 2;
|
||||
}
|
||||
|
|
|
@ -83,8 +83,8 @@ class CardsDrawnThisTurnDynamicValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
KydeleCardsDrawnThisTurnWatcher watcher = (KydeleCardsDrawnThisTurnWatcher) game.getState().getWatchers().get(KydeleCardsDrawnThisTurnWatcher.class.getName());
|
||||
return watcher.getNumCardsDrawnThisTurn(sourceAbility.getControllerId());
|
||||
KydeleCardsDrawnThisTurnWatcher watcher = (KydeleCardsDrawnThisTurnWatcher) game.getState().getWatchers().get(KydeleCardsDrawnThisTurnWatcher.class.getSimpleName());
|
||||
return watcher.getCardsDrawnThisTurn(sourceAbility.getControllerId()).size();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -108,7 +108,7 @@ class KydeleCardsDrawnThisTurnWatcher extends Watcher {
|
|||
private final Map<UUID, Set<UUID>> cardsDrawnThisTurn = new HashMap<>();
|
||||
|
||||
public KydeleCardsDrawnThisTurnWatcher() {
|
||||
super(KydeleCardsDrawnThisTurnWatcher.class.getName(), WatcherScope.GAME);
|
||||
super(KydeleCardsDrawnThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public KydeleCardsDrawnThisTurnWatcher(final KydeleCardsDrawnThisTurnWatcher watcher) {
|
||||
|
@ -119,20 +119,14 @@ class KydeleCardsDrawnThisTurnWatcher extends Watcher {
|
|||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DREW_CARD) {
|
||||
if (!cardsDrawnThisTurn.containsKey(event.getPlayerId())) {
|
||||
Set<UUID> cardsDrawn = new LinkedHashSet<>();
|
||||
cardsDrawnThisTurn.put(event.getPlayerId(), cardsDrawn);
|
||||
}
|
||||
Set<UUID> cardsDrawn = cardsDrawnThisTurn.get(event.getPlayerId());
|
||||
Set<UUID> cardsDrawn = getCardsDrawnThisTurn(event.getPlayerId());
|
||||
cardsDrawn.add(event.getTargetId());
|
||||
cardsDrawnThisTurn.put(event.getPlayerId(), cardsDrawn);
|
||||
}
|
||||
}
|
||||
|
||||
public int getNumCardsDrawnThisTurn(UUID playerId) {
|
||||
if (cardsDrawnThisTurn.get(playerId) == null) {
|
||||
return 0;
|
||||
}
|
||||
return cardsDrawnThisTurn.get(playerId).size();
|
||||
public Set<UUID> getCardsDrawnThisTurn(UUID playerId) {
|
||||
return cardsDrawnThisTurn.getOrDefault(playerId, new LinkedHashSet<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -98,7 +98,7 @@ class KytheonHeroOfAkrosCondition implements Condition {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent sourceObject = game.getPermanent(source.getSourceId());
|
||||
if (sourceObject != null) {
|
||||
AttackedOrBlockedThisCombatWatcher watcher = (AttackedOrBlockedThisCombatWatcher) game.getState().getWatchers().get(AttackedOrBlockedThisCombatWatcher.class.getName());
|
||||
AttackedOrBlockedThisCombatWatcher watcher = (AttackedOrBlockedThisCombatWatcher) game.getState().getWatchers().get(AttackedOrBlockedThisCombatWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
boolean sourceFound = false;
|
||||
int number = 0;
|
||||
|
|
|
@ -56,7 +56,7 @@ public class LavaballTrap extends CardImpl {
|
|||
this.subtype.add("Trap");
|
||||
|
||||
// If an opponent had two or more lands enter the battlefield under his or her control this turn, you may pay {3}{R}{R} rather than pay Lavaball Trap's mana cost.
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{3}{R}{R}"), LavaballTrapCondition.getInstance()), new PermanentsEnteredBattlefieldWatcher());
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{3}{R}{R}"), LavaballTrapCondition.instance), new PermanentsEnteredBattlefieldWatcher());
|
||||
|
||||
// Destroy two target lands. Lavaball Trap deals 4 damage to each creature.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
||||
|
@ -75,17 +75,13 @@ public class LavaballTrap extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class LavaballTrapCondition implements Condition {
|
||||
enum LavaballTrapCondition implements Condition {
|
||||
|
||||
private static final LavaballTrapCondition instance = new LavaballTrapCondition();
|
||||
|
||||
public static Condition getInstance() {
|
||||
return instance;
|
||||
}
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatchers().get(PermanentsEnteredBattlefieldWatcher.class.getName());
|
||||
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatchers().get(PermanentsEnteredBattlefieldWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
List<Permanent> permanents = watcher.getThisTurnEnteringPermanents(opponentId);
|
||||
|
|
|
@ -97,7 +97,7 @@ class LeovoldEmissaryOfTrestEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
CardsAmountDrawnThisTurnWatcher watcher = (CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.BASIC_KEY);
|
||||
CardsAmountDrawnThisTurnWatcher watcher = (CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
return watcher != null && controller != null && watcher.getAmountCardsDrawn(event.getPlayerId()) >= 1
|
||||
&& game.isOpponent(controller, event.getPlayerId());
|
||||
|
|
|
@ -58,7 +58,7 @@ public class LethargyTrap extends CardImpl {
|
|||
this.subtype.add("Trap");
|
||||
|
||||
// If three or more creatures are attacking, you may pay {U} rather than pay Lethargy Trap's mana cost.
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{U}"), LethargyTrapCondition.getInstance()));
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{U}"), LethargyTrapCondition.instance));
|
||||
|
||||
// Attacking creatures get -3/-0 until end of turn.
|
||||
this.getSpellAbility().addEffect(new BoostAllEffect(-3, 0, Duration.EndOfTurn, filter, false));
|
||||
|
@ -75,13 +75,9 @@ public class LethargyTrap extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class LethargyTrapCondition implements Condition {
|
||||
enum LethargyTrapCondition implements Condition {
|
||||
|
||||
private static final LethargyTrapCondition instance = new LethargyTrapCondition();
|
||||
|
||||
public static Condition getInstance() {
|
||||
return instance;
|
||||
}
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
|
|
|
@ -80,7 +80,7 @@ class LudevicNecroAlchemistCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher");
|
||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName());
|
||||
UUID player = game.getActivePlayerId();
|
||||
PlayerList playerList = game.getState().getPlayerList().copy();
|
||||
Player currentPlayer = null;
|
||||
|
|
|
@ -61,7 +61,7 @@ public class LuminarchAscension extends CardImpl {
|
|||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}");
|
||||
|
||||
// At the beginning of each opponent's end step, if you didn't lose life this turn, you may put a quest counter on Luminarch Ascension.
|
||||
this.addAbility(new ConditionalTriggeredAbility(new LuminarchAscensionTriggeredAbility(), YouLostNoLifeThisTurnCondition.getInstance(), rule));
|
||||
this.addAbility(new ConditionalTriggeredAbility(new LuminarchAscensionTriggeredAbility(), YouLostNoLifeThisTurnCondition.instance, rule));
|
||||
|
||||
// {1}{W}: Create a 4/4 white Angel creature token with flying. Activate this ability only if Luminarch Ascension has four or more quest counters on it.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new AngelToken()), new ManaCostsImpl("{1}{W}"));
|
||||
|
@ -139,17 +139,14 @@ class SourceHasCountersCost extends CostImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class YouLostNoLifeThisTurnCondition implements Condition {
|
||||
enum YouLostNoLifeThisTurnCondition implements Condition {
|
||||
|
||||
private static final YouLostNoLifeThisTurnCondition instance = new YouLostNoLifeThisTurnCondition();
|
||||
|
||||
public static Condition getInstance() {
|
||||
return instance;
|
||||
}
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher");
|
||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
return (watcher.getLiveLost(source.getControllerId()) == 0);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue