mirror of
				https://github.com/Investigamer/cardconjurer.git
				synced 2025-10-25 20:30:34 -05:00 
			
		
		
		
	Fix Case importing
This commit is contained in:
		| @@ -4679,15 +4679,16 @@ function changeCardIndex() { | ||||
| 	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.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 rulesText = (cardToImport.oracle_text || '').replace(/(?:\((?:.*?)\)|[^"\n]+(?= — ))/g, function(a){ | ||||
| 		    if (italicExemptions.includes(a)) {return a;} | ||||
| 		    return '{i}' + a + '{/i}'; | ||||
| 		}); | ||||
| 		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.)') | ||||
| 		 | ||||
|  | ||||
| 	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){ | ||||
| 	    if (italicExemptions.includes(a)) {return a;} | ||||
| 	    return '{i}' + a + '{/i}'; | ||||
| 	}); | ||||
| 	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.)') | ||||
|  | ||||
| 	if (card.text.rules) { | ||||
| 		if (card.version == 'pokemon') { | ||||
| 			if (cardToImport.type_line.toLowerCase().includes('creature')) { | ||||
| 				card.text.rules.text = langFontCode + rulesText; | ||||
| @@ -4720,9 +4721,6 @@ function changeCardIndex() { | ||||
| 				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 { | ||||
| 			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) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Josh birnholz
					Josh birnholz