Skip to content

Commit c447dfc

Browse files
Jetz72Hanmac
authored andcommitted
Support "Affinitycycling" and "Affinity for Affinity"
1 parent 8149966 commit c447dfc

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

forge-game/src/main/java/forge/game/card/CardFactoryUtil.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3764,6 +3764,8 @@ public void resolve() {
37643764
desc = "Basic land";
37653765
} else if (type.equals("Land.Artifact")) {
37663766
desc = "Artifact land";
3767+
} else if (type.startsWith("Card.with")) {
3768+
desc = type.substring(9);
37673769
}
37683770

37693771
sb.append(" Discard<1/CARDNAME> | ActivationZone$ Hand | PrecostDesc$ ").append(desc).append("cycling ");
@@ -3784,17 +3786,20 @@ public static void addStaticAbility(final KeywordInterface inst, final CardState
37843786
if (keyword.startsWith("Affinity")) {
37853787
final String[] k = keyword.split(":");
37863788
final String t = k[1];
3787-
String d = "";
3788-
if (k.length > 2) {
3789-
final StringBuilder s = new StringBuilder();
3790-
s.append(k[2]).append("s");
3791-
d = s.toString();
3792-
}
37933789

3794-
String desc = "Artifact".equals(t) ? "artifacts" : CardType.getPluralType(t);
3795-
if (!d.isEmpty()) {
3796-
desc = d;
3790+
String desc;
3791+
if(k.length > 2) {
3792+
String typeText = k[2];
3793+
if(typeText.contains(" with "))
3794+
desc = typeText.substring(typeText.indexOf(" with ") + 6);
3795+
else
3796+
desc = typeText + "s";
37973797
}
3798+
else if ("Artifact".equals(t))
3799+
desc = "artifacts";
3800+
else
3801+
desc = CardType.getPluralType(t);
3802+
37983803
StringBuilder sb = new StringBuilder();
37993804
sb.append("Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ AffinityX | EffectZone$ All");
38003805
sb.append("| Description$ Affinity for ").append(desc);

forge-game/src/main/java/forge/game/keyword/KeywordWithCostAndType.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ protected void parse(String details) {
2626
n[i] = "basic land";
2727
} else if (n[i].equals("Land.Artifact")) {
2828
n[i] = "artifact land";
29+
} else if (n[i].startsWith("Card.with")) {
30+
n[i] = n[i].substring(9);
2931
}
3032
}
3133

0 commit comments

Comments
 (0)