From 25a4f8acf21b17c2890d8c45fa06a82c5903b983 Mon Sep 17 00:00:00 2001 From: Josh birnholz Date: Tue, 16 Jan 2024 13:56:06 -0500 Subject: [PATCH] Add Case frame --- js/creator-23.js | 7 +++++-- js/frameSearch.js | 1 + js/frames/groupStandard-3.js | 1 + js/frames/packCase.js | 40 ++++++++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 js/frames/packCase.js diff --git a/js/creator-23.js b/js/creator-23.js index 1a73805f..49519e5f 100644 --- a/js/creator-23.js +++ b/js/creator-23.js @@ -4679,8 +4679,8 @@ 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) { - 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']; + 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}'; @@ -4720,6 +4720,9 @@ 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; } diff --git a/js/frameSearch.js b/js/frameSearch.js index b4becfe8..151c0762 100644 --- a/js/frameSearch.js +++ b/js/frameSearch.js @@ -16,6 +16,7 @@ const frameNames = new Map ([ ['Color Identity Pips', 'M15CIPips'], ['"The List" Stamp', 'TheList'], ['Lands', 'M15Lands'], + ['Cases (Murders at Karlov Manor)', 'Case'], ['Battles (March of the Machine)', 'Battle'], ['Prototype (Brothers\' War)', 'Prototype'], ['Prototype (Extended Art) (Brothers\' War)', 'PrototypeExtended'], diff --git a/js/frames/groupStandard-3.js b/js/frames/groupStandard-3.js index f2530fed..5181f049 100644 --- a/js/frames/groupStandard-3.js +++ b/js/frames/groupStandard-3.js @@ -13,6 +13,7 @@ loadFramePacks([ {name:'"The List" Stamp', value:'TheList'}, {name:'Other Frames', value:'disabled'}, {name:'Lands', value:'M15Lands'}, + {name:'Cases (Murders at Karlov Manor)', value:'Case'}, {name:'Battle (March of the Machine)', value:'Battle'}, {name:'Prototype (Brothers\' War)', value:'Prototype'}, {name:'Prototype (Extended Art) (Brothers\' War)', value:'PrototypeExtended'}, diff --git a/js/frames/packCase.js b/js/frames/packCase.js new file mode 100644 index 00000000..29b57e80 --- /dev/null +++ b/js/frames/packCase.js @@ -0,0 +1,40 @@ +//Create objects for common properties across available frames +var masks = [{src:'/img/frames/class/pinline.svg', name:'Pinline'}, {src:'/img/frames/m15/regular/m15MaskTitle.png', name:'Title'}, {src:'/img/frames/saga/sagaMaskType.png', name:'Type'}, {src:'/img/frames/class/frame.svg', name:'Frame'}, {src:'/img/frames/class/text.svg', name:'Text'}, {src:'/img/frames/class/textRight.png', name:'Text, Right Half'}, {src:'/img/frames/class/border.svg', name:'Border'}]; +//defines available frames +availableFrames = [ + {name:'White Frame', src:'/img/frames/class/w.png', masks:masks}, + {name:'Blue Frame', src:'/img/frames/class/u.png', masks:masks}, + {name:'Black Frame', src:'/img/frames/class/b.png', masks:masks}, + {name:'Red Frame', src:'/img/frames/class/r.png', masks:masks}, + {name:'Green Frame', src:'/img/frames/class/g.png', masks:masks}, + {name:'Multicolored Frame', src:'/img/frames/class/m.png', masks:masks}, + {name:'Artifact Frame', src:'/img/frames/class/a.png', masks:masks}, + {name:'Land Frame', src:'/img/frames/class/l.png', masks:masks} +]; +//disables/enables the "Load Frame Version" button +document.querySelector('#loadFrameVersion').disabled = false; +//defines process for loading this version, if applicable +document.querySelector('#loadFrameVersion').onclick = async function() { + //resets things so that every frame doesn't have to + await resetCardIrregularities(); + //sets card version + card.version = 'case'; + //art bounds + card.artBounds = {x:0.0753, y:0.1124, width:0.4247, height:0.7253}; + autoFitArt(); + //set symbol bounds + card.setSymbolBounds = {x:0.9227, y:0.8739, width:0.12, height:0.0381, vertical:'center', horizontal: 'right'}; + resetSetSymbol(); + //watermark bounds + card.watermarkBounds = {x:0.5214, y:0.4748, width:0.38, height:0.6767}; + resetWatermark(); + //text + loadTextOptions({ + mana: {name:'Mana Cost', text:'', y:0.0613, width:0.9292, height:71/2100, oneLine:true, size:71/1638, align:'right', shadowX:-0.001, shadowY:0.0029, manaCost:true, manaSpacing:0}, + title: {name:'Title', text:'', x:0.0854, y:0.0522, width:0.8292, height:0.0543, oneLine:true, font:'belerenb', size:0.0381}, + type: {name:'Type', text:'', x:0.0854, y:0.8481, width:0.8292, height:0.0543, oneLine:true, font:'belerenb', size:0.0324}, + case: {name:'Rules Text', text:'//{bar}//To solve — {i}(If unsolved, solve at the beginning of your end step.){/i}//{bar}//Solved — ', x:0.5093, y:356/2814, width:0.404, height:1974/2814, size:0.03445} + }); +} +//loads available frames +loadFramePack(); \ No newline at end of file