Changed history handling for user a bit. Added history to table waiting dialog and user avatar tooltip.

This commit is contained in:
LevelX2 2016-01-23 13:37:34 +01:00
parent 24dddd3e06
commit 151e678e84
9 changed files with 102 additions and 79 deletions

View file

@ -24,8 +24,7 @@
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
*/
package mage.game;
import java.io.Serializable;
@ -38,7 +37,6 @@ import mage.players.Player;
public class Seat implements Serializable {
// private static final Logger logger = Logger.getLogger(Seat.class);
private String playerType;
private Player player;

View file

@ -824,4 +824,6 @@ public interface Player extends MageItem, Copyable<Player> {
* @return
*/
boolean addTargets(Ability ability, Game game);
String getHistory();
}

View file

@ -524,31 +524,29 @@ public abstract class PlayerImpl implements Player, Serializable {
inRange.add(player.getId());
}
}
} else if ((range.getRange() * 2) + 1 >= game.getPlayers().size()) {
for (Player player : game.getPlayers().values()) {
if (!player.hasLeft()) {
inRange.add(player.getId());
}
}
} else {
if ((range.getRange() * 2) + 1 >= game.getPlayers().size()) {
for (Player player : game.getPlayers().values()) {
if (!player.hasLeft()) {
inRange.add(player.getId());
}
inRange.add(playerId);
PlayerList players = game.getState().getPlayerList(playerId);
for (int i = 0; i < range.getRange(); i++) {
Player player = players.getNext(game);
while (player.hasLeft()) {
player = players.getNext(game);
}
} else {
inRange.add(playerId);
PlayerList players = game.getState().getPlayerList(playerId);
for (int i = 0; i < range.getRange(); i++) {
Player player = players.getNext(game);
while (player.hasLeft()) {
player = players.getNext(game);
}
inRange.add(player.getId());
}
players = game.getState().getPlayerList(playerId);
for (int i = 0; i < range.getRange(); i++) {
Player player = players.getPrevious(game);
while (player.hasLeft()) {
player = players.getPrevious(game);
}
inRange.add(player.getId());
inRange.add(player.getId());
}
players = game.getState().getPlayerList(playerId);
for (int i = 0; i < range.getRange(); i++) {
Player player = players.getPrevious(game);
while (player.hasLeft()) {
player = players.getPrevious(game);
}
inRange.add(player.getId());
}
}
}
@ -2098,7 +2096,8 @@ public abstract class PlayerImpl implements Player, Serializable {
break;
}
}
if (!opponentInGame || // if no more opponent is in game the wins event may no longer be replaced
if (!opponentInGame
|| // if no more opponent is in game the wins event may no longer be replaced
!game.replaceEvent(new GameEvent(GameEvent.EventType.WINS, null, null, playerId))) {
logger.debug("player won -> start: " + this.getName());
if (!this.loses) {
@ -2178,10 +2177,8 @@ public abstract class PlayerImpl implements Player, Serializable {
if (blocker != null && group != null && group.canBlock(blocker, game)) {
group.addBlocker(blockerId, playerId, game);
game.getCombat().addBlockingGroup(blockerId, attackerId, playerId, game);
} else {
if (this.isHuman() && !game.isSimulation()) {
game.informPlayer(this, "You can't block this creature.");
}
} else if (this.isHuman() && !game.isSimulation()) {
game.informPlayer(this, "You can't block this creature.");
}
}
@ -2802,14 +2799,12 @@ public abstract class PlayerImpl implements Player, Serializable {
}
if (targetNum < option.getTargets().size() - 2) {
addTargetOptions(options, newOption, targetNum + 1, game);
} else if (option.getChoices().size() > 0) {
addChoiceOptions(options, newOption, 0, game);
} else if (option.getCosts().getTargets().size() > 0) {
addCostTargetOptions(options, newOption, 0, game);
} else {
if (option.getChoices().size() > 0) {
addChoiceOptions(options, newOption, 0, game);
} else if (option.getCosts().getTargets().size() > 0) {
addCostTargetOptions(options, newOption, 0, game);
} else {
options.add(newOption);
}
options.add(newOption);
}
}
}
@ -2820,12 +2815,10 @@ public abstract class PlayerImpl implements Player, Serializable {
newOption.getChoices().get(choiceNum).setChoice(choice);
if (choiceNum < option.getChoices().size() - 1) {
addChoiceOptions(options, newOption, choiceNum + 1, game);
} else if (option.getCosts().getTargets().size() > 0) {
addCostTargetOptions(options, newOption, 0, game);
} else {
if (option.getCosts().getTargets().size() > 0) {
addCostTargetOptions(options, newOption, 0, game);
} else {
options.add(newOption);
}
options.add(newOption);
}
}
}
@ -3512,4 +3505,9 @@ public abstract class PlayerImpl implements Player, Serializable {
return true;
}
@Override
public String getHistory() {
return "no available";
}
}

View file

@ -23,6 +23,8 @@ public class UserData implements Serializable {
protected boolean passPriorityActivation;
protected boolean autoOrderTrigger;
protected String history;
public UserData(UserGroup userGroup, int avatarId, boolean showAbilityPickerForced,
boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps,
String flagName, boolean askMoveToGraveOrder, boolean manaPoolAutomatic, boolean manaPoolAutomaticRestricted,
@ -40,6 +42,7 @@ public class UserData implements Serializable {
this.passPriorityCast = passPriorityCast;
this.passPriorityActivation = passPriorityActivation;
this.autoOrderTrigger = autoOrderTrigger;
this.history = "";
}
public void update(UserData userData) {
@ -166,7 +169,16 @@ public class UserData implements Serializable {
this.autoOrderTrigger = autoOrderTrigger;
}
public void setHistory(String history) {
this.history = history;
}
public String getHistory() {
return history;
}
public static String getDefaultFlagName() {
return "world.png";
}
}