MCPcopy Create free account
hub / github.com/Card-Forge/forge / kickerDesc

Method kickerDesc

forge-game/src/main/java/forge/game/card/Card.java:2771–2806  ·  view source on GitHub ↗
(String keyword, String remText)

Source from the content-addressed store, hash-verified

2769 }
2770
2771 private String kickerDesc(String keyword, String remText) {
2772 final StringBuilder sbx = new StringBuilder();
2773 final String[] n = keyword.split(":");
2774 final Cost cost = new Cost(n[1], false);
2775 final String costStr = cost.toSimpleString();
2776 final boolean manaOnly = cost.isOnlyManaCost();
2777 sbx.append("Kicker").append(manaOnly ? " " + costStr : "—" + costStr + ".");
2778 if (Lists.newArrayList(n).size() > 2) {
2779 sbx.append(" and/or ");
2780 final Cost cost2 = new Cost(n[2], false);
2781 sbx.append(cost2.toSimpleString());
2782 }
2783 if (!manaOnly) {
2784 if (cost.hasNoManaCost()) {
2785 remText = remText.replaceFirst(" pay an additional", "");
2786 remText = remText.replace(remText.charAt(8), Character.toLowerCase(remText.charAt(8)));
2787 } else {
2788 remText = remText.replaceFirst(" an additional", "");
2789 char c = remText.charAt(remText.indexOf(",") + 2);
2790 remText = remText.replace(c, Character.toLowerCase(c));
2791 remText = remText.replaceFirst(", ", " and ");
2792 }
2793 remText = remText.replaceFirst("as", "in addition to any other costs as");
2794 if (remText.contains(" tap ")) {
2795 if (remText.contains("tap a")) {
2796 String noun = remText.substring(remText.indexOf("untapped") + 9, remText.indexOf(" in "));
2797 remText = remText.replace(remText.substring(12, remText.indexOf(" in ")),
2798 Lang.nounWithNumeralExceptOne(1, noun) + " ");
2799 } else {
2800 remText = remText.replaceFirst(" untapped ", "");
2801 }
2802 }
2803 }
2804 sbx.append(" (").append(remText).append(")\r\n");
2805 return sbx.toString();
2806 }
2807
2808 // get the text of the abilities of a card
2809 public String getAbilityText() {

Callers 2

keywordsToTextMethod · 0.95

Calls 11

toSimpleStringMethod · 0.95
isOnlyManaCostMethod · 0.95
hasNoManaCostMethod · 0.95
splitMethod · 0.80
sizeMethod · 0.65
indexOfMethod · 0.65
containsMethod · 0.65
appendMethod · 0.45
replaceMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected