From 8685c676796d1bdfeb930ba3ec9a2677b28b4083 Mon Sep 17 00:00:00 2001 From: brodee Date: Sun, 21 Jun 2015 18:52:43 -0700 Subject: [PATCH 1/5] Update readme.md --- readme.md | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/readme.md b/readme.md index a7ee59046a3..3ffe232abc3 100644 --- a/readme.md +++ b/readme.md @@ -1,35 +1,3 @@ -# XMage - Magic, Another Game Engine +Fork of xmage for chaos cube implementation. -XMage allows you to play Magic against one or more online players or computer opponents. It includes full rules enforcement for over **10,000** unique cards (nearly 20,000 counting all cards from different editions). Starting with Eventide, all regular sets have nearly all the cards implemented ([detailed overview](http://ct-magefree.rhcloud.com/stats)). - -There are public servers where you can play XMage against other players. You can also host your own server to play against the AI and/or your friends. - -You can visit the XMage forum [here](http://www.slightlymagic.net/forum/viewforum.php?f=70). - -## Features -* Deck editor to build your desired decks. -* There is a simple computer AI opponent available. -* You can play either a two player duel or a multiplayer free-for-all game with up to 10 players. -* Commander format (also up to 10 players). -* Tiny Leaders duels. -* There are two tournament types supported, which can be played with up to 16 players: -* Elimination or swiss type handling -* Booster (also Cube) draft tournaments (4-16) -* Sealed (also from Cube) tournaments (2-16) - -## Installation -Download and install the [latest XMage release](http://XMage.de). -You will need to have the [Java Runtime Environment](http://java.com/en/) Version 7 or later. - -Look [here](http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=13632) for more detailed instructions. -[Here](http://github.com/magefree/mage/wiki/Release-changes) you can find a log of the latest changes. - -## Developer - -If you are interested in developing XMage, here are some useful resources: -* [Developer Getting Started](http://github.com/magefree/mage/wiki/Developer-Getting-Started) -* [Developer Notes](http://github.com/magefree/mage/wiki/Developer-Notes) -* [Developer Testing Tools](http://github.com/magefree/mage/wiki/Developer-Testing-Tools) -* [Double Faced Cards](http://github.com/magefree/mage/wiki/Double-Faced-Cards) -* [Card Requests](http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=4554) -* [Tournament Relevant Card Requests](http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=14062) \ No newline at end of file +a chaos booster draft is one where a pack pool is created with random packs and randomly distributed. you draft with those. Typically you use 24 different sets, so the decks are super weird. From 73495db4bdec57230ee3fb7efb07935500f1d92b Mon Sep 17 00:00:00 2001 From: brodee Date: Mon, 22 Jun 2015 19:20:24 -0700 Subject: [PATCH 2/5] Update readme.md --- readme.md | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 3ffe232abc3..7a6a9bb2f5c 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,35 @@ -Fork of xmage for chaos cube implementation. +# XMage - Magic, Another Game Engine -a chaos booster draft is one where a pack pool is created with random packs and randomly distributed. you draft with those. Typically you use 24 different sets, so the decks are super weird. +XMage allows you to play Magic against one or more online players or computer opponents. It includes full rules enforcement for over **10,000** unique cards (nearly 20,000 counting all cards from different editions). Starting with Eventide, all regular sets have nearly all the cards implemented ([detailed overview](http://ct-magefree.rhcloud.com/stats)). + +There are public servers where you can play XMage against other players. You can also host your own server to play against the AI and/or your friends. + +You can visit the XMage forum [here](http://www.slightlymagic.net/forum/viewforum.php?f=70). + +## Features +* Deck editor to build your desired decks. +* There is a simple computer AI opponent available. +* You can play either a two player duel or a multiplayer free-for-all game with up to 10 players. +* Commander format (also up to 10 players). +* Tiny Leaders duels. +* There are two tournament types supported, which can be played with up to 16 players: +* Elimination or swiss type handling +* Booster (also Cube) draft tournaments (4-16) +* Sealed (also from Cube) tournaments (2-16) + +## Installation +Download and install the [latest XMage release](http://XMage.de). +You will need to have the [Java Runtime Environment](http://java.com/en/) Version 7 or later. + +Look [here](http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=13632) for more detailed instructions. +[Here](http://github.com/magefree/mage/wiki/Release-changes) you can find a log of the latest changes. + +## Developer + +If you are interested in developing XMage, here are some useful resources: +* [Developer Getting Started](http://github.com/magefree/mage/wiki/Developer-Getting-Started) +* [Developer Notes](http://github.com/magefree/mage/wiki/Developer-Notes) +* [Developer Testing Tools](http://github.com/magefree/mage/wiki/Developer-Testing-Tools) +* [Double Faced Cards](http://github.com/magefree/mage/wiki/Double-Faced-Cards) +* [Card Requests](http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=4554) +* [Tournament Relevant Card Requests](http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=14062) From e3b84eaab551e0eb00bbbc87977024942e5a1010 Mon Sep 17 00:00:00 2001 From: brodee <> Date: Mon, 22 Jun 2015 21:55:43 -0700 Subject: [PATCH 3/5] chaos booster draft implementation first check-in --- .../client/dialog/NewTournamentDialog.form | 22 +++- .../client/dialog/NewTournamentDialog.java | 102 ++++++++++++++++-- .../java/mage/client/draft/DraftPanel.java | 13 ++- .../src/mage/view/TournamentTypeView.java | 7 +- ...haosBoosterDraftEliminationTournament.java | 58 ++++++++++ ...BoosterDraftEliminationTournamentType.java | 51 +++++++++ .../ChaosBoosterDraftSwissTournament.java | 58 ++++++++++ .../ChaosBoosterDraftSwissTournamentType.java | 51 +++++++++ Mage.Server/config/config.xml | 2 + .../mage/game/draft/ChaosBoosterDraft.java | 96 +++++++++++++++++ .../mage/game/tournament/LimitedOptions.java | 9 +- .../mage/game/tournament/TournamentType.java | 7 +- 12 files changed, 462 insertions(+), 14 deletions(-) create mode 100644 Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftEliminationTournament.java create mode 100644 Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftEliminationTournamentType.java create mode 100644 Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftSwissTournament.java create mode 100644 Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftSwissTournamentType.java create mode 100644 Mage/src/mage/game/draft/ChaosBoosterDraft.java 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 9e201ee6a22..cf2bffccce4 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form @@ -118,6 +118,7 @@ + @@ -168,6 +169,8 @@ + + @@ -188,7 +191,7 @@ - + @@ -470,7 +473,7 @@ - + @@ -508,5 +511,20 @@ + + + + + + + + + + + + + + + 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 168442a87c8..a3b6bb5f77f 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java @@ -39,8 +39,13 @@ import java.util.List; import java.util.UUID; import javax.swing.ComboBoxModel; import javax.swing.DefaultComboBoxModel; +import javax.swing.DefaultListModel; +import javax.swing.DefaultListSelectionModel; import javax.swing.JComboBox; +import javax.swing.JList; import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import static javax.swing.ListSelectionModel.SINGLE_SELECTION; import javax.swing.SpinnerNumberModel; import mage.cards.decks.importer.DeckImporterUtil; import mage.cards.repository.ExpansionInfo; @@ -75,8 +80,10 @@ public class NewTournamentDialog extends MageDialog { private UUID roomId; private final Session session; private String lastSessionId; + private JList chaosList = new JList(); private final List players = new ArrayList<>(); private final List packs = new ArrayList<>(); + private final List chaosPacks = new ArrayList<>(); private final int CONSTRUCTION_TIME_MIN = 6; private final int CONSTRUCTION_TIME_MAX = 30; @@ -171,6 +178,7 @@ public class NewTournamentDialog extends MageDialog { pnlOtherPlayers = new javax.swing.JPanel(); btnOk = new javax.swing.JButton(); btnCancel = new javax.swing.JButton(); + pnlChaosPacks = new javax.swing.JPanel(); setTitle("New Tournament"); @@ -316,7 +324,7 @@ public class NewTournamentDialog extends MageDialog { ); pnlPlayersLayout.setVerticalGroup( pnlPlayersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 7, Short.MAX_VALUE) + .addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); btnOk.setText("OK"); @@ -333,6 +341,9 @@ public class NewTournamentDialog extends MageDialog { } }); + pnlChaosPacks.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + pnlChaosPacks.setLayout(new java.awt.GridLayout(0, 1, 2, 0)); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -414,7 +425,8 @@ public class NewTournamentDialog extends MageDialog { .addComponent(lblPassword) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))))) - .addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pnlChaosPacks, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); layout.setVerticalGroup( @@ -457,6 +469,8 @@ public class NewTournamentDialog extends MageDialog { .addGroup(layout.createSequentialGroup() .addComponent(pnlPacks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pnlChaosPacks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cbAllowSpectators, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -464,7 +478,7 @@ public class NewTournamentDialog extends MageDialog { .addComponent(lblNumRounds)) .addComponent(lblNbrPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(spnNumPlayers) - .addComponent(pnlDraftOptions, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) + .addComponent(pnlDraftOptions, javax.swing.GroupLayout.DEFAULT_SIZE, 0, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblPlayer1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) @@ -472,7 +486,7 @@ public class NewTournamentDialog extends MageDialog { .addComponent(lblConstructionTime) .addComponent(chkRollbackTurnsAllowed))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE) + .addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(pnlPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -517,6 +531,16 @@ public class NewTournamentDialog extends MageDialog { tOptions.getLimitedOptions().setConstructionTime((Integer)this.spnConstructTime.getValue() * 60); if (tournamentType.isCubeBooster()) { tOptions.getLimitedOptions().setDraftCubeName(this.cbDraftCube.getSelectedItem().toString()); + } else if (tournamentType.isChaos()){ + for (Integer pack: chaosList.getSelectedIndices()){ + String packStr = (String)chaosList.getModel().getElementAt(pack); + String code = packStr.substring(0, 3); + tOptions.getLimitedOptions().getSetCodes().add(code); + } + if (tOptions.getLimitedOptions().getSetCodes().size() < 2){ + // At least two sets must be chosen. + return; + } } else { for (JComboBox pack: packs) { tOptions.getLimitedOptions().getSetCodes().add(((ExpansionInfo) pack.getSelectedItem()).getCode()); @@ -629,7 +653,11 @@ public class NewTournamentDialog extends MageDialog { createPlayers((Integer) spnNumPlayers.getValue() - 1); if (tournamentType.isLimited()) { - createPacks(tournamentType.getNumBoosters()); + if (tournamentType.isChaos()){ + createChaosPacks(); + }else{ + createPacks(tournamentType.getNumBoosters()); + } } } @@ -668,11 +696,19 @@ public class NewTournamentDialog extends MageDialog { this.cbDraftCube.setVisible(true); this.lblPacks.setVisible(false); this.pnlPacks.setVisible(false); + this.pnlChaosPacks.setVisible(false); + } else if (tournamentType.isChaos()){ + this.lblDraftCube.setVisible(false); + this.cbDraftCube.setVisible(false); + this.lblPacks.setVisible(true); + this.pnlChaosPacks.setVisible(true); + this.pnlPacks.setVisible(false); } else { this.lblDraftCube.setVisible(false); this.cbDraftCube.setVisible(false); this.lblPacks.setVisible(true); this.pnlPacks.setVisible(true); + this.pnlChaosPacks.setVisible(false); } } else { // construced @@ -680,9 +716,60 @@ public class NewTournamentDialog extends MageDialog { this.cbDraftCube.setVisible(false); this.pnlPacks.setVisible(false); this.pnlPacks.setVisible(false); + this.pnlChaosPacks.setVisible(false); } } +private void createChaosPacks() { + if (pnlChaosPacks.getComponentCount() == 0 ){ + DefaultListModel chaosListModel = new DefaultListModel(); + chaosList = new JList(chaosListModel); + ExpansionInfo[] allExpansions = ExpansionRepository.instance.getWithBoostersSortedByReleaseDate(); + for (ExpansionInfo expansion: allExpansions){ + String exp = expansion.getCode() + " - " + expansion.getName(); + chaosListModel.addElement(exp); + } + chaosList.setSelectionModel(new DefaultListSelectionModel() { + private boolean mGestureStarted; + @Override + public void setSelectionInterval(int index0, int index1) { + // Toggle only one element while the user is dragging the mouse + if (!mGestureStarted) { + if (isSelectedIndex(index0)) { + super.removeSelectionInterval(index0, index1); + } else { + if (getSelectionMode() == SINGLE_SELECTION) { + super.setSelectionInterval(index0, index1); + } else { + super.addSelectionInterval(index0, index1); + } + } + } + // Disable toggling till the adjusting is over, or keep it + // enabled in case setSelectionInterval was called directly. + mGestureStarted = getValueIsAdjusting(); + } + + @Override + public void setValueIsAdjusting(boolean isAdjusting) { + super.setValueIsAdjusting(isAdjusting); + + if (isAdjusting == false) { + // Enable toggling + mGestureStarted = false; + } + } + }); + chaosList.setSelectionInterval(0, chaosListModel.size()-1); + JScrollPane list1scr = new JScrollPane(chaosList); + chaosList.setVisibleRowCount(4); + pnlChaosPacks.add(list1scr); + } + this.pack(); + this.revalidate(); + this.repaint(); + } + private void createPacks(int numPacks) { while (packs.size() > numPacks) { pnlPacks.remove(packs.get(packs.size() - 1)); @@ -829,7 +916,9 @@ public class NewTournamentDialog extends MageDialog { if (tournamentType.isDraft()) { numPlayers = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLAYERS_DRAFT, "4")); setTournamentOptions(numPlayers); - loadBoosterPacks(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_DRAFT, "")); + if (!tournamentType.isChaos()){ + loadBoosterPacks(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_DRAFT, "")); + } String draftTiming = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_DRAFT_TIMING, "REGULAR"); for (TimingOption timingOption : DraftOptions.TimingOption.values()) { @@ -942,6 +1031,7 @@ public class NewTournamentDialog extends MageDialog { private javax.swing.JLabel lblPlayer1; private javax.swing.JLabel lblTournamentType; private mage.client.table.NewPlayerPanel player1Panel; + private javax.swing.JPanel pnlChaosPacks; private javax.swing.JPanel pnlDraftOptions; private javax.swing.JPanel pnlOtherPlayers; private javax.swing.JPanel pnlPacks; diff --git a/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java b/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java index 573a1b8be86..2a897152243 100644 --- a/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java +++ b/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java @@ -152,9 +152,16 @@ public class DraftPanel extends javax.swing.JPanel { } public void updateDraft(DraftView draftView) { - this.txtPack1.setText(draftView.getSets().get(0)); - this.txtPack2.setText(draftView.getSets().get(1)); - this.txtPack3.setText(draftView.getSets().get(2)); + if (draftView.getSets().size() != 3){ + // Chaos draft + this.txtPack1.setText("???"); + this.txtPack2.setText("???"); + this.txtPack3.setText("???"); + }else{ + this.txtPack1.setText(draftView.getSets().get(0)); + this.txtPack2.setText(draftView.getSets().get(1)); + this.txtPack3.setText(draftView.getSets().get(2)); + } this.chkPack1.setSelected(draftView.getBoosterNum() > 0); this.chkPack2.setSelected(draftView.getBoosterNum() > 1); this.chkPack3.setSelected(draftView.getBoosterNum() > 2); diff --git a/Mage.Common/src/mage/view/TournamentTypeView.java b/Mage.Common/src/mage/view/TournamentTypeView.java index b524e6a96e1..7a3519a1cf7 100644 --- a/Mage.Common/src/mage/view/TournamentTypeView.java +++ b/Mage.Common/src/mage/view/TournamentTypeView.java @@ -36,7 +36,7 @@ import mage.game.tournament.TournamentType; * @author BetaSteward_at_googlemail.com */ public class TournamentTypeView implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 2L; private final String name; private final int minPlayers; @@ -46,6 +46,7 @@ public class TournamentTypeView implements Serializable { private final boolean limited; private final boolean cubeBooster; private final boolean elimination; + private final boolean chaos; public TournamentTypeView(TournamentType tournamentType) { @@ -57,6 +58,7 @@ public class TournamentTypeView implements Serializable { this.limited = tournamentType.isLimited(); this.cubeBooster = tournamentType.isCubeBooster(); this.elimination = tournamentType.isElimination(); + this.chaos = tournamentType.isChaos(); } @Override @@ -96,4 +98,7 @@ public class TournamentTypeView implements Serializable { return elimination; } + public boolean isChaos(){ + return chaos; + } } diff --git a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftEliminationTournament.java b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftEliminationTournament.java new file mode 100644 index 00000000000..2a98c558eaa --- /dev/null +++ b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftEliminationTournament.java @@ -0,0 +1,58 @@ +/* + * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.tournament; + +import mage.constants.TournamentPlayerState; +import mage.game.draft.DraftOptions; +import mage.game.events.TableEvent.EventType; +import mage.game.tournament.TournamentPlayer; +import mage.game.draft.ChaosBoosterDraft; +import mage.game.tournament.TournamentOptions; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class ChaosBoosterDraftEliminationTournament extends BoosterDraftEliminationTournament { + + public ChaosBoosterDraftEliminationTournament(TournamentOptions options) { + super(options); + currentStep = TournamentStep.START; + } + + @Override + protected void draft() { + draft = new ChaosBoosterDraft((DraftOptions) options.getLimitedOptions(), getSets()); + for (TournamentPlayer player: players.values()) { + draft.addPlayer(player.getPlayer()); + player.setState(TournamentPlayerState.DRAFTING); + } + tableEventSource.fireTableEvent(EventType.START_DRAFT, null, draft); + } +} diff --git a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftEliminationTournamentType.java b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftEliminationTournamentType.java new file mode 100644 index 00000000000..6ac57a9ae69 --- /dev/null +++ b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftEliminationTournamentType.java @@ -0,0 +1,51 @@ +/* + * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.tournament; + +import mage.game.tournament.TournamentType; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class ChaosBoosterDraftEliminationTournamentType extends TournamentType { + + public ChaosBoosterDraftEliminationTournamentType() { + this.name = "Booster Draft Elimination (Chaos)"; + this.maxPlayers = 16; + this.minPlayers = 4; + this.numBoosters = 3; + this.draft = true; + this.limited = true; + this.cubeBooster = false; + this.elimination = false; + this.isChaos = true; + } + +} diff --git a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftSwissTournament.java b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftSwissTournament.java new file mode 100644 index 00000000000..75f0761f655 --- /dev/null +++ b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftSwissTournament.java @@ -0,0 +1,58 @@ +/* + * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.tournament; + +import mage.constants.TournamentPlayerState; +import mage.game.draft.DraftOptions; +import mage.game.events.TableEvent.EventType; +import mage.game.tournament.TournamentPlayer; +import mage.game.draft.ChaosBoosterDraft; +import mage.game.tournament.TournamentOptions; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class ChaosBoosterDraftSwissTournament extends BoosterDraftSwissTournament { + + public ChaosBoosterDraftSwissTournament(TournamentOptions options) { + super(options); + currentStep = TournamentStep.START; + } + + @Override + protected void draft() { + draft = new ChaosBoosterDraft((DraftOptions) options.getLimitedOptions(), getSets()); + for (TournamentPlayer player: players.values()) { + draft.addPlayer(player.getPlayer()); + player.setState(TournamentPlayerState.DRAFTING); + } + tableEventSource.fireTableEvent(EventType.START_DRAFT, null, draft); + } +} diff --git a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftSwissTournamentType.java b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftSwissTournamentType.java new file mode 100644 index 00000000000..8f638e2ea3e --- /dev/null +++ b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftSwissTournamentType.java @@ -0,0 +1,51 @@ +/* + * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.tournament; + +import mage.game.tournament.TournamentType; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class ChaosBoosterDraftSwissTournamentType extends TournamentType { + + public ChaosBoosterDraftSwissTournamentType() { + this.name = "Booster Draft Swiss (Chaos)"; + this.maxPlayers = 16; + this.minPlayers = 4; + this.numBoosters = 3; + this.draft = true; + this.limited = true; + this.cubeBooster = false; + this.elimination = false; + this.isChaos = true; + } + +} diff --git a/Mage.Server/config/config.xml b/Mage.Server/config/config.xml index ec01eac5b80..31d03689957 100644 --- a/Mage.Server/config/config.xml +++ b/Mage.Server/config/config.xml @@ -55,8 +55,10 @@ + + diff --git a/Mage/src/mage/game/draft/ChaosBoosterDraft.java b/Mage/src/mage/game/draft/ChaosBoosterDraft.java new file mode 100644 index 00000000000..3c25bfea68b --- /dev/null +++ b/Mage/src/mage/game/draft/ChaosBoosterDraft.java @@ -0,0 +1,96 @@ +/* + * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.game.draft; + +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 { + + List allSets; + List usedBoosters; + public ChaosBoosterDraft(DraftOptions options, List sets) { + super(options, sets); + if (sets.isEmpty()){ + throw new RuntimeException("At least one set must be selected for chaos booster draft"); + } + allSets = new ArrayList<>(sets); + resetBoosters(); + } + + @Override + public void start() { + while (!isAbort() && boosterNum < numberBoosters) { + openBooster(); + while (!isAbort() && pickCards()) { + if (boosterNum % 2 == 1) { + passLeft(); + } else { + passRight(); + } + fireUpdatePlayersEvent(); + } + } + resetBufferedCards(); + this.fireEndDraftEvent(); + } + + @Override + protected void openBooster() { + if (boosterNum < numberBoosters) { + for (DraftPlayer player: players.values()) { + player.setBooster(getNextBooster().createBooster()); + } + } + boosterNum++; + cardNum = 1; + fireUpdatePlayersEvent(); + } + + private ExpansionSet getNextBooster() { + if (0 == usedBoosters.size()){ + resetBoosters(); + } + ExpansionSet theBooster = usedBoosters.get(0); + usedBoosters.remove(theBooster); + return theBooster; + } + + private void resetBoosters(){ + usedBoosters = new ArrayList<>(allSets); + Collections.shuffle(usedBoosters); + } +} diff --git a/Mage/src/mage/game/tournament/LimitedOptions.java b/Mage/src/mage/game/tournament/LimitedOptions.java index e44b7efec9d..4c5e3b0080e 100644 --- a/Mage/src/mage/game/tournament/LimitedOptions.java +++ b/Mage/src/mage/game/tournament/LimitedOptions.java @@ -44,6 +44,7 @@ public class LimitedOptions implements Serializable { protected String draftCubeName; protected DraftCube draftCube; protected int numberBoosters; + protected boolean isChaos; public List getSetCodes() { return sets; @@ -80,5 +81,11 @@ public class LimitedOptions implements Serializable { public void setNumberBoosters(int numberBoosters) { this.numberBoosters = numberBoosters; } - + + public boolean getIsChaos(){ + return isChaos; + } + public void setIsChaos(boolean isChaos){ + this.isChaos = isChaos; + } } diff --git a/Mage/src/mage/game/tournament/TournamentType.java b/Mage/src/mage/game/tournament/TournamentType.java index af872e37057..88505f678d0 100644 --- a/Mage/src/mage/game/tournament/TournamentType.java +++ b/Mage/src/mage/game/tournament/TournamentType.java @@ -44,6 +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 TournamentType() {} @@ -83,5 +84,9 @@ public class TournamentType implements Serializable { public boolean isCubeBooster() { return cubeBooster; } - + + public boolean isChaos(){ + return this.isChaos; + } + } From 07aa53618c287175442aaed358535314ade8055b Mon Sep 17 00:00:00 2001 From: BrodyL Date: Mon, 22 Jun 2015 22:13:25 -0700 Subject: [PATCH 4/5] Revert "Update readme.md" This reverts commit 73495db4bdec57230ee3fb7efb07935500f1d92b. --- readme.md | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/readme.md b/readme.md index 7a6a9bb2f5c..3ffe232abc3 100644 --- a/readme.md +++ b/readme.md @@ -1,35 +1,3 @@ -# XMage - Magic, Another Game Engine +Fork of xmage for chaos cube implementation. -XMage allows you to play Magic against one or more online players or computer opponents. It includes full rules enforcement for over **10,000** unique cards (nearly 20,000 counting all cards from different editions). Starting with Eventide, all regular sets have nearly all the cards implemented ([detailed overview](http://ct-magefree.rhcloud.com/stats)). - -There are public servers where you can play XMage against other players. You can also host your own server to play against the AI and/or your friends. - -You can visit the XMage forum [here](http://www.slightlymagic.net/forum/viewforum.php?f=70). - -## Features -* Deck editor to build your desired decks. -* There is a simple computer AI opponent available. -* You can play either a two player duel or a multiplayer free-for-all game with up to 10 players. -* Commander format (also up to 10 players). -* Tiny Leaders duels. -* There are two tournament types supported, which can be played with up to 16 players: -* Elimination or swiss type handling -* Booster (also Cube) draft tournaments (4-16) -* Sealed (also from Cube) tournaments (2-16) - -## Installation -Download and install the [latest XMage release](http://XMage.de). -You will need to have the [Java Runtime Environment](http://java.com/en/) Version 7 or later. - -Look [here](http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=13632) for more detailed instructions. -[Here](http://github.com/magefree/mage/wiki/Release-changes) you can find a log of the latest changes. - -## Developer - -If you are interested in developing XMage, here are some useful resources: -* [Developer Getting Started](http://github.com/magefree/mage/wiki/Developer-Getting-Started) -* [Developer Notes](http://github.com/magefree/mage/wiki/Developer-Notes) -* [Developer Testing Tools](http://github.com/magefree/mage/wiki/Developer-Testing-Tools) -* [Double Faced Cards](http://github.com/magefree/mage/wiki/Double-Faced-Cards) -* [Card Requests](http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=4554) -* [Tournament Relevant Card Requests](http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=14062) +a chaos booster draft is one where a pack pool is created with random packs and randomly distributed. you draft with those. Typically you use 24 different sets, so the decks are super weird. From d57ff3b0b31378d514df323791630f53c4fcb72c Mon Sep 17 00:00:00 2001 From: BrodyL Date: Mon, 22 Jun 2015 22:13:38 -0700 Subject: [PATCH 5/5] Revert "Update readme.md" This reverts commit 8685c676796d1bdfeb930ba3ec9a2677b28b4083. --- readme.md | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 3ffe232abc3..a7ee59046a3 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,35 @@ -Fork of xmage for chaos cube implementation. +# XMage - Magic, Another Game Engine -a chaos booster draft is one where a pack pool is created with random packs and randomly distributed. you draft with those. Typically you use 24 different sets, so the decks are super weird. +XMage allows you to play Magic against one or more online players or computer opponents. It includes full rules enforcement for over **10,000** unique cards (nearly 20,000 counting all cards from different editions). Starting with Eventide, all regular sets have nearly all the cards implemented ([detailed overview](http://ct-magefree.rhcloud.com/stats)). + +There are public servers where you can play XMage against other players. You can also host your own server to play against the AI and/or your friends. + +You can visit the XMage forum [here](http://www.slightlymagic.net/forum/viewforum.php?f=70). + +## Features +* Deck editor to build your desired decks. +* There is a simple computer AI opponent available. +* You can play either a two player duel or a multiplayer free-for-all game with up to 10 players. +* Commander format (also up to 10 players). +* Tiny Leaders duels. +* There are two tournament types supported, which can be played with up to 16 players: +* Elimination or swiss type handling +* Booster (also Cube) draft tournaments (4-16) +* Sealed (also from Cube) tournaments (2-16) + +## Installation +Download and install the [latest XMage release](http://XMage.de). +You will need to have the [Java Runtime Environment](http://java.com/en/) Version 7 or later. + +Look [here](http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=13632) for more detailed instructions. +[Here](http://github.com/magefree/mage/wiki/Release-changes) you can find a log of the latest changes. + +## Developer + +If you are interested in developing XMage, here are some useful resources: +* [Developer Getting Started](http://github.com/magefree/mage/wiki/Developer-Getting-Started) +* [Developer Notes](http://github.com/magefree/mage/wiki/Developer-Notes) +* [Developer Testing Tools](http://github.com/magefree/mage/wiki/Developer-Testing-Tools) +* [Double Faced Cards](http://github.com/magefree/mage/wiki/Double-Faced-Cards) +* [Card Requests](http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=4554) +* [Tournament Relevant Card Requests](http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=14062) \ No newline at end of file