forked from External/mage
remove redundant null checks, remove some static fields
This commit is contained in:
parent
05dcfeaaa1
commit
a0e54fbb7b
21 changed files with 84 additions and 104 deletions
|
|
@ -88,10 +88,8 @@ class DrawCardsActivePlayerEffect extends OneShotEffect {
|
|||
if (cPlane == null) {
|
||||
return false;
|
||||
}
|
||||
if (cPlane != null) {
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Academy at Tolaria West")) {
|
||||
return false;
|
||||
}
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Academy at Tolaria West")) {
|
||||
return false;
|
||||
}
|
||||
Player player = game.getPlayer(game.getActivePlayerId());
|
||||
if (player != null) {
|
||||
|
|
|
|||
|
|
@ -81,10 +81,8 @@ class AstralArenaAttackRestrictionEffect extends RestrictionEffect {
|
|||
if (cPlane == null) {
|
||||
return false;
|
||||
}
|
||||
if (cPlane != null) {
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Astral Arena")) {
|
||||
return false;
|
||||
}
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Astral Arena")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -118,10 +116,8 @@ class AstralArenaBlockRestrictionEffect extends RestrictionEffect {
|
|||
if (cPlane == null) {
|
||||
return false;
|
||||
}
|
||||
if (cPlane != null) {
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Astral Arena")) {
|
||||
return false;
|
||||
}
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Astral Arena")) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,10 +101,8 @@ class EdgeOfMalacolEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
if (cPlane == null) {
|
||||
return false;
|
||||
}
|
||||
if (cPlane != null) {
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Edge of Malacol")) {
|
||||
return false;
|
||||
}
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Edge of Malacol")) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && filter.match(permanent, game) && Objects.equals(permanent.getControllerId(), game.getActivePlayerId())) {
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class FeedingGroundsEffect extends CostModificationEffectImpl {
|
|||
new ColorPredicate(ObjectColor.GREEN)));
|
||||
}
|
||||
|
||||
private static final String rule = "Red spells cost {1} less to cast. Green spells cost {1} less to cast.";
|
||||
private static final String rule = "Red spells cost {1} less to cast. Green spells cost {1} less to cast.";
|
||||
private int amount = 1;
|
||||
|
||||
public FeedingGroundsEffect() {
|
||||
|
|
@ -133,19 +133,17 @@ class FeedingGroundsEffect extends CostModificationEffectImpl {
|
|||
if (cPlane == null) {
|
||||
return false;
|
||||
}
|
||||
if (cPlane != null) {
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Feeding Grounds")) {
|
||||
return false;
|
||||
}
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Feeding Grounds")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
|
||||
if (spell != null) {
|
||||
return this.filter.match(spell, game) && selectedByRuntimeData(spell, source, game);
|
||||
return filter.match(spell, game) && selectedByRuntimeData(spell, source, game);
|
||||
} else {
|
||||
// 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) && selectedByRuntimeData(sourceCard, source, game);
|
||||
return sourceCard != null && filter.match(sourceCard, game) && selectedByRuntimeData(sourceCard, source, game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -95,10 +95,8 @@ class HedronFieldsOfAgadeemRestrictionEffect extends RestrictionEffect {
|
|||
if (cPlane == null) {
|
||||
return false;
|
||||
}
|
||||
if (cPlane != null) {
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Hedron Fields of Agadeem")) {
|
||||
return false;
|
||||
}
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Hedron Fields of Agadeem")) {
|
||||
return false;
|
||||
}
|
||||
return filter.match(permanent, source.getSourceId(), source.getControllerId(), game);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,10 +87,8 @@ class TheEonFogSkipUntapStepEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
if (cPlane == null) {
|
||||
return false;
|
||||
}
|
||||
if (cPlane != null) {
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - The Eon Fog")) {
|
||||
return false;
|
||||
}
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - The Eon Fog")) {
|
||||
return false;
|
||||
}
|
||||
return event.getType() == GameEvent.EventType.UNTAP_STEP;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,10 +86,8 @@ class TheGreatForestCombatDamageRuleEffect extends ContinuousEffectImpl {
|
|||
if (cPlane == null) {
|
||||
return false;
|
||||
}
|
||||
if (cPlane != null) {
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - The Great Forest")) {
|
||||
return false;
|
||||
}
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - The Great Forest")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Change the rule
|
||||
|
|
|
|||
|
|
@ -101,10 +101,8 @@ class TrailOfTheMageRingsReboundEffect extends ContinuousEffectImpl {
|
|||
if (cPlane == null) {
|
||||
return false;
|
||||
}
|
||||
if (cPlane != null) {
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Trail of the Mage-Rings")) {
|
||||
return false;
|
||||
}
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Trail of the Mage-Rings")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (UUID playerId : game.getPlayers().keySet()) {
|
||||
|
|
|
|||
|
|
@ -114,19 +114,17 @@ class TurriIslandEffect extends CostModificationEffectImpl {
|
|||
if (cPlane == null) {
|
||||
return false;
|
||||
}
|
||||
if (cPlane != null) {
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Turri Island")) {
|
||||
return false;
|
||||
}
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Turri Island")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
|
||||
if (spell != null) {
|
||||
return this.filter.match(spell, game) && selectedByRuntimeData(spell, source, game);
|
||||
return filter.match(spell, game) && selectedByRuntimeData(spell, source, game);
|
||||
} else {
|
||||
// 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) && selectedByRuntimeData(sourceCard, source, game);
|
||||
return sourceCard != null && filter.match(sourceCard, game) && selectedByRuntimeData(sourceCard, source, game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -96,10 +96,8 @@ class UndercityReachesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (cPlane == null) {
|
||||
return false;
|
||||
}
|
||||
if (cPlane != null) {
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Undercity Reaches")) {
|
||||
return false;
|
||||
}
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Undercity Reaches")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (((DamagedPlayerEvent) event).isCombatDamage()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue