From 8eff633a9c1af5b3e91c8b020c3e238290d9ff45 Mon Sep 17 00:00:00 2001 From: "Alex W. Jackson" Date: Sat, 14 May 2022 09:14:39 -0400 Subject: [PATCH] Remove redundant fields from AffinityForLandTypeAbility --- .../keyword/AffinityForLandTypeAbility.java | 30 ++++++------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/keyword/AffinityForLandTypeAbility.java b/Mage/src/main/java/mage/abilities/keyword/AffinityForLandTypeAbility.java index d12905a4b97..76148c57531 100644 --- a/Mage/src/main/java/mage/abilities/keyword/AffinityForLandTypeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/AffinityForLandTypeAbility.java @@ -13,33 +13,21 @@ import mage.filter.common.FilterControlledPermanent; */ public class AffinityForLandTypeAbility extends SimpleStaticAbility { + private final String rulesText; - private final FilterControlledPermanent filter; - - String text; - SubType landType; - - public AffinityForLandTypeAbility(SubType landType, String text) { - super(Zone.ALL, new AffinityEffect(getFilter(landType))); - this.filter = getFilter(landType); + public AffinityForLandTypeAbility(SubType landType, String pluralName) { + super(Zone.ALL, null); + rulesText = "Affinity for " + pluralName + " (This spell costs {1} less to cast for each " + landType + " you control.)"; setRuleAtTheTop(true); - this.text = text; - this.landType = landType; - - this.addHint(new ValueHint(landType + " you control", new PermanentsOnBattlefieldCount(filter))); - } - - private static FilterControlledPermanent getFilter(SubType landType) { - FilterControlledPermanent affinityfilter = new FilterControlledPermanent(); - affinityfilter.add(landType.getPredicate()); - return affinityfilter; + FilterControlledPermanent filter = new FilterControlledPermanent(landType); + addEffect(new AffinityEffect(filter)); + addHint(new ValueHint(pluralName + " you control", new PermanentsOnBattlefieldCount(filter))); } public AffinityForLandTypeAbility(final AffinityForLandTypeAbility ability) { super(ability); - this.text = ability.text; - this.filter = ability.filter.copy(); + this.rulesText = ability.rulesText; } @Override @@ -49,6 +37,6 @@ public class AffinityForLandTypeAbility extends SimpleStaticAbility { @Override public String getRule() { - return "Affinity for " + text + " (This spell costs 1 less to cast for each " + landType + " you control.)"; + return rulesText; } }