mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-27 05:14:53 -05:00
Add Seventh Edition autoframe
This commit is contained in:

committed by
Josh birnholz

parent
8caf5c74b5
commit
a61dbe8771
@@ -637,6 +637,7 @@
|
|||||||
<option value="M15Regular-1">Regular</option>
|
<option value="M15Regular-1">Regular</option>
|
||||||
<option value="UB">Universes Beyond</option>
|
<option value="UB">Universes Beyond</option>
|
||||||
<option value="Etched">Etched</option>
|
<option value="Etched">Etched</option>
|
||||||
|
<option value="Seventh">Seventh Edition</option>
|
||||||
</select>
|
</select>
|
||||||
<!-- <button class='input' onclick='autoFrame("M15");'>M15</button>
|
<!-- <button class='input' onclick='autoFrame("M15");'>M15</button>
|
||||||
<button class='input' onclick='autoFrame("UB");'>Universes Beyond</button> -->
|
<button class='input' onclick='autoFrame("UB");'>Universes Beyond</button> -->
|
||||||
|
115
js/creator-23.js
115
js/creator-23.js
@@ -503,7 +503,7 @@ function doubleClick(event, maskOrFrame) {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
function cardFrameProperties(colors, manaCost, typeLine, power, etched = false) {
|
function cardFrameProperties(colors, manaCost, typeLine, power, style) {
|
||||||
var colors = colors.map(color => color.toUpperCase())
|
var colors = colors.map(color => color.toUpperCase())
|
||||||
if ([
|
if ([
|
||||||
['U', 'W'],
|
['U', 'W'],
|
||||||
@@ -527,8 +527,21 @@ function cardFrameProperties(colors, manaCost, typeLine, power, etched = false)
|
|||||||
var isHybrid = manaCost.includes('/');
|
var isHybrid = manaCost.includes('/');
|
||||||
|
|
||||||
var pinlineRules;
|
var pinlineRules;
|
||||||
|
if (style == 'Seventh') {
|
||||||
|
if (colors.length == 1) {
|
||||||
|
pinlineRules = colors[0];
|
||||||
|
} else if (colors.length >=2) {
|
||||||
|
pinlineRules = 'M';
|
||||||
|
} else if (typeLine.includes("Artifact")) {
|
||||||
|
pinlineRules = 'A';
|
||||||
|
} else if (typeLine.includes("Land")) {
|
||||||
|
pinlineRules = 'L';
|
||||||
|
} else {
|
||||||
|
pinlineRules = 'C';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (colors.length > 2) {
|
if (colors.length > 2) {
|
||||||
if (etched && typeLine.includes('Artifact')) {
|
if (style == 'Etched' && typeLine.includes('Artifact')) {
|
||||||
pinlineRules = 'A';
|
pinlineRules = 'A';
|
||||||
} else {
|
} else {
|
||||||
pinlineRules = 'M';
|
pinlineRules = 'M';
|
||||||
@@ -540,6 +553,7 @@ function cardFrameProperties(colors, manaCost, typeLine, power, etched = false)
|
|||||||
} else {
|
} else {
|
||||||
pinlineRules = 'A';
|
pinlineRules = 'A';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var pinelineRulesRight;
|
var pinelineRulesRight;
|
||||||
if (typeLine.includes('Land')) {
|
if (typeLine.includes('Land')) {
|
||||||
@@ -577,6 +591,9 @@ function cardFrameProperties(colors, manaCost, typeLine, power, etched = false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
var frame;
|
var frame;
|
||||||
|
if (style == 'Seventh') {
|
||||||
|
frame = pinlineRules;
|
||||||
|
} else {
|
||||||
if (typeLine.includes('Land')) {
|
if (typeLine.includes('Land')) {
|
||||||
frame = 'L';
|
frame = 'L';
|
||||||
} else if (typeLine.includes('Vehicle')) {
|
} else if (typeLine.includes('Vehicle')) {
|
||||||
@@ -586,7 +603,7 @@ function cardFrameProperties(colors, manaCost, typeLine, power, etched = false)
|
|||||||
} else if (colors.length > 2) {
|
} else if (colors.length > 2) {
|
||||||
frame = 'M';
|
frame = 'M';
|
||||||
} else if (colors.length == 2) {
|
} else if (colors.length == 2) {
|
||||||
if (isHybrid || etched) {
|
if (isHybrid || style == 'Etched') {
|
||||||
frame = colors[0];
|
frame = colors[0];
|
||||||
} else {
|
} else {
|
||||||
frame = 'M';
|
frame = 'M';
|
||||||
@@ -596,12 +613,13 @@ function cardFrameProperties(colors, manaCost, typeLine, power, etched = false)
|
|||||||
} else {
|
} else {
|
||||||
frame = 'L';
|
frame = 'L';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var frameRight;
|
var frameRight;
|
||||||
if (!(typeLine.includes('Vehicle') || typeLine.includes('Artifact'))) {
|
if (!(typeLine.includes('Vehicle') || typeLine.includes('Artifact'))) {
|
||||||
if (typeLine.includes('Land')) {
|
if (typeLine.includes('Land')) {
|
||||||
frameRight = landRight;
|
frameRight = landRight;
|
||||||
} else if (colors.length == 2 && (isHybrid || etched)) {
|
} else if (colors.length == 2 && (isHybrid || style == 'Etched')) {
|
||||||
frameRight = colors[1];
|
frameRight = colors[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -629,6 +647,8 @@ function autoFrame() {
|
|||||||
autoUBFrame(colors, card.text.mana.text, card.text.type.text, card.text.pt.text);
|
autoUBFrame(colors, card.text.mana.text, card.text.type.text, card.text.pt.text);
|
||||||
} else if (frame == 'Etched') {
|
} else if (frame == 'Etched') {
|
||||||
autoEtchedFrame(colors, card.text.mana.text, card.text.type.text, card.text.pt.text);
|
autoEtchedFrame(colors, card.text.mana.text, card.text.type.text, card.text.pt.text);
|
||||||
|
} else if (frame == 'Seventh') {
|
||||||
|
autoSeventhEditionFrame(colors, card.text.mana.text, card.text.type.text, card.text.pt.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.querySelector('#selectFramePack') != frame) {
|
if (document.querySelector('#selectFramePack') != frame) {
|
||||||
@@ -681,6 +701,8 @@ async function autoUBFrame(colors, mana_cost, type_line, power) {
|
|||||||
card.text.pt.text = '{fontcolor#fff}' + card.text.pt.text;
|
card.text.pt.text = '{fontcolor#fff}' + card.text.pt.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
card.text.rules.text = card.text.rules.text.replace(/{oldflavor}/g, '{flavor}');
|
||||||
|
|
||||||
card.frames = frames;
|
card.frames = frames;
|
||||||
card.frames.reverse();
|
card.frames.reverse();
|
||||||
await card.frames.forEach(item => addFrame([], item));
|
await card.frames.forEach(item => addFrame([], item));
|
||||||
@@ -727,6 +749,8 @@ async function autoM15Frame(colors, mana_cost, type_line, power) {
|
|||||||
card.text.pt.text = '{fontcolor#fff}' + card.text.pt.text;
|
card.text.pt.text = '{fontcolor#fff}' + card.text.pt.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
card.text.rules.text = card.text.rules.text.replace(/{oldflavor}/g, '{flavor}');
|
||||||
|
|
||||||
card.frames = frames;
|
card.frames = frames;
|
||||||
card.frames.reverse();
|
card.frames.reverse();
|
||||||
await card.frames.forEach(item => addFrame([], item));
|
await card.frames.forEach(item => addFrame([], item));
|
||||||
@@ -739,7 +763,7 @@ async function autoEtchedFrame(colors, mana_cost, type_line, power) {
|
|||||||
card.frames = [];
|
card.frames = [];
|
||||||
document.querySelector('#frame-list').innerHTML = null;
|
document.querySelector('#frame-list').innerHTML = null;
|
||||||
|
|
||||||
var properties = cardFrameProperties(colors, mana_cost, type_line, power, true);
|
var properties = cardFrameProperties(colors, mana_cost, type_line, power, 'Etched');
|
||||||
|
|
||||||
// Set frames
|
// Set frames
|
||||||
|
|
||||||
@@ -765,6 +789,31 @@ async function autoEtchedFrame(colors, mana_cost, type_line, power) {
|
|||||||
frames.push(makeEtchedFrameByLetter(properties.frame, 'Frame', false));
|
frames.push(makeEtchedFrameByLetter(properties.frame, 'Frame', false));
|
||||||
frames.push(makeEtchedFrameByLetter(properties.frame, 'Border', false));
|
frames.push(makeEtchedFrameByLetter(properties.frame, 'Border', false));
|
||||||
|
|
||||||
|
card.text.rules.text = card.text.rules.text.replace(/{oldflavor}/g, '{flavor}');
|
||||||
|
|
||||||
|
card.frames = frames;
|
||||||
|
card.frames.reverse();
|
||||||
|
await card.frames.forEach(item => addFrame([], item));
|
||||||
|
card.frames.reverse();
|
||||||
|
}
|
||||||
|
async function autoSeventhEditionFrame(colors, mana_cost, type_line, power) {
|
||||||
|
var frames = card.frames.filter(frame => frame.name.includes('Extension'));
|
||||||
|
|
||||||
|
//clear the draggable frames
|
||||||
|
card.frames = [];
|
||||||
|
document.querySelector('#frame-list').innerHTML = null;
|
||||||
|
|
||||||
|
var properties = cardFrameProperties(colors, mana_cost, type_line, power, 'Seventh');
|
||||||
|
|
||||||
|
// Set frames
|
||||||
|
frames.push(makeSeventhEditionFrameByLetter(properties.pinlineRules, 'Pinline', false));
|
||||||
|
frames.push(makeSeventhEditionFrameByLetter(properties.pinlineRules, 'Rules', false));
|
||||||
|
frames.push(makeSeventhEditionFrameByLetter(properties.frame, 'Frame', false));
|
||||||
|
frames.push(makeSeventhEditionFrameByLetter(properties.pinlineRules, 'Textbox Pinline', false));
|
||||||
|
frames.push(makeSeventhEditionFrameByLetter(properties.frame, 'Border', false));
|
||||||
|
|
||||||
|
card.text.rules.text = card.text.rules.text.replace(/{flavor}/g, '{oldflavor}');
|
||||||
|
|
||||||
card.frames = frames;
|
card.frames = frames;
|
||||||
card.frames.reverse();
|
card.frames.reverse();
|
||||||
await card.frames.forEach(item => addFrame([], item));
|
await card.frames.forEach(item => addFrame([], item));
|
||||||
@@ -1066,6 +1115,62 @@ function makeEtchedFrameByLetter(letter, mask = false, maskToRightHalf = false)
|
|||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
function makeSeventhEditionFrameByLetter(letter, mask = false, maskToRightHalf = false) {
|
||||||
|
letter = letter.toUpperCase();
|
||||||
|
var frameNames = {
|
||||||
|
'W': 'White',
|
||||||
|
'U': 'Blue',
|
||||||
|
'B': 'Black',
|
||||||
|
'R': 'Red',
|
||||||
|
'G': 'Green',
|
||||||
|
'M': 'Multicolored',
|
||||||
|
'A': 'Artifact',
|
||||||
|
'L': 'Land',
|
||||||
|
'C': 'Colorless',
|
||||||
|
'V': 'Vehicle'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (letter == 'V') {
|
||||||
|
letter = 'A';
|
||||||
|
}
|
||||||
|
|
||||||
|
var frameName = frameNames[letter];
|
||||||
|
|
||||||
|
var frame = {
|
||||||
|
'name': frameName + ' Frame',
|
||||||
|
'src': '/img/frames/seventh/regular/' + letter + '.png',
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask) {
|
||||||
|
if (mask == 'Textbox Pinline') {
|
||||||
|
frame.masks = [
|
||||||
|
{
|
||||||
|
'src': '/img/frames/seventh/regular/trim.svg',
|
||||||
|
'name': 'Textbox Pinline'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
frame.masks = [
|
||||||
|
{
|
||||||
|
'src': '/img/frames/seventh/regular/' + mask + '.svg',
|
||||||
|
'name': mask
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (maskToRightHalf) {
|
||||||
|
frame.masks.push({
|
||||||
|
'src': '/img/frames/maskRightHalf.png',
|
||||||
|
'name': 'Right Half'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
frame.masks = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
async function addFrame(additionalMasks = [], loadingFrame = false) {
|
async function addFrame(additionalMasks = [], loadingFrame = false) {
|
||||||
var frameToAdd = JSON.parse(JSON.stringify(availableFrames[selectedFrameIndex]));
|
var frameToAdd = JSON.parse(JSON.stringify(availableFrames[selectedFrameIndex]));
|
||||||
var maskThumbnail = true;
|
var maskThumbnail = true;
|
||||||
|
Reference in New Issue
Block a user