diff --git a/static/filterWeapons.js b/static/filterWeapons.js index b15ef3d..f932dee 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -5,7 +5,7 @@ let globalModifiers = []; // Function to fetch operatives data from JSON function fetchOperativesData() { - fetch('static/json/operative.json') // Adjust the path to the actual location of your JSON file + fetch('/static/json/operative.json') // Adjust the path to the actual location of your JSON file .then(response => response.json()) .then(data => { populateOperatives(data.operatives); // Populate the operative dropdown once data is loaded @@ -230,6 +230,8 @@ function applyModifiers() { let rpmModifier = {additive: 0, multiplicative: 1}; let reloadTimeModifier = {additive: 0, multiplicative: 1}; + // Function to process global modifiers + // Function to process global modifiers // Function to process global modifiers const processModifier = (mod) => { // Ensure guntype is now an array of tags @@ -242,8 +244,9 @@ function applyModifiers() { // Check if the modifier applies to any of the current weapon's tags if (mod.appliesTo && !weaponTags.includes(mod.appliesTo)) { - return; // Skip this modifier + return; // Skip this modifier if it does not apply to the selected weapon type } + // Handle modifiers with multiple buffs if (mod.dataset.buffs) { const buffs = JSON.parse(mod.dataset.buffs); @@ -271,6 +274,9 @@ function applyModifiers() { } }; + + // Function to process operative-specific modifiers + // Function to process operative-specific modifiers // Function to process operative-specific modifiers const processOperativeModifier = (mod) => { // Ensure guntype is now an array of tags @@ -283,7 +289,7 @@ function applyModifiers() { // Check if the modifier applies to any of the current weapon's tags if (mod.appliesTo && !weaponTags.includes(mod.appliesTo)) { - return; // Skip this modifier + return; // Skip this modifier if it does not apply to the selected weapon type } // Handle operative modifiers with multiple buffs @@ -305,6 +311,7 @@ function applyModifiers() { } }; + // Clear out listeners and avoid re-adding const modifiersContainer = document.getElementById('modifiers'); modifiersContainer.removeEventListener('change', applyModifiers); diff --git a/static/json/modifiers.json b/static/json/modifiers.json index b13cb60..160df35 100644 --- a/static/json/modifiers.json +++ b/static/json/modifiers.json @@ -117,7 +117,8 @@ "value": 1.25, "buffType": "multiplicative" } - ] + ], + "appliesTo": "" }, { "id": "multiple-buffs-firefight", @@ -134,14 +135,16 @@ "buffType": "multiplicative" } ], - "operatives": "" + "operatives": "", + "appliesTo": "" }, { "id": "damage-ability-multiplicative-heath-spawn", "label": "[All Operatives] Heath Spawn (+30% Damage)", "value": 1.3, "type": "multiplicative", - "operatives": "" + "operatives": "", + "appliesTo": "" }, { "id": "multiple-buffs-warcry", @@ -158,49 +161,104 @@ "value": 1, "buffType": "multiplicative" } - ] + ], + "appliesTo": "" }, { "id": "damage-ability-multiplicative-blackout", "label": "[All Operatives] Blackout (+30% Damage)", "value": 1.3, "type": "multiplicative", - "operatives": "" + "operatives": "", + "appliesTo": "" }, { "id": "damage-ability-multiplicative-red-scan", "label": "[All Operatives] Red Scan (+30% Damage)", "value": 1.3, "type": "multiplicative", - "operatives": "" + "operatives": "", + "appliesTo": "" }, { "id": "damage-ability-multiplicative-red-scan", "label": "[All Operatives] Green Scan (+50% Damage)", "value": 1.5, "type": "multiplicative", - "operatives": "" + "operatives": "", + "appliesTo": "" }, { "id": "damage-ability-multiplicative-point-out", "label": "[All Operatives] Point Out (+50% Damage)", "value": 1.5, "type": "multiplicative", - "operatives": "" + "operatives": "", + "appliesTo": "" }, { "id": "damage-item-additive-5-uiu-elite", "label": "[All Operatives] 5 UIU Elite nearby (+25 damage)", "value": 25, "type": "additive", - "operatives": "" + "operatives": "", + "appliesTo": "" }, { "id": "damage-item-additive-field-support", "label": "[All Operatives] MTF Commander Field Support (+8 damage)", "value": 8, "type": "additive", - "operatives": "" + "operatives": "", + "appliesTo": "" + }, + { + "id": "damage-ability-multiplicative-scan grenade", + "label": "[All Operatives] Scan Grenade (+15% Damage)", + "value": 1.15, + "type": "multiplicative", + "operatives": "", + "appliesTo": "" + }, + { + "id": "damage-upgrade-multiplicative-upgraded-bullets", + "label": "[All Operatives] Experimental Bullets (+30% Damage)", + "value": 1.3, + "type": "multiplicative", + "operatives": "", + "appliesTo": "" + }, + { + "id": "damage-item-additive-GOC", + "label": "[All Operatives] GOC Ally (+8 damage)", + "value": 8, + "type": "additive", + "operatives": "", + "appliesTo": "" + }, + { + "id": "damage-item-additive-GOC-1", + "label": "[All Operatives] Weak Points (+8 damage)", + "value": 8, + "type": "additive", + "operatives": "", + "appliesTo": "" + }, + { + "id": "damage-item-additive-GOC-3", + "label": "[All Operatives] GOC Ally: Kraken Buff (+3 damage)", + "value": 3, + "type": "additive", + "operatives": "", + "appliesTo": "" + }, + { + "id": "damage-item-additive-uiu-1", + "label": "[All Operatives] UIU Upgraded Towers (+20% damage)", + "value": 1.2, + "type": "multiplicative", + "operatives": "", + "appliesTo": "" } ] }