code review comments for chaos/random booster draft:

1. rename chaos booster draft to random booster draft
2. save packs selected in the user preferences
3. print "Random Boosters" in the player draft viewer during the draft
This commit is contained in:
Brodee 2015-06-23 20:59:05 -07:00
parent d57ff3b0b3
commit ac0aa65aab
13 changed files with 107 additions and 84 deletions

View file

@ -32,20 +32,19 @@ import java.util.ArrayList;
import java.util.List;
import mage.cards.ExpansionSet;
import java.util.Collections;
import java.lang.RuntimeException;
/**
*
* @author BrodyLodmell_at_googlemail.com
*/
public class ChaosBoosterDraft extends BoosterDraft {
public class RandomBoosterDraft extends BoosterDraft {
List<ExpansionSet> allSets;
List<ExpansionSet> usedBoosters;
public ChaosBoosterDraft(DraftOptions options, List<ExpansionSet> sets) {
List<ExpansionSet> useBoosters;
public RandomBoosterDraft(DraftOptions options, List<ExpansionSet> sets) {
super(options, sets);
if (sets.isEmpty()){
throw new RuntimeException("At least one set must be selected for chaos booster draft");
throw new RuntimeException("At least one set must be selected for random booster draft");
}
allSets = new ArrayList<>(sets);
resetBoosters();
@ -81,16 +80,16 @@ public class ChaosBoosterDraft extends BoosterDraft {
}
private ExpansionSet getNextBooster() {
if (0 == usedBoosters.size()){
if (0 == useBoosters.size()){
resetBoosters();
}
ExpansionSet theBooster = usedBoosters.get(0);
usedBoosters.remove(theBooster);
ExpansionSet theBooster = useBoosters.get(0);
useBoosters.remove(theBooster);
return theBooster;
}
private void resetBoosters(){
usedBoosters = new ArrayList<>(allSets);
Collections.shuffle(usedBoosters);
useBoosters = new ArrayList<>(allSets);
Collections.shuffle(useBoosters);
}
}

View file

@ -44,7 +44,7 @@ public class LimitedOptions implements Serializable {
protected String draftCubeName;
protected DraftCube draftCube;
protected int numberBoosters;
protected boolean isChaos;
protected boolean isRandom;
public List<String> getSetCodes() {
return sets;
@ -82,10 +82,10 @@ public class LimitedOptions implements Serializable {
this.numberBoosters = numberBoosters;
}
public boolean getIsChaos(){
return isChaos;
public boolean getIsRandom(){
return isRandom;
}
public void setIsChaos(boolean isChaos){
this.isChaos = isChaos;
public void setIsRandom(boolean isRandom){
this.isRandom = isRandom;
}
}

View file

@ -44,7 +44,7 @@ public class TournamentType implements Serializable {
protected boolean draft; // or sealed
protected boolean limited; // or construced
protected boolean elimination; // or Swiss
protected boolean isChaos;
protected boolean isRandom;
protected TournamentType() {}
@ -85,8 +85,8 @@ public class TournamentType implements Serializable {
return cubeBooster;
}
public boolean isChaos(){
return this.isChaos;
public boolean isRandom(){
return this.isRandom;
}
}