From 70248cdd2b0d44888aa5190ed813620c9750532c Mon Sep 17 00:00:00 2001 From: xenohedron Date: Sat, 20 May 2023 20:53:38 -0400 Subject: [PATCH] Fix text generation for default duration rule at end --- .../BecomesCreatureSourceEffect.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java index 5dd4f10f941..3d356f925ed 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java @@ -20,6 +20,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements protected boolean loseAbilities; protected DynamicValue power = null; protected DynamicValue toughness = null; + protected boolean durationRuleAtStart = false; // put duration rule at the start of the rules text rather than the end public BecomesCreatureSourceEffect(Token token, String theyAreStillType, Duration duration) { this(token, theyAreStillType, duration, false, false); @@ -59,6 +60,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements if (effect.toughness != null) { this.toughness = effect.toughness.copy(); } + this.durationRuleAtStart = effect.durationRuleAtStart; } @Override @@ -145,11 +147,22 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements } private void setText() { - if (theyAreStillType != null && !theyAreStillType.isEmpty()) { - staticText = duration.toString() + ", {this} becomes a " + token.getDescription() + " that's still a " + this.theyAreStillType; - } else { - staticText = duration.toString() + ", {this} becomes a " + token.getDescription(); + StringBuilder sb = new StringBuilder(); + if (!duration.toString().isEmpty() && durationRuleAtStart) { + sb.append(duration.toString()); + sb.append(", "); } + sb.append("{this} becomes a "); + sb.append(token.getDescription()); + if (!duration.toString().isEmpty() && !durationRuleAtStart) { + sb.append(" "); + sb.append(duration.toString()); + } + if (theyAreStillType != null && !theyAreStillType.isEmpty()) { + sb.append(". It's still a "); + sb.append(theyAreStillType); + } + staticText = sb.toString(); } @Override