remove explicit null checks, match(..) checks on null itself by instanceof calls

This commit is contained in:
Ingmar Goudt 2021-04-28 20:53:42 +02:00
parent b4d806211c
commit 96d026e4af
77 changed files with 97 additions and 104 deletions

View file

@ -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;
}

View file

@ -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));

View file

@ -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;