diff --git a/static/filterTable.js b/static/filterTable.js index d69cb7d..210aa5f 100644 --- a/static/filterTable.js +++ b/static/filterTable.js @@ -4,7 +4,7 @@ function filterTable() { const table = document.getElementById('gun-stats'); const tr = table.getElementsByTagName('tr'); for (let i = 1; i < tr.length; i++) { - const td = tr[i].getElementsByTagName('td')[1]; + const td = tr[i].getElementsByTagName('td')[0]; if (td) { const txtValue = td.textContent || td.innerText; if (txtValue.toLowerCase().indexOf(filter) > -1) { diff --git a/static/filterWeapons.js b/static/filterWeapons.js index ec30d90..8d6e3f5 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -5,6 +5,7 @@ let globalModifiers = []; // This will be populated by the modifiers let selectedGunTypes = []; // Track selected gun types for filtering let headshotMultiplier = 0; // Initialize Headshots as 0 let headshotBaseApplied = false; //Initialize Headshots Applied as false +let ignoreHeadshots = false; // Function to fetch operatives data from JSON function fetchOperativesData() { @@ -265,19 +266,20 @@ function populateModifiers(modifiers) { modifiersContainer.addEventListener('change', applyModifiers); } -// Function to apply the modifiers and recalculate damage, RPM, and reloadTime function applyModifiers() { if (!selectedWeapon) return; - // Base stats + const hasNVG = !!document.querySelector( + "#modifiers input[id='damage-item-multiplicative-nightvision']:checked" + ); let baseDamage = selectedWeapon.damage; let baseRpm = selectedWeapon.rpm; let baseReloadTime = selectedWeapon.reload_time; - // Modifiers initialization let damageModifier = {additive: 0, multiplicative: 1}; let rpmModifier = {additive: 0, multiplicative: 1}; let reloadTimeModifier = {additive: 0, multiplicative: 1}; - headshotMultiplier = 0; // Reset headshot multiplier + headshotMultiplier = 0; headshotBaseApplied = false; + ignoreHeadshots = hasNVG; // Function to process global modifiers function processModifier(mod) { @@ -413,6 +415,11 @@ function applyModifiers() { } function applyBuff(buff, rpmModifier, reloadTimeModifier, damageModifier) { + if (ignoreHeadshots && + (buff.buffType === 'multiplicative-headshot' || + buff.buffType === 'multiplicative-headshot-base')) { + return; + } const {type, buffType, value} = buff; // Handle headshot multipliers if (buffType === 'multiplicative-headshot-base' && !headshotBaseApplied) { diff --git a/static/json/modifiers.json b/static/json/modifiers.json index d063d33..8794b45 100644 --- a/static/json/modifiers.json +++ b/static/json/modifiers.json @@ -61,7 +61,7 @@ }, { "id": "damage-item-multiplicative-nightvision", - "label": "Night Vision Goggles (+50% damage)", + "label": "Night Vision Goggles (+50% damage) | Resets Headshot Multiplier", "value": 1.5, "type": "multiplicative", "operatives": "" diff --git a/templates/calculator.html b/templates/calculator.html index 256a2a7..9af92fc 100644 --- a/templates/calculator.html +++ b/templates/calculator.html @@ -3,7 +3,7 @@
- +