mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18: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() {
|
public String getPlayerName() {
|
||||||
String name = card.getName();
|
String name = card.getName();
|
||||||
int idx = name.indexOf(' ');
|
int idx = name.indexOf(',');
|
||||||
if (idx != -1) {
|
if (idx != -1) { //trim everything after the comma
|
||||||
name = name.substring(0, idx);
|
name = name.substring(0, idx);
|
||||||
}
|
}
|
||||||
if (name.endsWith(",") || name.endsWith("-")) {
|
|
||||||
name = name.substring(0, name.length() - 1).trim();
|
|
||||||
}
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,15 @@ public class ConquestEvent {
|
|||||||
return avatarCard;
|
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) {
|
public ConquestBattle createBattle(ConquestLocation location0, int tier0) {
|
||||||
return new ConquestEventBattle(location0, tier0);
|
return new ConquestEventBattle(location0, tier0);
|
||||||
}
|
}
|
||||||
@@ -171,7 +180,7 @@ public class ConquestEvent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOpponentName() {
|
public String getOpponentName() {
|
||||||
return ConquestEvent.this.getAvatar();
|
return ConquestEvent.this.getOpponentName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user