mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Simplify extraction of player/opponent name from card name
This commit is contained in:
@@ -65,13 +65,10 @@ public class ConquestCommander implements InventoryItem, IXmlWritable {
|
||||
|
||||
public String getPlayerName() {
|
||||
String name = card.getName();
|
||||
int idx = name.indexOf(' ');
|
||||
if (idx != -1) {
|
||||
int idx = name.indexOf(',');
|
||||
if (idx != -1) { //trim everything after the comma
|
||||
name = name.substring(0, idx);
|
||||
}
|
||||
if (name.endsWith(",") || name.endsWith("-")) {
|
||||
name = name.substring(0, name.length() - 1).trim();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,15 @@ public class ConquestEvent {
|
||||
return avatarCard;
|
||||
}
|
||||
|
||||
public String getOpponentName() {
|
||||
String name = avatar;
|
||||
int idx = name.indexOf(',');
|
||||
if (idx != -1) { //trim everything after the comma
|
||||
name = name.substring(0, idx);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public ConquestBattle createBattle(ConquestLocation location0, int tier0) {
|
||||
return new ConquestEventBattle(location0, tier0);
|
||||
}
|
||||
@@ -171,7 +180,7 @@ public class ConquestEvent {
|
||||
|
||||
@Override
|
||||
public String getOpponentName() {
|
||||
return ConquestEvent.this.getAvatar();
|
||||
return ConquestEvent.this.getOpponentName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user