Commit 1281f6fb authored by Hans Mackowiak's avatar Hans Mackowiak

Merge branch '763-concurrentmodificationexception-in-getplayercommanderinfo' into 'master'

Resolve "ConcurrentModificationException in getPlayerCommanderInfo"

Closes #763

See merge request core-developers/forge!1063
parents f7de8353 e2dd52cf
......@@ -137,16 +137,22 @@ public class PlayerView extends GameEntityView {
final List<String> info = Lists.newArrayListWithExpectedSize(opponents.size());
info.add(TextUtil.concatWithSpace("Commanders:", Lang.joinHomogenous(commanders)));
for (final PlayerView p : Iterables.concat(Collections.singleton(this), opponents)) {
// own commanders
for (final CardView v : commanders) {
final int damage = getCommanderDamage(v);
if (damage > 0) {
final String text = TextUtil.concatWithSpace("Commander damage from own commander", TextUtil.addSuffix(v.toString(),":"));
info.add(TextUtil.concatWithSpace(text,TextUtil.addSuffix(String.valueOf(damage),"\r\n")));
}
}
// opponents commanders
for (final PlayerView p : opponents) {
for (final CardView v : p.getCommanders()) {
final int damage = this.getCommanderDamage(v);
final int damage = getCommanderDamage(v);
if (damage > 0) {
final String text;
if (p.equals(this)) {
text = TextUtil.concatWithSpace("Commander damage from own commander", TextUtil.addSuffix(v.toString(),":"));
} else {
text = TextUtil.concatWithSpace("Commander damage from", TextUtil.addSuffix(p.toString(),"'s"), TextUtil.addSuffix(v.toString(),":"));
}
final String text = TextUtil.concatWithSpace("Commander damage from", TextUtil.addSuffix(p.toString(),"'s"), TextUtil.addSuffix(v.toString(),":"));
info.add(TextUtil.concatWithSpace(text,TextUtil.addSuffix(String.valueOf(damage),"\r\n")));
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment