mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* Draft improves:
* added additional and improved timing options for pick timeouts (x1.0, x1.5, x2.0, see #8033); * added pick timing info in tables list (info column); * fixed that booster draft starts with wrong pick timeout (#8036);
This commit is contained in:
parent
214b688fdb
commit
400acae0c1
9 changed files with 71 additions and 37 deletions
|
@ -545,7 +545,7 @@
|
|||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel6" min="-2" pref="49" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="cbDraftTiming" min="-2" pref="107" max="-2" attributes="0"/>
|
||||
<Component id="cbDraftTiming" min="-2" pref="140" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="19" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.game.draft;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -24,9 +23,8 @@ public abstract class DraftImpl implements Draft {
|
|||
protected List<ExpansionSet> sets;
|
||||
protected List<String> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Integer> times;
|
||||
|
||||
TimingOption(String shortName, String name, double customTimeoutFactor, List<Integer> 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() {
|
||||
|
|
|
@ -32,7 +32,6 @@ public class RandomBoosterDraft extends BoosterDraft {
|
|||
}
|
||||
}
|
||||
boosterNum++;
|
||||
cardNum = 1;
|
||||
fireUpdatePlayersEvent();
|
||||
}
|
||||
|
||||
|
|
|
@ -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<ExpansionSet> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<String, CardIdentity> cardsInCube = new LinkedHashMap<>();
|
||||
|
||||
public RichManCubeBoosterDraft(DraftOptions options, List<ExpansionSet> 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue