Add user rating using Glicko rating system (#1498)

This commit is contained in:
Quercitron 2016-05-17 17:22:14 +03:00
parent 11158d5fa4
commit 972d59aa37
10 changed files with 701 additions and 9 deletions

View file

@ -35,6 +35,7 @@ import mage.constants.MatchTimeLimit;
import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence;
import mage.constants.SkillLevel;
import mage.game.result.ResultProtos;
/**
*
@ -55,6 +56,7 @@ public class MatchOptions implements Serializable {
protected SkillLevel skillLevel;
protected boolean rollbackTurnsAllowed;
protected int quitRatio;
protected boolean rated;
/**
* Time each player has during the game to play using his\her priority.
@ -177,4 +179,36 @@ public class MatchOptions implements Serializable {
public void setQuitRatio(int quitRatio) {
this.quitRatio = quitRatio;
}
public boolean isRated() {
return rated;
}
public void setRated(boolean rated) {
this.rated = rated;
}
public ResultProtos.MatchOptionsProto toProto() {
ResultProtos.MatchOptionsProto.Builder builder = ResultProtos.MatchOptionsProto.newBuilder()
.setName(this.getName())
.setLimited(this.isLimited())
.setRated(this.isRated())
.setWinsNeeded(this.getWinsNeeded());
ResultProtos.SkillLevel skillLevel = ResultProtos.SkillLevel.BEGINNER;
switch (this.getSkillLevel()) {
case BEGINNER:
skillLevel = ResultProtos.SkillLevel.BEGINNER;
break;
case CASUAL:
skillLevel = ResultProtos.SkillLevel.CASUAL;
break;
case SERIOUS:
skillLevel = ResultProtos.SkillLevel.SERIOUS;
break;
}
builder.setSkillLevel(skillLevel);
return builder.build();
}
}