diff --git a/Mage.Deck.Constructed/build.xml b/Mage.Deck.Constructed/build.xml new file mode 100644 index 00000000000..5e6d83e9315 --- /dev/null +++ b/Mage.Deck.Constructed/build.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + Builds, tests, and runs the project Mage.Deck.Constructed. + + + diff --git a/Mage.Deck.Constructed/build/classes/mage/deck/Constructed.class b/Mage.Deck.Constructed/build/classes/mage/deck/Constructed.class new file mode 100644 index 00000000000..ffb121d7aff Binary files /dev/null and b/Mage.Deck.Constructed/build/classes/mage/deck/Constructed.class differ diff --git a/Mage.Deck.Constructed/dist/Mage.Deck.Constructed.jar b/Mage.Deck.Constructed/dist/Mage.Deck.Constructed.jar new file mode 100644 index 00000000000..2676cf0e3a5 Binary files /dev/null and b/Mage.Deck.Constructed/dist/Mage.Deck.Constructed.jar differ diff --git a/Mage.Deck.Constructed/dist/README.TXT b/Mage.Deck.Constructed/dist/README.TXT new file mode 100644 index 00000000000..8da2d46ca0d --- /dev/null +++ b/Mage.Deck.Constructed/dist/README.TXT @@ -0,0 +1,33 @@ +======================== +BUILD OUTPUT DESCRIPTION +======================== + +When you build an Java application project that has a main class, the IDE +automatically copies all of the JAR +files on the projects classpath to your projects dist/lib folder. The IDE +also adds each of the JAR files to the Class-Path element in the application +JAR files manifest file (MANIFEST.MF). + +To run the project from the command line, go to the dist folder and +type the following: + +java -jar "Mage.Deck.Constructed.jar" + +To distribute this project, zip up the dist folder (including the lib folder) +and distribute the ZIP file. + +Notes: + +* If two JAR files on the project classpath have the same name, only the first +JAR file is copied to the lib folder. +* Only JAR files are copied to the lib folder. +If the classpath contains other types of files or folders, none of the +classpath elements are copied to the lib folder. In such a case, +you need to copy the classpath elements to the lib folder manually after the build. +* If a library on the projects classpath also has a Class-Path element +specified in the manifest,the content of the Class-Path element has to be on +the projects runtime path. +* To set a main class in a standard Java project, right-click the project node +in the Projects window and choose Properties. Then click Run and enter the +class name in the Main Class field. Alternatively, you can manually type the +class name in the manifest Main-Class element. diff --git a/Mage.Deck.Constructed/dist/lib/Mage.jar b/Mage.Deck.Constructed/dist/lib/Mage.jar new file mode 100644 index 00000000000..229fabce3e2 Binary files /dev/null and b/Mage.Deck.Constructed/dist/lib/Mage.jar differ diff --git a/Mage.Deck.Constructed/nbproject/build-impl.xml b/Mage.Deck.Constructed/nbproject/build-impl.xml new file mode 100644 index 00000000000..817ea6e706b --- /dev/null +++ b/Mage.Deck.Constructed/nbproject/build-impl.xml @@ -0,0 +1,704 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + + + + + + java -cp "${run.classpath.with.dist.jar}" ${main.class} + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + diff --git a/Mage.Deck.Constructed/nbproject/genfiles.properties b/Mage.Deck.Constructed/nbproject/genfiles.properties new file mode 100644 index 00000000000..0f504af6ce0 --- /dev/null +++ b/Mage.Deck.Constructed/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=603f8385 +build.xml.script.CRC32=cad336c1 +build.xml.stylesheet.CRC32=958a1d3e@1.26.2.45 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=603f8385 +nbproject/build-impl.xml.script.CRC32=af9bf5f7 +nbproject/build-impl.xml.stylesheet.CRC32=5c621a33@1.26.2.45 diff --git a/Mage.Deck.Constructed/nbproject/private/private.properties b/Mage.Deck.Constructed/nbproject/private/private.properties new file mode 100644 index 00000000000..a290194ec68 --- /dev/null +++ b/Mage.Deck.Constructed/nbproject/private/private.properties @@ -0,0 +1,2 @@ +jaxws.endorsed.dir=C:\\Program Files (x86)\\NetBeans 6.7.1\\java2\\modules\\ext\\jaxws21\\api:C:\\Program Files (x86)\\NetBeans 6.7.1\\ide11\\modules\\ext\\jaxb\\api +user.properties.file=C:\\Users\\Bill\\.netbeans\\6.7\\build.properties diff --git a/Mage.Deck.Constructed/nbproject/project.properties b/Mage.Deck.Constructed/nbproject/project.properties new file mode 100644 index 00000000000..7dd93e0d15d --- /dev/null +++ b/Mage.Deck.Constructed/nbproject/project.properties @@ -0,0 +1,63 @@ +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/Mage.Deck.Constructed.jar +dist.javadoc.dir=${dist.dir}/javadoc +excludes= +includes=** +jar.compress=false +javac.classpath=\ + ${reference.Mage.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.source=1.5 +javac.target=1.5 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir}:\ + ${libs.junit.classpath}:\ + ${libs.junit_4.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +meta.inf.dir=${src.dir}/META-INF +platform.active=default_platform +project.Mage=../Mage +reference.Mage.jar=${project.Mage}/dist/Mage.jar +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value +# or test-sys-prop.name=value to set system properties for unit tests): +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/Mage.Deck.Constructed/nbproject/project.xml b/Mage.Deck.Constructed/nbproject/project.xml new file mode 100644 index 00000000000..5890078732d --- /dev/null +++ b/Mage.Deck.Constructed/nbproject/project.xml @@ -0,0 +1,25 @@ + + + org.netbeans.modules.java.j2seproject + + + Mage.Deck.Constructed + + + + + + + + + + Mage + jar + + jar + clean + jar + + + + diff --git a/Mage.Deck.Constructed/src/mage/deck/Constructed.java b/Mage.Deck.Constructed/src/mage/deck/Constructed.java new file mode 100644 index 00000000000..a6d0d744cd6 --- /dev/null +++ b/Mage.Deck.Constructed/src/mage/deck/Constructed.java @@ -0,0 +1,74 @@ +/* +* Copyright 2010 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.deck; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import mage.cards.decks.Deck; +import mage.cards.decks.DeckValidatorImpl; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class Constructed extends DeckValidatorImpl { + + public Constructed() { + super("Constructed"); + } + + @Override + public boolean validate(Deck deck) { + //20091005 - 100.2a + if (deck.getCards().size() < 60) + return false; + //20091005 - 100.4a + if (deck.getSideboard().size() != 0 && deck.getSideboard().size() != 15) + return false; + + List basicLandNames = new ArrayList(Arrays.asList("Forest", "Island", "Mountain", "Swamp", "Plains")); + Map counts = new HashMap(); + countCards(counts, deck.getCards().values()); + countCards(counts, deck.getSideboard().values()); + for (Entry entry: counts.entrySet()) { + if (entry.getValue() > 4) { + if (!basicLandNames.contains(entry.getKey())) { + return false; + } + } + } + + return true; + } + +}