Unhinged lands (Issue#416)

This commit is contained in:
magenoxx 2014-04-25 18:10:33 +05:30
parent ec692902c7
commit 27dbcf2d6c
13 changed files with 319 additions and 26 deletions

View file

@ -1,14 +1,11 @@
package mage.client.util.sets; 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.ExpansionInfo;
import mage.cards.repository.ExpansionRepository; import mage.cards.repository.ExpansionRepository;
import mage.constants.SetType; import mage.constants.SetType;
import java.util.*;
/** /**
* Utility class for constructed formats (expansions and other editions). * 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", "Revised Edition", "Unlimited Edition", "Limited Edition Beta", "Limited Edition Alpha",
"Portal Three Kingdoms", "Portal Three Kingdoms",
"Guru", "Guru",
"Unhinged",
"Duel Decks: Elves vs. Goblins", "Duel Decks: Elves vs. Goblins",
"Duel Decks: Jace vs. Chandra", "Duel Decks: Jace vs. Chandra",
"Duel Decks: Divine vs. Demonic", "Duel Decks: Divine vs. Demonic",
@ -398,6 +396,9 @@ public class ConstructedFormats {
if (format.equals("Guru")) { if (format.equals("Guru")) {
return Arrays.asList("GUR"); return Arrays.asList("GUR");
} }
if (format.equals("Unhinged")) {
return Arrays.asList("UNH");
}
if (format.equals("Portal Three Kingdoms")) { if (format.equals("Portal Three Kingdoms")) {
return Arrays.asList("PTK"); return Arrays.asList("PTK");
} }
@ -448,7 +449,7 @@ public class ConstructedFormats {
private static void buildLists() { private static void buildLists() {
for (ExpansionInfo set : ExpansionRepository.instance.getAll()) { 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)) { if (set.getReleaseDate().after(standardDate)) {
standard.add(set.getCode()); standard.add(set.getCode());
} }

View file

@ -62,6 +62,7 @@ mpr=mprp
ddc=dvd ddc=dvd
dd2=jvc dd2=jvc
ddd=gvl ddd=gvl
unh=uh
# Remove setname as soon as the images can be downloaded # Remove setname as soon as the images can be downloaded
ignore.urls=TOK,EMBLEM,JOU ignore.urls=TOK,EMBLEM,JOU
# sets ordered by release time (newest goes first) # sets ordered by release time (newest goes first)

View file

@ -28,12 +28,13 @@
package mage.deck; 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.Calendar;
import java.util.GregorianCalendar; 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); cutoff = new GregorianCalendar(current.get(Calendar.YEAR) - 4, Calendar.SEPTEMBER, 1);
} }
for (ExpansionSet set: Sets.getInstance().values()) { 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()); setCodes.add(set.getCode());
} }
} }

View file

@ -27,13 +27,14 @@
*/ */
package mage.deck; package mage.deck;
import java.util.Date;
import java.util.GregorianCalendar;
import mage.cards.ExpansionSet; import mage.cards.ExpansionSet;
import mage.cards.Sets; import mage.cards.Sets;
import mage.cards.decks.Constructed; import mage.cards.decks.Constructed;
import mage.constants.SetType; 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 Date cutoff = new GregorianCalendar(2003, 7, 28).getTime(); // Eight edition release date
for (ExpansionSet set: Sets.getInstance().values()) { 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()); setCodes.add(set.getCode());
} }
} }

View file

@ -28,12 +28,13 @@
package mage.deck; 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.Calendar;
import java.util.GregorianCalendar; 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); cutoff = new GregorianCalendar(current.get(Calendar.YEAR) - 2, Calendar.SEPTEMBER, 1);
} }
for (ExpansionSet set: Sets.getInstance().values()) { 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()); setCodes.add(set.getCode());
} }
} }

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -35,15 +35,12 @@ import com.j256.ormlite.stmt.SelectArg;
import com.j256.ormlite.stmt.Where; import com.j256.ormlite.stmt.Where;
import com.j256.ormlite.support.ConnectionSource; import com.j256.ormlite.support.ConnectionSource;
import com.j256.ormlite.table.TableUtils; import com.j256.ormlite.table.TableUtils;
import mage.constants.CardType;
import java.io.File; import java.io.File;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import mage.constants.CardType;
/** /**
* *
@ -77,6 +74,7 @@ public enum CardRepository {
TableUtils.createTableIfNotExists(connectionSource, CardInfo.class); TableUtils.createTableIfNotExists(connectionSource, CardInfo.class);
cardDao = DaoManager.createDao(connectionSource, CardInfo.class); cardDao = DaoManager.createDao(connectionSource, CardInfo.class);
} catch (SQLException ex) { } catch (SQLException ex) {
ex.printStackTrace();
} }
} }

View file

@ -7,7 +7,8 @@ package mage.constants;
public enum SetType { public enum SetType {
CORE("Core"), CORE("Core"),
EXPANSION("Expansion"), EXPANSION("Expansion"),
REPRINT("Reprint"); REPRINT("Reprint"),
JOKESET("Joke Set");
private String text; private String text;