clean up unnecessary casts

This commit is contained in:
Ingmar Goudt 2019-01-06 22:10:20 +01:00
parent 9a310732d8
commit 9486dce144
257 changed files with 288 additions and 288 deletions

View file

@ -69,7 +69,7 @@ class AnimarCostReductionEffect extends CostModificationEffectImpl {
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
Ability spellAbility = (SpellAbility) abilityToModify;
Ability spellAbility = abilityToModify;
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null && spellAbility != null) {
int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1);

View file

@ -43,7 +43,7 @@ public final class AppealAuthority extends SplitCard {
// Authority
// Aftermath
((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true));
// Tap up to two target creatures your opponents control. Creatures you control gain vigilance until end of turn.
getRightHalfCard().getSpellAbility().addEffect(new TapTargetEffect());
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures your opponents control");

View file

@ -81,7 +81,7 @@ class BartelRuneaxeEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
StackObject stackObject = (StackObject) game.getStack().getStackObject(event.getSourceId());
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
if (stackObject != null && event.getTargetId().equals(source.getSourceId())) {
if (stackObject.hasSubtype(SubType.AURA, game)) {
return true;

View file

@ -89,7 +89,7 @@ class BurningOfXinyeEffect extends OneShotEffect{
}
for ( int idx = 0; idx < target.getTargets().size(); idx++) {
Permanent permanent = game.getPermanent((UUID)target.getTargets().get(idx));
Permanent permanent = game.getPermanent(target.getTargets().get(idx));
if ( permanent != null ) {
abilityApplied |= permanent.destroy(source.getSourceId(), game, false);

View file

@ -109,7 +109,7 @@ class CephalidShrineEffect extends OneShotEffect {
}
// even if the cost is 0, we still offer
Cost cost = new GenericManaCost(count);
if (game.getStack().contains((StackObject) spell)
if (game.getStack().contains(spell)
&& cost.canPay(source, source.getSourceId(), controller.getId(), game)
&& controller.chooseUse(outcome, "Pay " + cost.getText() + " to prevent countering " + spell.getName() + "?", source, game)
&& cost.pay(source, game, source.getSourceId(), controller.getId(), false)

View file

@ -42,7 +42,7 @@ public final class ClaimFame extends SplitCard {
// Fame
// Aftermath
((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true));
// Target creature gets +2/+0 and gains haste until end of turn.
getRightHalfCard().getSpellAbility().addEffect(new BoostTargetEffect(2, 0, Duration.EndOfTurn));
getRightHalfCard().getSpellAbility().addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn)

View file

@ -61,7 +61,7 @@ class CoastalPiracyTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (((DamagedPlayerEvent) event).isCombatDamage()
&& game.getOpponents(this.controllerId).contains(((DamagedPlayerEvent) event).getPlayerId())) {
&& game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
Permanent creature = game.getPermanent(event.getSourceId());
if (creature != null && creature.isControlledBy(controllerId)) {
return true;

View file

@ -86,7 +86,7 @@ class CobraTrapWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == EventType.DESTROYED_PERMANENT) {
Permanent perm = (Permanent) game.getPermanentOrLKIBattlefield(event.getTargetId()); // can regenerate or be indestructible
Permanent perm = game.getPermanentOrLKIBattlefield(event.getTargetId()); // can regenerate or be indestructible
if (perm != null && !perm.isCreature()) {
if (!game.getStack().isEmpty()) {
StackObject spell = game.getStack().getStackObject(event.getSourceId());

View file

@ -45,7 +45,7 @@ public final class CommitMemory extends SplitCard {
// Memory
// Aftermath
// Each player shuffles their hand and graveyard into their library, then draws seven cards.
((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().getSpellAbility().addEffect(new ShuffleHandGraveyardAllEffect());
Effect effect = new DrawCardAllEffect(7);
effect.setText(", then draws seven cards");

View file

@ -67,7 +67,7 @@ class CongregationAtDawnEffect extends OneShotEffect {
if (controller.searchLibrary(target, game)) {
if (!target.getTargets().isEmpty()) {
Cards revealed = new CardsImpl();
for (UUID cardId : (List<UUID>) target.getTargets()) {
for (UUID cardId : target.getTargets()) {
Card card = controller.getLibrary().remove(cardId, game);
revealed.add(card);
}

View file

@ -29,7 +29,7 @@ public final class ConsignOblivion extends SplitCard {
// Oblivion {4}{B}
// Sorcery
// Aftermath
((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true));
// Target opponent discards two cards.
getRightHalfCard().getSpellAbility().addEffect(new DiscardTargetEffect(2));
getRightHalfCard().getSpellAbility().addTarget(new TargetOpponent());

View file

@ -87,7 +87,7 @@ class CrypticGatewayCost extends CostImpl {
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
int numTargets = 0;
while (numTargets < 2 && target.choose(Outcome.Tap, controllerId, sourceId, game)) {
for (UUID targetId : (List<UUID>) target.getTargets()) {
for (UUID targetId : target.getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent == null) {
return false;

View file

@ -92,7 +92,7 @@ class CultivatorDroneManaCondition extends ManaCondition implements Condition {
}
}
if (costToPay instanceof ManaCost) {
return ((ManaCost) costToPay).getText().contains("{C}");
return costToPay.getText().contains("{C}");
}
return false;
}

View file

@ -28,7 +28,7 @@ public final class CutRibbons extends SplitCard {
// to
// Ribbons
// Each opponent loses X life.
((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().getSpellAbility().addEffect(new LoseLifeOpponentsEffect(new ManacostVariableValue()));
}

View file

@ -76,7 +76,7 @@ class DeceiverOfFormEffect extends OneShotEffect {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, controller.getId(), game)) {
if (!permanent.getId().equals(sourceObject.getId())) {
Permanent newBluePrint = null;
newBluePrint = new PermanentCard((Card) copyFromCard, source.getControllerId(), game);
newBluePrint = new PermanentCard(copyFromCard, source.getControllerId(), game);
newBluePrint.assignNewId();
CopyEffect copyEffect = new CopyEffect(Duration.EndOfTurn, newBluePrint, permanent.getId());
copyEffect.newId();

View file

@ -90,7 +90,7 @@ class DefilerOfSoulsEffect extends OneShotEffect {
}
for ( int idx = 0; idx < target.getTargets().size(); idx++) {
Permanent permanent = game.getPermanent((UUID)target.getTargets().get(idx));
Permanent permanent = game.getPermanent(target.getTargets().get(idx));
if ( permanent != null ) {
abilityApplied |= permanent.sacrifice(source.getSourceId(), game);

View file

@ -58,7 +58,7 @@ class DeniedEffect extends OneShotEffect {
return true;
}
Player player = game.getPlayer(targetSpell.getControllerId());
Object object = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
Object object = game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
if (player != null && object instanceof String) {
player.revealCards("Denied!", player.getHand(), game, true);
String namedCard = (String) object;

View file

@ -35,7 +35,7 @@ public final class DestinedLead extends SplitCard {
// to
// Lead
// All creatures able to block target creature this turn must do so.
((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().getSpellAbility().addTarget(new TargetCreaturePermanent());
getRightHalfCard().getSpellAbility().addEffect(new MustBeBlockedByAllTargetEffect(Duration.EndOfTurn));
}

View file

@ -161,6 +161,6 @@ class DiluvianPrimordialReplacementEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
return zEvent.getToZone() == Zone.GRAVEYARD
&& ((ZoneChangeEvent) event).getTargetId().equals(getTargetPointer().getFirst(game, source));
&& event.getTargetId().equals(getTargetPointer().getFirst(game, source));
}
}

View file

@ -81,7 +81,7 @@ class DimirDoppelgangerEffect extends OneShotEffect {
Cards cardsToExile = new CardsImpl();
cardsToExile.add(copyFromCard);
controller.moveCards(cardsToExile, Zone.EXILED, source, game);
newBluePrint = new PermanentCard((Card) copyFromCard, source.getControllerId(), game);
newBluePrint = new PermanentCard(copyFromCard, source.getControllerId(), game);
newBluePrint.assignNewId();
ApplyToPermanent applier = new DimirDoppelgangerApplier();
applier.apply(game, newBluePrint, source, dimirDoppelganger.getId());

View file

@ -179,7 +179,7 @@ class DireFleetDaredevilReplacementEffect extends ReplacementEffectImpl {
StackObject stackObject = game.getStack().getStackObject(eventObject);
if (stackObject != null) {
if (stackObject instanceof Spell) {
game.rememberLKI(stackObject.getId(), Zone.STACK, (Spell) stackObject);
game.rememberLKI(stackObject.getId(), Zone.STACK, stackObject);
}
if (stackObject instanceof Card
&& stackObject.getSourceId().equals(((FixedTarget) getTargetPointer()).getTarget())
@ -201,6 +201,6 @@ class DireFleetDaredevilReplacementEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
return zEvent.getToZone() == Zone.GRAVEYARD
&& ((ZoneChangeEvent) event).getTargetId().equals(((FixedTarget) getTargetPointer()).getTarget());
&& event.getTargetId().equals(((FixedTarget) getTargetPointer()).getTarget());
}
}

View file

@ -70,7 +70,7 @@ class DisappearEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent aura = (Permanent) game.getPermanentOrLKIBattlefield(source.getSourceId());
Permanent aura = game.getPermanentOrLKIBattlefield(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (controller != null
&& aura != null

View file

@ -36,7 +36,7 @@ public final class DrivenDespair extends SplitCard {
// Despair {1}{B}
// Sorcery
// Aftermath
((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true));
// Until end of turn, creatures you control gain menace and "Whenever this creature deals combat damage to a player, that player discards a card."
getRightHalfCard().getSpellAbility().addEffect(new GainAbilityControlledEffect(new MenaceAbility(), Duration.EndOfTurn, StaticFilters.FILTER_CONTROLLED_CREATURES));
ability = new DealsCombatDamageToAPlayerTriggeredAbility(new DiscardTargetEffect(1), false, true);

View file

@ -43,7 +43,7 @@ public final class DuskDawn extends SplitCard {
// Dawn
// Return all creature cards with power less than or equal to 2 from your graveyard to your hand.
((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().getSpellAbility().addEffect(new DawnEffect());
}

View file

@ -69,7 +69,7 @@ class EdricSpymasterOfTrestTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (((DamagedPlayerEvent) event).isCombatDamage() &&
game.getOpponents(this.controllerId).contains(((DamagedPlayerEvent) event).getPlayerId())) {
game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getPermanent(event.getSourceId()).getControllerId()));
}

View file

@ -37,7 +37,7 @@ public final class FailureComply extends SplitCard {
// to
// Comply
// Choose a card name. Until your next turn, your opponents can't cast spells with the chosen name
((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true));
Effect effect = new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.ALL);
effect.setText("Choose a card name");
getRightHalfCard().getSpellAbility().addEffect(effect);

View file

@ -28,7 +28,7 @@ public final class FarmMarket extends SplitCard {
// Market {2}{U}
// Sorcery
// Aftermath
((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true));
// Draw two cards, then discard two cards
getRightHalfCard().getSpellAbility().addEffect(new DrawDiscardControllerEffect(2, 2));

View file

@ -94,7 +94,7 @@ class FiendslayerPaladinEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Card targetCard = game.getCard(event.getTargetId());
StackObject stackObject = (StackObject) game.getStack().getStackObject(event.getSourceId());
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
if (targetCard != null && stackObject != null && targetCard.getId().equals(source.getSourceId())) {
if (stackObject.getColor(game).isBlack() || stackObject.getColor(game).isRed()) {
if (!stackObject.isControlledBy(source.getControllerId())

View file

@ -69,7 +69,7 @@ class FinalPartingEffect extends OneShotEffect {
if (controller.searchLibrary(target, game)) {
if (!target.getTargets().isEmpty()) {
Cards searched = new CardsImpl();
for (UUID cardId : (List<UUID>) target.getTargets()) {
for (UUID cardId : target.getTargets()) {
Card card = controller.getLibrary().getCard(cardId, game);
searched.add(card);
}

View file

@ -67,7 +67,7 @@ class FlayingTendrilsReplacementEffect extends ReplacementEffectImpl {
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && permanent != null) {
return controller.moveCards((Card) permanent, Zone.EXILED, source, game);
return controller.moveCards(permanent, Zone.EXILED, source, game);
}
return false;
}

View file

@ -118,7 +118,7 @@ class GoToJailTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals((UUID) game.getState().getValue(this.getSourceId().toString() + ChooseOpponentEffect.VALUE_KEY));
return event.getPlayerId().equals(game.getState().getValue(this.getSourceId().toString() + ChooseOpponentEffect.VALUE_KEY));
}
@Override

View file

@ -80,7 +80,7 @@ class GarnaTheBloodflameEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
GarnaTheBloodflameWatcher watcher = (GarnaTheBloodflameWatcher) game.getState().getWatcher(GarnaTheBloodflameWatcher.class);
GarnaTheBloodflameWatcher watcher = game.getState().getWatcher(GarnaTheBloodflameWatcher.class);
if (watcher != null) {
Set<Card> toHand = new HashSet<>();
for (UUID cardId : watcher.getCardsPutToGraveyardThisTurn()) {

View file

@ -98,7 +98,7 @@ class GazeOfTheGorgonEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && targetCreature != null) {
BlockedAttackerWatcher watcher = (BlockedAttackerWatcher) game.getState().getWatcher(BlockedAttackerWatcher.class);
BlockedAttackerWatcher watcher = game.getState().getWatcher(BlockedAttackerWatcher.class);
if (watcher != null) {
List<Permanent> toDestroy = new ArrayList<>();
for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) {

View file

@ -114,7 +114,7 @@ class GeneratorServantHasteEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Game game, Ability source) {
GeneratorServantWatcher watcher = (GeneratorServantWatcher) game.getState().getWatcher(GeneratorServantWatcher.class, source.getSourceId());
GeneratorServantWatcher watcher = game.getState().getWatcher(GeneratorServantWatcher.class, source.getSourceId());
if (watcher != null) {
for (Permanent perm : game.getBattlefield().getAllActivePermanents()) {
if (watcher.creatures.contains(perm.getId())) {

View file

@ -80,7 +80,7 @@ class GhostlyWingsReturnEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = (Permanent) game.getPermanentOrLKIBattlefield(source.getSourceId());
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && permanent != null && permanent.getAttachedTo() != null) {
Permanent enchantedCreature = game.getPermanent(permanent.getAttachedTo());

View file

@ -76,7 +76,7 @@ class GhostwayEffect extends OneShotEffect {
Cards cardsToReturn = new CardsImpl();
for (Card exiled : toExile) {
if (((Permanent) exiled).getZoneChangeCounter(game) == game.getState().getZoneChangeCounter(exiled.getId()) - 1) {
if (exiled.getZoneChangeCounter(game) == game.getState().getZoneChangeCounter(exiled.getId()) - 1) {
cardsToReturn.add(exiled);
}
}

View file

@ -63,7 +63,7 @@ class CantAttackIfAttackedLastTurnEffect extends RestrictionEffect {
@Override
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game) {
AttackedLastTurnWatcher watcher = (AttackedLastTurnWatcher) game.getState().getWatcher(AttackedLastTurnWatcher.class);
AttackedLastTurnWatcher watcher = game.getState().getWatcher(AttackedLastTurnWatcher.class);
if (watcher != null) {
Set<MageObjectReference> attackingCreatures = watcher.getAttackedLastTurnCreatures(attacker.getControllerId());
MageObjectReference mor = new MageObjectReference(attacker, game);

View file

@ -68,7 +68,7 @@ class GiltspireAvengerTarget extends TargetPermanent {
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatcher(PlayerDamagedBySourceWatcher.class, source.getControllerId());
PlayerDamagedBySourceWatcher watcher = game.getState().getWatcher(PlayerDamagedBySourceWatcher.class, source.getControllerId());
if (watcher != null && watcher.hasSourceDoneDamage(id, game)) {
return super.canTarget(id, source, game);
}
@ -79,7 +79,7 @@ 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().getWatcher(PlayerDamagedBySourceWatcher.class, sourceControllerId);
PlayerDamagedBySourceWatcher watcher = game.getState().getWatcher(PlayerDamagedBySourceWatcher.class, sourceControllerId);
for (UUID targetId : availablePossibleTargets) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null && watcher != null && watcher.hasSourceDoneDamage(targetId, game)) {
@ -97,7 +97,7 @@ class GiltspireAvengerTarget extends TargetPermanent {
}
int count = 0;
MageObject targetSource = game.getObject(sourceId);
PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatcher(PlayerDamagedBySourceWatcher.class, sourceControllerId);
PlayerDamagedBySourceWatcher watcher = game.getState().getWatcher(PlayerDamagedBySourceWatcher.class, sourceControllerId);
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, sourceControllerId, sourceId, game)) {
if (!targets.containsKey(permanent.getId()) && permanent.canBeTargetedBy(targetSource, sourceControllerId, game)
&& watcher != null && watcher.hasSourceDoneDamage(permanent.getId(), game)) {

View file

@ -120,7 +120,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().getWatcher(GisaAndGeralfWatcher.class, source.getSourceId());
GisaAndGeralfWatcher watcher = game.getState().getWatcher(GisaAndGeralfWatcher.class, source.getSourceId());
return watcher != null && !watcher.isAbilityUsed();
}
}

View file

@ -73,7 +73,7 @@ class GleancrawlerEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
CardsPutIntoGraveyardWatcher watcher = (CardsPutIntoGraveyardWatcher) game.getState().getWatcher(CardsPutIntoGraveyardWatcher.class);
CardsPutIntoGraveyardWatcher watcher = game.getState().getWatcher(CardsPutIntoGraveyardWatcher.class);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && watcher != null) {
Set<MageObjectReference> cardsToGraveyardThisTurn = watcher.getCardsPutToGraveyardFromBattlefield();

View file

@ -79,7 +79,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().getWatcher(NumberOfTimesPermanentTargetedATurnWatcher.class);
NumberOfTimesPermanentTargetedATurnWatcher watcher = game.getState().getWatcher(NumberOfTimesPermanentTargetedATurnWatcher.class);
if (watcher != null
&& watcher.notMoreThanOnceTargetedThisTurn(permanent, game)) {
for (Effect effect : getEffects()) {

View file

@ -106,7 +106,7 @@ class GlyphOfDoomEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && targetCreature != null) {
BlockedAttackerWatcher watcher = (BlockedAttackerWatcher) game.getState().getWatcher(BlockedAttackerWatcher.class);
BlockedAttackerWatcher watcher = game.getState().getWatcher(BlockedAttackerWatcher.class);
if (watcher != null) {
List<Permanent> toDestroy = new ArrayList<>();
for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) {

View file

@ -69,7 +69,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().getWatcher(PlayerCastCreatureWatcher.class);
PlayerCastCreatureWatcher watcher = game.getState().getWatcher(PlayerCastCreatureWatcher.class);
if (watcher != null && !watcher.playerDidCastCreatureThisTurn(source.getControllerId())) {
return true;
}

View file

@ -96,7 +96,7 @@ class DontUntapIfAttackedLastTurnSourceEffect extends ContinuousRuleModifyingEff
&& event.getTargetId().equals(source.getSourceId())) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null && permanent.isControlledBy(game.getActivePlayerId())) {
AttackedLastTurnWatcher watcher = (AttackedLastTurnWatcher) game.getState().getWatcher(AttackedLastTurnWatcher.class);
AttackedLastTurnWatcher watcher = game.getState().getWatcher(AttackedLastTurnWatcher.class);
if (watcher != null) {
Set<MageObjectReference> attackingCreatures = watcher.getAttackedLastTurnCreatures(permanent.getControllerId());
MageObjectReference mor = new MageObjectReference(permanent, game);

View file

@ -86,7 +86,7 @@ class GomazoaEffect extends OneShotEffect {
players.add(gomazoa.getOwnerId());
}
BlockedByWatcher watcher = (BlockedByWatcher) game.getState().getWatcher(BlockedByWatcher.class, source.getSourceId());
BlockedByWatcher watcher = game.getState().getWatcher(BlockedByWatcher.class, source.getSourceId());
creaturesBlocked = watcher.blockedByWatcher;
for (UUID blockedById : creaturesBlocked) {

View file

@ -68,7 +68,7 @@ class GontisMachinationsTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(getControllerId())) {
GontisMachinationsFirstLostLifeThisTurnWatcher watcher
= (GontisMachinationsFirstLostLifeThisTurnWatcher) game.getState().getWatcher(GontisMachinationsFirstLostLifeThisTurnWatcher.class);
= game.getState().getWatcher(GontisMachinationsFirstLostLifeThisTurnWatcher.class);
if (watcher != null && watcher.timesLostLifeThisTurn(event.getTargetId()) < 2) {
return true;
}

View file

@ -153,7 +153,7 @@ class GrandWarlordRadhaEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
CreaturesAttackedWatcher watcher = (CreaturesAttackedWatcher) game.getState().getWatcher(CreaturesAttackedWatcher.class);
CreaturesAttackedWatcher watcher = game.getState().getWatcher(CreaturesAttackedWatcher.class);
if (watcher != null) {
int attackingCreatures = 0;
for (MageObjectReference attacker : watcher.getAttackedThisTurnCreatures()) {

View file

@ -93,7 +93,7 @@ class GrimReminderEffect extends OneShotEffect {
Cards cardsToReveal = new CardsImpl(card);
controller.revealCards(sourceObject.getIdName(), cardsToReveal, game);
String cardName = card.getName();
GrimReminderWatcher watcher = (GrimReminderWatcher) game.getState().getWatcher(GrimReminderWatcher.class);
GrimReminderWatcher watcher = game.getState().getWatcher(GrimReminderWatcher.class);
if (watcher != null) {
for (UUID playerId : watcher.getPlayersCastSpell(cardName)) {
Player player = game.getPlayer(playerId);

View file

@ -49,7 +49,7 @@ public final class GrimReturn extends CardImpl {
@Override
public void adjustTargets(Ability ability, Game game) {
CardsPutIntoGraveyardWatcher watcher = (CardsPutIntoGraveyardWatcher) game.getState().getWatcher(CardsPutIntoGraveyardWatcher.class);
CardsPutIntoGraveyardWatcher watcher = game.getState().getWatcher(CardsPutIntoGraveyardWatcher.class);
if (watcher != null) {
FilterCard filter = new FilterCreatureCard(textFilter);
List<CardIdPredicate> uuidPredicates = new ArrayList<>();

View file

@ -34,7 +34,7 @@ public final class GrindDust extends SplitCard {
// Dust
// Aftermath
((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true));
// Exile any number of target creatures that have -1/-1 counters on them.
getRightHalfCard().getSpellAbility().addEffect(new ExileTargetEffect());
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures that have -1/-1 counters on them");

View file

@ -148,7 +148,7 @@ class GrothamaAllDevouringDrawCardsEffect extends OneShotEffect {
if (controller == null) {
return false;
}
GrothamaAllDevouringWatcher watcher = (GrothamaAllDevouringWatcher) game.getState().getWatcher(GrothamaAllDevouringWatcher.class);
GrothamaAllDevouringWatcher watcher = game.getState().getWatcher(GrothamaAllDevouringWatcher.class);
if (watcher == null) {
return false;
}

View file

@ -56,7 +56,7 @@ enum GutterbonesCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
if (game.isActivePlayer(source.getControllerId())) {
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatcher(PlayerLostLifeWatcher.class);
PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class);
return watcher != null && watcher.getAllOppLifeLost(source.getControllerId(), game) > 0;
}
return false;

View file

@ -38,7 +38,7 @@ public final class HeavenEarth extends SplitCard {
// to
// Earth
// Earth deals X damage to each creature without flying.
((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().getSpellAbility().addEffect(new DamageAllEffect(new ManacostVariableValue(), filterWithouFlying));
}

View file

@ -68,7 +68,7 @@ class HiveMindTriggeredAbility extends TriggeredAbilityImpl {
|| spell.isSorcery())) {
for (Effect effect : getEffects()) {
if (effect instanceof HiveMindEffect) {
((HiveMindEffect) effect).setTargetPointer(new FixedTarget(spell.getId()));
effect.setTargetPointer(new FixedTarget(spell.getId()));
}
}
return true;

View file

@ -62,7 +62,7 @@ enum GreatestAmountOfDamageDealtValue implements DynamicValue, MageSingleton {
}
public int calculate(Game game, UUID controllerId) {
GreatestAmountOfDamageWatcher watcher = (GreatestAmountOfDamageWatcher) game.getState().getWatcher(GreatestAmountOfDamageWatcher.class);
GreatestAmountOfDamageWatcher watcher = game.getState().getWatcher(GreatestAmountOfDamageWatcher.class);
if (watcher != null) {
return watcher.getGreatestAmountOfDamage();
}

View file

@ -46,7 +46,7 @@ class ImpatienceCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatcher(CastSpellLastTurnWatcher.class);
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
return watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(game.getActivePlayerId()) == 0;
}

View file

@ -87,7 +87,7 @@ class ImpelledGiantCost extends CostImpl {
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
if (target.choose(Outcome.Tap, controllerId, sourceId, game)) {
for (UUID targetId: (List<UUID>)target.getTargets()) {
for (UUID targetId: target.getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent == null)
return false;

View file

@ -145,7 +145,7 @@ class ImprisonUnblockEffect extends OneShotEffect {
effect.apply(game, source);
// Make blocked creatures unblocked
BlockedByOnlyOneCreatureThisCombatWatcher watcher = (BlockedByOnlyOneCreatureThisCombatWatcher) game.getState().getWatcher(BlockedByOnlyOneCreatureThisCombatWatcher.class);
BlockedByOnlyOneCreatureThisCombatWatcher watcher = game.getState().getWatcher(BlockedByOnlyOneCreatureThisCombatWatcher.class);
if (watcher != null) {
Set<CombatGroup> combatGroups = watcher.getBlockedOnlyByCreature(permanent.getId());
if (combatGroups != null) {

View file

@ -70,7 +70,7 @@ class IncinerateEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatcher(DamagedByWatcher.class, source.getSourceId());
DamagedByWatcher watcher = game.getState().getWatcher(DamagedByWatcher.class, source.getSourceId());
if (watcher != null) {
return watcher.wasDamaged(event.getTargetId(), game);
}

View file

@ -77,7 +77,7 @@ class IncreasingAmbitionEffect extends SearchEffect {
}
if (player.searchLibrary(target, game)) {
if (!target.getTargets().isEmpty()) {
for (UUID cardId: (List<UUID>)target.getTargets()) {
for (UUID cardId: target.getTargets()) {
Card card = player.getLibrary().remove(cardId, game);
if (card != null) {
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);

View file

@ -69,7 +69,7 @@ class IncursionTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(controllerId)) {
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatcher(CastSpellLastTurnWatcher.class);
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 2) {
return true;
}

View file

@ -66,8 +66,8 @@ enum InfernoHellionCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
AttackedThisTurnWatcher watcherAttacked = (AttackedThisTurnWatcher) game.getState().getWatcher(AttackedThisTurnWatcher.class);
BlockedThisTurnWatcher watcherBlocked = (BlockedThisTurnWatcher) game.getState().getWatcher(BlockedThisTurnWatcher.class);
AttackedThisTurnWatcher watcherAttacked = game.getState().getWatcher(AttackedThisTurnWatcher.class);
BlockedThisTurnWatcher watcherBlocked = game.getState().getWatcher(BlockedThisTurnWatcher.class);
MageObjectReference mor = new MageObjectReference(source.getSourceId(), game);
if (watcherAttacked == null || watcherBlocked == null) {
return false;

View file

@ -53,7 +53,7 @@ enum InfernoTrapCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
InfernoTrapWatcher watcher = (InfernoTrapWatcher) game.getState().getWatcher(InfernoTrapWatcher.class);
InfernoTrapWatcher watcher = game.getState().getWatcher(InfernoTrapWatcher.class);
if (watcher != null) {
Set<MageObjectReference> damagingCreatures = watcher.getDamagingCreatures(source.getControllerId());
return damagingCreatures.size() > 1;

View file

@ -62,7 +62,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().getWatcher(NonArtifactCreaturesDiedWatcher.class);
NonArtifactCreaturesDiedWatcher watcher = game.getState().getWatcher(NonArtifactCreaturesDiedWatcher.class);
if (watcher != null && watcher.conditionMet()) {
Permanent permanent = game.getPermanentEntering(source.getSourceId());
if (permanent != null) {

View file

@ -80,7 +80,7 @@ class InsidiousDreamsEffect extends OneShotEffect {
TargetCardInLibrary target = new TargetCardInLibrary(0, amount, new FilterCard());
if (controller.searchLibrary(target, game)) {
Cards chosen = new CardsImpl();
for (UUID cardId : (List<UUID>) target.getTargets()) {
for (UUID cardId : target.getTargets()) {
Card card = controller.getLibrary().remove(cardId, game);
chosen.add(card);
}

View file

@ -65,7 +65,7 @@ class InsistEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public void init(Ability source, Game game) {
super.init(source, game);
InsistWatcher watcher = (InsistWatcher) game.getState().getWatcher(InsistWatcher.class, source.getControllerId());
InsistWatcher watcher = game.getState().getWatcher(InsistWatcher.class, source.getControllerId());
if (watcher != null) {
watcher.setReady();
}
@ -93,7 +93,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().getWatcher(InsistWatcher.class, source.getControllerId());
InsistWatcher watcher = game.getState().getWatcher(InsistWatcher.class, source.getControllerId());
return spell != null && watcher != null && watcher.isUncounterable(spell.getId());
}
}

View file

@ -38,7 +38,7 @@ public final class InsultInjury extends SplitCard {
// to
// Injury
// Injury deals 2 damage to target creature and 2 damage to target player.
((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().getSpellAbility().addTarget(new TargetCreaturePermanent());
getRightHalfCard().getSpellAbility().addTarget(new TargetPlayerOrPlaneswalker());
getRightHalfCard().getSpellAbility().addEffect(new InjuryEffect());

View file

@ -79,7 +79,7 @@ class IsperiaTheInscrutableEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
Object object = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
Object object = game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
if (player != null && object instanceof String) {
player.revealCards(player.getLogName() + " hand", player.getHand(), game, true);
String namedCard = (String) object;

View file

@ -71,7 +71,7 @@ class JandorsRingEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
JandorsRingWatcher watcher = (JandorsRingWatcher) game.getState().getWatcher(JandorsRingWatcher.class);
JandorsRingWatcher watcher = game.getState().getWatcher(JandorsRingWatcher.class);
if (watcher != null) {
UUID cardId = watcher.getLastDrewCard(source.getControllerId());
Card card = game.getCard(cardId);
@ -134,7 +134,7 @@ enum WatchedCardInHandCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
JandorsRingWatcher watcher = (JandorsRingWatcher) game.getState().getWatcher(JandorsRingWatcher.class);
JandorsRingWatcher watcher = game.getState().getWatcher(JandorsRingWatcher.class);
return watcher != null
&& watcher.lastDrawnCards != null && game.getPlayer(source.getControllerId()).getHand().contains(watcher.getLastDrewCard(source.getControllerId()));

View file

@ -68,7 +68,7 @@ class JaradsOrdersEffect extends OneShotEffect {
if (controller.searchLibrary(target, game)) {
if (!target.getTargets().isEmpty()) {
Cards revealed = new CardsImpl();
for (UUID cardId: (List<UUID>)target.getTargets()) {
for (UUID cardId: target.getTargets()) {
Card card = controller.getLibrary().getCard(cardId, game);
revealed.add(card);
}

View file

@ -103,7 +103,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().getWatcher(DamagedByWatcher.class, source.getSourceId());
DamagedByWatcher watcher = game.getState().getWatcher(DamagedByWatcher.class, source.getSourceId());
if (watcher != null) {
return watcher.wasDamaged(event.getTargetId(), game);
}

View file

@ -84,7 +84,7 @@ class JelevaNephaliasScourgeEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
JelevaNephaliasWatcher watcher = (JelevaNephaliasWatcher) game.getState().getWatcher(JelevaNephaliasWatcher.class);
JelevaNephaliasWatcher watcher = game.getState().getWatcher(JelevaNephaliasWatcher.class);
if (controller != null && sourceObject != null && watcher != null) {
int xValue = watcher.getManaSpentToCastLastTime(sourceObject.getId(), sourceObject.getZoneChangeCounter(game) - 1);
if (xValue > 0) {

View file

@ -67,7 +67,7 @@ class JoriEnTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(controllerId)) {
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatcher(CastSpellLastTurnWatcher.class);
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 2) {
return true;
}

View file

@ -82,7 +82,7 @@ class JovensFerretsEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourcePermanent != null) {
BlockedAttackerWatcher watcher = (BlockedAttackerWatcher) game.getState().getWatcher(BlockedAttackerWatcher.class);
BlockedAttackerWatcher watcher = game.getState().getWatcher(BlockedAttackerWatcher.class);
if (watcher != null) {
List<Permanent> toTap = new ArrayList<>();
for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) {

View file

@ -150,7 +150,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().getWatcher(KaradorGhostChieftainWatcher.class, source.getSourceId());
KaradorGhostChieftainWatcher watcher = game.getState().getWatcher(KaradorGhostChieftainWatcher.class, source.getSourceId());
return watcher != null && !watcher.isAbilityUsed();
}
}

View file

@ -90,7 +90,7 @@ class KeldonBattlewagonCost extends CostImpl {
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
if (target.choose(Outcome.Tap, controllerId, sourceId, game)) {
for (UUID targetId: (List<UUID>)target.getTargets()) {
for (UUID targetId: target.getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent == null)
return false;

View file

@ -54,7 +54,7 @@ class KeldonTwilightCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatcher(AttackedThisTurnWatcher.class);
AttackedThisTurnWatcher watcher = game.getState().getWatcher(AttackedThisTurnWatcher.class);
if (watcher != null) {
return watcher.getAttackedThisTurnCreatures().isEmpty();
}

View file

@ -94,7 +94,7 @@ class KeranosGodOfStormsTriggeredAbility extends TriggeredAbilityImpl {
if (event.getPlayerId().equals(this.getControllerId())) {
if (game.isActivePlayer(this.getControllerId())) {
CardsAmountDrawnThisTurnWatcher watcher =
(CardsAmountDrawnThisTurnWatcher) game.getState().getWatcher(CardsAmountDrawnThisTurnWatcher.class);
game.getState().getWatcher(CardsAmountDrawnThisTurnWatcher.class);
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) != 1) {
return false;
}

View file

@ -93,7 +93,7 @@ class KessDissidentMageCastFromGraveyardEffect extends AsThoughEffectImpl {
if (card != null && (card.isInstant() || card.isSorcery())
&& game.getState().getZone(objectId).equals(Zone.GRAVEYARD)) {
// check if not already a card was cast this turn with this ability
KessDissidentMageWatcher watcher = (KessDissidentMageWatcher) game.getState().getWatcher(KessDissidentMageWatcher.class);
KessDissidentMageWatcher watcher = game.getState().getWatcher(KessDissidentMageWatcher.class);
return watcher != null && !watcher.isAbilityUsed(new MageObjectReference(source.getSourceId(), game));
}
}
@ -137,7 +137,7 @@ class KessDissidentMageReplacementEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Zone.GRAVEYARD) {
KessDissidentMageWatcher watcher = (KessDissidentMageWatcher) game.getState().getWatcher(KessDissidentMageWatcher.class);
KessDissidentMageWatcher watcher = game.getState().getWatcher(KessDissidentMageWatcher.class);
if (watcher != null && source.getSourceId().equals(watcher.spellCastWasAllowedBy(new MageObjectReference(event.getTargetId(), game)))) {
return true;
}

View file

@ -78,7 +78,7 @@ class KheruSpellsnatcherEffect extends OneShotEffect {
StackObject stackObject = game.getStack().getStackObject(objectId);
if (stackObject != null
&& game.getStack().counter(targetPointer.getFirst(game, source), source.getSourceId(), game, Zone.EXILED, false, ZoneDetail.NONE)) {
if (!((Spell) stackObject).isCopy()) {
if (!stackObject.isCopy()) {
MageObject card = game.getObject(stackObject.getSourceId());
if (card instanceof Card) {
((Card) card).moveToZone(Zone.EXILED, sourceId, game, true);

View file

@ -82,7 +82,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().getWatcher(NumberOfTimesPermanentTargetedATurnWatcher.class);
NumberOfTimesPermanentTargetedATurnWatcher watcher = game.getState().getWatcher(NumberOfTimesPermanentTargetedATurnWatcher.class);
if (watcher != null && watcher.notMoreThanOnceTargetedThisTurn(permanent, game)) {
for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getSourceId()));

View file

@ -85,7 +85,7 @@ class BecomesMonarchTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkInterveningIfClause(Game game) {
MonarchAtTurnStartWatcher watcher = (MonarchAtTurnStartWatcher) game.getState().getWatcher(MonarchAtTurnStartWatcher.class);
MonarchAtTurnStartWatcher watcher = game.getState().getWatcher(MonarchAtTurnStartWatcher.class);
return watcher != null && isControlledBy(watcher.getMonarchIdAtTurnStart());
}

View file

@ -68,7 +68,7 @@ class KnollspineDragonEffect extends OneShotEffect {
if (controller != null) {
new DiscardHandControllerEffect().apply(game, source);
if (targetOpponent != null) {
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = (AmountOfDamageAPlayerReceivedThisTurnWatcher) game.getState().getWatcher(AmountOfDamageAPlayerReceivedThisTurnWatcher.class);
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = game.getState().getWatcher(AmountOfDamageAPlayerReceivedThisTurnWatcher.class);
if (watcher != null) {
int drawAmount = watcher.getAmountOfDamageReceivedThisTurn(targetOpponent.getId());
controller.drawCards(drawAmount, game);

View file

@ -80,7 +80,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().getWatcher(CastSpellLastTurnWatcher.class);
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 2) {
return true;
}

View file

@ -112,8 +112,8 @@ enum KrovikanVampireInterveningIfCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
KrovikanVampireCreaturesDiedWatcher watcherDied = (KrovikanVampireCreaturesDiedWatcher) game.getState().getWatcher(KrovikanVampireCreaturesDiedWatcher.class);
KrovikanVampireCreaturesDamagedWatcher watcherDamaged = (KrovikanVampireCreaturesDamagedWatcher) game.getState().getWatcher(KrovikanVampireCreaturesDamagedWatcher.class);
KrovikanVampireCreaturesDiedWatcher watcherDied = game.getState().getWatcher(KrovikanVampireCreaturesDiedWatcher.class);
KrovikanVampireCreaturesDamagedWatcher watcherDamaged = game.getState().getWatcher(KrovikanVampireCreaturesDamagedWatcher.class);
if (watcherDied != null) {
Set<UUID> creaturesThatDiedThisTurn = watcherDied.diedThisTurn;
for (UUID mor : creaturesThatDiedThisTurn) {

View file

@ -94,7 +94,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().getWatcher(DamagedByEnchantedWatcher.class, source.getSourceId());
DamagedByEnchantedWatcher watcher = game.getState().getWatcher(DamagedByEnchantedWatcher.class, source.getSourceId());
if (watcher != null) {
return watcher.wasDamaged(zce.getTarget(), game);
}

View file

@ -89,7 +89,7 @@ enum KuonOgreAscendantCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
CreaturesDiedWatcher watcher = (CreaturesDiedWatcher) game.getState().getWatcher(CreaturesDiedWatcher.class);
CreaturesDiedWatcher watcher = game.getState().getWatcher(CreaturesDiedWatcher.class);
if (watcher != null) {
return watcher.getAmountOfCreaturesDiedThisTurn() > 2;
}

View file

@ -57,7 +57,7 @@ class CardsDrawnThisTurnDynamicValue implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
KydeleCardsDrawnThisTurnWatcher watcher = (KydeleCardsDrawnThisTurnWatcher) game.getState().getWatcher(KydeleCardsDrawnThisTurnWatcher.class);
KydeleCardsDrawnThisTurnWatcher watcher = game.getState().getWatcher(KydeleCardsDrawnThisTurnWatcher.class);
if(watcher != null) {
return watcher.getCardsDrawnThisTurn(sourceAbility.getControllerId());
}

View file

@ -71,7 +71,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().getWatcher(AttackedOrBlockedThisCombatWatcher.class);
AttackedOrBlockedThisCombatWatcher watcher = game.getState().getWatcher(AttackedOrBlockedThisCombatWatcher.class);
if (watcher != null) {
boolean sourceFound = false;
int number = 0;

View file

@ -57,7 +57,7 @@ enum LavaballTrapCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatcher(PermanentsEnteredBattlefieldWatcher.class);
PermanentsEnteredBattlefieldWatcher watcher = game.getState().getWatcher(PermanentsEnteredBattlefieldWatcher.class);
if (watcher != null) {
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
List<Permanent> permanents = watcher.getThisTurnEnteringPermanents(opponentId);

View file

@ -80,7 +80,7 @@ class LazavDimirMastermindEffect extends OneShotEffect {
&& lazavDimirMastermind != null) {
Card copyFromCard = game.getCard(((FixedTarget) getTargetPointer()).getTarget());
if (copyFromCard != null) {
newBluePrint = new PermanentCard((Card) copyFromCard, source.getControllerId(), game);
newBluePrint = new PermanentCard(copyFromCard, source.getControllerId(), game);
newBluePrint.assignNewId();
ApplyToPermanent applier = new LazavDimirMastermindApplier();
applier.apply(game, newBluePrint, source, lazavDimirMastermind.getId());

View file

@ -110,7 +110,7 @@ class LazavTheMultifariousEffect extends OneShotEffect {
&& lazavTheMultifarious != null) {
Card copyFromCard = game.getCard(source.getFirstTarget());
if (copyFromCard != null) {
newBluePrint = new PermanentCard((Card) copyFromCard, source.getControllerId(), game);
newBluePrint = new PermanentCard(copyFromCard, source.getControllerId(), game);
newBluePrint.assignNewId();
ApplyToPermanent applier = new LazavTheMultifariousApplier();
applier.apply(game, newBluePrint, source, lazavTheMultifarious.getId());

View file

@ -62,7 +62,7 @@ enum LeapfrogCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
SpellsCastWatcher watcher
= (SpellsCastWatcher) game.getState().getWatcher(
= game.getState().getWatcher(
SpellsCastWatcher.class
);
if (watcher == null) {

View file

@ -42,7 +42,7 @@ public final class LeaveChance extends SplitCard {
// Chance
// Sorcery
// Aftermath
((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true));
getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true));
// Discard any number of cards, then draw that many cards.
getRightHalfCard().getSpellAbility().addEffect(new ChanceEffect());

View file

@ -71,7 +71,7 @@ class LeovoldEmissaryOfTrestEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
CardsAmountDrawnThisTurnWatcher watcher = (CardsAmountDrawnThisTurnWatcher) game.getState().getWatcher(CardsAmountDrawnThisTurnWatcher.class);
CardsAmountDrawnThisTurnWatcher watcher = game.getState().getWatcher(CardsAmountDrawnThisTurnWatcher.class);
Player controller = game.getPlayer(source.getControllerId());
return watcher != null && controller != null && watcher.getAmountCardsDrawn(event.getPlayerId()) >= 1
&& game.isOpponent(controller, event.getPlayerId());

View file

@ -112,7 +112,7 @@ class YouGainLifeCount implements DynamicValue {
}
public int calculate(Game game, UUID controllerId) {
PlayerGainedLifeWatcher watcher = (PlayerGainedLifeWatcher) game.getState().getWatcher(PlayerGainedLifeWatcher.class);
PlayerGainedLifeWatcher watcher = game.getState().getWatcher(PlayerGainedLifeWatcher.class);
if (watcher != null) {
return watcher.getLifeGained(controllerId);
}

View file

@ -53,7 +53,7 @@ class LudevicNecroAlchemistCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatcher(PlayerLostLifeWatcher.class);
PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class);
PlayerList playerList = game.getState().getPlayerList().copy();
Player currentPlayer;
UUID sourcePlayerId = source.getControllerId();

View file

@ -119,7 +119,7 @@ enum YouLostNoLifeThisTurnCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatcher(PlayerLostLifeWatcher.class);
PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class);
if (watcher != null) {
return (watcher.getLifeLost(source.getControllerId()) == 0);
}

View file

@ -69,7 +69,7 @@ class LureOfPreyRestrictionEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getSourceId().equals(source.getSourceId())) {
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatcher(CastSpellLastTurnWatcher.class);
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
if (watcher != null) {
for (UUID playerId : game.getOpponents(source.getControllerId())) {
if (watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(playerId) != 0) {

View file

@ -58,8 +58,8 @@ enum MadDogCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
Permanent madDog = game.getPermanent(source.getSourceId());
PermanentsEnteredBattlefieldWatcher watcher = (PermanentsEnteredBattlefieldWatcher) game.getState().getWatcher(PermanentsEnteredBattlefieldWatcher.class);
AttackedThisTurnWatcher watcher2 = (AttackedThisTurnWatcher) game.getState().getWatcher(AttackedThisTurnWatcher.class);
PermanentsEnteredBattlefieldWatcher watcher = game.getState().getWatcher(PermanentsEnteredBattlefieldWatcher.class);
AttackedThisTurnWatcher watcher2 = game.getState().getWatcher(AttackedThisTurnWatcher.class);
if (watcher != null
&& watcher2 != null
&& madDog != null) {

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