# Blaze Away Rounding Issue causing unexpected behaviour with stacks

**URL:** <https://forums.fatsharkgames.com/t/blaze-away-rounding-issue-causing-unexpected-behaviour-with-stacks/81591>\
**Category:** Bugs\
**Tags:** acknowledged\
**Created:** [July 4, 2023, 12:05pm UTC](https://forums.fatsharkgames.com/t/blaze-away-rounding-issue-causing-unexpected-behaviour-with-stacks/81591 "2023-07-04T12:05:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grawr](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@Grawr](https://forums.fatsharkgames.com/u/Grawr)\
**Post date:** [July 4, 2023, 12:05pm UTC](https://forums.fatsharkgames.com/t/blaze-away-rounding-issue-causing-unexpected-behaviour-with-stacks/81591/1 "2023-07-04T12:05:25Z")

</div>

**Issue Description:**  
When using a Ripper Gun with a clip size of 20, continuous fire means you accumulate 5 stacks of Blaze Away after 10 rounds of continuous shooting.

However, when using a Ripper Gun with a clip size of 21, continuous fire means you accumulate 5 stacks of Blaze away after **15** rounds of continuous shooting.

By adding 1 to our max clip size, we have increased the number of bullets we need to fire to get max Blaze away by 5.

**Steps to Reproduce:**  
Simply take any Ripper Gun with 20 ammo and fire it in the Psykanium and observe the stacks. Then repeat the process with any Ripper gun with 21 ammo.

**Likely Cause**  
The likely cause of this is due to the implementation of the Blaze Away blessing. Below is likely the pseudocode I suspect is used.

```auto
BulletsPerStackofBlazeAway = ceil(ClipSize/10) 
BulletsFired = 0
if (ShotFired){
   BulletsFired++
   BlazeAwayCooldownReset()
   if (BulletsFired == BulletsPerStackofBlazeAway){
      BlazeAwayStacks = min (BlazeAwayStacks+1,5)
      BulletsFired = 0
   }
}
if (BlazeAwayCooldownExpire==true){
  BulletsFired = 0
  BlazeAwayStacks = 0
}

```

The above code causes the issue where a clip size of 20/10 = 2, while a clip size of 21/10 = 2.1, which gets rounded up to 3. Thus you need 2 shots per stack of blaze away for 20 size clips, but 3 shots per stack of blaze away for 21 size clips

**Solution**  
The better way to do this is to keep track of the number of bullets continuously fired, and setting the stacks to be equal to the BulletsFired \* 10/max(10,ClipSize). The purpose of max(10,Clipsize) is to ensure Blaze Away works with clip size 1 weapons such as the rumbler by ensuring you never get more than 1 stack per shot fired. See the code below.

```auto
BulletsFired = 0
if (ShotFired){
   BulletsFired++
   BlazeAwayCooldownReset()
   BlazeAwayStacks = min (ceil(BulletsFired*10/max(10,ClipSize)),5)
}
if (BlazeAwayCooldownExpire==true){
  BulletsFired = 0
  BlazeAwayStacks = 0
}

```

---

<div class="post-metadata">

**Author:** ![kuli](https://dub1.discourse-cdn.com/flex013/user_avatar/forums.fatsharkgames.com/kuli/32/20818_2.png) [@kuli](https://forums.fatsharkgames.com/u/kuli)\
**Post date:** [July 4, 2023, 2:10pm UTC](https://forums.fatsharkgames.com/t/blaze-away-rounding-issue-causing-unexpected-behaviour-with-stacks/81591/2 "2023-07-04T14:10:10Z")

</div>

Just dropping some links so you don’t have to assume pseudocode:

- [fire step function](https://github.com/Aussiemon/Darktide-Source-Code/blob/015215d5266fa83bac4c7dba56659291e5d24383/scripts/settings/buff/fire_step_functions.lua#L3-L17) used for ripper gun Blaze Away
- [number of continous fire steps](https://github.com/Aussiemon/Darktide-Source-Code/blob/015215d5266fa83bac4c7dba56659291e5d24383/scripts/settings/buff/weapon_traits_buff_templates/base_weapon_trait_buff_templates.lua#L1467-L1517)

---

<div class="post-metadata">

**Author:** ![Flawless](https://avatars.discourse-cdn.com/v4/letter/f/eada6e/32.png) [@Flawless](https://forums.fatsharkgames.com/u/Flawless)\
**Post date:** [July 4, 2023, 3:27pm UTC](https://forums.fatsharkgames.com/t/blaze-away-rounding-issue-causing-unexpected-behaviour-with-stacks/81591/3 "2023-07-04T15:27:24Z")

</div>

Blaze away should simply build stacks every (correctly rounded) 10% of the BASE mag capacity of a weapon.  
Even if the numbers were not rounded up every time, a bunch of weapons would still require a larger number of shots to stack up the blessing, when they have a higher ammo stat.  
(which makes the weapon with higher ammo stat weaker, when engaging in firefights that do not involve emptying the entire mag at once).

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/fatshark/original/3X/3/1/319a2f41b73f03a4d9360defbe43058888a33c8c.png) [@system](https://forums.fatsharkgames.com/u/system)\
**Post date:** [July 11, 2023, 3:28pm UTC](https://forums.fatsharkgames.com/t/blaze-away-rounding-issue-causing-unexpected-behaviour-with-stacks/81591/4 "2023-07-11T15:28:12Z")

</div>

Closed on July 11, 2023, 3:28pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
