mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 22:12:03 -08:00
* TXT deck importer - Changes to recognize sideboard starting and split cards in txt files from MTGO.
This commit is contained in:
parent
61dff9e3c2
commit
80f56dfb42
3 changed files with 16 additions and 3 deletions
|
|
@ -105,7 +105,7 @@ public abstract class SplitCard extends CardImpl {
|
|||
|
||||
@Override
|
||||
public Abilities<Ability> getAbilities(){
|
||||
Abilities<Ability> allAbilites = new AbilitiesImpl<Ability>();
|
||||
Abilities<Ability> allAbilites = new AbilitiesImpl<>();
|
||||
for (Ability ability : super.getAbilities()) {
|
||||
if (ability instanceof SpellAbility && !((SpellAbility)ability).getSpellAbilityType().equals(SpellAbilityType.SPLIT)) {
|
||||
allAbilites.add(ability);
|
||||
|
|
|
|||
|
|
@ -48,16 +48,26 @@ import mage.cards.repository.ExpansionRepository;
|
|||
public class TxtDeckImporter extends DeckImporter {
|
||||
|
||||
public static final String[] SET_VALUES = new String[] { "lands", "creatures", "planeswalkers","other spells","sideboard cards" };
|
||||
public static final Set<String> IGNORE_NAMES = new HashSet<String>(Arrays.asList(SET_VALUES));
|
||||
public static final Set<String> IGNORE_NAMES = new HashSet<>(Arrays.asList(SET_VALUES));
|
||||
|
||||
private boolean sideboard = false;
|
||||
private int emptyLinesInARow = 0;
|
||||
|
||||
|
||||
@Override
|
||||
protected void readLine(String line, DeckCardLists deckList) {
|
||||
if (line.length() == 0 || line.startsWith("//")) {
|
||||
if (line.startsWith("//")) {
|
||||
return;
|
||||
}
|
||||
if (line.length() == 0) {
|
||||
emptyLinesInARow++;
|
||||
if (emptyLinesInARow > 1) {
|
||||
sideboard = true;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
emptyLinesInARow = 0;
|
||||
}
|
||||
|
||||
if (line.toLowerCase().startsWith("sideboard")) {
|
||||
sideboard = true;
|
||||
|
|
@ -70,6 +80,7 @@ public class TxtDeckImporter extends DeckImporter {
|
|||
}
|
||||
String lineNum = line.substring(0, delim).trim();
|
||||
String lineName = line.substring(delim).replace("’","\'").trim();
|
||||
lineName = lineName.replace("&","//");
|
||||
if (IGNORE_NAMES.contains(lineName)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ since 1.3.0-2014-08-11
|
|||
git log 709dc83ae6fd6778e5b52e5176a978f1c6fda3b7..HEAD --diff-filter=A --name-status | sed -ne "s/^A[^u]Mage.Sets\/src\/mage\/sets\///p" | sort > added_cards.txt
|
||||
since 1.3.0-2014-08-19
|
||||
git log edd1563c12422f69c10bc76d310e0a84421ab4a2..HEAD --diff-filter=A --name-status | sed -ne "s/^A[^u]Mage.Sets\/src\/mage\/sets\///p" | sort > added_cards.txt
|
||||
since 1.3.0-2014-08-30
|
||||
git log fbc2a7258face1e908f3f08da1c2fec4ec0f86fe..HEAD --diff-filter=A --name-status | sed -ne "s/^A[^u]Mage.Sets\/src\/mage\/sets\///p" | sort > added_cards.txt
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue