From 27dbcf2d6c43a17a679b7a01b1558f187f1d8350 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Fri, 25 Apr 2014 18:10:33 +0530 Subject: [PATCH] Unhinged lands (Issue#416) --- .../client/util/sets/ConstructedFormats.java | 13 ++--- .../src/main/resources/image.url.properties | 1 + .../src/mage/deck/Extended.java | 12 +++-- .../src/mage/deck/Modern.java | 8 +-- .../src/mage/deck/Standard.java | 12 +++-- Mage.Sets/src/mage/sets/Unhinged.java | 22 ++++++++ Mage.Sets/src/mage/sets/unhinged/Forest.java | 51 ++++++++++++++++++ Mage.Sets/src/mage/sets/unhinged/Island.java | 53 ++++++++++++++++++ .../src/mage/sets/unhinged/Mountain.java | 54 +++++++++++++++++++ Mage.Sets/src/mage/sets/unhinged/Plains.java | 53 ++++++++++++++++++ Mage.Sets/src/mage/sets/unhinged/Swamp.java | 53 ++++++++++++++++++ .../mage/cards/repository/CardRepository.java | 10 ++-- Mage/src/mage/constants/SetType.java | 3 +- 13 files changed, 319 insertions(+), 26 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/Unhinged.java create mode 100644 Mage.Sets/src/mage/sets/unhinged/Forest.java create mode 100644 Mage.Sets/src/mage/sets/unhinged/Island.java create mode 100644 Mage.Sets/src/mage/sets/unhinged/Mountain.java create mode 100644 Mage.Sets/src/mage/sets/unhinged/Plains.java create mode 100644 Mage.Sets/src/mage/sets/unhinged/Swamp.java diff --git a/Mage.Client/src/main/java/mage/client/util/sets/ConstructedFormats.java b/Mage.Client/src/main/java/mage/client/util/sets/ConstructedFormats.java index 5c9705f28c..a6451c7381 100644 --- a/Mage.Client/src/main/java/mage/client/util/sets/ConstructedFormats.java +++ b/Mage.Client/src/main/java/mage/client/util/sets/ConstructedFormats.java @@ -1,14 +1,11 @@ package mage.client.util.sets; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.List; import mage.cards.repository.ExpansionInfo; import mage.cards.repository.ExpansionRepository; import mage.constants.SetType; +import java.util.*; + /** * Utility class for constructed formats (expansions and other editions). * @@ -53,6 +50,7 @@ public class ConstructedFormats { "Revised Edition", "Unlimited Edition", "Limited Edition Beta", "Limited Edition Alpha", "Portal Three Kingdoms", "Guru", + "Unhinged", "Duel Decks: Elves vs. Goblins", "Duel Decks: Jace vs. Chandra", "Duel Decks: Divine vs. Demonic", @@ -398,6 +396,9 @@ public class ConstructedFormats { if (format.equals("Guru")) { return Arrays.asList("GUR"); } + if (format.equals("Unhinged")) { + return Arrays.asList("UNH"); + } if (format.equals("Portal Three Kingdoms")) { return Arrays.asList("PTK"); } @@ -448,7 +449,7 @@ public class ConstructedFormats { private static void buildLists() { for (ExpansionInfo set : ExpansionRepository.instance.getAll()) { - if (!set.getType().equals(SetType.REPRINT)) { + if (!set.getType().equals(SetType.REPRINT) && !set.getType().equals(SetType.JOKESET)) { if (set.getReleaseDate().after(standardDate)) { standard.add(set.getCode()); } diff --git a/Mage.Client/src/main/resources/image.url.properties b/Mage.Client/src/main/resources/image.url.properties index 759663bb90..91b0d95b95 100644 --- a/Mage.Client/src/main/resources/image.url.properties +++ b/Mage.Client/src/main/resources/image.url.properties @@ -62,6 +62,7 @@ mpr=mprp ddc=dvd dd2=jvc ddd=gvl +unh=uh # Remove setname as soon as the images can be downloaded ignore.urls=TOK,EMBLEM,JOU # sets ordered by release time (newest goes first) diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Extended.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Extended.java index 144ffd7e77..ecfe093cd5 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Extended.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Extended.java @@ -28,12 +28,13 @@ package mage.deck; +import mage.cards.ExpansionSet; +import mage.cards.Sets; +import mage.cards.decks.Constructed; +import mage.constants.SetType; + import java.util.Calendar; import java.util.GregorianCalendar; -import mage.constants.SetType; -import mage.cards.ExpansionSet; -import mage.cards.decks.Constructed; -import mage.cards.Sets; /** * @@ -52,7 +53,8 @@ public class Extended extends Constructed { cutoff = new GregorianCalendar(current.get(Calendar.YEAR) - 4, Calendar.SEPTEMBER, 1); } for (ExpansionSet set: Sets.getInstance().values()) { - if (set.getReleaseDate().after(cutoff.getTime()) && set.getSetType() != SetType.REPRINT) { + if (set.getReleaseDate().after(cutoff.getTime()) && set.getSetType() != SetType.REPRINT + && set.getSetType() != SetType.JOKESET) { setCodes.add(set.getCode()); } } diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Modern.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Modern.java index d13e4a5734..176ba2d91c 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Modern.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Modern.java @@ -27,13 +27,14 @@ */ package mage.deck; -import java.util.Date; -import java.util.GregorianCalendar; import mage.cards.ExpansionSet; import mage.cards.Sets; import mage.cards.decks.Constructed; import mage.constants.SetType; +import java.util.Date; +import java.util.GregorianCalendar; + /** * @@ -47,7 +48,8 @@ public class Modern extends Constructed { Date cutoff = new GregorianCalendar(2003, 7, 28).getTime(); // Eight edition release date for (ExpansionSet set: Sets.getInstance().values()) { - if ((set.getReleaseDate().after(cutoff) || set.getReleaseDate().equals(cutoff)) && set.getSetType() != SetType.REPRINT) { + if ((set.getReleaseDate().after(cutoff) || set.getReleaseDate().equals(cutoff)) && set.getSetType() != SetType.REPRINT + && set.getSetType() != SetType.JOKESET) { setCodes.add(set.getCode()); } } diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Standard.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Standard.java index 8232a053fe..85216e9158 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Standard.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Standard.java @@ -28,12 +28,13 @@ package mage.deck; +import mage.cards.ExpansionSet; +import mage.cards.Sets; +import mage.cards.decks.Constructed; +import mage.constants.SetType; + import java.util.Calendar; import java.util.GregorianCalendar; -import mage.constants.SetType; -import mage.cards.ExpansionSet; -import mage.cards.decks.Constructed; -import mage.cards.Sets; /** * @@ -52,7 +53,8 @@ public class Standard extends Constructed { cutoff = new GregorianCalendar(current.get(Calendar.YEAR) - 2, Calendar.SEPTEMBER, 1); } for (ExpansionSet set: Sets.getInstance().values()) { - if (set.getReleaseDate().after(cutoff.getTime()) && set.getSetType() != SetType.REPRINT) { + if (set.getReleaseDate().after(cutoff.getTime()) && set.getSetType() != SetType.REPRINT + && set.getSetType() != SetType.JOKESET) { setCodes.add(set.getCode()); } } diff --git a/Mage.Sets/src/mage/sets/Unhinged.java b/Mage.Sets/src/mage/sets/Unhinged.java new file mode 100644 index 0000000000..db65f2d3cb --- /dev/null +++ b/Mage.Sets/src/mage/sets/Unhinged.java @@ -0,0 +1,22 @@ +package mage.sets; + +import mage.cards.ExpansionSet; +import mage.constants.SetType; + +import java.util.GregorianCalendar; + +/** + * + * @author magenoxx + */ +public class Unhinged extends ExpansionSet { + private static final Unhinged fINSTANCE = new Unhinged(); + + public static Unhinged getInstance() { + return fINSTANCE; + } + + private Unhinged() { + super("Unhinged", "UNH", "mage.sets.unhinged", new GregorianCalendar(2004, 11, 20).getTime(), SetType.JOKESET); + } +} diff --git a/Mage.Sets/src/mage/sets/unhinged/Forest.java b/Mage.Sets/src/mage/sets/unhinged/Forest.java new file mode 100644 index 0000000000..01ef082a33 --- /dev/null +++ b/Mage.Sets/src/mage/sets/unhinged/Forest.java @@ -0,0 +1,51 @@ +/* + * Copyright 2014 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.sets.unhinged; + +import java.util.UUID; + +/** + * User: magenoxx + */ +public class Forest extends mage.cards.basiclands.Forest { + + public Forest(UUID ownerId) { + super(ownerId, 140); + this.expansionSetCode = "UNH"; + } + + public Forest(final Forest card) { + super(card); + } + + @Override + public Forest copy() { + return new Forest(this); + } +} diff --git a/Mage.Sets/src/mage/sets/unhinged/Island.java b/Mage.Sets/src/mage/sets/unhinged/Island.java new file mode 100644 index 0000000000..9890a84206 --- /dev/null +++ b/Mage.Sets/src/mage/sets/unhinged/Island.java @@ -0,0 +1,53 @@ +/* + * Copyright 2014 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.sets.unhinged; + +import java.util.UUID; + +/** + * + * @author magenoxx + */ +public class Island extends mage.cards.basiclands.Island { + + public Island(UUID ownerId) { + super(ownerId, 137); + this.expansionSetCode = "UNH"; + } + + public Island(final Island card) { + super(card); + } + + @Override + public Island copy() { + return new Island(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/unhinged/Mountain.java b/Mage.Sets/src/mage/sets/unhinged/Mountain.java new file mode 100644 index 0000000000..38b666a6ac --- /dev/null +++ b/Mage.Sets/src/mage/sets/unhinged/Mountain.java @@ -0,0 +1,54 @@ +/* + * Copyright 2014 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.sets.unhinged; + +import java.util.UUID; + +/** + * + * @author magenoxx + */ +public class Mountain extends mage.cards.basiclands.Mountain { + + public Mountain(UUID ownerId) { + super(ownerId, 139); + this.expansionSetCode = "UNH"; + } + + public Mountain(final Mountain card) { + super(card); + } + + @Override + public Mountain copy() { + return new Mountain(this); + } + +} + diff --git a/Mage.Sets/src/mage/sets/unhinged/Plains.java b/Mage.Sets/src/mage/sets/unhinged/Plains.java new file mode 100644 index 0000000000..95299023e4 --- /dev/null +++ b/Mage.Sets/src/mage/sets/unhinged/Plains.java @@ -0,0 +1,53 @@ +/* + * Copyright 2014 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.sets.unhinged; + +import java.util.UUID; + +/** + * + * @author magenoxx + */ +public class Plains extends mage.cards.basiclands.Plains { + + public Plains(UUID ownerId) { + super(ownerId, 136); + this.expansionSetCode = "UNH"; + } + + public Plains(final Plains card) { + super(card); + } + + @Override + public Plains copy() { + return new Plains(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/unhinged/Swamp.java b/Mage.Sets/src/mage/sets/unhinged/Swamp.java new file mode 100644 index 0000000000..046793432c --- /dev/null +++ b/Mage.Sets/src/mage/sets/unhinged/Swamp.java @@ -0,0 +1,53 @@ +/* + * Copyright 2014 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.sets.unhinged; + +import java.util.UUID; + +/** + * + * @author magenoxx + */ +public class Swamp extends mage.cards.basiclands.Swamp { + + public Swamp(UUID ownerId) { + super(ownerId, 138); + this.expansionSetCode = "UNH"; + } + + public Swamp(final Swamp card) { + super(card); + } + + @Override + public Swamp copy() { + return new Swamp(this); + } + +} diff --git a/Mage/src/mage/cards/repository/CardRepository.java b/Mage/src/mage/cards/repository/CardRepository.java index a7ab481cff..5cc791573f 100644 --- a/Mage/src/mage/cards/repository/CardRepository.java +++ b/Mage/src/mage/cards/repository/CardRepository.java @@ -35,15 +35,12 @@ import com.j256.ormlite.stmt.SelectArg; import com.j256.ormlite.stmt.Where; import com.j256.ormlite.support.ConnectionSource; import com.j256.ormlite.table.TableUtils; +import mage.constants.CardType; + import java.io.File; import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import java.util.Set; -import java.util.TreeSet; +import java.util.*; import java.util.concurrent.Callable; -import mage.constants.CardType; /** * @@ -77,6 +74,7 @@ public enum CardRepository { TableUtils.createTableIfNotExists(connectionSource, CardInfo.class); cardDao = DaoManager.createDao(connectionSource, CardInfo.class); } catch (SQLException ex) { + ex.printStackTrace(); } } diff --git a/Mage/src/mage/constants/SetType.java b/Mage/src/mage/constants/SetType.java index 256915545f..e6f54b5708 100644 --- a/Mage/src/mage/constants/SetType.java +++ b/Mage/src/mage/constants/SetType.java @@ -7,7 +7,8 @@ package mage.constants; public enum SetType { CORE("Core"), EXPANSION("Expansion"), - REPRINT("Reprint"); + REPRINT("Reprint"), + JOKESET("Joke Set"); private String text;