From 98f87ad60e0eac580bf97f7bd7899b1963398970 Mon Sep 17 00:00:00 2001 From: IM23a-spirgif Date: Sat, 21 Sep 2024 09:42:12 +0200 Subject: [PATCH] added default value for selectors and some more operatives --- static/filterWeapons.js | 13 ++++-- static/json/data.json | 2 +- static/json/operative.json | 85 +++++++++++++++++++++++++++++++++++++- 3 files changed, 93 insertions(+), 7 deletions(-) diff --git a/static/filterWeapons.js b/static/filterWeapons.js index 1ec9706..3d25839 100644 --- a/static/filterWeapons.js +++ b/static/filterWeapons.js @@ -238,6 +238,9 @@ function applyModifiers() { if (mod.appliesTo && mod.appliesTo !== selectedWeapon.guntype) { return; // Skip this modifier } + if (mod.operatives && selectedOperative && mod.operatives !== selectedOperative.category) { + return; // Skip this modifier if it doesn't apply to the current operative's category + } // Handle modifiers with multiple buffs if (mod.dataset.buffs) { @@ -266,7 +269,7 @@ function applyModifiers() { } }; - // Function to process operative-based modifiers + // Function to process operative-specific modifiers const processOperativeModifier = (mod) => { if (mod.appliesNotTo && mod.appliesNotTo === selectedWeapon.guntype) { return; // Skip this modifier for this weapon type @@ -275,6 +278,11 @@ function applyModifiers() { return; // Skip if the modifier does not apply to this weapon type } + // Ensure that the modifier only applies if it matches the selected operative's category + if (mod.operatives && selectedOperative && mod.operatives !== selectedOperative.category) { + return; // Skip this modifier if it doesn't apply to the current operative's category + } + // Handle operative modifiers with multiple buffs if (mod.buffs) { mod.buffs.forEach(buff => { @@ -303,11 +311,9 @@ function applyModifiers() { processModifier(mod); }); - // Re-apply listener after change modifiersContainer.addEventListener('change', applyModifiers); - // Process operative-specific modifiers // Process operative-specific modifiers that are checked const operativeSection = document.getElementById('operative-modifiers'); operativeSection.querySelectorAll('input:checked').forEach(mod => { @@ -319,7 +325,6 @@ function applyModifiers() { } }); - // Recalculate with applied modifiers let damage = baseDamage * damageModifier.multiplicative; damage += damageModifier.additive; diff --git a/static/json/data.json b/static/json/data.json index 5f0d167..77919ad 100644 --- a/static/json/data.json +++ b/static/json/data.json @@ -337,7 +337,7 @@ "rpm": 30, "mag_size": 5, "reload_time": 3.5, - "guntype": "RIFLE?" + "guntype": "RIFLE" }, { "id": 38, diff --git a/static/json/operative.json b/static/json/operative.json index f7d6f43..9e5f362 100644 --- a/static/json/operative.json +++ b/static/json/operative.json @@ -182,8 +182,8 @@ "appliesTo": "" }, { - "id": "adrenaline-damage-perk", - "label": "All Upgrades (+30% Damage)", + "id": "anarchist-adrenaline-damage-perk", + "label": "Adrenaline (+30% Damage)", "value": 1.3, "type": "multiplicative", "appliesTo": "" @@ -1097,6 +1097,87 @@ "appliesTo": "SMG" } ] + }, + { + "id": "GRU-P-Assault", + "name": "GRU-P Assault", + "category": "GRU-P", + "modifiers": [ + { + "id": "not-step-back-damage-perk", + "label": "Not one step back (+50% Damage)", + "value": 1.5, + "type": "multiplicative", + "appliesTo": "" + }, + { + "id": "gru-p-assault-mastery-reload-perk", + "label": "Mastery [SOVIET WEAPONS] (+10% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.9, + "buffType": "multiplicative" + } + ], + "appliesTo": "SOVIET" + }, + { + "id": "gru-p-assault-mastery-damage-perk", + "label": "Mastery (+20% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.2, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + }, + { + "id": "gru-p-assault-patriotic-damage-perk", + "label": "Patriotic (+60% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.6, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] + }, + { + "id": "GRU-P-Specialist", + "name": "GRU-P Specialist", + "category": "GRU-P", + "modifiers": [ + { + "id": "well-taught-reload-perk", + "label": "Not one step back (+50% Reload Speed)", + "buffs": [ + { + "type": "reloadTime", + "value": 0.5, + "buffType": "multiplicative" + } + ], + "appliesNotTo": "SHOTGUN" + }, + { + "id": "heavy-bullets-damage-perk", + "label": "Heavy Bullets (+32% Damage)", + "buffs": [ + { + "type": "damage", + "value": 1.32, + "buffType": "multiplicative" + } + ], + "appliesTo": "" + } + ] } ] } \ No newline at end of file