mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 04:22:01 -08:00
GUI enchancements (themes, sound notification, deck validation) (#6755)
GUI enchancements (themes, sound notification, deck validation)
This commit is contained in:
parent
8c4c2728d6
commit
99d5eafc8a
128 changed files with 1988 additions and 11320 deletions
|
|
@ -37,6 +37,10 @@ public class Constructed extends DeckValidator {
|
|||
super(name);
|
||||
}
|
||||
|
||||
protected Constructed(String name, String shortName) {
|
||||
super(name, shortName);
|
||||
}
|
||||
|
||||
public List<String> getSetCodes() {
|
||||
return setCodes;
|
||||
}
|
||||
|
|
@ -54,6 +58,7 @@ public class Constructed extends DeckValidator {
|
|||
@Override
|
||||
public boolean validate(Deck deck) {
|
||||
boolean valid = true;
|
||||
invalid.clear();
|
||||
//20091005 - 100.2a
|
||||
if (deck.getCards().size() < getDeckMinSize()) {
|
||||
invalid.put("Deck", "Must contain at least " + getDeckMinSize() + " cards: has only " + deck.getCards().size() + " cards");
|
||||
|
|
|
|||
|
|
@ -13,11 +13,16 @@ import java.util.Map;
|
|||
public abstract class DeckValidator implements Serializable {
|
||||
|
||||
protected String name;
|
||||
protected String shortName;
|
||||
|
||||
protected Map<String, String> invalid = new HashMap<>();
|
||||
|
||||
public DeckValidator(String name) {
|
||||
this.name = name;
|
||||
setName(name);
|
||||
}
|
||||
|
||||
public DeckValidator(String name, String shortName) {
|
||||
setName(name, shortName);
|
||||
}
|
||||
|
||||
public abstract boolean validate(Deck deck);
|
||||
|
|
@ -26,6 +31,24 @@ public abstract class DeckValidator implements Serializable {
|
|||
return name;
|
||||
}
|
||||
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
protected void setName(String name) {
|
||||
this.name = name;
|
||||
this.shortName = name.contains("-") ? name.substring(name.indexOf("-") + 1).trim() : name;
|
||||
}
|
||||
|
||||
protected void setName(String name, String shortName) {
|
||||
this.name = name;
|
||||
this.shortName = shortName;
|
||||
}
|
||||
|
||||
protected void setShortName(String shortName) {
|
||||
this.shortName = shortName;
|
||||
}
|
||||
|
||||
public Map<String, String> getInvalid() {
|
||||
return invalid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package mage.cards.decks;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
public class PennyDreadfulLegalityUtil {
|
||||
public static Map<String, Integer> getLegalCardList() {
|
||||
Map<String, Integer> pdAllowed = new HashMap<>();
|
||||
|
||||
Properties properties = new Properties();
|
||||
try {
|
||||
properties.load(PennyDreadfulLegalityUtil.class.getResourceAsStream("/pennydreadful.properties"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
for (final Map.Entry<Object, Object> entry : properties.entrySet()) {
|
||||
pdAllowed.put((String) entry.getKey(), 1);
|
||||
}
|
||||
|
||||
return pdAllowed;
|
||||
}
|
||||
}
|
||||
10371
Mage/src/main/resources/pennydreadful.properties
Normal file
10371
Mage/src/main/resources/pennydreadful.properties
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue