Add battle frame

This commit is contained in:
Josh birnholz
2023-05-08 21:13:35 -04:00
parent ada5fbb110
commit 5be0fb3fc2
40 changed files with 94 additions and 6 deletions

BIN
img/frames/m15/battle/a.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
img/frames/m15/battle/b.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
img/frames/m15/battle/c.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
img/frames/m15/battle/g.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
img/frames/m15/battle/l.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

BIN
img/frames/m15/battle/m.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
img/frames/m15/battle/r.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
img/frames/m15/battle/u.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

BIN
img/frames/m15/battle/w.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -81,6 +81,9 @@ var loadedVersions = [];
async function resetCardIrregularities({canvas = [1500, 2100, 0, 0], resetOthers = true} = {}) {
//misc details
card.margins = false;
card.bottomInfoTranslate = {x:0, y:0};
card.bottomInfoRotate = 0;
card.bottomInfoZoom = 1;
replacementMasks = {};
//rotation
if (card.landscape) {
@@ -3411,17 +3414,29 @@ function drawCard() {
// set symbol
cardContext.drawImage(setSymbol, scaleX(card.setSymbolX), scaleY(card.setSymbolY), setSymbol.width * card.setSymbolZoom, setSymbol.height * card.setSymbolZoom)
// bottom info
cardContext.drawImage(bottomInfoCanvas, 0, 0, cardCanvas.width, cardCanvas.height);
if (card.bottomInfoTranslate) {
cardContext.save();
cardContext.rotate(Math.PI / 180 * (card.bottomInfoRotate || 0));
cardContext.translate(card.bottomInfoTranslate.x || 0, card.bottomInfoTranslate.y || 0);
cardContext.drawImage(bottomInfoCanvas, 0, 0, cardCanvas.width * (card.bottomInfoZoom || 1), cardCanvas.height * (card.bottomInfoZoom || 1));
cardContext.restore();
} else {
cardContext.drawImage(bottomInfoCanvas, 0, 0, cardCanvas.width, cardCanvas.height);
}
// cutout the corners
cardContext.globalCompositeOperation = 'destination-out';
if (!card.noCorners && (card.marginX == 0 && card.marginY == 0)) {
cardContext.drawImage(corner, 0, 0, scaleWidth(59/1500), scaleWidth(59/1500));
var w = card.version == 'battle' ? 2100 : 1500;
cardContext.drawImage(corner, 0, 0, scaleWidth(59/w), scaleWidth(59/w));
cardContext.rotate(Math.PI / 2);
cardContext.drawImage(corner, 0, -card.width, scaleWidth(59/1500), scaleWidth(59/1500));
cardContext.drawImage(corner, 0, -card.width, scaleWidth(59/w), scaleWidth(59/w));
cardContext.rotate(Math.PI / 2);
cardContext.drawImage(corner, -card.width, -card.height, scaleWidth(59/1500), scaleWidth(59/1500));
cardContext.drawImage(corner, -card.width, -card.height, scaleWidth(59/w), scaleWidth(59/w));
cardContext.rotate(Math.PI / 2);
cardContext.drawImage(corner, -card.height, 0, scaleWidth(59/1500), scaleWidth(59/1500));
cardContext.drawImage(corner, -card.height, 0, scaleWidth(59/w), scaleWidth(59/w));
cardContext.rotate(Math.PI / 2);
}
// show preview
@@ -3571,6 +3586,14 @@ function changeCardIndex() {
card.text.middleStatTitle.text = '';
card.text.rightStatTitle.text = 'loyalty';
} else if (cardToImport.type_line.toLowerCase().includes('battle')) {
card.text.rules.text = langFontCode + rulesText;
card.text.rulesnoncreature.text = '';
card.text.pt.text = '{' + (cardToImport.defense || '' + '}');
card.text.middleStatTitle.text = '';
card.text.rightStatTitle.text = 'defense';
} else {
card.text.rulesnoncreature.text = langFontCode + rulesText;
card.text.rules.text = '';
@@ -3670,6 +3693,8 @@ function changeCardIndex() {
planeswalkerEdited();
} else if (card.version.includes('saga')) {
card.text.ability0.text = cardToImport.oracle_text.replace('(', '{i}(').replace(')', '){/i}') || '';
} else if (card.version.includes('battle')) {
card.text.defense.text = cardToImport.defense || '';
}
document.querySelector('#text-editor').value = card.text[Object.keys(card.text)[selectedTextIndex]].text;
document.querySelector('#text-editor-font-size').value = 0;
@@ -4064,6 +4089,8 @@ function processScryfallCard(card, responseCards) {
card.card_faces.forEach(face => {
face.set = card.set;
face.rarity = card.rarity;
face.collector_number = card.collector_number;
face.lang = card.lang;
if (card.lang != 'en') {
face.oracle_text = face.printed_text;
face.name = face.printed_name;

View File

@@ -12,6 +12,7 @@ const frameNames = new Map ([
['Color Identity Pips', 'M15CIPips'],
['"The List" Stamp', 'TheList'],
['Lands', 'M15Lands'],
['Battles (March of the Machine)', 'Battle'],
['Prototype (Brothers\' War)', 'Prototype'],
['Prototype (Extended Art) (Brothers\' War)', 'PrototypeExtended'],
['Class (D&D)', 'Class'],
@@ -148,7 +149,6 @@ const frameNames = new Map ([
['Playtest Cards', 'Playtest'],
['Dungeon (AFR)', 'Dungeon'],
['Planechase', 'Planechase'],
['Battles', 'Battle'],
['Vanguard', 'Vanguard'],
['Cardback', 'Cardback'],
//promo

View File

@@ -56,6 +56,7 @@ loadFramePacks([
{name:'Legend Crowns', value:'M15LegendCrowns'},
{name:'Floating Legend Crowns', value:'M15LegendCrownsFloating'},
{name:'Inner Crowns', value:'M15InnerCrowns'},
{name:'Nicknames', value:'M15Nickname-2'},
{name:'Holo Stamps', value:'M15HoloStamps'},
{name:'Dark Power/Toughness', value:'M15DarkPT'},
{name:'Colored Borders', value:'M15Borders'},

View File

@@ -13,6 +13,7 @@ loadFramePacks([
{name:'"The List" Stamp', value:'TheList'},
{name:'Other Frames', value:'disabled'},
{name:'Lands', value:'M15Lands'},
{name:'Battle (March of the Machine)', value:'Battle'},
{name:'Prototype (Brothers\' War)', value:'Prototype'},
{name:'Prototype (Extended Art) (Brothers\' War)', value:'PrototypeExtended'},
{name:'Class (D&D)', value:'Class'},

59
js/frames/packBattle.js Normal file
View File

@@ -0,0 +1,59 @@
//Create objects for common properties across available frames
var masks = [{src:'/img/frames/m15/battle/maskPinline.png', name:'Pinline'}, {src:'/img/frames/m15/battle/maskTitle.png', name:'Title'}, {src:'/img/frames/m15/battle/maskType.png', name:'Type'}, {src:'/img/frames/m15/battle/maskRules.png', name:'Rules'}, {src:'/img/frames/m15/battle/maskDefense.png', name:'Defense'}, {src:'/img/frames/m15/battle/maskBorder.png', name:'Border'}];
//defines available frames
availableFrames = [
{name:'White Frame', src:'/img/frames/m15/battle/w.png', masks:masks},
{name:'Blue Frame', src:'/img/frames/m15/battle/u.png', masks:masks},
{name:'Black Frame', src:'/img/frames/m15/battle/b.png', masks:masks},
{name:'Red Frame', src:'/img/frames/m15/battle/r.png', masks:masks},
{name:'Green Frame', src:'/img/frames/m15/battle/g.png', masks:masks},
{name:'Multicolored Frame', src:'/img/frames/m15/battle/m.png', masks:masks},
{name:'Artifact Frame', src:'/img/frames/m15/battle/a.png', masks:masks},
{name:'Land Frame', src:'/img/frames/m15/battle/l.png', masks:masks},
{name:'Colorless Frame', src:'/img/frames/m15/battle/c.png', masks:masks},
{name:'Holo Stamp', src:'/img/frames/m15/battle/holoStamp.png', bounds:{x:103/2100, y:657/1500, width:93/2100, height:186/1500}}
];
//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() {
// Notification
//resets things so that every frame doesn't have to
var previousCardHeight = card.height
await resetCardIrregularities({canvas:[2100, 1500, 0, 0]});
replacementMasks = {'Right Half':'/img/frames/m15/battle/maskRightHalf.png'};
//sets card version
card.version = 'battle';
//rotation
card.landscape = true;
previewContext.translate(0, previousCardHeight / 2);
previewContext.rotate(-Math.PI / 2);
previewContext.scale(7/5, 5/7);
//art bounds
card.artBounds = {x:167/2100, y:60/1500, width:1873/2100, height:1371/1500};
autoFitArt();
//set symbol bounds
card.setSymbolBounds = {x:1945/2100, y:925/1500, width:180/2100, height:86/1500, vertical:'center', horizontal: 'right'};
resetSetSymbol();
//watermark bounds
card.watermarkBounds = {x:0, y:0, width:0, height:0};
resetWatermark();
//text
loadTextOptions({
mana: {name:'Mana Cost', text:'', x: 0/2100, y:100/1500, width:1957/2100, height:71/1500, oneLine:true, size:((71/1638)*2100)/1500, align:'right', shadowX:-0.001, shadowY:0.0029, manaCost:true, manaSpacing:0},
title: {name:'Title', text:'', x:387/2100, y:81/1500, width:1547/2100, height:114/1500, oneLine:true, font:'belerenb', size:(0.0381*2100)/1500},
type: {name:'Type', text:'', x:268/2100, y:873/1500, width:1667/2100, height:114/1500, oneLine:true, font:'belerenb', size:(0.0324*2100)/1500},
rules: {name:'Rules Text', text:'', x:272/2100, y:1008/1500, width:1661/2100, height:414/1500, size:(0.0362*2100)/1500},
reminder: {name:'Reverse PT', text:'', x:257/2100, y:1219/1500, width:1667/2100, height:43/1500, size:(0.0291*2100)/1500, oneLine:true, color:'#666', align:'right', font:'belerenbsc'},
defense: {name:'Defense', text:'', x:1920/2100, y:1320/1500, width:86/2100, height:123/1500, size:(0.0372*2100)/1500, color:'white', font:'belerenbsc', oneLine:true, align:'center'}
});
if (card.text.rules.text == '') {
card.text.rules.text = '{i}(As a Siege enters, choose an opponent to protect it. You and others can attack it. When its defeated, exile it, then cast it transformed.){/i}\n';
}
card.bottomInfoTranslate = {x: -92, y:-2100};
card.bottomInfoRotate = 90;
card.bottomInfoZoom = 1.4;
}
//loads available frames
loadFramePack();