From d0fa00f3afd3bd592916f514ab3f5a4c4c8880de Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Sun, 19 Feb 2017 23:58:32 +0100 Subject: [PATCH] put the writing of equipped and enchanted in the attachmenttype --- .../common/AttacksAttachedTriggeredAbility.java | 6 +----- .../common/CantBeTargetedAttachedEffect.java | 8 ++------ .../effects/common/RegenerateAttachedEffect.java | 10 ++-------- .../common/combat/AttacksIfAbleAttachedEffect.java | 6 +----- .../common/combat/BlocksIfAbleAttachedEffect.java | 7 +------ .../combat/CanBlockOnlyFlyingAttachedEffect.java | 7 +------ .../combat/CantAttackAloneAttachedEffect.java | 6 +----- .../common/combat/CantAttackAttachedEffect.java | 6 +----- .../combat/CantAttackBlockAttachedEffect.java | 7 +------ .../CantAttackBlockUnlessPaysAttachedEffect.java | 4 ++-- .../combat/CantAttackControllerAttachedEffect.java | 6 +----- .../combat/CantAttackUnlessPaysAttachedEffect.java | 4 ++-- .../common/combat/CantBeBlockedAttachedEffect.java | 6 +----- .../CantBeBlockedByCreaturesAttachedEffect.java | 11 +++-------- .../combat/CantBeBlockedByOneAttachedEffect.java | 2 +- .../common/combat/CantBlockAttachedEffect.java | 7 ++----- .../combat/MustBeBlockedByAllAttachedEffect.java | 6 +++--- .../continuous/AddCardColorAttachedEffect.java | 6 +----- .../continuous/AddCardSubtypeAttachedEffect.java | 5 +---- .../continuous/AddCardTypeAttachedEffect.java | 6 +----- .../continuous/GainAbilityAttachedEffect.java | 6 +----- .../continuous/LoseAbilityAttachedEffect.java | 6 +----- .../continuous/SetCardColorAttachedEffect.java | 6 +----- .../continuous/SetCardSubtypeAttachedEffect.java | 8 ++------ .../main/java/mage/constants/AttachmentType.java | 14 ++++++++++++-- 25 files changed, 46 insertions(+), 120 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/common/AttacksAttachedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/AttacksAttachedTriggeredAbility.java index 97c5d2ac80..0efaa22f9c 100644 --- a/Mage/src/main/java/mage/abilities/common/AttacksAttachedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/AttacksAttachedTriggeredAbility.java @@ -88,11 +88,7 @@ public class AttacksAttachedTriggeredAbility extends TriggeredAbilityImpl { @Override public String getRule() { StringBuilder sb = new StringBuilder("Whenever "); - if (attachmentType.equals(AttachmentType.EQUIPMENT)) { - sb.append("equipped"); - } else { - sb.append("enchanted"); - } + sb.append(attachmentType.verb().toLowerCase()); return sb.append(" creature attacks, ").append(super.getRule()).toString(); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java index e4d0498e14..507910fc0e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java @@ -109,16 +109,12 @@ public class CantBeTargetedAttachedEffect extends ContinuousRuleModifyingEffectI return staticText; } StringBuilder sb = new StringBuilder(); - if (attachmentType.equals(AttachmentType.AURA)) { - sb.append("Enchanted creature"); - } else { - sb.append("Equipped creature"); - } + sb.append(attachmentType.verb() + " creature"); sb.append(" can't be the target of "); sb.append(filterSource.getMessage()); if (!duration.toString().isEmpty()) { sb.append(' '); - if (duration.equals(Duration.EndOfTurn)) { + if (duration == Duration.EndOfTurn) { sb.append("this turn"); } else { sb.append(duration.toString()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/RegenerateAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RegenerateAttachedEffect.java index ce6fd70fc1..2bf62a4b5b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RegenerateAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RegenerateAttachedEffect.java @@ -40,7 +40,6 @@ import mage.game.events.GameEvent; import mage.game.permanent.Permanent; /** - * * @author jeff */ public class RegenerateAttachedEffect extends ReplacementEffectImpl { @@ -102,13 +101,8 @@ public class RegenerateAttachedEffect extends ReplacementEffectImpl { } return false; } + private void setText() { - StringBuilder sb = new StringBuilder(); - if (attachmentType == AttachmentType.AURA) { - sb.append("Regenerate enchanted creature"); - } else if (attachmentType == AttachmentType.EQUIPMENT) { - sb.append("Regenerate equipped creature"); - } - staticText = sb.toString(); + staticText = "Regenerate " + attachmentType.verb().toLowerCase() + " creature"; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/AttacksIfAbleAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/AttacksIfAbleAttachedEffect.java index db8b62ba53..9dac0b88ef 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/AttacksIfAbleAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/AttacksIfAbleAttachedEffect.java @@ -44,11 +44,7 @@ public class AttacksIfAbleAttachedEffect extends RequirementEffect { public AttacksIfAbleAttachedEffect(Duration duration, AttachmentType attachmentType) { super(duration); - if (attachmentType == AttachmentType.AURA) { - this.staticText = "Enchanted creature attacks each turn if able"; - } else { - this.staticText = "Equipped creature attacks each turn if able"; - } + this.staticText = attachmentType.verb() + " creature attacks each turn if able"; } public AttacksIfAbleAttachedEffect(final AttacksIfAbleAttachedEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/BlocksIfAbleAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/BlocksIfAbleAttachedEffect.java index b6dcc75a19..988c75ff76 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/BlocksIfAbleAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/BlocksIfAbleAttachedEffect.java @@ -36,7 +36,6 @@ import mage.game.Game; import mage.game.permanent.Permanent; /** - * * @author LevelX2 */ @@ -44,11 +43,7 @@ public class BlocksIfAbleAttachedEffect extends RequirementEffect { public BlocksIfAbleAttachedEffect(Duration duration, AttachmentType attachmentType) { super(duration); - if (attachmentType == AttachmentType.AURA) { - this.staticText = "Enchanted creature blocks each turn if able"; - } else { - this.staticText = "Equipped creature blocks each turn if able"; - } + this.staticText = attachmentType.verb() + " creature blocks each turn if able"; } public BlocksIfAbleAttachedEffect(final BlocksIfAbleAttachedEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CanBlockOnlyFlyingAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CanBlockOnlyFlyingAttachedEffect.java index 889acb03ea..27026a5aab 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CanBlockOnlyFlyingAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CanBlockOnlyFlyingAttachedEffect.java @@ -37,7 +37,6 @@ import mage.game.Game; import mage.game.permanent.Permanent; /** - * * @author LevelX2 */ @@ -45,11 +44,7 @@ public class CanBlockOnlyFlyingAttachedEffect extends RestrictionEffect { public CanBlockOnlyFlyingAttachedEffect(AttachmentType attachmentType) { super(Duration.WhileOnBattlefield); - if (attachmentType == AttachmentType.AURA) { - this.staticText = "Enchanted creature can block only creatures with flying"; - } else { - this.staticText = "Equipped creature can block only creatures with flying"; - } + this.staticText = attachmentType.verb() + " creature can block only creatures with flying"; } public CanBlockOnlyFlyingAttachedEffect(final CanBlockOnlyFlyingAttachedEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAloneAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAloneAttachedEffect.java index 55a030d9e4..ec593c1f16 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAloneAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAloneAttachedEffect.java @@ -20,11 +20,7 @@ public class CantAttackAloneAttachedEffect extends RestrictionEffect { public CantAttackAloneAttachedEffect(AttachmentType attachmentType) { super(Duration.WhileOnBattlefield); - if (attachmentType == AttachmentType.AURA) { - this.staticText = "Enchanted creature can't attack alone"; - } else { - this.staticText = "Equipped creature can't attack alone"; - } + this.staticText = attachmentType.verb() + " creature can't attack alone"; } public CantAttackAloneAttachedEffect(final CantAttackAloneAttachedEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAttachedEffect.java index 1bb4ce7527..f2d549aafa 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAttachedEffect.java @@ -44,11 +44,7 @@ public class CantAttackAttachedEffect extends RestrictionEffect { public CantAttackAttachedEffect(AttachmentType attachmentType) { super(Duration.WhileOnBattlefield); - if (attachmentType == AttachmentType.AURA) { - this.staticText = "Enchanted creature can't attack"; - } else { - this.staticText = "Equipped creature can't attack"; - } + this.staticText = attachmentType.verb() + " creature can't attack"; } public CantAttackAttachedEffect(final CantAttackAttachedEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockAttachedEffect.java index 4f1e9be277..ce15c24140 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockAttachedEffect.java @@ -35,18 +35,13 @@ import mage.game.Game; import mage.game.permanent.Permanent; /** - * * @author LevelX2 */ public class CantAttackBlockAttachedEffect extends RestrictionEffect { public CantAttackBlockAttachedEffect(AttachmentType attachmentType) { super(Duration.WhileOnBattlefield); - if (attachmentType == AttachmentType.AURA) { - this.staticText = "Enchanted creature can't attack or block"; - } else { - this.staticText = "Equipped creature can't attack or block"; - } + this.staticText = attachmentType.verb() + " creature can't attack or block"; } public CantAttackBlockAttachedEffect(final CantAttackBlockAttachedEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockUnlessPaysAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockUnlessPaysAttachedEffect.java index df1f936cc1..877fb04854 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockUnlessPaysAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockUnlessPaysAttachedEffect.java @@ -46,8 +46,8 @@ public class CantAttackBlockUnlessPaysAttachedEffect extends PayCostToAttackBloc public CantAttackBlockUnlessPaysAttachedEffect(ManaCosts manaCosts, AttachmentType attachmentType) { super(Duration.WhileOnBattlefield, Outcome.Detriment, RestrictType.ATTACK_AND_BLOCK, manaCosts); - staticText = (attachmentType == AttachmentType.AURA ? "Enchanted " : "Equipped ") - + "creature can't attack or block unless its controller pays " + staticText = attachmentType.verb() + + " creature can't attack or block unless its controller pays " + (manaCosts == null ? "" : manaCosts.getText()); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackControllerAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackControllerAttachedEffect.java index df49c730d0..0a681b2d29 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackControllerAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackControllerAttachedEffect.java @@ -46,11 +46,7 @@ public class CantAttackControllerAttachedEffect extends RestrictionEffect { public CantAttackControllerAttachedEffect(AttachmentType attachmentType) { super(Duration.WhileOnBattlefield); - if (attachmentType == AttachmentType.AURA) { - this.staticText = "Enchanted creature can't attack you or a planeswalker you control"; - } else { - this.staticText = "Equipped creature can't attack you or a planeswalker you control"; - } + this.staticText = attachmentType.verb() + " creature can't attack you or a planeswalker you control"; } public CantAttackControllerAttachedEffect(final CantAttackControllerAttachedEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackUnlessPaysAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackUnlessPaysAttachedEffect.java index 4bfb764f58..9de2c1cd48 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackUnlessPaysAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackUnlessPaysAttachedEffect.java @@ -46,8 +46,8 @@ public class CantAttackUnlessPaysAttachedEffect extends PayCostToAttackBlockEffe public CantAttackUnlessPaysAttachedEffect(ManaCosts manaCosts, AttachmentType attachmentType) { super(Duration.WhileOnBattlefield, Outcome.Detriment, RestrictType.ATTACK, manaCosts); - staticText = (attachmentType == AttachmentType.AURA ? "Enchanted " : "Equipped ") - + "creature can't attack unless its controller pays " + staticText = attachmentType.verb() + + " creature can't attack unless its controller pays " + (manaCosts == null ? "" : manaCosts.getText()); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedAttachedEffect.java index a975bc89f3..862ebd70c1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedAttachedEffect.java @@ -42,11 +42,7 @@ public class CantBeBlockedAttachedEffect extends RestrictionEffect { public CantBeBlockedAttachedEffect(AttachmentType attachmentType) { super(Duration.WhileOnBattlefield); - if (attachmentType == AttachmentType.AURA) { - this.staticText = "Enchanted creature can't be blocked"; - } else { - this.staticText = "Equipped creature can't be blocked"; - } + this.staticText = attachmentType.verb() + " creature can't be blocked"; } public CantBeBlockedAttachedEffect(CantBeBlockedAttachedEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedByCreaturesAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedByCreaturesAttachedEffect.java index c6c5c62472..2e5c8a279a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedByCreaturesAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedByCreaturesAttachedEffect.java @@ -36,7 +36,6 @@ import mage.game.Game; import mage.game.permanent.Permanent; /** - * * @author LevelX2 */ public class CantBeBlockedByCreaturesAttachedEffect extends RestrictionEffect { @@ -47,13 +46,9 @@ public class CantBeBlockedByCreaturesAttachedEffect extends RestrictionEffect { super(duration); this.filter = filter; StringBuilder sb = new StringBuilder(); - if (attachmentType == AttachmentType.AURA) { - sb.append("Enchanted "); - } else { - sb.append("Equipped "); - } - staticText = sb.append("creature can't be blocked ") - .append(filter.getMessage().startsWith("except by") ? "":"by ").append(filter.getMessage()).toString(); + sb.append(attachmentType.verb()); + staticText = sb.append(" creature can't be blocked ") + .append(filter.getMessage().startsWith("except by") ? "" : "by ").append(filter.getMessage()).toString(); } public CantBeBlockedByCreaturesAttachedEffect(final CantBeBlockedByCreaturesAttachedEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedByOneAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedByOneAttachedEffect.java index 76437b0e84..fd5b60d303 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedByOneAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedByOneAttachedEffect.java @@ -54,7 +54,7 @@ public class CantBeBlockedByOneAttachedEffect extends ContinuousEffectImpl { super(duration, Outcome.Benefit); this.amount = amount; this.attachmentType = attachmentType; - staticText = (attachmentType == AttachmentType.AURA ? "Enchanted" : "Equipped") + " creature can't be blocked except by " + amount + " or more creatures"; + staticText = attachmentType.verb() + " creature can't be blocked except by " + amount + " or more creatures"; } public CantBeBlockedByOneAttachedEffect(final CantBeBlockedByOneAttachedEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockAttachedEffect.java index 017cf8991b..76a23da819 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockAttachedEffect.java @@ -56,11 +56,8 @@ public class CantBlockAttachedEffect extends RestrictionEffect { super(duration); this.filter = filter; StringBuilder sb = new StringBuilder(); - if (attachmentType == AttachmentType.AURA) { - sb.append("Enchanted creature can't block"); - } else { - sb.append("Equipped creature can't block"); - } + sb.append(attachmentType.verb()); + sb.append(" creature can't block"); if (!filter.getMessage().equals("creature")) { sb.append(' ').append(filter.getMessage()); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/MustBeBlockedByAllAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/MustBeBlockedByAllAttachedEffect.java index c64e8a662c..24fa94d0b0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/MustBeBlockedByAllAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/MustBeBlockedByAllAttachedEffect.java @@ -29,6 +29,7 @@ package mage.abilities.effects.common.combat; import java.util.UUID; + import mage.constants.AttachmentType; import mage.constants.Duration; import mage.abilities.Ability; @@ -37,7 +38,6 @@ import mage.game.Game; import mage.game.permanent.Permanent; /** - * * @author LevelX2 */ public class MustBeBlockedByAllAttachedEffect extends RequirementEffect { @@ -51,7 +51,7 @@ public class MustBeBlockedByAllAttachedEffect extends RequirementEffect { public MustBeBlockedByAllAttachedEffect(Duration duration, AttachmentType attachmentType) { super(duration); this.attachmentType = attachmentType; - staticText = "All creatures able to block " + (attachmentType.equals(AttachmentType.AURA) ? "enchanted":"equipped") + " creature do so"; + staticText = "All creatures able to block " + attachmentType.verb().toLowerCase() + " creature do so"; } public MustBeBlockedByAllAttachedEffect(final MustBeBlockedByAllAttachedEffect effect) { @@ -84,7 +84,7 @@ public class MustBeBlockedByAllAttachedEffect extends RequirementEffect { public UUID mustBlockAttacker(Ability source, Game game) { Permanent attachment = game.getPermanent(source.getSourceId()); if (attachment != null && attachment.getAttachedTo() != null) { - return attachment.getAttachedTo() ; + return attachment.getAttachedTo(); } return null; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardColorAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardColorAttachedEffect.java index cab6d29e66..538d422096 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardColorAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardColorAttachedEffect.java @@ -84,11 +84,7 @@ public class AddCardColorAttachedEffect extends ContinuousEffectImpl { private void setText() { StringBuilder sb = new StringBuilder(); - if (attachmentType == AttachmentType.AURA) - sb.append("Enchanted"); - else if (attachmentType == AttachmentType.EQUIPMENT) - sb.append("Equipped"); - + sb.append(attachmentType.verb()); sb.append(" creature is a ").append(addedColor.getDescription()).append(" in addition to its colors"); staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardSubtypeAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardSubtypeAttachedEffect.java index 8811d631cc..b22025852c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardSubtypeAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardSubtypeAttachedEffect.java @@ -72,11 +72,8 @@ public class AddCardSubtypeAttachedEffect extends ContinuousEffectImpl { private void setText() { StringBuilder sb = new StringBuilder(); - if (attachmentType == AttachmentType.AURA) - sb.append("Enchanted"); - else if (attachmentType == AttachmentType.EQUIPMENT) - sb.append("Equipped"); + sb.append(attachmentType.verb()); sb.append(" creature becomes ").append(addedSubtype).append(" in addition to its other types"); //TODO add attacked card type detection staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeAttachedEffect.java index 0d42828dd0..2886bdf363 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardTypeAttachedEffect.java @@ -72,11 +72,7 @@ public class AddCardTypeAttachedEffect extends ContinuousEffectImpl { private void setText() { StringBuilder sb = new StringBuilder(); - if (attachmentType == AttachmentType.AURA) - sb.append("Enchanted"); - else if (attachmentType == AttachmentType.EQUIPMENT) - sb.append("Equipped"); - + sb.append(attachmentType.verb()); sb.append(" creature becomes ").append(addedCardType.toString()).append(" in addition to its other types"); //TODO add attacked card type detection staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAttachedEffect.java index 90734de9f2..543c49bab4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAttachedEffect.java @@ -124,11 +124,7 @@ public class GainAbilityAttachedEffect extends ContinuousEffectImpl { private void setText() { StringBuilder sb = new StringBuilder(); - if (attachmentType == AttachmentType.AURA) { - sb.append("Enchanted"); - } else if (attachmentType == AttachmentType.EQUIPMENT) { - sb.append("Equipped"); - } + sb.append(attachmentType.verb()); sb.append(" creature "); if (duration == Duration.WhileOnBattlefield) { sb.append("has "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAttachedEffect.java index 7315dd2005..82fd03fdaa 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAttachedEffect.java @@ -83,11 +83,7 @@ public class LoseAbilityAttachedEffect extends ContinuousEffectImpl { private void setText() { StringBuilder sb = new StringBuilder(); - if (attachmentType == AttachmentType.AURA) { - sb.append("Enchanted"); - } else if (attachmentType == AttachmentType.EQUIPMENT) { - sb.append("Equipped"); - } + sb.append(attachmentType.verb()); sb.append(" creature "); if (duration == Duration.WhileOnBattlefield) { sb.append("loses "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardColorAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardColorAttachedEffect.java index 1de431c2d1..c11f4dcdf3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardColorAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardColorAttachedEffect.java @@ -75,11 +75,7 @@ public class SetCardColorAttachedEffect extends ContinuousEffectImpl { private void setText() { StringBuilder sb = new StringBuilder(); - if (attachmentType == AttachmentType.AURA) - sb.append("Enchanted"); - else if (attachmentType == AttachmentType.EQUIPMENT) - sb.append("Equipped"); - + sb.append(attachmentType.verb()); sb.append(" creature is ").append(setColor.getDescription()); staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java index cb528774c9..f9c06e4bf7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java @@ -29,6 +29,7 @@ package mage.abilities.effects.common.continuous; import java.util.ArrayList; import java.util.List; + import mage.abilities.Ability; import mage.abilities.effects.ContinuousEffectImpl; import mage.cards.repository.CardRepository; @@ -88,12 +89,7 @@ public class SetCardSubtypeAttachedEffect extends ContinuousEffectImpl { private void setText() { StringBuilder sb = new StringBuilder(); - if (attachmentType == AttachmentType.AURA) { - sb.append("Enchanted"); - } else if (attachmentType == AttachmentType.EQUIPMENT) { - sb.append("Equipped"); - } - + sb.append(attachmentType.verb()); sb.append(" creature is a"); for (String subtype : this.setSubtypes) { sb.append(' ').append(subtype); diff --git a/Mage/src/main/java/mage/constants/AttachmentType.java b/Mage/src/main/java/mage/constants/AttachmentType.java index c6a7ece88c..238fe1ca88 100644 --- a/Mage/src/main/java/mage/constants/AttachmentType.java +++ b/Mage/src/main/java/mage/constants/AttachmentType.java @@ -5,6 +5,16 @@ package mage.constants; * @author North */ public enum AttachmentType { - EQUIPMENT, - AURA + EQUIPMENT("Equipped"), + AURA("Enchanted"); + + String verb; + + public String verb(){ + return verb; + } + + AttachmentType(String verb){ + this.verb = verb; + } }