mirror of
https://github.com/correl/mage.git
synced 2025-04-09 01:01:06 -09:00
updated sets and added booster packs - commented out planechase set
This commit is contained in:
parent
ad83ccabf4
commit
5acf46bb60
21 changed files with 379 additions and 151 deletions
Mage.Client/src/main/java/mage/client/deckeditor
Mage.Server/src/mage/server/game
Mage.Sets/src/mage/sets
AlaraReborn.javaConflux.javaMagic2010.javaMagic2011.javaPlanechase.javaRiseOfTheEldrazi.javaSets.javaShardsOfAlara.javaTenth.javaWorldwake.javaZendikar.java
planechase
Mage/src/mage/cards
|
@ -16,9 +16,9 @@
|
|||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="tbColor" alignment="0" pref="825" max="32767" attributes="0"/>
|
||||
<Component id="tbTypes" alignment="0" pref="825" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" alignment="0" pref="825" max="32767" attributes="0"/>
|
||||
<Component id="tbColor" alignment="0" pref="917" max="32767" attributes="0"/>
|
||||
<Component id="tbTypes" alignment="0" pref="917" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" alignment="0" pref="917" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
|
@ -129,6 +129,28 @@
|
|||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbExpansionSetActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnBooster">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Open Booster"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnBoosterActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnClear">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Clear"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnClearActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
|
|
|
@ -101,12 +101,12 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
|
||||
private void filterCards() {
|
||||
try {
|
||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||
cards.clear();
|
||||
for (Card card: allCards) {
|
||||
if (filter.match(card))
|
||||
cards.add(card);
|
||||
}
|
||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||
this.cardGrid.loadCards(new CardsView(cards), bigCard, null);
|
||||
}
|
||||
finally {
|
||||
|
@ -139,6 +139,8 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
rdoWhite = new javax.swing.JRadioButton();
|
||||
rdoColorless = new javax.swing.JRadioButton();
|
||||
cbExpansionSet = new javax.swing.JComboBox();
|
||||
btnBooster = new javax.swing.JButton();
|
||||
btnClear = new javax.swing.JButton();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
cardGrid = new mage.client.cards.CardGrid();
|
||||
tbTypes = new javax.swing.JToolBar();
|
||||
|
@ -233,6 +235,28 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
});
|
||||
tbColor.add(cbExpansionSet);
|
||||
|
||||
btnBooster.setText("Open Booster");
|
||||
btnBooster.setFocusable(false);
|
||||
btnBooster.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnBooster.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnBooster.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnBoosterActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbColor.add(btnBooster);
|
||||
|
||||
btnClear.setText("Clear");
|
||||
btnClear.setFocusable(false);
|
||||
btnClear.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnClear.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnClear.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnClearActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbColor.add(btnClear);
|
||||
|
||||
jScrollPane1.setViewportView(cardGrid);
|
||||
|
||||
tbTypes.setFloatable(false);
|
||||
|
@ -326,9 +350,9 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(tbColor, javax.swing.GroupLayout.DEFAULT_SIZE, 825, Short.MAX_VALUE)
|
||||
.addComponent(tbTypes, javax.swing.GroupLayout.DEFAULT_SIZE, 825, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 825, Short.MAX_VALUE)
|
||||
.addComponent(tbColor, javax.swing.GroupLayout.DEFAULT_SIZE, 917, Short.MAX_VALUE)
|
||||
.addComponent(tbTypes, javax.swing.GroupLayout.DEFAULT_SIZE, 917, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 917, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
@ -435,8 +459,23 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
filterCards();
|
||||
}//GEN-LAST:event_cbExpansionSetActionPerformed
|
||||
|
||||
private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
|
||||
cards.clear();
|
||||
this.cardGrid.loadCards(new CardsView(cards), bigCard, null);
|
||||
}//GEN-LAST:event_btnClearActionPerformed
|
||||
|
||||
private void btnBoosterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBoosterActionPerformed
|
||||
List<Card> booster = ((ExpansionSet)this.cbExpansionSet.getSelectedItem()).createBooster();
|
||||
for (Card card: booster) {
|
||||
cards.add(card);
|
||||
}
|
||||
this.cardGrid.loadCards(new CardsView(cards), bigCard, null);
|
||||
}//GEN-LAST:event_btnBoosterActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnBooster;
|
||||
private javax.swing.JButton btnClear;
|
||||
private mage.client.cards.CardGrid cardGrid;
|
||||
private javax.swing.JComboBox cbExpansionSet;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
|
|
|
@ -42,6 +42,7 @@ import java.util.UUID;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.decks.Deck;
|
||||
|
@ -49,6 +50,7 @@ import mage.cards.decks.DeckCardLists;
|
|||
import mage.client.MageFrame;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.Listener;
|
||||
import mage.game.GameException;
|
||||
import mage.view.CardsView;
|
||||
|
||||
/**
|
||||
|
@ -275,6 +277,8 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
try {
|
||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||
deck = Deck.load(DeckCardLists.load(file.getPath()));
|
||||
} catch (GameException ex) {
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), ex.getMessage(), "Error loading deck", JOptionPane.ERROR_MESSAGE);
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(DeckEditorPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ import mage.cards.Cards;
|
|||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.game.Game;
|
||||
import mage.game.GameException;
|
||||
import mage.game.events.Listener;
|
||||
import mage.game.events.PlayerQueryEvent;
|
||||
import mage.game.events.TableEvent;
|
||||
|
@ -213,10 +214,15 @@ public class GameController implements GameCallback {
|
|||
}
|
||||
|
||||
public void cheat(UUID sessionId, UUID playerId, DeckCardLists deckList) {
|
||||
Deck deck = Deck.load(deckList);
|
||||
game.loadCards(deck.getCards(), playerId);
|
||||
for (Card card: deck.getCards()) {
|
||||
card.putOntoBattlefield(game, Zone.OUTSIDE, playerId);
|
||||
Deck deck;
|
||||
try {
|
||||
deck = Deck.load(deckList);
|
||||
game.loadCards(deck.getCards(), playerId);
|
||||
for (Card card: deck.getCards()) {
|
||||
card.putOntoBattlefield(game, Zone.OUTSIDE, playerId);
|
||||
}
|
||||
} catch (GameException ex) {
|
||||
logger.warning(ex.getMessage());
|
||||
}
|
||||
addCardsForTesting(game);
|
||||
updateGame();
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
package mage.sets;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
import mage.cards.ExpansionSet;
|
||||
|
||||
/**
|
||||
|
@ -43,7 +44,13 @@ public class AlaraReborn extends ExpansionSet {
|
|||
}
|
||||
|
||||
private AlaraReborn() {
|
||||
super("Alara Reborn", "ARB", "seticon_mtgarb", "mage.sets.alarareborn");
|
||||
super("Alara Reborn", "ARB", "seticon_mtgarb", "mage.sets.alarareborn", new GregorianCalendar(2009, 3, 25).getTime(), false);
|
||||
this.blockName = "Shards of Alara";
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
this.numBoosterUncommon = 3;
|
||||
this.numBoosterRare = 1;
|
||||
this.ratioBoosterMythic = 8;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
package mage.sets;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
import mage.cards.ExpansionSet;
|
||||
|
||||
/**
|
||||
|
@ -43,7 +44,13 @@ public class Conflux extends ExpansionSet {
|
|||
}
|
||||
|
||||
private Conflux() {
|
||||
super("Conflux", "CON", "seticon_conflux", "mage.sets.conflux");
|
||||
super("Conflux", "CON", "seticon_conflux", "mage.sets.conflux", new GregorianCalendar(2009, 0, 31).getTime(), false);
|
||||
this.blockName = "Shards of Alara";
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
this.numBoosterUncommon = 3;
|
||||
this.numBoosterRare = 1;
|
||||
this.ratioBoosterMythic = 8;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
package mage.sets;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
import mage.cards.ExpansionSet;
|
||||
|
||||
/**
|
||||
|
@ -43,6 +44,12 @@ public class Magic2010 extends ExpansionSet {
|
|||
}
|
||||
|
||||
private Magic2010() {
|
||||
super("Magic 2010", "M10", "seticon_M10", "mage.sets.magic2010");
|
||||
super("Magic 2010", "M10", "seticon_M10", "mage.sets.magic2010", new GregorianCalendar(2009, 6, 17).getTime(), true);
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
this.numBoosterUncommon = 3;
|
||||
this.numBoosterRare = 1;
|
||||
this.ratioBoosterMythic = 8;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
package mage.sets;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
import mage.cards.ExpansionSet;
|
||||
|
||||
/**
|
||||
|
@ -43,6 +44,12 @@ public class Magic2011 extends ExpansionSet {
|
|||
}
|
||||
|
||||
private Magic2011() {
|
||||
super("Magic 2011", "M11", "seticon_M11", "mage.sets.magic2011");
|
||||
super("Magic 2011", "M11", "seticon_M11", "mage.sets.magic2011", new GregorianCalendar(2010, 6, 16).getTime(), true);
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
this.numBoosterUncommon = 3;
|
||||
this.numBoosterRare = 1;
|
||||
this.ratioBoosterMythic = 8;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,24 +26,24 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.sets;
|
||||
|
||||
import mage.cards.ExpansionSet;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class Planechase extends ExpansionSet {
|
||||
|
||||
private static final Planechase fINSTANCE = new Planechase();
|
||||
|
||||
public static Planechase getInstance() {
|
||||
return fINSTANCE;
|
||||
}
|
||||
|
||||
private Planechase() {
|
||||
super("Planechase", "HOP", "", "mage.sets.planechase");
|
||||
}
|
||||
|
||||
}
|
||||
//package mage.sets;
|
||||
//
|
||||
//import mage.cards.ExpansionSet;
|
||||
//
|
||||
///**
|
||||
// *
|
||||
// * @author BetaSteward_at_googlemail.com
|
||||
// */
|
||||
//public class Planechase extends ExpansionSet {
|
||||
//
|
||||
// private static final Planechase fINSTANCE = new Planechase();
|
||||
//
|
||||
// public static Planechase getInstance() {
|
||||
// return fINSTANCE;
|
||||
// }
|
||||
//
|
||||
// private Planechase() {
|
||||
// super("Planechase", "HOP", "", "mage.sets.planechase");
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -28,6 +28,11 @@
|
|||
|
||||
package mage.sets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.ExpansionSet;
|
||||
|
||||
/**
|
||||
|
@ -43,7 +48,13 @@ public class RiseOfTheEldrazi extends ExpansionSet {
|
|||
}
|
||||
|
||||
private RiseOfTheEldrazi() {
|
||||
super("Rise Of The Eldrazi", "ROE", "seticon_ROE", "mage.sets.riseoftheeldrazi");
|
||||
super("Rise Of The Eldrazi", "ROE", "seticon_ROE", "mage.sets.riseoftheeldrazi", new GregorianCalendar(2010, 3, 17).getTime(), false);
|
||||
this.blockName = "Zendikar";
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
this.numBoosterUncommon = 3;
|
||||
this.numBoosterRare = 1;
|
||||
this.ratioBoosterMythic = 8;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
|||
this.addSet(Conflux.getInstance());
|
||||
this.addSet(Magic2010.getInstance());
|
||||
this.addSet(Magic2011.getInstance());
|
||||
this.addSet(Planechase.getInstance());
|
||||
// this.addSet(Planechase.getInstance());
|
||||
this.addSet(RiseOfTheEldrazi.getInstance());
|
||||
this.addSet(ShardsOfAlara.getInstance());
|
||||
this.addSet(Tenth.getInstance());
|
||||
|
|
|
@ -28,6 +28,11 @@
|
|||
|
||||
package mage.sets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.ExpansionSet;
|
||||
|
||||
/**
|
||||
|
@ -43,7 +48,13 @@ public class ShardsOfAlara extends ExpansionSet {
|
|||
}
|
||||
|
||||
private ShardsOfAlara() {
|
||||
super("Shards Of Alara", "ALA", "seticon_mtgala", "mage.sets.shardsofalara");
|
||||
super("Shards of Alara", "ALA", "seticon_mtgala", "mage.sets.shardsofalara", new GregorianCalendar(2008, 8, 27).getTime(), false);
|
||||
this.blockName = "Shards of Alara";
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
this.numBoosterUncommon = 3;
|
||||
this.numBoosterRare = 1;
|
||||
this.ratioBoosterMythic = 8;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
package mage.sets;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
import mage.cards.ExpansionSet;
|
||||
|
||||
/**
|
||||
|
@ -43,7 +44,12 @@ public class Tenth extends ExpansionSet {
|
|||
}
|
||||
|
||||
private Tenth() {
|
||||
super("Tenth Edition", "10E", "exp_symbol_mtg10e", "mage.sets.tenth");
|
||||
super("Tenth Edition", "10E", "exp_symbol_mtg10e", "mage.sets.tenth", new GregorianCalendar(2007, 6, 14).getTime(), true);
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
this.numBoosterUncommon = 3;
|
||||
this.numBoosterRare = 1;
|
||||
this.ratioBoosterMythic = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
package mage.sets;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
import mage.cards.ExpansionSet;
|
||||
|
||||
/**
|
||||
|
@ -43,7 +44,13 @@ public class Worldwake extends ExpansionSet {
|
|||
}
|
||||
|
||||
private Worldwake() {
|
||||
super("Worldwake", "WWK", "seticon_WWK", "mage.sets.worldwake");
|
||||
super("Worldwake", "WWK", "seticon_WWK", "mage.sets.worldwake", new GregorianCalendar(2010, 0, 30).getTime(), false);
|
||||
this.blockName = "Zendikar";
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
this.numBoosterUncommon = 3;
|
||||
this.numBoosterRare = 1;
|
||||
this.ratioBoosterMythic = 8;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
package mage.sets;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
import mage.cards.ExpansionSet;
|
||||
|
||||
/**
|
||||
|
@ -43,7 +44,13 @@ public class Zendikar extends ExpansionSet {
|
|||
}
|
||||
|
||||
private Zendikar() {
|
||||
super("Zendikar", "ZEN", "seticon_ZEN", "mage.sets.zendikar");
|
||||
super("Zendikar", "ZEN", "seticon_ZEN", "mage.sets.zendikar", new GregorianCalendar(2009, 8, 26).getTime(), false);
|
||||
this.blockName = "Zendikar";
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
this.numBoosterUncommon = 3;
|
||||
this.numBoosterRare = 1;
|
||||
this.ratioBoosterMythic = 8;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,29 +26,29 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.sets.planechase;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class Gravedigger extends mage.sets.tenth.Gravedigger {
|
||||
|
||||
public Gravedigger(UUID ownerId) {
|
||||
super(ownerId);
|
||||
this.cardNumber = 29;
|
||||
this.expansionSetCode = "HOP";
|
||||
}
|
||||
|
||||
public Gravedigger(final Gravedigger card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Gravedigger copy() {
|
||||
return new Gravedigger(this);
|
||||
}
|
||||
|
||||
}
|
||||
//package mage.sets.planechase;
|
||||
//
|
||||
//import java.util.UUID;
|
||||
//
|
||||
///**
|
||||
// *
|
||||
// * @author BetaSteward_at_googlemail.com
|
||||
// */
|
||||
//public class Gravedigger extends mage.sets.tenth.Gravedigger {
|
||||
//
|
||||
// public Gravedigger(UUID ownerId) {
|
||||
// super(ownerId);
|
||||
// this.cardNumber = 29;
|
||||
// this.expansionSetCode = "HOP";
|
||||
// }
|
||||
//
|
||||
// public Gravedigger(final Gravedigger card) {
|
||||
// super(card);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Gravedigger copy() {
|
||||
// return new Gravedigger(this);
|
||||
// }
|
||||
//
|
||||
//}
|
|
@ -26,29 +26,29 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.sets.planechase;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class OblivionRing extends mage.sets.shardsofalara.OblivionRing {
|
||||
|
||||
public OblivionRing(UUID ownerId) {
|
||||
super(ownerId);
|
||||
this.cardNumber = 4;
|
||||
this.expansionSetCode = "HOP";
|
||||
}
|
||||
|
||||
public OblivionRing(final OblivionRing card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OblivionRing copy() {
|
||||
return new OblivionRing(this);
|
||||
}
|
||||
|
||||
}
|
||||
//package mage.sets.planechase;
|
||||
//
|
||||
//import java.util.UUID;
|
||||
//
|
||||
///**
|
||||
// *
|
||||
// * @author BetaSteward_at_googlemail.com
|
||||
// */
|
||||
//public class OblivionRing extends mage.sets.shardsofalara.OblivionRing {
|
||||
//
|
||||
// public OblivionRing(UUID ownerId) {
|
||||
// super(ownerId);
|
||||
// this.cardNumber = 4;
|
||||
// this.expansionSetCode = "HOP";
|
||||
// }
|
||||
//
|
||||
// public OblivionRing(final OblivionRing card) {
|
||||
// super(card);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public OblivionRing copy() {
|
||||
// return new OblivionRing(this);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -26,29 +26,29 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.sets.planechase;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class SoulWarden extends mage.sets.magic2010.SoulWarden {
|
||||
|
||||
public SoulWarden(UUID ownerId) {
|
||||
super(ownerId);
|
||||
this.cardNumber = 7;
|
||||
this.expansionSetCode = "HOP";
|
||||
}
|
||||
|
||||
public SoulWarden(final SoulWarden card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoulWarden copy() {
|
||||
return new SoulWarden(this);
|
||||
}
|
||||
|
||||
}
|
||||
//package mage.sets.planechase;
|
||||
//
|
||||
//import java.util.UUID;
|
||||
//
|
||||
///**
|
||||
// *
|
||||
// * @author BetaSteward_at_googlemail.com
|
||||
// */
|
||||
//public class SoulWarden extends mage.sets.magic2010.SoulWarden {
|
||||
//
|
||||
// public SoulWarden(UUID ownerId) {
|
||||
// super(ownerId);
|
||||
// this.cardNumber = 7;
|
||||
// this.expansionSetCode = "HOP";
|
||||
// }
|
||||
//
|
||||
// public SoulWarden(final SoulWarden card) {
|
||||
// super(card);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public SoulWarden copy() {
|
||||
// return new SoulWarden(this);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -26,29 +26,29 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.sets.planechase;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class TerramorphicExpanse extends mage.sets.tenth.TerramorphicExpanse {
|
||||
|
||||
public TerramorphicExpanse(UUID ownerId) {
|
||||
super(ownerId);
|
||||
this.cardNumber = 139;
|
||||
this.expansionSetCode = "HOP";
|
||||
}
|
||||
|
||||
public TerramorphicExpanse(final TerramorphicExpanse card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TerramorphicExpanse copy() {
|
||||
return new TerramorphicExpanse(this);
|
||||
}
|
||||
|
||||
}
|
||||
//package mage.sets.planechase;
|
||||
//
|
||||
//import java.util.UUID;
|
||||
//
|
||||
///**
|
||||
// *
|
||||
// * @author BetaSteward_at_googlemail.com
|
||||
// */
|
||||
//public class TerramorphicExpanse extends mage.sets.tenth.TerramorphicExpanse {
|
||||
//
|
||||
// public TerramorphicExpanse(UUID ownerId) {
|
||||
// super(ownerId);
|
||||
// this.cardNumber = 139;
|
||||
// this.expansionSetCode = "HOP";
|
||||
// }
|
||||
//
|
||||
// public TerramorphicExpanse(final TerramorphicExpanse card) {
|
||||
// super(card);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public TerramorphicExpanse copy() {
|
||||
// return new TerramorphicExpanse(this);
|
||||
// }
|
||||
//
|
||||
//}
|
|
@ -34,15 +34,20 @@ import java.io.Serializable;
|
|||
import java.lang.reflect.Constructor;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.util.Logging;
|
||||
|
||||
/**
|
||||
|
@ -53,16 +58,32 @@ public abstract class ExpansionSet implements Serializable {
|
|||
|
||||
private final static Logger logger = Logging.getLogger(ExpansionSet.class.getName());
|
||||
|
||||
protected static Random rnd = new Random();
|
||||
|
||||
protected String name;
|
||||
protected String code;
|
||||
protected String symbolCode;
|
||||
protected Date releaseDate;
|
||||
protected ExpansionSet parentSet;
|
||||
protected List<Class> cards;
|
||||
protected boolean core;
|
||||
protected Map<Rarity, List<Class>> rarities;
|
||||
|
||||
public ExpansionSet(String name, String code, String symbolCode, String packageName) {
|
||||
protected String blockName;
|
||||
protected int numBoosterLands;
|
||||
protected int numBoosterCommon;
|
||||
protected int numBoosterUncommon;
|
||||
protected int numBoosterRare;
|
||||
protected int ratioBoosterMythic;
|
||||
|
||||
public ExpansionSet(String name, String code, String symbolCode, String packageName, Date releaseDate, boolean core) {
|
||||
this.name = name;
|
||||
this.code = code;
|
||||
this.symbolCode = symbolCode;
|
||||
this.releaseDate = releaseDate;
|
||||
this.core = core;
|
||||
this.cards = getCardClassesForPackage(packageName);
|
||||
this.rarities = getCardsByRarity();
|
||||
}
|
||||
|
||||
public List<Class> getCards() {
|
||||
|
@ -81,6 +102,14 @@ public abstract class ExpansionSet implements Serializable {
|
|||
return symbolCode;
|
||||
}
|
||||
|
||||
public Date getReleaseDate() {
|
||||
return releaseDate;
|
||||
}
|
||||
|
||||
public boolean isCore() {
|
||||
return core;
|
||||
}
|
||||
|
||||
public Card createCard(Class clazz) {
|
||||
try {
|
||||
Constructor<?> con = clazz.getConstructor(new Class[]{UUID.class});
|
||||
|
@ -143,4 +172,53 @@ public abstract class ExpansionSet implements Serializable {
|
|||
return classes;
|
||||
}
|
||||
|
||||
private Map<Rarity, List<Class>> getCardsByRarity() {
|
||||
Map<Rarity, List<Class>> cardsByRarity = new HashMap<Rarity, List<Class>>();
|
||||
|
||||
for (Class clazz: cards) {
|
||||
Card card = createCard(clazz);
|
||||
if (!cardsByRarity.containsKey(card.getRarity()))
|
||||
cardsByRarity.put(card.getRarity(), new ArrayList<Class>());
|
||||
cardsByRarity.get(card.getRarity()).add(clazz);
|
||||
}
|
||||
|
||||
return cardsByRarity;
|
||||
}
|
||||
|
||||
public List<Card> createBooster() {
|
||||
List<Card> booster = new ArrayList<Card>();
|
||||
|
||||
if (parentSet != null) {
|
||||
parentSet.getRandom(Rarity.LAND);
|
||||
}
|
||||
else {
|
||||
booster.add(getRandom(Rarity.LAND));
|
||||
}
|
||||
for (int i = 0; i < numBoosterCommon; i++) {
|
||||
booster.add(getRandom(Rarity.COMMON));
|
||||
}
|
||||
for (int i = 0; i < numBoosterUncommon; i++) {
|
||||
booster.add(getRandom(Rarity.UNCOMMON));
|
||||
}
|
||||
for (int i = 0; i < numBoosterRare; i++) {
|
||||
if (rnd.nextInt(ratioBoosterMythic) == 1) {
|
||||
booster.add(getRandom(Rarity.MYTHIC));
|
||||
}
|
||||
else {
|
||||
booster.add(getRandom(Rarity.RARE));
|
||||
}
|
||||
}
|
||||
|
||||
return booster;
|
||||
}
|
||||
|
||||
protected Card getRandom(Rarity rarity) {
|
||||
if (!rarities.containsKey(rarity))
|
||||
return null;
|
||||
int size = rarities.get(rarity).size();
|
||||
if (size > 0) {
|
||||
return createCard(rarities.get(rarity).get(rnd.nextInt(size)));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import mage.cards.*;
|
|||
import java.io.Serializable;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import mage.game.GameException;
|
||||
|
||||
public class Deck implements Serializable {
|
||||
|
||||
|
@ -39,14 +40,22 @@ public class Deck implements Serializable {
|
|||
private Set<Card> cards = new LinkedHashSet<Card>();
|
||||
private Set<Card> sideboard = new LinkedHashSet<Card>();
|
||||
|
||||
public static Deck load(DeckCardLists deckCardLists) {
|
||||
public static Deck load(DeckCardLists deckCardLists) throws GameException {
|
||||
Deck deck = new Deck();
|
||||
deck.setName(deckCardLists.getName());
|
||||
for (String cardName: deckCardLists.getCards()) {
|
||||
deck.cards.add(CardImpl.createCard(cardName));
|
||||
Card card = CardImpl.createCard(cardName);
|
||||
if (card != null)
|
||||
deck.cards.add(CardImpl.createCard(cardName));
|
||||
else
|
||||
throw new GameException("Error loading card - " + cardName + " for deck - " + deck.getName());
|
||||
}
|
||||
for (String cardName: deckCardLists.getSideboard()) {
|
||||
deck.sideboard.add(CardImpl.createCard(cardName));
|
||||
Card card = CardImpl.createCard(cardName);
|
||||
if (card != null)
|
||||
deck.sideboard.add(CardImpl.createCard(cardName));
|
||||
else
|
||||
throw new GameException("Error loading card - " + cardName + " for deck - " + deck.getName());
|
||||
}
|
||||
|
||||
return deck;
|
||||
|
|
Loading…
Add table
Reference in a new issue