From Brotato Wiki
(attack speed notes: use code formatting) Tag: Reverted |
(fix range) Tag: Reverted |
||
Line 628: | Line 628: | ||
** At 100 attack speed (1), this would be: 0.05 | ** At 100 attack speed (1), this would be: 0.05 | ||
* atk_duration = <code>max(0.01, 0.2 - (stat_attack_speed / 10.0)) + range_factor * 0.15</code> | * atk_duration = <code>max(0.01, 0.2 - (stat_attack_speed / 10.0)) + range_factor * 0.15</code> | ||
* range_factor = <code>max(0.0, WPN.max_range / clamp(70.0 * (1 + (stat_attack_speed / 3)), 70.0, 120.0))</code> | * range_factor = <code>max(0.0, (WPN.max_range + (stat_range / 2)) / clamp(70.0 * (1 + (stat_attack_speed / 3)), 70.0, 120.0))</code> | ||
** <code>max</code> gets the highest value, so here it can't be lower than 0 | ** <code>max</code> gets the highest value, so here it can't be lower than 0 | ||
** <code>clamp</code> makes sure the value isn't higher/lower than the specified numbers, so here it can't be lower than 70 or higher than 120 | ** <code>clamp</code> makes sure the value isn't higher/lower than the specified numbers, so here it can't be lower than 70 or higher than 120 |
Revision as of 11:04, 4 December 2022
Itembox
Testing a new template, intended for use on mod pages.
PLEASE USE CTRL+F5 TO SEE THE NEW STYLES
Characters
Items
Weapons
Works with weapons too. Might be a bit excessive to show all tiers so I'm only showing the initial one here.
Attack Speed Notes
In the game's code, a weapon's displayed "attack speed" is determined by both two of its stats: cooldown
and recoil_duration
, via weapon_stats.gd (see get_cooldown_text
in ranged_weapon_stats.gd and melee_weapon_stats.gd)
Recoil Duration is almost always 0.1, except for 11 ranged weapons: Crossbow (0.15), Flamethrower (0.02), Laser Gun (0.2), Minigun (0.02), Nuclear Launcher (0.142), Obliterator (0.2), Rocket Launcher (0.142), Shredder (0.15), Slingshot (0.15), SMG (0.05), and Sniper Gun (0.2).
For ranged weapons, the displayed attack speed is calculated as:
(cooldown / 60) + (recoil_duration * 2)
For melee weapons, the displayed attack speed is calculated as:
(cooldown / 60) + recoil_duration + (atk_duration / 2) + back_duration
Here's what those melee variables mean:
- back_duration =
0.2 / (1 + (stat_attack_speed * 3))
- At 0 attack speed, this would be: 0.2
- At 10 attack speed (0.1), this would be: 0.15
- At 50 attack speed (0.5), this would be: 0.08
- At 100 attack speed (1), this would be: 0.05
- atk_duration =
max(0.01, 0.2 - (stat_attack_speed / 10.0)) + range_factor * 0.15
- range_factor =
max(0.0, (WPN.max_range + (stat_range / 2)) / clamp(70.0 * (1 + (stat_attack_speed / 3)), 70.0, 120.0))
max
gets the highest value, so here it can't be lower than 0clamp
makes sure the value isn't higher/lower than the specified numbers, so here it can't be lower than 70 or higher than 120