Difference between revisions of "Talk:Flaming"

From CrawlWiki
Jump to: navigation, search
m (Rounding for %-based brands: re: damage brands)
m (rw an old point so that it's easier to read)
 
(9 intermediate revisions by 2 users not shown)
Line 4: Line 4:
  
 
:Start at apply_damage_brand() in attack.cc, and check for <code>case SPWPN_FLAMING:</code>. It has a call to calc_elemental_brand_damage() there, which does <code>special_damage = resist_adjust_damage(defender, flavour, random2(damage_done) / 2 + 1);</code>, which is flaming's +0-50% damage. Then there's a check for the target's resists in resist_adjust_damage(), and so on and so forth. [[User:Ge0ff|Ge0ff]] ([[User talk:Ge0ff|talk]]) 17:32, 27 November 2023 (CET)
 
:Start at apply_damage_brand() in attack.cc, and check for <code>case SPWPN_FLAMING:</code>. It has a call to calc_elemental_brand_damage() there, which does <code>special_damage = resist_adjust_damage(defender, flavour, random2(damage_done) / 2 + 1);</code>, which is flaming's +0-50% damage. Then there's a check for the target's resists in resist_adjust_damage(), and so on and so forth. [[User:Ge0ff|Ge0ff]] ([[User talk:Ge0ff|talk]]) 17:32, 27 November 2023 (CET)
 +
 +
:"it makes quickblade of flaming worse than an executioner's axe of freezing" This makes no '''practical''' sense, regardless of how the game calculates weapon damage. [[User:Ge0ff|Ge0ff]] ([[User talk:Ge0ff|talk]]) 17:36, 27 November 2023 (CET)
 +
 +
::Re: "it makes quickblade of flaming worse than an executioner's axe of freezing." That meant something along the lines of "do quickblades receive a less than an avg. 25% boost from the flaming brand?" a.k.a "is ''flaming'' on a quickblade a smaller % boost than ''flaming'' on an exe's axe?".
 +
 +
::For example, say flaming gave a multiplicative bonus of <code>1 + uniform(50)/100</code>, rounded down, just like how [[weapon damage]] works. If you got a 25/100, a quickblade could go from 7 dmg -> 8 (14% boost). An executioner's axe might go from 19 -> 23 (+21% boost). Therefore the axe gets a bigger boost. In practice, this matters when comparing brands, e.g. +9 flaming vs +5 elec quickblade.
 +
 +
::However, with the code provided, I don't think the rounding works as I stated above. Assuming no resistances:
 +
::*A QB of flaming that dealt 7 damage would have a range of {0,1,2,3,4,5,6} from the random2 function.
 +
::*C++ defaults to round down, and resist_adjust_damage() doesn't have any special rounding that I can see. So random2(7)/2 + 1 would be rounded down. This gives a range of {0,0,1,1,2,2,3} + 1.
 +
::*Average damage is (0+0+1+1+2+2+3)/7 + 1 = 1.286 + 1 = 2.286. Then, 2.286 (added damage) / 7 (base damage) = +32.65% damage on average.
 +
::Maybe this is worth mentioning? [[User:Hordes|Hordes]] ([[User talk:Hordes|talk]]) 18:45, 27 November 2023 (CET) [updated 1/11/24]
 +
 +
:::Re: "+32.65% damage on average." If you had a qb of flaming that ''always'' did 7 raw damage, then you'd get +32.65% damage on average from the fire brand. [[User:Ge0ff|Ge0ff]] ([[User talk:Ge0ff|talk]]) 23:04, 28 November 2023 (CET)
 +
 +
::::Sorry for being confusing. The calculated 32.65% is greater than the "average 25%" damage the page currently states. This applies to any low damage value, not just 7. I am trying to ask 1. did i miss anything, and 2. is this fact worth adding the pages.

Latest revision as of 13:32, 11 January 2024

Rounding for %-based brands

Simple question. How is the damage for flaming/freezing/etc. calculated? Because if it truncates, it makes quickblade of flaming worse than an executioner's axe of freezing. Hordes (talk) 07:19, 27 November 2023 (CET)

Start at apply_damage_brand() in attack.cc, and check for case SPWPN_FLAMING:. It has a call to calc_elemental_brand_damage() there, which does special_damage = resist_adjust_damage(defender, flavour, random2(damage_done) / 2 + 1);, which is flaming's +0-50% damage. Then there's a check for the target's resists in resist_adjust_damage(), and so on and so forth. Ge0ff (talk) 17:32, 27 November 2023 (CET)
"it makes quickblade of flaming worse than an executioner's axe of freezing" This makes no practical sense, regardless of how the game calculates weapon damage. Ge0ff (talk) 17:36, 27 November 2023 (CET)
Re: "it makes quickblade of flaming worse than an executioner's axe of freezing." That meant something along the lines of "do quickblades receive a less than an avg. 25% boost from the flaming brand?" a.k.a "is flaming on a quickblade a smaller % boost than flaming on an exe's axe?".
For example, say flaming gave a multiplicative bonus of 1 + uniform(50)/100, rounded down, just like how weapon damage works. If you got a 25/100, a quickblade could go from 7 dmg -> 8 (14% boost). An executioner's axe might go from 19 -> 23 (+21% boost). Therefore the axe gets a bigger boost. In practice, this matters when comparing brands, e.g. +9 flaming vs +5 elec quickblade.
However, with the code provided, I don't think the rounding works as I stated above. Assuming no resistances:
  • A QB of flaming that dealt 7 damage would have a range of {0,1,2,3,4,5,6} from the random2 function.
  • C++ defaults to round down, and resist_adjust_damage() doesn't have any special rounding that I can see. So random2(7)/2 + 1 would be rounded down. This gives a range of {0,0,1,1,2,2,3} + 1.
  • Average damage is (0+0+1+1+2+2+3)/7 + 1 = 1.286 + 1 = 2.286. Then, 2.286 (added damage) / 7 (base damage) = +32.65% damage on average.
Maybe this is worth mentioning? Hordes (talk) 18:45, 27 November 2023 (CET) [updated 1/11/24]
Re: "+32.65% damage on average." If you had a qb of flaming that always did 7 raw damage, then you'd get +32.65% damage on average from the fire brand. Ge0ff (talk) 23:04, 28 November 2023 (CET)
Sorry for being confusing. The calculated 32.65% is greater than the "average 25%" damage the page currently states. This applies to any low damage value, not just 7. I am trying to ask 1. did i miss anything, and 2. is this fact worth adding the pages.