Skip to content

Commit

Permalink
Merge pull request #844 from NetrunnerDB/startupspoilers
Browse files Browse the repository at this point in the history
Startup Deckbuilding Changes
  • Loading branch information
plural authored Sep 20, 2024
2 parents e0c1cdd + 92d2069 commit cd39e5f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/Resources/views/Builder/deck.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var Filters = {},
<div id="latestpack"></div>
<div id="onesies" style="display:none"></div>
<div id="cacherefresh" style="display:none"></div>
<div id="startupvalidation" style="display:none"></div>
<div id="restricted"></div>
<div id="limited"></div>
<div id="ampere_agenda_limit"></div>
Expand Down
1 change: 1 addition & 0 deletions web/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,7 @@ ul.rulings-list blockquote {
#rotated:not(:empty),
#limited:not(:empty),
#out_of_faction_agendas:not(:empty),
#startupvalidation:not(:empty),
#ampere_agenda_limit:not(:empty) {
color: var(--nrdb-color--error);
display: list-item;
Expand Down
27 changes: 27 additions & 0 deletions web/js/nrdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ function update_deck(options) {
}
check_influence(influenceSpent);
check_restricted();
check_startup_constraints();
check_deck_limit();
check_agenda_factions();
check_ampere_agenda_limits();
Expand Down Expand Up @@ -546,6 +547,32 @@ function check_ampere_agenda_limits() {
}
}

function check_startup_constraints() {
if(MWL && MWL['name'].includes("Startup Ban List 24.09")){
const five_threes = NRDB.data.cards.find({
indeck: { '$gt': 0 },
type_code: 'agenda'
}).filter(function (card) {
return card.agenda_points >= 3;
});

const num_five_threes = five_threes.reduce(function (count, agenda){
return count + agenda['indeck'];
}, 0);

if(num_five_threes > 3){
$('#startupvalidation').text('More than 3 agendas included with 3 or more agenda points each.').show();
}
else {
// remove any messages if things are okay
$('#startupvalidation').text('').hide();
}
}
else {
$('#startupvalidation').text('').hide();
}
}

function show_onesies() {
var content = test_onesies() ? '<span class="text-success glyphicon glyphicon-ok"></span> 1.1.1.1 format compliant' : '<span class="text-danger glyphicon glyphicon-remove"></span> Non 1.1.1.1 format compliant';
$('#onesies').html(content).show();
Expand Down

0 comments on commit cd39e5f

Please sign in to comment.