diff --git a/Mage.Sets/src/mage/cards/a/AlAbarasCarpet.java b/Mage.Sets/src/mage/cards/a/AlAbarasCarpet.java index 03ed6b5248..2c49f22694 100644 --- a/Mage.Sets/src/mage/cards/a/AlAbarasCarpet.java +++ b/Mage.Sets/src/mage/cards/a/AlAbarasCarpet.java @@ -74,7 +74,7 @@ class AlAbarasCarpetEffect extends PreventionEffectImpl { DamagePlayerEvent damageEvent = (DamagePlayerEvent) event; if (event.getTargetId().equals(source.getControllerId())) { Permanent permanent = game.getPermanentOrLKIBattlefield(damageEvent.getSourceId()); - if (permanent != null && filter.match(permanent, game)) { + if (filter.match(permanent, game)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/a/AuntiesSnitch.java b/Mage.Sets/src/mage/cards/a/AuntiesSnitch.java index 38f5b69038..7432bd05b7 100644 --- a/Mage.Sets/src/mage/cards/a/AuntiesSnitch.java +++ b/Mage.Sets/src/mage/cards/a/AuntiesSnitch.java @@ -83,7 +83,7 @@ class AuntiesSnitchTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; Permanent p = game.getPermanent(event.getSourceId()); - return damageEvent.isCombatDamage() && p != null && filter.match(p, getSourceId(), getControllerId(), game); + return damageEvent.isCombatDamage() && filter.match(p, getSourceId(), getControllerId(), game); } @Override diff --git a/Mage.Sets/src/mage/cards/b/BombSquad.java b/Mage.Sets/src/mage/cards/b/BombSquad.java index 3470751fa9..92c5886f90 100644 --- a/Mage.Sets/src/mage/cards/b/BombSquad.java +++ b/Mage.Sets/src/mage/cards/b/BombSquad.java @@ -89,7 +89,7 @@ class BombSquadTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (event.getData().equals(CounterType.FUSE.getName())) { Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent != null && filter.match(permanent, game)) { + if (filter.match(permanent, game)) { if (4 <= permanent.getCounters(game).getCount(CounterType.FUSE)) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(permanent, game)); diff --git a/Mage.Sets/src/mage/cards/b/BubblingMuck.java b/Mage.Sets/src/mage/cards/b/BubblingMuck.java index a99653d56e..aa6157e4ee 100644 --- a/Mage.Sets/src/mage/cards/b/BubblingMuck.java +++ b/Mage.Sets/src/mage/cards/b/BubblingMuck.java @@ -68,7 +68,7 @@ class BubblingMuckTriggeredAbility extends DelayedTriggeredManaAbility { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent land = game.getPermanentOrLKIBattlefield(event.getTargetId()); - if (land != null && filter.match(land, getSourceId(), getControllerId(), game)) { + if (filter.match(land, getSourceId(), getControllerId(), game)) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(land.getControllerId())); } diff --git a/Mage.Sets/src/mage/cards/c/Camel.java b/Mage.Sets/src/mage/cards/c/Camel.java index 72bd328800..17ba9344c4 100644 --- a/Mage.Sets/src/mage/cards/c/Camel.java +++ b/Mage.Sets/src/mage/cards/c/Camel.java @@ -80,7 +80,7 @@ class CamelEffect extends PreventionEffectImpl { && sourcePermanent.isAttacking() && (event.getTargetId().equals(source.getSourceId()) || sourcePermanent.getBandedCards().contains(event.getTargetId()))) { Permanent permanent = game.getPermanentOrLKIBattlefield(damageEvent.getSourceId()); - if (permanent != null && filter.match(permanent, game)) { + if (filter.match(permanent, game)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/c/CeaseFire.java b/Mage.Sets/src/mage/cards/c/CeaseFire.java index 12cfa696a4..dc559d1afe 100644 --- a/Mage.Sets/src/mage/cards/c/CeaseFire.java +++ b/Mage.Sets/src/mage/cards/c/CeaseFire.java @@ -80,7 +80,7 @@ class CeaseFireEffect extends ContinuousRuleModifyingEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { if (event.getPlayerId().equals(getTargetPointer().getFirst(game, source))) { Spell spell = game.getStack().getSpell(event.getSourceId()); - if (spell != null && filter.match(spell, game)) { + if (filter.match(spell, game)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/c/ChaosMoon.java b/Mage.Sets/src/mage/cards/c/ChaosMoon.java index 79af06b243..9835bad390 100644 --- a/Mage.Sets/src/mage/cards/c/ChaosMoon.java +++ b/Mage.Sets/src/mage/cards/c/ChaosMoon.java @@ -119,7 +119,7 @@ class ChaosMoonOddTriggeredAbility extends DelayedTriggeredManaAbility { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent land = game.getPermanentOrLKIBattlefield(event.getTargetId()); - if (land != null && filter.match(land, getSourceId(), getControllerId(), game)) { + if (filter.match(land, getSourceId(), getControllerId(), game)) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(land.getControllerId())); } diff --git a/Mage.Sets/src/mage/cards/c/CityInABottle.java b/Mage.Sets/src/mage/cards/c/CityInABottle.java index 0e88862039..10fdf2cf61 100644 --- a/Mage.Sets/src/mage/cards/c/CityInABottle.java +++ b/Mage.Sets/src/mage/cards/c/CityInABottle.java @@ -239,6 +239,6 @@ class CityInABottleCantPlayEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { Card card = game.getCard(event.getSourceId()); - return card != null && filter.match(card, source.getSourceId(), source.getControllerId(), game); + return filter.match(card, source.getSourceId(), source.getControllerId(), game); } } diff --git a/Mage.Sets/src/mage/cards/c/CryptGhast.java b/Mage.Sets/src/mage/cards/c/CryptGhast.java index b94ffd5bb1..8bb21bda4e 100644 --- a/Mage.Sets/src/mage/cards/c/CryptGhast.java +++ b/Mage.Sets/src/mage/cards/c/CryptGhast.java @@ -72,7 +72,7 @@ class CryptGhastTriggeredAbility extends TriggeredManaAbility { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent land = game.getPermanentOrLKIBattlefield(event.getTargetId()); - return land != null && filter.match(land, this.getSourceId(), this.getControllerId(), game); + return filter.match(land, this.getSourceId(), this.getControllerId(), game); } @Override diff --git a/Mage.Sets/src/mage/cards/c/CultOfTheWaxingMoon.java b/Mage.Sets/src/mage/cards/c/CultOfTheWaxingMoon.java index 4673d42bba..a0282606bd 100644 --- a/Mage.Sets/src/mage/cards/c/CultOfTheWaxingMoon.java +++ b/Mage.Sets/src/mage/cards/c/CultOfTheWaxingMoon.java @@ -73,7 +73,7 @@ class CultOfTheWaxingMoonAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(event.getTargetId()); - return permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game); + return filter.match(permanent, getSourceId(), getControllerId(), game); } @Override diff --git a/Mage.Sets/src/mage/cards/d/DeepWood.java b/Mage.Sets/src/mage/cards/d/DeepWood.java index c943aa24b6..46f482cdd0 100644 --- a/Mage.Sets/src/mage/cards/d/DeepWood.java +++ b/Mage.Sets/src/mage/cards/d/DeepWood.java @@ -74,7 +74,7 @@ class DeepWoodEffect extends PreventionEffectImpl { DamagePlayerEvent damageEvent = (DamagePlayerEvent) event; if (event.getTargetId().equals(source.getControllerId())) { Permanent permanent = game.getPermanentOrLKIBattlefield(damageEvent.getSourceId()); - if (permanent != null && filter.match(permanent, game)) { + if (filter.match(permanent, game)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/e/EchoBaseCommando.java b/Mage.Sets/src/mage/cards/e/EchoBaseCommando.java index b9f525d811..7812cab8b0 100644 --- a/Mage.Sets/src/mage/cards/e/EchoBaseCommando.java +++ b/Mage.Sets/src/mage/cards/e/EchoBaseCommando.java @@ -86,7 +86,7 @@ class EchoBaseCommandoEffect extends CostModificationEffectImpl { public boolean applies(Ability abilityToModify, Ability source, Game game) { if (abilityToModify.getAbilityType() == AbilityType.ACTIVATED || (abilityToModify.getAbilityType() == AbilityType.MANA && (abilityToModify instanceof ActivatedAbility))) { Permanent permanent = game.getPermanent(abilityToModify.getSourceId()); - if (permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) { + if (filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/e/EmbalmersTools.java b/Mage.Sets/src/mage/cards/e/EmbalmersTools.java index d745bd7b71..80e45a47fc 100644 --- a/Mage.Sets/src/mage/cards/e/EmbalmersTools.java +++ b/Mage.Sets/src/mage/cards/e/EmbalmersTools.java @@ -91,7 +91,7 @@ class EmbalmersToolsEffect extends CostModificationEffectImpl { || (abilityToModify.getAbilityType() == AbilityType.MANA && (abilityToModify instanceof ActivatedAbility))) { // Activated abilities of creatures Card card = game.getCard(abilityToModify.getSourceId()); - if (card != null && filter.match(card, source.getSourceId(), source.getControllerId(), game) && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) { + if (filter.match(card, source.getSourceId(), source.getControllerId(), game) && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) { return true; } } diff --git a/Mage.Sets/src/mage/cards/n/NimbleTrapfinder.java b/Mage.Sets/src/mage/cards/n/NimbleTrapfinder.java index 92ab23debc..062272e7a6 100644 --- a/Mage.Sets/src/mage/cards/n/NimbleTrapfinder.java +++ b/Mage.Sets/src/mage/cards/n/NimbleTrapfinder.java @@ -119,7 +119,7 @@ class NimbleTrapfinderWatcher extends Watcher { return; } Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent == null || !filter.match(permanent, game)) { + if (!filter.match(permanent, game)) { return; } playerMap diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index 22b586c796..14376a487c 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -982,7 +982,7 @@ public abstract class AbilityImpl implements Ability { } // check against current state Zone test = game.getState().getZone(parameterSourceId); - return test != null && zone.match(test); + return zone.match(test); } @Override diff --git a/Mage/src/main/java/mage/abilities/TriggeredAbilityImpl.java b/Mage/src/main/java/mage/abilities/TriggeredAbilityImpl.java index 17367c8a0b..3f81d96a84 100644 --- a/Mage/src/main/java/mage/abilities/TriggeredAbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/TriggeredAbilityImpl.java @@ -295,7 +295,7 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge && !(sourceObject instanceof PermanentToken) // it's no token && sourceObject.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(source.getSourceId())) { // It's in the next zone Zone after = game.getState().getZone(source.getSourceId()); - if (after == null || !Zone.GRAVEYARD.match(after)) { // Zone is not the graveyard + if (!Zone.GRAVEYARD.match(after)) { // Zone is not the graveyard return false; // Moving to graveyard was replaced so no trigger } } diff --git a/Mage/src/main/java/mage/abilities/common/AttacksCreatureYouControlTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/AttacksCreatureYouControlTriggeredAbility.java index db042bb682..6ec8413e06 100644 --- a/Mage/src/main/java/mage/abilities/common/AttacksCreatureYouControlTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/AttacksCreatureYouControlTriggeredAbility.java @@ -60,7 +60,7 @@ public class AttacksCreatureYouControlTriggeredAbility extends TriggeredAbilityI @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent sourcePermanent = game.getPermanent(event.getSourceId()); - if (sourcePermanent != null && filter.match(sourcePermanent, sourceId, controllerId, game)) { + if (filter.match(sourcePermanent, sourceId, controllerId, game)) { if (setTargetPointer) { this.getEffects().setTargetPointer(new FixedTarget(event.getSourceId(), game)); } diff --git a/Mage/src/main/java/mage/abilities/common/AttacksWithCreaturesTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/AttacksWithCreaturesTriggeredAbility.java index c93994fef9..35611ab11e 100644 --- a/Mage/src/main/java/mage/abilities/common/AttacksWithCreaturesTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/AttacksWithCreaturesTriggeredAbility.java @@ -56,7 +56,7 @@ public class AttacksWithCreaturesTriggeredAbility extends TriggeredAbilityImpl { int attackerCount = 0; for (UUID attackerId : game.getCombat().getAttackers()) { Permanent attacker = game.getPermanent(attackerId); - if (attacker != null && filter.match(attacker, game)) { + if (filter.match(attacker, game)) { attackerCount++; } } diff --git a/Mage/src/main/java/mage/abilities/common/BecomesBlockedAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BecomesBlockedAllTriggeredAbility.java index 035f4339ce..47d4d724c7 100644 --- a/Mage/src/main/java/mage/abilities/common/BecomesBlockedAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/BecomesBlockedAllTriggeredAbility.java @@ -43,7 +43,7 @@ public class BecomesBlockedAllTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { + if (filter.match(permanent, getSourceId(), getControllerId(), game)) { if (setTargetPointer) { this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId())); } diff --git a/Mage/src/main/java/mage/abilities/common/BecomesTappedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BecomesTappedTriggeredAbility.java index 641e408622..5157df744c 100644 --- a/Mage/src/main/java/mage/abilities/common/BecomesTappedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/BecomesTappedTriggeredAbility.java @@ -55,7 +55,7 @@ public class BecomesTappedTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { + if (filter.match(permanent, getSourceId(), getControllerId(), game)) { if (setTargetPointer) { this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId())); } diff --git a/Mage/src/main/java/mage/abilities/common/BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility.java index 67fb936145..bc17e85918 100644 --- a/Mage/src/main/java/mage/abilities/common/BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility.java @@ -57,7 +57,7 @@ public class BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility extends Triggered } for (UUID uuid : group.getBlockers()){ Permanent permanent = game.getPermanentOrLKIBattlefield(uuid); - if (permanent != null && filter.match(permanent, game)){ + if (filter.match(permanent, game)){ return true; } } @@ -67,7 +67,7 @@ public class BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility extends Triggered } for (UUID uuid : group.getAttackers()){ Permanent permanent = game.getPermanentOrLKIBattlefield(uuid); - if (permanent != null && filter.match(permanent, game)){ + if (filter.match(permanent, game)){ return true; } } diff --git a/Mage/src/main/java/mage/abilities/common/BlocksOrBecomesBlockedSourceTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BlocksOrBecomesBlockedSourceTriggeredAbility.java index 3863d19045..63f1fba4d0 100644 --- a/Mage/src/main/java/mage/abilities/common/BlocksOrBecomesBlockedSourceTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/BlocksOrBecomesBlockedSourceTriggeredAbility.java @@ -57,7 +57,7 @@ public class BlocksOrBecomesBlockedSourceTriggeredAbility extends TriggeredAbili public boolean checkTrigger(GameEvent event, Game game) { if (event.getSourceId().equals(this.getSourceId())) { Permanent blocked = game.getPermanent(event.getTargetId()); - if (blocked != null && filter.match(blocked, game)) { + if (filter.match(blocked, game)) { if (setTargetPointer) { this.getEffects().setTargetPointer(new FixedTarget(blocked, game)); } @@ -66,7 +66,7 @@ public class BlocksOrBecomesBlockedSourceTriggeredAbility extends TriggeredAbili } if (event.getTargetId().equals(this.getSourceId())) { Permanent blocker = game.getPermanent(event.getSourceId()); - if (blocker != null && filter.match(blocker, game)) { + if (filter.match(blocker, game)) { if (setTargetPointer) { this.getEffects().setTargetPointer(new FixedTarget(blocker, game)); } diff --git a/Mage/src/main/java/mage/abilities/common/BlocksOrBecomesBlockedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BlocksOrBecomesBlockedTriggeredAbility.java index 79351ba474..85abdd6b62 100644 --- a/Mage/src/main/java/mage/abilities/common/BlocksOrBecomesBlockedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/BlocksOrBecomesBlockedTriggeredAbility.java @@ -57,7 +57,7 @@ public class BlocksOrBecomesBlockedTriggeredAbility extends TriggeredAbilityImpl public boolean checkTrigger(GameEvent event, Game game) { if (event.getSourceId().equals(this.getSourceId())) { Permanent blocked = game.getPermanent(event.getTargetId()); - if (blocked != null && filter.match(blocked, game)) { + if (filter.match(blocked, game)) { if (setTargetPointer) { this.getEffects().setTargetPointer(new FixedTarget(blocked, game)); } @@ -66,7 +66,7 @@ public class BlocksOrBecomesBlockedTriggeredAbility extends TriggeredAbilityImpl } if (event.getTargetId().equals(this.getSourceId())) { Permanent blocker = game.getPermanent(event.getSourceId()); - if (blocker != null && filter.match(blocker, game)) { + if (filter.match(blocker, game)) { if (setTargetPointer) { this.getEffects().setTargetPointer(new FixedTarget(blocker, game)); } diff --git a/Mage/src/main/java/mage/abilities/common/DealsDamageToACreatureAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/DealsDamageToACreatureAllTriggeredAbility.java index 3c7402e585..7d5e8dea3b 100644 --- a/Mage/src/main/java/mage/abilities/common/DealsDamageToACreatureAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/DealsDamageToACreatureAllTriggeredAbility.java @@ -69,7 +69,7 @@ public class DealsDamageToACreatureAllTriggeredAbility extends TriggeredAbilityI return false; } permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); - if (permanent == null || !filterPermanent.match(permanent, getSourceId(), getControllerId(), game)) { + if (!filterPermanent.match(permanent, getSourceId(), getControllerId(), game)) { return false; } for (Effect effect : this.getEffects()) { diff --git a/Mage/src/main/java/mage/abilities/common/DealsDamageToACreatureTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/DealsDamageToACreatureTriggeredAbility.java index 44b81118df..5de73a3a57 100644 --- a/Mage/src/main/java/mage/abilities/common/DealsDamageToACreatureTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/DealsDamageToACreatureTriggeredAbility.java @@ -55,7 +55,7 @@ public class DealsDamageToACreatureTriggeredAbility extends TriggeredAbilityImpl && (!combatOnly || ((DamagedEvent) event).isCombatDamage())) { if (filter != null) { Permanent creature = game.getPermanentOrLKIBattlefield(event.getTargetId()); - if (creature == null || !filter.match(creature, getSourceId(), getControllerId(), game)) { + if (!filter.match(creature, getSourceId(), getControllerId(), game)) { return false; } } diff --git a/Mage/src/main/java/mage/abilities/common/DealsDamageToAPlayerAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/DealsDamageToAPlayerAllTriggeredAbility.java index 720c069e0f..4ce2717c79 100644 --- a/Mage/src/main/java/mage/abilities/common/DealsDamageToAPlayerAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/DealsDamageToAPlayerAllTriggeredAbility.java @@ -74,7 +74,7 @@ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImp return false; } Permanent permanent = game.getPermanent(event.getSourceId()); - if (permanent == null || !filter.match(permanent, getSourceId(), getControllerId(), game)) { + if (!filter.match(permanent, getSourceId(), getControllerId(), game)) { return false; } this.getEffects().setValue("damage", event.getAmount()); diff --git a/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAllTriggeredAbility.java index a411a0385f..84410cb01c 100644 --- a/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAllTriggeredAbility.java @@ -84,7 +84,7 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { UUID targetId = event.getTargetId(); Permanent permanent = game.getPermanent(targetId); - if (permanent == null || !filter.match(permanent, getSourceId(), getControllerId(), game)) { + if (!filter.match(permanent, getSourceId(), getControllerId(), game)) { return false; } this.getEffects().setValue("permanentEnteringBattlefield", permanent); diff --git a/Mage/src/main/java/mage/abilities/common/EntersBattlefieldOrAttacksAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldOrAttacksAllTriggeredAbility.java index c42b9026d9..6e4db93693 100644 --- a/Mage/src/main/java/mage/abilities/common/EntersBattlefieldOrAttacksAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldOrAttacksAllTriggeredAbility.java @@ -79,7 +79,7 @@ public class EntersBattlefieldOrAttacksAllTriggeredAbility extends TriggeredAbil public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(event.getTargetId()); if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD - && permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { + && filter.match(permanent, getSourceId(), getControllerId(), game)) { if (setTargetPointer != SetTargetPointer.NONE) { for (Effect effect : this.getEffects()) { switch (setTargetPointer) { @@ -98,7 +98,7 @@ public class EntersBattlefieldOrAttacksAllTriggeredAbility extends TriggeredAbil Permanent attacker = game.getPermanent(event.getSourceId()); if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED - && attacker != null && filter.match(attacker, getSourceId(), getControllerId(), game)) { + && filter.match(attacker, getSourceId(), getControllerId(), game)) { if (setTargetPointer != SetTargetPointer.NONE) { for (Effect effect : this.getEffects()) { switch (setTargetPointer) { diff --git a/Mage/src/main/java/mage/abilities/common/LeavesBattlefieldAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/LeavesBattlefieldAllTriggeredAbility.java index 83d6d92f95..f771042724 100644 --- a/Mage/src/main/java/mage/abilities/common/LeavesBattlefieldAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/LeavesBattlefieldAllTriggeredAbility.java @@ -62,7 +62,7 @@ public class LeavesBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl { if (zEvent.getFromZone() == Zone.BATTLEFIELD) { UUID targetId = event.getTargetId(); Permanent permanent = game.getPermanentOrLKIBattlefield(targetId); - if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { + if (filter.match(permanent, getSourceId(), getControllerId(), game)) { if (setTargetPointer != SetTargetPointer.NONE) { for (Effect effect : this.getEffects()) { switch (setTargetPointer) { diff --git a/Mage/src/main/java/mage/abilities/common/SacrificeAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/SacrificeAllTriggeredAbility.java index 34924f6b28..d7d37ed423 100644 --- a/Mage/src/main/java/mage/abilities/common/SacrificeAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/SacrificeAllTriggeredAbility.java @@ -58,7 +58,7 @@ public class SacrificeAllTriggeredAbility extends TriggeredAbilityImpl { break; } Permanent sacrificedPermanent = game.getPermanentOrLKIBattlefield(event.getTargetId()); - return sacrificed && sacrificedPermanent != null && filter.match(sacrificedPermanent, getSourceId(), getControllerId(), game); + return sacrificed && filter.match(sacrificedPermanent, getSourceId(), getControllerId(), game); } @Override diff --git a/Mage/src/main/java/mage/abilities/common/SpellCastAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/SpellCastAllTriggeredAbility.java index 80a049d40b..536f85de84 100644 --- a/Mage/src/main/java/mage/abilities/common/SpellCastAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/SpellCastAllTriggeredAbility.java @@ -59,7 +59,7 @@ public class SpellCastAllTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell == null || !filter.match(spell, getSourceId(), getControllerId(), game)) { + if (!filter.match(spell, getSourceId(), getControllerId(), game)) { return false; } getEffects().setValue("spellCast", spell); diff --git a/Mage/src/main/java/mage/abilities/common/SpellCastControllerTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/SpellCastControllerTriggeredAbility.java index 0ffd427617..612129deea 100644 --- a/Mage/src/main/java/mage/abilities/common/SpellCastControllerTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/SpellCastControllerTriggeredAbility.java @@ -68,7 +68,7 @@ public class SpellCastControllerTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (event.getPlayerId().equals(this.getControllerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && filter.match(spell, getSourceId(), getControllerId(), game)) { + if (filter.match(spell, getSourceId(), getControllerId(), game)) { if (rememberSource) { this.getEffects().setValue("spellCast", spell); if (rememberSourceAsCard) { diff --git a/Mage/src/main/java/mage/abilities/common/SpellCastOpponentTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/SpellCastOpponentTriggeredAbility.java index aa7e6f4b2b..c4f1513f70 100644 --- a/Mage/src/main/java/mage/abilities/common/SpellCastOpponentTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/SpellCastOpponentTriggeredAbility.java @@ -61,7 +61,7 @@ public class SpellCastOpponentTriggeredAbility extends TriggeredAbilityImpl { return false; } Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell == null || !filter.match(spell, getSourceId(), getControllerId(), game)) { + if (!filter.match(spell, getSourceId(), getControllerId(), game)) { return false; } getEffects().setValue("spellCast", spell); diff --git a/Mage/src/main/java/mage/abilities/common/TapForManaAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/TapForManaAllTriggeredAbility.java index 570487225f..52d4b20bda 100644 --- a/Mage/src/main/java/mage/abilities/common/TapForManaAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/TapForManaAllTriggeredAbility.java @@ -45,7 +45,7 @@ public class TapForManaAllTriggeredAbility extends TriggeredAbilityImpl { return false; } Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); - if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { + if (filter.match(permanent, getSourceId(), getControllerId(), game)) { ManaEvent mEvent = (ManaEvent) event; for(Effect effect:getEffects()) { effect.setValue("mana", mEvent.getMana()); diff --git a/Mage/src/main/java/mage/abilities/common/TapForManaAllTriggeredManaAbility.java b/Mage/src/main/java/mage/abilities/common/TapForManaAllTriggeredManaAbility.java index 8c73d19bd0..a9fdfb0c80 100644 --- a/Mage/src/main/java/mage/abilities/common/TapForManaAllTriggeredManaAbility.java +++ b/Mage/src/main/java/mage/abilities/common/TapForManaAllTriggeredManaAbility.java @@ -43,7 +43,7 @@ public class TapForManaAllTriggeredManaAbility extends TriggeredManaAbility { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); - if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { + if (filter.match(permanent, getSourceId(), getControllerId(), game)) { ManaEvent mEvent = (ManaEvent) event; for(Effect effect:getEffects()) { effect.setValue("mana", mEvent.getMana()); diff --git a/Mage/src/main/java/mage/abilities/common/TurnedFaceUpAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/TurnedFaceUpAllTriggeredAbility.java index 6b954afe1a..599f3e3ce2 100644 --- a/Mage/src/main/java/mage/abilities/common/TurnedFaceUpAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/TurnedFaceUpAllTriggeredAbility.java @@ -67,7 +67,7 @@ public class TurnedFaceUpAllTriggeredAbility extends TriggeredAbilityImpl { } } Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { + if (filter.match(permanent, getSourceId(), getControllerId(), game)) { if (setTargetPointer) { for (Effect effect : getEffects()) { effect.setTargetPointer(new FixedTarget(event.getTargetId())); diff --git a/Mage/src/main/java/mage/abilities/common/ZoneChangeAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/ZoneChangeAllTriggeredAbility.java index 10ee16f538..0ceb073ef1 100644 --- a/Mage/src/main/java/mage/abilities/common/ZoneChangeAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/ZoneChangeAllTriggeredAbility.java @@ -60,7 +60,7 @@ public class ZoneChangeAllTriggeredAbility extends TriggeredAbilityImpl { } else { perm = game.getPermanent(event.getTargetId()); // LevelX2: maybe this part is not neccessary } - if (perm != null && filter.match(perm, sourceId, controllerId, game)) { + if (filter.match(perm, sourceId, controllerId, game)) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/condition/common/AttachedToMatchesFilterCondition.java b/Mage/src/main/java/mage/abilities/condition/common/AttachedToMatchesFilterCondition.java index 380bccbd88..98fefd1279 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/AttachedToMatchesFilterCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/AttachedToMatchesFilterCondition.java @@ -29,12 +29,10 @@ public class AttachedToMatchesFilterCondition implements Condition { if (attachedTo == null) { attachedTo = (Permanent) game.getLastKnownInformation(permanent.getAttachedTo(), Zone.BATTLEFIELD); } - if (attachedTo != null) { - if (filter.match(attachedTo, attachedTo.getId(), attachedTo.getControllerId(), game)) { - return true; - } - + if (filter.match(attachedTo, attachedTo.getId(), attachedTo.getControllerId(), game)) { + return true; } + } return false; } diff --git a/Mage/src/main/java/mage/abilities/condition/common/EnchantedCreatureColorCondition.java b/Mage/src/main/java/mage/abilities/condition/common/EnchantedCreatureColorCondition.java index 718dcbcd38..12f62254b4 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/EnchantedCreatureColorCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/EnchantedCreatureColorCondition.java @@ -30,10 +30,8 @@ public class EnchantedCreatureColorCondition implements Condition { Permanent enchantment = game.getPermanent(source.getSourceId()); if (enchantment != null) { Permanent creature = game.getPermanent(enchantment.getAttachedTo()); - if (creature != null) { - if(filter.match(creature, source.getSourceId(), enchantment.getControllerId(), game)){ - return true; - } + if(filter.match(creature, source.getSourceId(), enchantment.getControllerId(), game)){ + return true; } } return false; diff --git a/Mage/src/main/java/mage/abilities/condition/common/EnchantedCreatureSubtypeCondition.java b/Mage/src/main/java/mage/abilities/condition/common/EnchantedCreatureSubtypeCondition.java index 434dcc8359..5aaf26241a 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/EnchantedCreatureSubtypeCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/EnchantedCreatureSubtypeCondition.java @@ -26,11 +26,10 @@ public class EnchantedCreatureSubtypeCondition implements Condition { Permanent enchantment = game.getPermanent(source.getSourceId()); if (enchantment != null) { Permanent creature = game.getPermanent(enchantment.getAttachedTo()); - if (creature != null) { - if (filter.match(creature, source.getSourceId(), enchantment.getControllerId(), game)) { - return true; - } + if (filter.match(creature, source.getSourceId(), enchantment.getControllerId(), game)) { + return true; } + } return false; } diff --git a/Mage/src/main/java/mage/abilities/condition/common/SourceMatchesFilterCondition.java b/Mage/src/main/java/mage/abilities/condition/common/SourceMatchesFilterCondition.java index ef760a3619..cfacae4ec2 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/SourceMatchesFilterCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/SourceMatchesFilterCondition.java @@ -29,11 +29,10 @@ public class SourceMatchesFilterCondition implements Condition { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId()); - if (permanent != null) { - if (FILTER.match(permanent, permanent.getId(), permanent.getControllerId(), game)) { - return true; - } + if (FILTER.match(permanent, permanent.getId(), permanent.getControllerId(), game)) { + return true; } + return false; } diff --git a/Mage/src/main/java/mage/abilities/condition/common/SourceTargetsPermanentCondition.java b/Mage/src/main/java/mage/abilities/condition/common/SourceTargetsPermanentCondition.java index b4e3697752..545518e6ef 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/SourceTargetsPermanentCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/SourceTargetsPermanentCondition.java @@ -30,7 +30,7 @@ public class SourceTargetsPermanentCondition implements Condition { Iterator targets = sourceSpell.getStackAbility().getTargets().iterator(); while (targets.hasNext()) { Permanent permanent = game.getPermanentOrLKIBattlefield(targets.next().getFirstTarget()); - if (permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) { + if (filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttackingCreatureCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttackingCreatureCount.java index 5b19df74a5..315505335a 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttackingCreatureCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttackingCreatureCount.java @@ -48,7 +48,7 @@ public class AttackingCreatureCount implements DynamicValue { for (UUID permId : combatGroup.getAttackers()) { if (filter != null) { Permanent attacker = game.getPermanent(permId); - if (attacker != null && filter.match(attacker, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game)) { + if (filter.match(attacker, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game)) { count++; } } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredControlledEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredControlledEffect.java index 0098e281b7..1db6300d9f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredControlledEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredControlledEffect.java @@ -67,7 +67,7 @@ public class CantBeCounteredControlledEffect extends ContinuousRuleModifyingEffe return true; } else { MageObject sourceObject = game.getObject(event.getSourceId()); - if (sourceObject != null && filterSource.match(sourceObject, game)) { + if (filterSource.match(sourceObject, game)) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java index f739244429..a2c34d6fc8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java @@ -76,7 +76,7 @@ public class CantBeTargetedAllEffect extends ContinuousRuleModifyingEffectImpl { } else { sourceObject = stackObject; } - if (sourceObject != null && filterSource.match(sourceObject, game)) { + if (filterSource.match(sourceObject, game)) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java index 8d7fb405e8..69a35c9f43 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java @@ -57,7 +57,7 @@ public class CantBeTargetedSourceEffect extends ContinuousRuleModifyingEffectImp } else { sourceObject = stackObject; } - if (sourceObject != null && filterSource.match(sourceObject, game)) { + if (filterSource.match(sourceObject, game)) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java index f078990566..cdcb1f4080 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java @@ -69,7 +69,7 @@ public class CantBeTargetedTargetEffect extends ContinuousRuleModifyingEffectImp } else { sourceObject = stackObject; } - if (sourceObject != null && filterSource.match(sourceObject, game)) { + if (filterSource.match(sourceObject, game)) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/GainActivatedAbilitiesOfTopCardEffect.java b/Mage/src/main/java/mage/abilities/effects/common/GainActivatedAbilitiesOfTopCardEffect.java index 2ea7fe132c..decdcd9ac5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/GainActivatedAbilitiesOfTopCardEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/GainActivatedAbilitiesOfTopCardEffect.java @@ -38,7 +38,7 @@ public class GainActivatedAbilitiesOfTopCardEffect extends ContinuousEffectImpl Player player = game.getPlayer(source.getControllerId()); if (player != null) { Card card = player.getLibrary().getFromTop(game); - if (card != null && filter.match(card, game)) { + if (filter.match(card, game)) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { for (Ability ability : card.getAbilities(game)) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PermanentsEnterBattlefieldTappedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PermanentsEnterBattlefieldTappedEffect.java index 71f8d18d96..65e815fdd3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PermanentsEnterBattlefieldTappedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PermanentsEnterBattlefieldTappedEffect.java @@ -55,7 +55,7 @@ public class PermanentsEnterBattlefieldTappedEffect extends ReplacementEffectImp public boolean applies(GameEvent event, Ability source, Game game) { Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); - return permanent != null && filter.match(permanent, source.getSourceId(), event.getPlayerId(), game); + return filter.match(permanent, source.getSourceId(), event.getPlayerId(), game); } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageByAllPermanentsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageByAllPermanentsEffect.java index 24922cae10..58d7564d4d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageByAllPermanentsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageByAllPermanentsEffect.java @@ -55,7 +55,7 @@ public class PreventAllDamageByAllPermanentsEffect extends PreventionEffectImpl return true; } Permanent permanent = game.getPermanent(damageEvent.getSourceId()); - if (permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) { + if (filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java index 533c336d4e..dddb343176 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java @@ -72,7 +72,7 @@ public class RevealCardsFromLibraryUntilEffect extends OneShotEffect { if (card != null) { cards.add(card); } - } while (library.hasCards() && card != null && !filter.match(card, game)); + } while (library.hasCards() && !filter.match(card, game)); // reveal cards if (!cards.isEmpty()) { controller.revealCards(sourceObject.getIdName(), cards, game); diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CanAttackAsThoughItDidntHaveDefenderAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CanAttackAsThoughItDidntHaveDefenderAllEffect.java index d3b865179d..a7c1dbffe2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CanAttackAsThoughItDidntHaveDefenderAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CanAttackAsThoughItDidntHaveDefenderAllEffect.java @@ -48,8 +48,7 @@ public class CanAttackAsThoughItDidntHaveDefenderAllEffect extends AsThoughEffec @Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { Permanent permanent = game.getPermanent(objectId); - return permanent != null - && filter.match(permanent, source.getSourceId(), source.getControllerId(), game); + return filter.match(permanent, source.getSourceId(), source.getControllerId(), game); } private String getText() { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/ExchangeControlTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/ExchangeControlTargetEffect.java index 2f780e7dd0..2394f9dab5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/ExchangeControlTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/ExchangeControlTargetEffect.java @@ -129,7 +129,7 @@ public class ExchangeControlTargetEffect extends ContinuousEffectImpl { filter.add(SubType.AURA.getPredicate()); for (UUID attachmentId : new HashSet<>(permanent.getAttachments())) { Permanent attachment = game.getPermanent(attachmentId); - if (attachment != null && filter.match(attachment, game)) { + if (filter.match(attachment, game)) { attachment.destroy(source, game, false); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledSpellsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledSpellsEffect.java index 179d8194ff..d6f8aa2acd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledSpellsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledSpellsEffect.java @@ -78,7 +78,7 @@ public class GainAbilityControlledSpellsEffect extends ContinuousEffectImpl { && !stackObject.isCopy() && stackObject.isControlledBy(source.getControllerId())) { Card card = game.getCard(stackObject.getSourceId()); - if (card != null && filter.match(card, game)) { + if (filter.match(card, game)) { game.getState().addOtherAbility(card, ability); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostIncreasingAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostIncreasingAllEffect.java index 35158e68c6..543d7d4ca8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostIncreasingAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostIncreasingAllEffect.java @@ -124,7 +124,7 @@ public class SpellsCostIncreasingAllEffect extends CostModificationEffectImpl { // get playable and other staff without put on stack // used at least for flashback ability because Flashback ability doesn't use stack Card sourceCard = game.getCard(abilityToModify.getSourceId()); - return sourceCard != null && this.filter.match(sourceCard, game); + return this.filter.match(sourceCard, game); } } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostModificationThatTargetSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostModificationThatTargetSourceEffect.java index e8fbeb1c1d..975420979d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostModificationThatTargetSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostModificationThatTargetSourceEffect.java @@ -113,7 +113,7 @@ public class SpellsCostModificationThatTargetSourceEffect extends CostModificati } Card spellCard = ((SpellAbility) abilityToModify).getCharacteristics(game); - if (spellCard == null || !this.spellFilter.match(spellCard, game)) { + if (!this.spellFilter.match(spellCard, game)) { return false; } diff --git a/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java b/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java index 74065dba28..a39e9d95cf 100644 --- a/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java +++ b/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java @@ -73,7 +73,7 @@ class SpellCastManaCondition extends ManaCondition implements Condition { } else if (object instanceof Commander) { spell = new Spell(((Commander) object).getSourceObject(), (SpellAbility) source, source.getControllerId(), game.getState().getZone(source.getSourceId()), game); } - return spell != null && filter.match(spell, source.getSourceId(), source.getControllerId(), game); + return filter.match(spell, source.getSourceId(), source.getControllerId(), game); } } return false; diff --git a/Mage/src/main/java/mage/filter/FilterPermanent.java b/Mage/src/main/java/mage/filter/FilterPermanent.java index 63ec4379e3..f7d4e9759a 100644 --- a/Mage/src/main/java/mage/filter/FilterPermanent.java +++ b/Mage/src/main/java/mage/filter/FilterPermanent.java @@ -52,7 +52,7 @@ public class FilterPermanent extends FilterObject implements FilterIn @Override public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) { - if (!permanent.isPhasedIn() || !this.match(permanent, game)) { + if (!this.match(permanent, game) || !permanent.isPhasedIn()) { return false; } diff --git a/Mage/src/main/java/mage/filter/predicate/mageobject/TargetsPermanentPredicate.java b/Mage/src/main/java/mage/filter/predicate/mageobject/TargetsPermanentPredicate.java index 5b6cfe3714..fd16aea94b 100644 --- a/Mage/src/main/java/mage/filter/predicate/mageobject/TargetsPermanentPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/mageobject/TargetsPermanentPredicate.java @@ -35,7 +35,7 @@ public class TargetsPermanentPredicate implements ObjectSourcePlayerPredicate { public boolean apply(Permanent input, Game game) { UUID attachedTo = input.getAttachedTo(); Permanent permanent = game.getPermanent(attachedTo); - return permanent != null && filter.match(permanent, game); + return filter.match(permanent, game); } @Override diff --git a/Mage/src/main/java/mage/game/command/emblems/VenserTheSojournerEmblem.java b/Mage/src/main/java/mage/game/command/emblems/VenserTheSojournerEmblem.java index 9a5f0b82bd..9d61680895 100644 --- a/Mage/src/main/java/mage/game/command/emblems/VenserTheSojournerEmblem.java +++ b/Mage/src/main/java/mage/game/command/emblems/VenserTheSojournerEmblem.java @@ -60,7 +60,7 @@ class VenserTheSojournerSpellCastTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (event.getPlayerId().equals(this.getControllerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); - return spell != null && StaticFilters.FILTER_SPELL_A.match(spell, game); + return StaticFilters.FILTER_SPELL_A.match(spell, game); } return false; } diff --git a/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java b/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java index 06d74f100a..ddf68e00b0 100644 --- a/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java @@ -99,7 +99,7 @@ class EdgeOfMalacolEffect extends ContinuousRuleModifyingEffectImpl { return false; } Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent != null && filter.match(permanent, game) && Objects.equals(permanent.getControllerId(), game.getActivePlayerId())) { + if (filter.match(permanent, game) && Objects.equals(permanent.getControllerId(), game.getActivePlayerId())) { UUID oldController = source.getControllerId(); source.setControllerId(game.getActivePlayerId()); Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(2)); diff --git a/Mage/src/main/java/mage/game/command/planes/FeedingGroundsPlane.java b/Mage/src/main/java/mage/game/command/planes/FeedingGroundsPlane.java index f88d7bc3b1..6a7ab373db 100644 --- a/Mage/src/main/java/mage/game/command/planes/FeedingGroundsPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/FeedingGroundsPlane.java @@ -138,7 +138,7 @@ class FeedingGroundsEffect extends CostModificationEffectImpl { } else { // used at least for flashback ability because Flashback ability doesn't use stack Card sourceCard = game.getCard(abilityToModify.getSourceId()); - return sourceCard != null && filter.match(sourceCard, game) && selectedByRuntimeData(sourceCard, source, game); + return filter.match(sourceCard, game) && selectedByRuntimeData(sourceCard, source, game); } } return false; diff --git a/Mage/src/main/java/mage/target/TargetPermanent.java b/Mage/src/main/java/mage/target/TargetPermanent.java index f7fc169675..fbeef9d1f7 100644 --- a/Mage/src/main/java/mage/target/TargetPermanent.java +++ b/Mage/src/main/java/mage/target/TargetPermanent.java @@ -79,7 +79,7 @@ public class TargetPermanent extends TargetObject { public boolean canTarget(UUID controllerId, UUID id, UUID sourceId, Game game, boolean flag) { Permanent permanent = game.getPermanent(id); - return permanent != null && filter.match(permanent, sourceId, controllerId, game); + return filter.match(permanent, sourceId, controllerId, game); } @Override diff --git a/Mage/src/main/java/mage/target/TargetPlayer.java b/Mage/src/main/java/mage/target/TargetPlayer.java index acd77cf0b5..e49673aac1 100644 --- a/Mage/src/main/java/mage/target/TargetPlayer.java +++ b/Mage/src/main/java/mage/target/TargetPlayer.java @@ -141,7 +141,7 @@ public class TargetPlayer extends TargetImpl { @Override public boolean canTarget(UUID id, Game game) { Player player = game.getPlayer(id); - return player != null && filter.match(player, game); + return filter.match(player, game); } @Override diff --git a/Mage/src/main/java/mage/target/TargetSpell.java b/Mage/src/main/java/mage/target/TargetSpell.java index 0fe66adb0a..b959d8697e 100644 --- a/Mage/src/main/java/mage/target/TargetSpell.java +++ b/Mage/src/main/java/mage/target/TargetSpell.java @@ -61,7 +61,7 @@ public class TargetSpell extends TargetObject { return false; } Spell spell = game.getStack().getSpell(id); - return spell != null && filter.match(spell, source.getSourceId(), source.getControllerId(), game); + return filter.match(spell, source.getSourceId(), source.getControllerId(), game); } @Override diff --git a/Mage/src/main/java/mage/target/TargetStackObject.java b/Mage/src/main/java/mage/target/TargetStackObject.java index c0269fca61..11c084fba9 100644 --- a/Mage/src/main/java/mage/target/TargetStackObject.java +++ b/Mage/src/main/java/mage/target/TargetStackObject.java @@ -51,7 +51,7 @@ public class TargetStackObject extends TargetObject { @Override public boolean canTarget(UUID id, Ability source, Game game) { StackObject stackObject = game.getStack().getStackObject(id); - return stackObject != null && filter.match(stackObject, source.getSourceId(), source.getControllerId(), game); + return filter.match(stackObject, source.getSourceId(), source.getControllerId(), game); } @Override diff --git a/Mage/src/main/java/mage/target/common/TargetAnyTarget.java b/Mage/src/main/java/mage/target/common/TargetAnyTarget.java index f5f9f9393d..1fd701564a 100644 --- a/Mage/src/main/java/mage/target/common/TargetAnyTarget.java +++ b/Mage/src/main/java/mage/target/common/TargetAnyTarget.java @@ -62,7 +62,7 @@ public class TargetAnyTarget extends TargetImpl { return filter.match(permanent, game); } Player player = game.getPlayer(id); - return player != null && filter.match(player, game); + return filter.match(player, game); } @Override @@ -88,7 +88,7 @@ public class TargetAnyTarget extends TargetImpl { if (permanent != null) { return filter.match(permanent, game); } - return player != null && filter.match(player, game); + return filter.match(player, game); } /** @@ -143,7 +143,7 @@ public class TargetAnyTarget extends TargetImpl { for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) { Player player = game.getPlayer(playerId); - if (player != null && filter.match(player, game)) { + if (filter.match(player, game)) { count++; if (count >= this.minNumberOfTargets) { return true; @@ -193,7 +193,7 @@ public class TargetAnyTarget extends TargetImpl { for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) { Player player = game.getPlayer(playerId); - if (player != null && filter.match(player, game)) { + if (filter.match(player, game)) { possibleTargets.add(playerId); } } diff --git a/Mage/src/main/java/mage/target/common/TargetCardInHand.java b/Mage/src/main/java/mage/target/common/TargetCardInHand.java index 11520478fc..d60d8a5ad0 100644 --- a/Mage/src/main/java/mage/target/common/TargetCardInHand.java +++ b/Mage/src/main/java/mage/target/common/TargetCardInHand.java @@ -48,7 +48,7 @@ public class TargetCardInHand extends TargetCard { Card card = game.getCard(id); return game.getState().getZone(id) == Zone.HAND && game.getState().getPlayersInRange(getTargetController() == null ? playerId : getTargetController(), game).contains(game.getOwnerId(id)) - && card != null && filter.match(card, game); + && filter.match(card, game); } @Override diff --git a/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java b/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java index 99577565c0..5fa73b53a1 100644 --- a/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java +++ b/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java @@ -90,7 +90,7 @@ public class TargetCardInLibrary extends TargetCard { @Override public boolean canTarget(UUID id, Ability source, Game game) { Card card = game.getPlayer(source.getControllerId()).getLibrary().getCard(id, game); - return card != null && filter.match(card, source.getSourceId(), source.getControllerId(), game); + return filter.match(card, source.getSourceId(), source.getControllerId(), game); } @Override diff --git a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayer.java b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayer.java index a8ef0efe33..8dc7dd5c10 100644 --- a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayer.java +++ b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayer.java @@ -62,7 +62,7 @@ public class TargetCreatureOrPlayer extends TargetImpl { return filter.match(permanent, game); } Player player = game.getPlayer(id); - return player != null && filter.match(player, game); + return filter.match(player, game); } @Override @@ -88,7 +88,7 @@ public class TargetCreatureOrPlayer extends TargetImpl { if (permanent != null) { return filter.match(permanent, game); } - return player != null && filter.match(player, game); + return filter.match(player, game); } /** @@ -139,7 +139,7 @@ public class TargetCreatureOrPlayer extends TargetImpl { int count = 0; for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) { Player player = game.getPlayer(playerId); - if (player != null && filter.match(player, game)) { + if (filter.match(player, game)) { count++; if (count >= this.minNumberOfTargets) { return true; diff --git a/Mage/src/main/java/mage/target/common/TargetDiscard.java b/Mage/src/main/java/mage/target/common/TargetDiscard.java index 0fe0fe718a..63b9eb7a67 100644 --- a/Mage/src/main/java/mage/target/common/TargetDiscard.java +++ b/Mage/src/main/java/mage/target/common/TargetDiscard.java @@ -47,7 +47,7 @@ public class TargetDiscard extends TargetCard { @Override public boolean canTarget(UUID id, Ability source, Game game) { Card card = game.getPlayer(playerId).getHand().get(id, game); - return card != null && filter.match(card, source.getControllerId(), game); + return filter.match(card, source.getControllerId(), game); } @Override diff --git a/Mage/src/main/java/mage/target/common/TargetPermanentAmount.java b/Mage/src/main/java/mage/target/common/TargetPermanentAmount.java index 2556df419d..50b6d967a8 100644 --- a/Mage/src/main/java/mage/target/common/TargetPermanentAmount.java +++ b/Mage/src/main/java/mage/target/common/TargetPermanentAmount.java @@ -51,7 +51,7 @@ public abstract class TargetPermanentAmount extends TargetAmount { @Override public boolean canTarget(UUID objectId, Game game) { Permanent permanent = game.getPermanent(objectId); - return permanent != null && filter.match(permanent, game); + return filter.match(permanent, game); } @Override diff --git a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java index 6a99354f10..40433a2c9a 100644 --- a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java +++ b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java @@ -64,7 +64,7 @@ public class TargetPermanentOrPlayer extends TargetImpl { return filter.match(permanent, game); } Player player = game.getPlayer(id); - return player != null && filter.match(player, game); + return filter.match(player, game); } @Override @@ -102,7 +102,7 @@ public class TargetPermanentOrPlayer extends TargetImpl { if (permanent != null) { return filter.match(permanent, game); } - return player != null && filter.match(player, game); + return filter.match(player, game); } /** @@ -196,7 +196,7 @@ public class TargetPermanentOrPlayer extends TargetImpl { Set possibleTargets = new HashSet<>(); for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) { Player player = game.getPlayer(playerId); - if (player != null && filter.match(player, game)) { + if (filter.match(player, game)) { possibleTargets.add(playerId); } } diff --git a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayerAmount.java b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayerAmount.java index 3971c1aa5c..f6852c4013 100644 --- a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayerAmount.java +++ b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayerAmount.java @@ -54,7 +54,7 @@ public abstract class TargetPermanentOrPlayerAmount extends TargetAmount { return filter.match(permanent, game); } Player player = game.getPlayer(objectId); - return player != null && filter.match(player, game); + return filter.match(player, game); } @Override @@ -83,7 +83,7 @@ public abstract class TargetPermanentOrPlayerAmount extends TargetAmount { if (permanent != null) { return filter.match(permanent, game); } - return player != null && filter.match(player, game); + return filter.match(player, game); } @Override diff --git a/Mage/src/main/java/mage/target/common/TargetPermanentOrSuspendedCard.java b/Mage/src/main/java/mage/target/common/TargetPermanentOrSuspendedCard.java index 50e37b7300..186d5bc6b3 100644 --- a/Mage/src/main/java/mage/target/common/TargetPermanentOrSuspendedCard.java +++ b/Mage/src/main/java/mage/target/common/TargetPermanentOrSuspendedCard.java @@ -118,7 +118,7 @@ public class TargetPermanentOrSuspendedCard extends TargetImpl { return filter.match(permanent, game); } Card card = game.getExile().getCard(id, game); - return card != null && filter.match(card, game); + return filter.match(card, game); } @Override @@ -134,7 +134,7 @@ public class TargetPermanentOrSuspendedCard extends TargetImpl { } } Card card = game.getExile().getCard(id, game); - return card != null && filter.match(card, game); + return filter.match(card, game); } @Override diff --git a/Mage/src/main/java/mage/target/common/TargetSpellOrPermanent.java b/Mage/src/main/java/mage/target/common/TargetSpellOrPermanent.java index 7bab1da97c..3578c44ffc 100644 --- a/Mage/src/main/java/mage/target/common/TargetSpellOrPermanent.java +++ b/Mage/src/main/java/mage/target/common/TargetSpellOrPermanent.java @@ -80,7 +80,7 @@ public class TargetSpellOrPermanent extends TargetImpl { return filter.match(permanent, game); } Spell spell = game.getStack().getSpell(id); - return spell != null && filter.match(spell, game); + return filter.match(spell, game); } @Override