forked from GithubMirrors/cardconjurer
Fix Case importing
This commit is contained in:
@@ -4679,7 +4679,7 @@ function changeCardIndex() {
|
|||||||
if (card.text.nickname) {card.text.nickname.text = cardToImport.flavor_name || '';}
|
if (card.text.nickname) {card.text.nickname.text = cardToImport.flavor_name || '';}
|
||||||
if (card.text.mana) {card.text.mana.text = cardToImport.mana_cost || '';}
|
if (card.text.mana) {card.text.mana.text = cardToImport.mana_cost || '';}
|
||||||
if (card.text.type) {card.text.type.text = langFontCode + cardToImport.type_line || '';}
|
if (card.text.type) {card.text.type.text = langFontCode + cardToImport.type_line || '';}
|
||||||
if (card.text.rules || card.text.case) {
|
|
||||||
var italicExemptions = ['Boast', 'Cycling', 'Visit', 'Prize', 'I', 'II', 'III', 'IV', 'I, II', 'II, III', 'III, IV', 'I, II, III', 'II, III, IV', 'I, II, III, IV', '• Khans', '• Dragons', '• Mirran', '• Phyrexian', 'Prototype', 'Companion', 'To solve', 'Solved'];
|
var italicExemptions = ['Boast', 'Cycling', 'Visit', 'Prize', 'I', 'II', 'III', 'IV', 'I, II', 'II, III', 'III, IV', 'I, II, III', 'II, III, IV', 'I, II, III, IV', '• Khans', '• Dragons', '• Mirran', '• Phyrexian', 'Prototype', 'Companion', 'To solve', 'Solved'];
|
||||||
var rulesText = (cardToImport.oracle_text || '').replace(/(?:\((?:.*?)\)|[^"\n]+(?= — ))/g, function(a){
|
var rulesText = (cardToImport.oracle_text || '').replace(/(?:\((?:.*?)\)|[^"\n]+(?= — ))/g, function(a){
|
||||||
if (italicExemptions.includes(a)) {return a;}
|
if (italicExemptions.includes(a)) {return a;}
|
||||||
@@ -4688,6 +4688,7 @@ function changeCardIndex() {
|
|||||||
rulesText = curlyQuotes(rulesText).replace(/{Q}/g, '{untap}').replace(/{\u221E}/g, "{inf}").replace(/• /g, '• {indent}');
|
rulesText = curlyQuotes(rulesText).replace(/{Q}/g, '{untap}').replace(/{\u221E}/g, "{inf}").replace(/• /g, '• {indent}');
|
||||||
rulesText = rulesText.replace('(If this card is your chosen companion, you may put it into your hand from outside the game for {3} any time you could cast a sorcery.)', '(If this card is your chosen companion, you may put it into your hand from outside the game for {3} as a sorcery.)')
|
rulesText = rulesText.replace('(If this card is your chosen companion, you may put it into your hand from outside the game for {3} any time you could cast a sorcery.)', '(If this card is your chosen companion, you may put it into your hand from outside the game for {3} as a sorcery.)')
|
||||||
|
|
||||||
|
if (card.text.rules) {
|
||||||
if (card.version == 'pokemon') {
|
if (card.version == 'pokemon') {
|
||||||
if (cardToImport.type_line.toLowerCase().includes('creature')) {
|
if (cardToImport.type_line.toLowerCase().includes('creature')) {
|
||||||
card.text.rules.text = langFontCode + rulesText;
|
card.text.rules.text = langFontCode + rulesText;
|
||||||
@@ -4720,9 +4721,6 @@ function changeCardIndex() {
|
|||||||
card.text.rightStatTitle.text = '';
|
card.text.rightStatTitle.text = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (card.version == 'case') {
|
|
||||||
rulesText = rulesText.replace(/(\r\n|\r|\n)/g, '//{bar}//');
|
|
||||||
card.text.case.text = langFontCode + rulesText;
|
|
||||||
} else {
|
} else {
|
||||||
card.text.rules.text = langFontCode + rulesText;
|
card.text.rules.text = langFontCode + rulesText;
|
||||||
}
|
}
|
||||||
@@ -4769,6 +4767,9 @@ function changeCardIndex() {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else if (card.text.case) {
|
||||||
|
rulesText = rulesText.replace(/(\r\n|\r|\n)/g, '//{bar}//');
|
||||||
|
card.text.case.text = langFontCode + rulesText;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (card.text.pt) {
|
if (card.text.pt) {
|
||||||
|
Reference in New Issue
Block a user