* Server - Some changes to user / match / table handling.

This commit is contained in:
LevelX2 2014-09-07 02:28:47 +02:00
parent 5b34b46eac
commit c3c77e3974
13 changed files with 164 additions and 70 deletions

View file

@ -983,15 +983,18 @@ public class ContinuousEffects implements Serializable {
public List<String> getReplacementEffectsTexts(HashMap<ReplacementEffect, HashSet<Ability>> rEffects, Game game) {
List<String> texts = new ArrayList<>();
for (Map.Entry<ReplacementEffect, HashSet<Ability>> entry : rEffects.entrySet()) {
for (Ability ability :entry.getValue()) {
MageObject object = game.getObject(ability.getSourceId());
if (object != null) {
texts.add(ability.getRule(object.getLogName()));
} else {
texts.add(entry.getKey().getText(null));
if (entry.getValue() != null) {
for (Ability ability :entry.getValue()) {
MageObject object = game.getObject(ability.getSourceId());
if (object != null) {
texts.add(ability.getRule(object.getLogName()));
} else {
texts.add(entry.getKey().getText(null));
}
}
} else {
logger.error("Replacement effect without ability: " + entry.getKey().toString());
}
}
return texts;
}

View file

@ -203,6 +203,15 @@ public class Table implements Serializable {
return null;
}
public boolean allSeatsAreOccupied() {
for (int i = 0; i < numSeats; i++ ) {
if (seats[i].getPlayer() == null) {
return false;
}
}
return true;
}
public void leaveNotStartedTable(UUID playerId) {
for (int i = 0; i < numSeats; i++ ) {
Player player = seats[i].getPlayer();

View file

@ -1648,8 +1648,8 @@ public abstract class PlayerImpl implements Player, Serializable {
@Override
public void lost(Game game) {
logger.debug(this.getName() + " has lost gameId: " + game.getId());
if (canLose(game)) {
if (canLose(game)) {
logger.debug(this.getName() + " has lost gameId: " + game.getId());
//20100423 - 603.9
if (!this.wins) {
this.loses = true;
@ -1672,9 +1672,9 @@ public abstract class PlayerImpl implements Player, Serializable {
}
@Override
public void won(Game game) {
logger.debug("player won -> start: " + this.getName());
public void won(Game game) {
if (!game.replaceEvent(new GameEvent(GameEvent.EventType.WINS, null, null, playerId))) {
logger.debug("player won -> start: " + this.getName());
if (!this.loses) {
//20130501 - 800.7, 801.16
// all opponents in range loose the game