mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
SpellAbilityEffect > tokenizeString add {n: SVar parser
This commit is contained in:
@@ -165,18 +165,23 @@ public abstract class SpellAbilityEffect {
|
|||||||
if ("}".equals(t)) { isPlainText = true; continue; }
|
if ("}".equals(t)) { isPlainText = true; continue; }
|
||||||
|
|
||||||
if (!isPlainText) {
|
if (!isPlainText) {
|
||||||
final List<? extends GameObject> objs;
|
if (t.startsWith("n:")) { // {n:<SVar> <noun(opt.)>}
|
||||||
if (t.startsWith("p:")) {
|
String parts[] = t.substring(2).split(" ", 2);
|
||||||
objs = AbilityUtils.getDefinedPlayers(sa.getHostCard(), t.substring(2), sa);
|
int n = AbilityUtils.calculateAmount(sa.getHostCard(), parts[0], sa);
|
||||||
} else if (t.startsWith("s:")) {
|
sb.append(parts.length == 1 ? Lang.getNumeral(n) : Lang.nounWithNumeral(n, parts[1]));
|
||||||
objs = AbilityUtils.getDefinedSpellAbilities(sa.getHostCard(), t.substring(2), sa);
|
|
||||||
} else if (t.startsWith("c:")) {
|
|
||||||
objs = AbilityUtils.getDefinedCards(sa.getHostCard(), t.substring(2), sa);
|
|
||||||
} else {
|
} else {
|
||||||
objs = AbilityUtils.getDefinedObjects(sa.getHostCard(), t, sa);
|
final List<? extends GameObject> objs;
|
||||||
|
if (t.startsWith("p:")) {
|
||||||
|
objs = AbilityUtils.getDefinedPlayers(sa.getHostCard(), t.substring(2), sa);
|
||||||
|
} else if (t.startsWith("s:")) {
|
||||||
|
objs = AbilityUtils.getDefinedSpellAbilities(sa.getHostCard(), t.substring(2), sa);
|
||||||
|
} else if (t.startsWith("c:")) {
|
||||||
|
objs = AbilityUtils.getDefinedCards(sa.getHostCard(), t.substring(2), sa);
|
||||||
|
} else {
|
||||||
|
objs = AbilityUtils.getDefinedObjects(sa.getHostCard(), t, sa);
|
||||||
|
}
|
||||||
|
sb.append(StringUtils.join(objs, ", "));
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append(StringUtils.join(objs, ", "));
|
|
||||||
} else {
|
} else {
|
||||||
sb.append(t);
|
sb.append(t);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user