diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form index 903c8c6bf0..01be5c944c 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form @@ -545,7 +545,7 @@ - + diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java index eaa9623baf..2739a7740c 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java @@ -344,7 +344,7 @@ public class NewTournamentDialog extends MageDialog { .addGroup(pnlDraftOptionsLayout.createSequentialGroup() .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cbDraftTiming, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(cbDraftTiming, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(19, Short.MAX_VALUE)) ); pnlDraftOptionsLayout.setVerticalGroup( @@ -1224,7 +1224,6 @@ public class NewTournamentDialog extends MageDialog { } if (tournamentType.isDraft()) { DraftOptions options = new DraftOptions(); - options.setDraftType(""); options.setTiming((TimingOption) this.cbDraftTiming.getSelectedItem()); tOptions.setLimitedOptions(options); } diff --git a/Mage.Common/src/main/java/mage/view/TableView.java b/Mage.Common/src/main/java/mage/view/TableView.java index 1d6d91085a..f32a822667 100644 --- a/Mage.Common/src/main/java/mage/view/TableView.java +++ b/Mage.Common/src/main/java/mage/view/TableView.java @@ -6,6 +6,7 @@ import mage.game.Game; import mage.game.Seat; import mage.game.Table; import mage.game.draft.Draft; +import mage.game.draft.DraftOptions; import mage.game.match.MatchPlayer; import mage.game.tournament.TournamentPlayer; @@ -155,6 +156,10 @@ public class TableView implements Serializable { if (table.getTournament().getTournamentType().isLimited()) { infoText.append(" Constr.: ").append(table.getTournament().getOptions().getLimitedOptions().getConstructionTime() / 60).append(" Min."); } + if (table.getTournament().getOptions().getLimitedOptions() instanceof DraftOptions) { + DraftOptions draftOptions = (DraftOptions) table.getTournament().getOptions().getLimitedOptions(); + infoText.append(" Pick time: ").append(draftOptions.getTiming().getShortName()); + } if (table.getTournament().getOptions().getMatchOptions().isRollbackTurnsAllowed()) { infoText.append(" RB"); } diff --git a/Mage/src/main/java/mage/game/draft/BoosterDraft.java b/Mage/src/main/java/mage/game/draft/BoosterDraft.java index 480d96b183..152572e313 100644 --- a/Mage/src/main/java/mage/game/draft/BoosterDraft.java +++ b/Mage/src/main/java/mage/game/draft/BoosterDraft.java @@ -17,8 +17,10 @@ public class BoosterDraft extends DraftImpl { @Override public void start() { + cardNum = 0; while (!isAbort() && boosterNum < numberBoosters) { openBooster(); + cardNum = 0; while (!isAbort() && pickCards()) { if (boosterNum % 2 == 1) { passLeft(); diff --git a/Mage/src/main/java/mage/game/draft/DraftImpl.java b/Mage/src/main/java/mage/game/draft/DraftImpl.java index 5ef5a2330e..f0b031ba5b 100644 --- a/Mage/src/main/java/mage/game/draft/DraftImpl.java +++ b/Mage/src/main/java/mage/game/draft/DraftImpl.java @@ -1,4 +1,3 @@ - package mage.game.draft; import java.util.*; @@ -24,9 +23,8 @@ public abstract class DraftImpl implements Draft { protected List sets; protected List setCodes; protected int boosterNum = 0; - protected int cardNum = 0; + protected int cardNum = 0; // increases +1 on first picking (so draft get 1 as first card number) protected TimingOption timing; - protected int[] times = {75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5}; protected boolean abort = false; protected boolean started = false; @@ -204,7 +202,6 @@ public abstract class DraftImpl implements Draft { } } boosterNum++; - cardNum = 1; fireUpdatePlayersEvent(); } @@ -270,7 +267,7 @@ public abstract class DraftImpl implements Draft { if (cardNum > 15) { cardNum = 15; } - int time = times[cardNum - 1] * timing.getFactor(); + int time = timing.getPickTimeout(cardNum); playerQueryEventSource.pickCard(playerId, "Pick card", player.getBooster(), time); } diff --git a/Mage/src/main/java/mage/game/draft/DraftOptions.java b/Mage/src/main/java/mage/game/draft/DraftOptions.java index 88cafa94df..7220c191ba 100644 --- a/Mage/src/main/java/mage/game/draft/DraftOptions.java +++ b/Mage/src/main/java/mage/game/draft/DraftOptions.java @@ -1,41 +1,69 @@ - - package mage.game.draft; -import java.io.Serializable; import mage.game.tournament.LimitedOptions; +import java.io.Serializable; +import java.util.Arrays; +import java.util.List; + /** - * - * @author BetaSteward_at_googlemail.com + * @author BetaSteward_at_googlemail.com, JayDi85 */ public class DraftOptions extends LimitedOptions implements Serializable { - protected String draftType; protected TimingOption timing; - + public enum TimingOption { - REGULAR (1), - BEGINNER (2), - NONE (0); - private int factor; + // seconds per card's pick + BEGINNER("x2.0", "Beginner (x2.0)", 2.0, + Arrays.asList(150, 140, 130, 120, 110, 100, 90, 80, 45, 35, 30, 25, 20, 15, 10) + ), + REGULAR("x1.5", "Regular (x1.5)", 1.5, + Arrays.asList(113, 105, 98, 90, 83, 75, 68, 60, 35, 30, 25, 20, 15, 10, 8) + ), + PROFI("x1.0", "Profi (x1.0)", 1.0, + Arrays.asList(75, 70, 65, 60, 55, 50, 45, 40, 30, 25, 20, 15, 12, 10, 7) + ), + NONE("ERROR", "", 0, + Arrays.asList(0) + ); - TimingOption(int factor) { - this.factor = factor; + private final String shortName; + private final String name; + private final double customTimeoutFactor; // profi as x1.0, other modes increases by factor from x1.5 to x2.0 + private final List times; + + TimingOption(String shortName, String name, double customTimeoutFactor, List times) { + this.shortName = shortName; + this.name = name; + this.customTimeoutFactor = customTimeoutFactor; + this.times = times; } - public int getFactor() { - return this.factor; + public String getShortName() { + return shortName; } - } - public String getDraftType() { - return draftType; - } + public String getName() { + return name; + } - public void setDraftType(String draftType) { - this.draftType = draftType; + public double getCustomTimeoutFactor() { + return customTimeoutFactor; + } + + public int getPickTimeout(int cardNum) { + if (cardNum > 15) { + cardNum = 15; + } + return times.get(cardNum - 1); + } + + @Override + public String toString() { + return name; + } } public TimingOption getTiming() { diff --git a/Mage/src/main/java/mage/game/draft/RandomBoosterDraft.java b/Mage/src/main/java/mage/game/draft/RandomBoosterDraft.java index 3463363470..a38c787608 100644 --- a/Mage/src/main/java/mage/game/draft/RandomBoosterDraft.java +++ b/Mage/src/main/java/mage/game/draft/RandomBoosterDraft.java @@ -32,7 +32,6 @@ public class RandomBoosterDraft extends BoosterDraft { } } boosterNum++; - cardNum = 1; fireUpdatePlayersEvent(); } diff --git a/Mage/src/main/java/mage/game/draft/RichManBoosterDraft.java b/Mage/src/main/java/mage/game/draft/RichManBoosterDraft.java index da3fd7d8da..1660e7ede8 100644 --- a/Mage/src/main/java/mage/game/draft/RichManBoosterDraft.java +++ b/Mage/src/main/java/mage/game/draft/RichManBoosterDraft.java @@ -16,8 +16,8 @@ public class RichManBoosterDraft extends DraftImpl { private static final Logger logger = Logger.getLogger(RichManBoosterDraft.class); - //protected int[] richManTimes = {75, 70, 65, 60, 55, 50, 45, 40, 35, 35, 35, 35, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25}; - protected int[] richManTimes = {70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40}; + // custom timeouts per pick on profi timing + protected int[] customProfiTimes = {70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40}; public RichManBoosterDraft(DraftOptions options, List sets) { super(options, sets); @@ -87,7 +87,9 @@ public class RichManBoosterDraft extends DraftImpl { if (cardNum <= 0) { cardNum = 1; } - int time = richManTimes[cardNum - 1] * timing.getFactor(); + + // richman uses custom times + int time = (int) Math.ceil(customProfiTimes[cardNum - 1] * timing.getCustomTimeoutFactor()); playerQueryEventSource.pickCard(playerId, "Pick card", player.getBooster(), time); } } diff --git a/Mage/src/main/java/mage/game/draft/RichManCubeBoosterDraft.java b/Mage/src/main/java/mage/game/draft/RichManCubeBoosterDraft.java index 082d82deb5..3bfd8edc84 100644 --- a/Mage/src/main/java/mage/game/draft/RichManCubeBoosterDraft.java +++ b/Mage/src/main/java/mage/game/draft/RichManCubeBoosterDraft.java @@ -1,4 +1,3 @@ - package mage.game.draft; import java.util.*; @@ -13,8 +12,9 @@ import mage.game.draft.DraftCube.CardIdentity; */ public class RichManCubeBoosterDraft extends DraftImpl { - //protected int[] richManTimes = {75, 70, 65, 60, 55, 50, 45, 40, 35, 35, 35, 35, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25}; - protected int[] richManTimes = {70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40}; + // custom timeouts per pick on profi timing + protected int[] customProfiTimes = {70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40}; + protected final Map cardsInCube = new LinkedHashMap<>(); public RichManCubeBoosterDraft(DraftOptions options, List sets) { @@ -102,7 +102,9 @@ public class RichManCubeBoosterDraft extends DraftImpl { if (cardNum <= 0) { cardNum = 1; } - int time = richManTimes[cardNum - 1] * timing.getFactor(); + + // richman uses custom times + int time = (int) Math.ceil(customProfiTimes[cardNum - 1] * timing.getCustomTimeoutFactor()); playerQueryEventSource.pickCard(playerId, "Pick card", player.getBooster(), time); } }