Skip to content

Commit

Permalink
synchro to forge
Browse files Browse the repository at this point in the history
SQUASHED: AUTO-COMMIT-src-components-widgets-lively-code-mirror-shadow-text.js,AUTO-COMMIT-src-components-widgets-ubg-cards.html,AUTO-COMMIT-src-components-widgets-ubg-cards.js,AUTO-COMMIT-src-components-widgets-ubg-rules-text.js,AUTO-COMMIT-src-external-test-folder-sub-lib.js,AUTO-COMMIT-src-external-test-folder-utils.js,
  • Loading branch information
onsetsu committed Feb 28, 2025
1 parent 6b0f5d5 commit ee18fcf
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 29 deletions.
1 change: 0 additions & 1 deletion src/components/widgets/lively-code-mirror-shadow-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ class OpenAICompletion {
return
}


const completableTextType = lcm.isJavaScript || lcm.isMarkdown || lcm.isHTML
if (!completableTextType) {
return;
Expand Down
4 changes: 1 addition & 3 deletions src/components/widgets/ubg-cards.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,7 @@
<div id='layout'>
<div id="buttons">
<input id="filter" title="Ctrl+/" placeholder="filter: regex fire\b or > c.getId() > 1000"/>
<button id="onlyGoodCards" title="adjust filter to only the best cards"><i class="fa fa-thumbs-o-up" aria-hidden="true"></i></button>
<button id="onlyCardsToTest" title="adjust filter to only cards to test"><i class="fa fa-fire" aria-hidden="true"></i></button>
<button id="onlyNewCards" title="adjust filter to only new cards"><i class="fa fa-plus-square-o" aria-hidden="true"></i></button>
<button id="cardFilter" title="adjust filter to various cards"><i class="fa fa-filter" aria-hidden="true"></i></button>
<button id="startCardScanner" title="start scanning playtested cards"><i class="fa fa-barcode" aria-hidden="true"></i></button>
<button id="sortById" title="sort cards by id"><i class="fa fa-sort" aria-hidden="true"></i>by id</button>
<button id="sortByName" title="sort cards by name"><i class="fa fa-sort" aria-hidden="true"></i>by name</button>
Expand Down
94 changes: 80 additions & 14 deletions src/components/widgets/ubg-cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,12 @@ export default class Cards extends Morph {

this.cardFrameStyle.addEventListener('input', evt => this.updateCardInEditor(this.card), false);
for (let eventName of ['input']) {
this.filter.addEventListener(eventName, evt => this.filterChanged(evt), false);
this.filter.addEventListener(eventName, evt => this.filterChanged(), false);
this.rangeStart.addEventListener(eventName, evt => this.rangeChanged(evt), false);
this.rangeEnd.addEventListener(eventName, evt => this.rangeChanged(evt), false);
}

this.get('#cardFilter').addEventListener('pointermove', evt => this.onCardFilter(evt), false)

this.addEventListener('dragenter', evt => this.dragenter(evt), false);
this.addEventListener('dragover', evt => this.dragover(evt), false);
Expand Down Expand Up @@ -232,7 +234,7 @@ export default class Cards extends Morph {
return;
}

filterChanged(evt) {
filterChanged() {
this.filterValue = this.filter.value;

this.updateItemsToFilter();
Expand Down Expand Up @@ -1074,20 +1076,84 @@ export default class Cards extends Morph {
}

/*MD ## Main Bar Buttons MD*/
onOnlyGoodCards(evt) {
this.filter.value = `> ['essential', 'keep', 'borderline'].includes(c.getRating()) && !c.getTags().includes('expansion')`
this.filterChanged(evt)
}

onOnlyCardsToTest(evt) {
this.filter.value = `> c.getRating() === 'test next'`
this.filterChanged(evt)
applyTextBasedFilter(filterText) {
if (this.filter.value === filterText) {
return;
}

this.filter.value = filterText
this.filterChanged()
}

onOnlyNewCards(evt) {
this.filter.value = `> !c.getRating()`
this.filterChanged(evt)

async onCardFilter(evt) {
evt.stopPropagation();
evt.preventDefault();

function faLeft(icon) {
return <i class={"fa fa-" + icon} aria-hidden="true"></i>;
}
function faRight(icon) {
return `<i class="fa fa-${icon}"></i>`;
}
const menu = new ContextMenu(this, [{
name: "Good cards",
callback: () => {
this.applyTextBasedFilter(`> ['essential', 'keep', 'borderline'].includes(c.getRating()) && !c.getTags().includes('expansion')`)
this.filter.select();
},
// children: ,
right: faRight('filter'),
icon: faLeft('thumbs-o-up'),
}, {
name: 'Cards to test',
callback: () => {
this.applyTextBasedFilter(`> c.getRating() === 'test next'`)
this.filter.select();
},
right: faRight('filter'),
icon: faLeft('fire'),
}, {
name: "Needs revision",
callback: () => {
this.applyTextBasedFilter(`> ['needs revision'].includes(c.getRating())`)
this.filter.select();
},
right: faRight('filter'),
icon: faLeft('eye'),
},
'---',
{
name: "Simple cards",
callback: () => {
this.applyTextBasedFilter(`> 4 > c.getComprehensionComplexity()`)
this.filter.select();
},
right: faRight('filter'),
icon: faLeft('cube'),
}, {
name: "Complex cards",
callback: () => {
this.applyTextBasedFilter(`> 4 <= c.getComprehensionComplexity()`)
this.filter.select();
},
right: faRight('filter'),
icon: faLeft('cubes'),
},
'---',
{
name: 'New cards',
callback: () => {
this.applyTextBasedFilter(`> !c.getRating()`)
this.filter.select();
},
right: faRight('filter'),
icon: faLeft('flask'),
},
]);
menu.openIn(document.body, evt, this);
return;
}

onStartCardScanner(evt) {
lively.openComponentInWindow('ubg-cards-scanner', undefined, lively.pt(1000, 800))
}
Expand Down
22 changes: 11 additions & 11 deletions src/components/widgets/ubg-rules-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,6 @@ ${SVG.elementSymbol(others[2], lively.pt(12.5, 8.5), 1.5)}`, lively.rect(0, 0, 1
printedRules = printedRules.replace(/\bdaybreak\b/gmi, '<i class="fas fa-sun"></i>');
printedRules = printedRules.replace(/\bnightfall\b/gmi, '<i class="fa-solid fa-moon"></i>');

printedRules = this.renderCardnames(printedRules)

printedRules = printedRules.replace(/actionFree/gmi, () => this.chip('free'));
printedRules = printedRules.replace(/actionMulti/gmi, () => this.chip('multi'));
printedRules = this.renderXPerTurnOrGame(printedRules);
Expand Down Expand Up @@ -259,6 +257,8 @@ ${SVG.elementSymbol(others[2], lively.pt(12.5, 8.5), 1.5)}`, lively.rect(0, 0, 1
return `<span class='mandatory-icon'></span><span class='mandatory'>${content}</span>`;
});

printedRules = this.renderCardnames(printedRules)

this.renderToDoc(printedRules)
}

Expand Down Expand Up @@ -501,6 +501,14 @@ ${SVG.elementSymbol(others[2], lively.pt(12.5, 8.5), 1.5)}`, lively.rect(0, 0, 1
return `gear Sacrifice ${subject} to exec its blitz effects.`
},

forgeable: (...args) => {
return 'gear Play this by sacrificing 2+ cards with total cost equal to this card\'s.'
},

forge: (...args) => {
return 'Sacrifice 2+ cards with total cost equal to a card in hand to play that card.'
},

impulse: () => {
return `To impulse a card, set it aside. You may buy it this turn as gear. If you don't: Trash it at end of turn.`
},
Expand Down Expand Up @@ -594,14 +602,6 @@ ${SVG.elementSymbol(others[2], lively.pt(12.5, 8.5), 1.5)}`, lively.rect(0, 0, 1
return 'Casting a card with a stun counter removes the counter instead of the effect.'
},

synchro: (...args) => {
return 'gear Play this by sacrificing 2+ cards from field with total cost equal to this card\'s.'
},

synchronize: (...args) => {
return 'Sacrifice 2+ cards with total cost equal to a card in hand to play that card.'
},

tiny: () => {
return 'Tiny cards do not count for triggering the game end.'
},
Expand Down Expand Up @@ -696,6 +696,7 @@ ${SVG.elementSymbol(others[2], lively.pt(12.5, 8.5), 1.5)}`, lively.rect(0, 0, 1
highlightKeyword(/\benhance\b/gmi);
highlightKeyword(/\bevoke\b/gmi);
highlightKeyword(/\bflashback\b/gmi);
highlightKeyword(/\bforg(e(able|d)?|ing)\b/gmi);
highlightKeyword(/\bimpulsed?\b/gmi);
highlightKeyword(/\binstant\b/gmi);
highlightKeyword(/\binvoke\b/gmi);
Expand All @@ -712,7 +713,6 @@ ${SVG.elementSymbol(others[2], lively.pt(12.5, 8.5), 1.5)}`, lively.rect(0, 0, 1
highlightKeyword(/seek\b/gmi, C_GREEN, '<i class="fa-sharp fa-solid fa-eye"></i> ');
//'#3FDAA5' some turquise
highlightKeyword(/\bstuncounter\b/gmi);
highlightKeyword(/\bsynchro(nized?)?\b/gmi);
highlightKeyword(/\btiny\b/gmi);
highlightKeyword(/trad(ed?|ing)\b/gmi, '#2E9F78', SVG.inlineSVG(tradeSVG.innerHTML, lively.rect(0, 0, 36, 36), 'x="10%" y="10%" width="80%" height="80%"', ''));
highlightKeyword(/troph(y|ies)(\spoints?)?\b/gmi, C_ORANGE + ' !important', '<i class="fa fa-trophy"></i> ');
Expand Down

0 comments on commit ee18fcf

Please sign in to comment.