From b51b5272b3887aad053220f21c3693261e358567 Mon Sep 17 00:00:00 2001 From: etpalmer63 Date: Fri, 8 May 2020 11:50:19 -0700 Subject: [PATCH] cleaned up comments and spacing --- .../BeginningOfEndStepTriggeredAbility.java | 10 +---- .../BeginningOfUpkeepTriggeredAbility.java | 10 ++--- .../java/mage/abilities/effects/Effects.java | 43 +++---------------- .../counter/DistributeCountersEffect.java | 8 ++-- 4 files changed, 15 insertions(+), 56 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/common/BeginningOfEndStepTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BeginningOfEndStepTriggeredAbility.java index 7d5fadecda..506780c395 100644 --- a/Mage/src/main/java/mage/abilities/common/BeginningOfEndStepTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/BeginningOfEndStepTriggeredAbility.java @@ -104,8 +104,6 @@ public class BeginningOfEndStepTriggeredAbility extends TriggeredAbilityImpl { public String getRule() { StringBuilder sb = new StringBuilder(getEffects().getText(modes.getMode())); - System.out.printf("Beg.OfEndStep getRule called:: ", sb); - if (this.optional) { if (sb.substring(0, 6).toLowerCase(Locale.ENGLISH).equals("target")) { sb.insert(0, "you may have "); @@ -118,9 +116,6 @@ public class BeginningOfEndStepTriggeredAbility extends TriggeredAbilityImpl { abilityWordRule = "" + abilityWord.toString() + " &mdash "; } - System.out.printf("Beg.OfEndStep getRule called:: ", sb); - - switch (targetController) { case YOU: return sb.insert(0, generateConditionString()).insert(0, abilityWordRule + "At the beginning of your end step, ").toString(); @@ -144,16 +139,15 @@ public class BeginningOfEndStepTriggeredAbility extends TriggeredAbilityImpl { System.out.println("GenCondString called"); if (interveningIfClauseCondition != null) { if (interveningIfClauseCondition.toString().startsWith("if")) { - //System.out.println("GenCondString called 2"); - //System.out.println(interveningIfClauseCondition.toString()); + //Fixes punctuation on multiple sentence if, then construction + // see -- Colfenor's Urn if (interveningIfClauseCondition.toString().endsWith(".")){ return interveningIfClauseCondition.toString() + " "; } return interveningIfClauseCondition.toString() + ", "; } else { - //System.out.println("GenCondString called 3"); return "if {this} is " + interveningIfClauseCondition.toString() + ", "; } } diff --git a/Mage/src/main/java/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java index d0c6cb7b39..b252b77d83 100644 --- a/Mage/src/main/java/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java @@ -133,15 +133,15 @@ public class BeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl { sb.insert(0, "you may "); } } - return sb.insert(0, generateZoneString()).insert(0, "at the beginning of your upkeep, ").toString(); //removed captialization + return sb.insert(0, generateZoneString()).insert(0, "at the beginning of your upkeep, ").toString(); //removed capitalization case OPPONENT: - return sb.insert(0, generateZoneString()).insert(0, "at the beginning of each opponent's upkeep, ").toString(); //removed captialization + return sb.insert(0, generateZoneString()).insert(0, "at the beginning of each opponent's upkeep, ").toString(); //removed capitalization case ANY: - return sb.insert(0, generateZoneString()).insert(0, "at the beginning of each upkeep, ").toString(); //removed captialization + return sb.insert(0, generateZoneString()).insert(0, "at the beginning of each upkeep, ").toString(); //removed capitalization case ACTIVE: - return sb.insert(0, generateZoneString()).insert(0, "at the beginning of each player's upkeep, ").toString(); //removed captialization + return sb.insert(0, generateZoneString()).insert(0, "at the beginning of each player's upkeep, ").toString(); //removed capitalization case CONTROLLER_ATTACHED_TO: - return sb.insert(0, generateZoneString()).insert(0, "at the beginning of the upkeep of enchanted creature's controller, ").toString(); //removed captialization + return sb.insert(0, generateZoneString()).insert(0, "at the beginning of the upkeep of enchanted creature's controller, ").toString(); //removed capitalization } return ""; } diff --git a/Mage/src/main/java/mage/abilities/effects/Effects.java b/Mage/src/main/java/mage/abilities/effects/Effects.java index 0f904ab4bb..8636cb984f 100644 --- a/Mage/src/main/java/mage/abilities/effects/Effects.java +++ b/Mage/src/main/java/mage/abilities/effects/Effects.java @@ -37,7 +37,6 @@ public class Effects extends ArrayList { } public String getText(Mode mode) { - System.out.println(" -- getText method called -- "); StringBuilder sbText = new StringBuilder(); String lastRule = null; int effectNum = 0; @@ -45,12 +44,6 @@ public class Effects extends ArrayList { String endString = ""; String nextRule = effect.getText(mode); - System.out.printf("Effect Num: %d\n", effectNum); - System.out.print("nextRule from Effects - getText:: "); - System.out.println(nextRule); - System.out.print("lastRule from Effects - getText:: "); - System.out.println(lastRule); - // ignore empty rules if (nextRule == null || nextRule.isEmpty()) { continue; @@ -59,37 +52,30 @@ public class Effects extends ArrayList { // concat effects (default: each effect with a new sentence) String concatPrefix = effect.getConcatPrefix(); - System.out.print("concatPrefix:"); - System.out.println(concatPrefix); if (effectNum > 1 && !concatPrefix.isEmpty() && !concatPrefix.equals(".")) { nextRule = concatPrefix + " " + nextRule; - System.out.println("Catch 1!!"); } if (nextRule != null) { + //check if nextRule is a new sentence or not. if (nextRule.startsWith("and ") || nextRule.startsWith("with ") || nextRule.startsWith("then ")) { endString = " "; - System.out.println("Catch 2!!"); } else if (nextRule.startsWith(",") || nextRule.startsWith(" ")) { endString = ""; - System.out.println("Catch 3!!"); + // nextRule determined to be a new sentence, now check ending of lastRule } else if (lastRule != null && lastRule.length() > 3) { - System.out.println("Catch 4!!"); - //check if lastRule already has appropriate punctuation, if so, add a space + //check if lastRule already has appropriate punctuation, if so, add a space. if (lastRule.endsWith(".\"") || lastRule.endsWith(".)") || lastRule.endsWith(".)") || lastRule.endsWith(".")){ endString = " "; - System.out.println("Catch 9!!"); // if lastRule does not have appropriate punctuation, add the default ". " } else if (!lastRule.endsWith(".") && !lastRule.endsWith("
")) { endString = ". "; - System.out.println("Catch 5!!"); } if (nextRule.length() > 3) { - System.out.println("Catch 6!!"); nextRule = Character.toUpperCase(nextRule.charAt(0)) + nextRule.substring(1); } } @@ -97,35 +83,21 @@ public class Effects extends ArrayList { String currentRule = endString + nextRule; // fix dot in the combined effect like IfDoCost if (sbText.length() > 0 && currentRule.length() > 0) { - System.out.println("Catch 7!!"); boolean prevTextEndsWithDot = sbText.charAt(sbText.length() - 1) == '.'; boolean currentTextStartsWithDot = currentRule.startsWith(",") || currentRule.startsWith("."); if (prevTextEndsWithDot && currentTextStartsWithDot) { - System.out.println("Catch 8!!"); sbText.delete(sbText.length() - 1, sbText.length()); } - - /* - if (!prevTextEndsWithDot){ - System.out.println("Catch 10!!"); - currentRule = currentRule + "."; - } - */ } - - sbText.append(currentRule); } + lastRule = nextRule; - - - - } - //add punctuation to last line + //add punctuation to very last rule. if (lastRule != null && lastRule.length() > 3 && !lastRule.endsWith(".") && !lastRule.endsWith("\"") @@ -135,13 +107,8 @@ public class Effects extends ArrayList { sbText.append('.'); } - - System.out.print("sbText from Effects - getText ::"); - System.out.println(sbText); - return sbText.toString(); - } public boolean hasOutcome(Ability source, Outcome outcome) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java index e4e1edd426..f6f004fcac 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java @@ -76,12 +76,10 @@ public class DistributeCountersEffect extends OneShotEffect { } String name = counterType.getName(); - //String text = "distribute " + CardUtil.numberToText(amount) + ' ' + name + " counters among " + targetDescription + '.'; - //removed punctuation - String text = "distribute " + CardUtil.numberToText(amount) + ' ' + name + " counters among " + targetDescription; + String text = "distribute " + CardUtil.numberToText(amount) + ' ' + name + " counters among " + targetDescription; //removed punctuation if (removeAtEndOfTurn) { text += " For each " + name + " counter you put on a creature this way, remove a " - + name + " counter from that creature at the beginning of the next cleanup step."; //should this period be removed? + + name + " counter from that creature at the beginning of the next cleanup step."; } return text; } @@ -96,7 +94,7 @@ class RemoveCountersAtEndOfTurn extends OneShotEffect { this.counterType = counterType; String name = counterType.getName(); staticText = "For each " + name + " counter you put on a creature this way, remove a " - + name + " counter from that creature at the beginning of the next cleanup step."; //should this period be removed? + + name + " counter from that creature at the beginning of the next cleanup step."; } public RemoveCountersAtEndOfTurn(final RemoveCountersAtEndOfTurn effect) {