Added designation names to player tooltip.

This commit is contained in:
LevelX2 2018-01-13 18:55:07 +01:00
parent f528d556d6
commit 2e3ba7e104
4 changed files with 18 additions and 5 deletions

View file

@ -76,6 +76,7 @@ import static mage.constants.Constants.MIN_AVATAR_ID;
import mage.constants.ManaType;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.designations.DesignationType;
import mage.remote.Session;
import mage.utils.timer.PriorityTimer;
import mage.view.CardView;
@ -333,11 +334,15 @@ public class PlayerPanelExt extends javax.swing.JPanel {
}
// Extend tooltip
StringBuilder tooltipText = new StringBuilder(basicTooltipText);
this.avatar.setTopTextImageRight(null);
for (String name : player.getDesignationNames()) {
tooltipText.append("<br/>").append(name);
if (DesignationType.CITYS_BLESSING.toString().equals(name)) {
this.avatar.setTopTextImageRight(ImageHelper.getImageFromResources("/info/city_blessing.png"));
}
}
if (player.isMonarch()) {
tooltipText.append("<br/>Monarch");
this.avatar.setTopTextImageRight(ImageHelper.getImageFromResources("/info/crown.png"));
} else {
this.avatar.setTopTextImageRight(null);
}
for (Counter counter : player.getCounters().values()) {
tooltipText.append("<br/>").append(counter.getName()).append(" counters: ").append(counter.getCount());

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

View file

@ -34,9 +34,9 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import mage.cards.Card;
import mage.counters.Counters;
import mage.designations.Designation;
import mage.game.ExileZone;
import mage.game.Game;
import mage.game.GameState;
@ -84,6 +84,7 @@ public class PlayerView implements Serializable {
private final boolean passedAllTurns; // F9
private final boolean passedUntilEndStepBeforeMyTurn; // F11
private final boolean monarch;
private final List<String> designationNames = new ArrayList<>();
public PlayerView(Player player, GameState state, Game game, UUID createdForPlayerId, UUID watcherUserId) {
this.playerId = player.getId();
@ -164,6 +165,9 @@ public class PlayerView implements Serializable {
this.passedUntilStackResolved = player.getPassedUntilStackResolved();
this.passedUntilEndStepBeforeMyTurn = player.getPassedUntilEndStepBeforeMyTurn();
this.monarch = player.getId().equals(game.getMonarchId());
for (Designation designation : player.getDesignations()) {
this.designationNames.add(designation.getName());
}
}
private boolean showInBattlefield(Permanent permanent, GameState state) {
@ -305,4 +309,8 @@ public class PlayerView implements Serializable {
return monarch;
}
public List<String> getDesignationNames() {
return designationNames;
}
}

View file

@ -52,7 +52,7 @@ public abstract class Designation implements MageObject {
}
public Designation(DesignationType designationType, String expansionSetCode, boolean unique) {
this.name = designationType.name();
this.name = designationType.toString();
this.designationType = designationType;
this.id = UUID.randomUUID();
this.frameStyle = FrameStyle.M15_NORMAL;