mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-11 16:26:22 +00:00
Simplify logic
This commit is contained in:
@@ -279,17 +279,15 @@ public class BoosterDraft implements IBoosterDraft {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static BoosterDraft createDraft(final LimitedPoolType draftType, final CardBlock block, final String[] boosters, Integer numPlayers) {
|
public static BoosterDraft createDraft(final LimitedPoolType draftType, final CardBlock block, final String[] boosters, Integer numPlayers) {
|
||||||
// quest draft
|
|
||||||
final BoosterDraft draft = new BoosterDraft(draftType);
|
final BoosterDraft draft = new BoosterDraft(draftType);
|
||||||
|
|
||||||
String setCode = boosters[0];
|
String setCode = boosters[0];
|
||||||
CardEdition edition = FModel.getMagicDb().getEditions().get(setCode);
|
CardEdition edition = FModel.getMagicDb().getEditions().get(setCode);
|
||||||
// If this is metaset, edtion will be null
|
// If this is metaset, edtion will be null
|
||||||
if (edition != null) {
|
if (edition != null) {
|
||||||
if (numPlayers != null) {
|
// Auto choosing recommended pod size. If we've chosen the podsize it should be passed in via numPlayers
|
||||||
draft.setPodSize(numPlayers);
|
int newPodSize = Objects.requireNonNullElseGet(numPlayers, () -> edition.getDraftOptions().getRecommendedPodSize());
|
||||||
} else if (draft.getPodSize() != edition.getDraftOptions().getRecommendedPodSize()) {
|
if (newPodSize != draft.getPodSize()) {
|
||||||
// Auto choosing recommended pod size. In the future we may want to allow user to choose
|
|
||||||
draft.setPodSize(edition.getDraftOptions().getRecommendedPodSize());
|
draft.setPodSize(edition.getDraftOptions().getRecommendedPodSize());
|
||||||
}
|
}
|
||||||
draft.doublePickDuringDraft = edition.getDraftOptions().isDoublePick(draft.getPodSize());
|
draft.doublePickDuringDraft = edition.getDraftOptions().isDoublePick(draft.getPodSize());
|
||||||
|
|||||||
Reference in New Issue
Block a user