Skip to content

Commit

Permalink
Improve logic for if a weapon can roll a damage type
Browse files Browse the repository at this point in the history
  • Loading branch information
Sainan committed Jun 23, 2024
1 parent b82aaa9 commit 43d462e
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions rivencalc.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ function addStatCompatInfo(div, weaponData, tag, buff)
if (tag in upgradeTagToDamageType)
{
const damageType = upgradeTagToDamageType[tag];
if (!weaponHasInnateDamage(weaponData, damageType))
if (!weaponCanRollDamageType(weaponData, damageType))
{
const isPhysical = (damageType == "DT_IMPACT" || damageType == "DT_PUNCTURE" || damageType == "DT_SLASH");
if (isPhysical || !buff)
Expand All @@ -425,18 +425,27 @@ function addStatCompatInfo(div, weaponData, tag, buff)
}
}

function weaponHasInnateDamage(weaponData, damageType)
// Test vectors for rollable physicals

// Weapons with projectile:
// - Aeolak: Impact, Puncture, Slash.
// - Acceltra: Impact.
// - Hystrix: Puncture.
// Weapons without projectile:
// - Braton: Impact, Puncture, Slash.
// - Bronco: Impact.
// - Lex: Puncture.

function weaponCanRollDamageType(weaponData, damageType)
{
if (weaponData
&& weaponData.behaviors
&& weaponData.behaviors[0]
&& weaponData.behaviors[0].projectile
&& weaponData.behaviors[0].projectile.attack
)
const behavior = weaponData.behaviors[0];
const damageTable = behavior.projectile?.attack ? behavior.projectile.attack : behavior.impact;
if (damageType in damageTable)
{
return (damageType in weaponData.behaviors[0].projectile.attack);
const totalDamage = Object.values(damageTable).reduce((a, b) => a + b, 0);
return (damageTable[damageType] / totalDamage) > 0.15;
}
return true;
return false;
}

function getBuffValue(rivenType, tag, tagValue, omegaAttenuation, lvl, buffs, curses)
Expand Down

0 comments on commit 43d462e

Please sign in to comment.