mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Implement Dungeon mechanism and related spoiled cards
This commit is contained in:
@@ -6,12 +6,12 @@
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@@ -34,7 +34,7 @@ import static org.apache.commons.lang3.StringUtils.containsIgnoreCase;
|
||||
/**
|
||||
* A collection of methods containing full
|
||||
* meta and gameplay properties of a card.
|
||||
*
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id: CardRules.java 9708 2011-08-09 19:34:12Z jendave $
|
||||
*/
|
||||
@@ -116,7 +116,7 @@ public final class CardRules implements ICardCharacteristics {
|
||||
|
||||
public boolean isVariant() {
|
||||
CardType t = getType();
|
||||
return t.isVanguard() || t.isScheme() || t.isPlane() || t.isPhenomenon() || t.isConspiracy();
|
||||
return t.isVanguard() || t.isScheme() || t.isPlane() || t.isPhenomenon() || t.isConspiracy() || t.isDungeon();
|
||||
}
|
||||
|
||||
public CardSplitType getSplitType() {
|
||||
@@ -334,7 +334,7 @@ public final class CardRules implements ICardCharacteristics {
|
||||
|
||||
/**
|
||||
* Gets the card.
|
||||
*
|
||||
*
|
||||
* @return the card
|
||||
*/
|
||||
public final CardRules getCard() {
|
||||
@@ -370,7 +370,7 @@ public final class CardRules implements ICardCharacteristics {
|
||||
|
||||
/**
|
||||
* Parses the line.
|
||||
*
|
||||
*
|
||||
* @param line
|
||||
* the line
|
||||
*/
|
||||
@@ -528,7 +528,7 @@ public final class CardRules implements ICardCharacteristics {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see java.util.Iterator#hasNext()
|
||||
*/
|
||||
@Override
|
||||
@@ -538,7 +538,7 @@ public final class CardRules implements ICardCharacteristics {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see java.util.Iterator#next()
|
||||
*/
|
||||
@Override
|
||||
@@ -554,7 +554,7 @@ public final class CardRules implements ICardCharacteristics {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see java.util.Iterator#remove()
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -598,6 +598,7 @@ public final class CardRulesPredicates {
|
||||
public static final Predicate<CardRules> IS_SCHEME = CardRulesPredicates.coreType(true, CardType.CoreType.Scheme);
|
||||
public static final Predicate<CardRules> IS_VANGUARD = CardRulesPredicates.coreType(true, CardType.CoreType.Vanguard);
|
||||
public static final Predicate<CardRules> IS_CONSPIRACY = CardRulesPredicates.coreType(true, CardType.CoreType.Conspiracy);
|
||||
public static final Predicate<CardRules> IS_DUNGEON = CardRulesPredicates.coreType(true, CardType.CoreType.Dungeon);
|
||||
public static final Predicate<CardRules> IS_NON_LAND = CardRulesPredicates.coreType(false, CardType.CoreType.Land);
|
||||
public static final Predicate<CardRules> CAN_BE_BRAWL_COMMANDER = Predicates.and(Presets.IS_LEGENDARY,
|
||||
Predicates.or(Presets.IS_CREATURE, Presets.IS_PLANESWALKER));
|
||||
|
||||
@@ -57,6 +57,7 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
||||
Artifact(true, "artifacts"),
|
||||
Conspiracy(false, "conspiracies"),
|
||||
Creature(true, "creatures"),
|
||||
Dungeon(false, "dungeons"),
|
||||
Emblem(false, "emblems"),
|
||||
Enchantment(true, "enchantments"),
|
||||
Instant(false, "instants"),
|
||||
@@ -446,6 +447,11 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
||||
return coreTypes.contains(CoreType.Tribal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDungeon() {
|
||||
return coreTypes.contains(CoreType.Dungeon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (calculatedType == null) {
|
||||
@@ -686,13 +692,11 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
||||
}
|
||||
|
||||
private static boolean isMultiwordType(final String type) {
|
||||
final String[] multiWordTypes = { "Serra's Realm", "Bolas's Meditation Realm" };
|
||||
// no need to loop for only 2 exceptions!
|
||||
if (multiWordTypes[0].startsWith(type) && !multiWordTypes[0].equals(type)) {
|
||||
return true;
|
||||
}
|
||||
if (multiWordTypes[1].startsWith(type) && !multiWordTypes[1].equals(type)) {
|
||||
return true;
|
||||
final String[] multiWordTypes = { "Serra's Realm", "Bolas's Meditation Realm", "Dungeon Master" };
|
||||
for (int i = 0; i < multiWordTypes.length; ++i) {
|
||||
if (multiWordTypes[i].startsWith(type) && !multiWordTypes[i].equals(type)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -44,5 +44,6 @@ public interface CardTypeView extends Iterable<String>, Serializable {
|
||||
boolean isPhenomenon();
|
||||
boolean isEmblem();
|
||||
boolean isTribal();
|
||||
boolean isDungeon();
|
||||
CardTypeView getTypeWithChanges(Iterable<CardChangedType> changedCardTypes);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user