problem in stat_modify_dammage
Posted: Monday, 19th December 2016, 05:16
sorry for bad english
first, this is fight simulation in 0.18.1,
human, all skill = 27, unarmed attack, no armour, dex = 30, vs ogre
str 8 vs str 12
there is only little dammage difference, huh?
and that difference is just because I forgot about off hand punch.
in 0.18.1, there is no damage bonus between str8 and str12 (execept aux and ER)
[attack.cc file in dcss 0.18.1]
int attack::player_stat_modify_damage(int damage)
{
int dammod = 39;
if (you.strength() > 11)
dammod += (random2(you.strength() - 11) * 2);
else if (you.strength() < 9)
dammod -= (random2(9 - you.strength()) * 3);
damage *= dammod;
damage /= 39;
return damage;
}
as you know, random2(max) equals to 1d(max) -1
let's calculate, you will gain this result
~ str7, dammod = 42 - (1d( 9 - str )) *3
str8~12 , dammod =39
str13~, dammod = 37 + (1d( str - 11 )) *2
1. I can't understand why str 9/11 is not assigned
2. when your str is 8/12, dammod is still 39. because 1d(1) - 1 = 0
3. this code is sucks
this part was changed in 7 may
https://github.com/crawl/crawl/commit/6c060d3771dd4915b9da9e6cd1bb37106e1dba0d
Tightened the 0 bonus/penalty range for STR.
STR = 9,10,11 would not pass either if statement, providing no appreciable benefit to damage scaling for going from 9 to 11 strength. This was a classic inclusive/exclusive range if statement bug.
but there is still problem
[attack.cc in recent version]
int attack::player_stat_modify_damage(int damage)
{
int dammod = 39;
if (you.strength() > 10)
dammod += (random2(you.strength() - 10) * 2);
else if (you.strength() < 10)
dammod -= (random2(10 - you.strength()) * 3);
damage *= dammod;
damage /= 39;
return damage;
}
when calculated,
str = 14, dammod = 39 + (1d(3) - 1)*2 = 37 + (1d4)*2 avg 42
str = 13, dammod = 39 + (1d(3) - 1)*2 = 37 + (1d3)*2 avg 41
str = 12, dammod = 39 + (1d(2) - 1)*2 = 37 + (1d2)*2 avg 40
str = 11, dammod = 39 + (1d(1) - 1)*2 = 39
str = 10, dammod = 39
str = 9, dammod = 39 - (1d(1) - 1)*3 = 39
str = 8, dammod = 39 - (1d(2) - 1)*3 = 42 - (1d2)*3 avg 37.5
str = 7, dammod = 39 - (1d(2) - 1)*3 = 42 - (1d3)*3 avg 36
ok, now 8 and 12 is fine, but it seems he dosen't have accomplished purpose enough
the thing confusing me more is
[melee_attack.cc in 0.18.1]
int melee_attack::player_aux_stat_modify_damage(int damage)
{
int dammod = 20;
if (you.strength() > 10)
dammod += random2(you.strength() - 9);
else if (you.strength() < 10)
dammod -= random2(11 - you.strength());
damage *= dammod;
damage /= 20;
return damage;
}
this is stat modifier for auxiliary attack, and it totally works!
so, main dammage calculation is broken while additional dammage calculation is correct.
???????????????????
first, this is fight simulation in 0.18.1,
human, all skill = 27, unarmed attack, no armour, dex = 30, vs ogre
str 8 vs str 12
there is only little dammage difference, huh?
and that difference is just because I forgot about off hand punch.
in 0.18.1, there is no damage bonus between str8 and str12 (execept aux and ER)
[attack.cc file in dcss 0.18.1]
int attack::player_stat_modify_damage(int damage)
{
int dammod = 39;
if (you.strength() > 11)
dammod += (random2(you.strength() - 11) * 2);
else if (you.strength() < 9)
dammod -= (random2(9 - you.strength()) * 3);
damage *= dammod;
damage /= 39;
return damage;
}
as you know, random2(max) equals to 1d(max) -1
let's calculate, you will gain this result
~ str7, dammod = 42 - (1d( 9 - str )) *3
str8~12 , dammod =39
str13~, dammod = 37 + (1d( str - 11 )) *2
1. I can't understand why str 9/11 is not assigned
2. when your str is 8/12, dammod is still 39. because 1d(1) - 1 = 0
3. this code is sucks
this part was changed in 7 may
https://github.com/crawl/crawl/commit/6c060d3771dd4915b9da9e6cd1bb37106e1dba0d
Tightened the 0 bonus/penalty range for STR.
STR = 9,10,11 would not pass either if statement, providing no appreciable benefit to damage scaling for going from 9 to 11 strength. This was a classic inclusive/exclusive range if statement bug.
but there is still problem
[attack.cc in recent version]
int attack::player_stat_modify_damage(int damage)
{
int dammod = 39;
if (you.strength() > 10)
dammod += (random2(you.strength() - 10) * 2);
else if (you.strength() < 10)
dammod -= (random2(10 - you.strength()) * 3);
damage *= dammod;
damage /= 39;
return damage;
}
when calculated,
str = 14, dammod = 39 + (1d(3) - 1)*2 = 37 + (1d4)*2 avg 42
str = 13, dammod = 39 + (1d(3) - 1)*2 = 37 + (1d3)*2 avg 41
str = 12, dammod = 39 + (1d(2) - 1)*2 = 37 + (1d2)*2 avg 40
str = 11, dammod = 39 + (1d(1) - 1)*2 = 39
str = 10, dammod = 39
str = 9, dammod = 39 - (1d(1) - 1)*3 = 39
str = 8, dammod = 39 - (1d(2) - 1)*3 = 42 - (1d2)*3 avg 37.5
str = 7, dammod = 39 - (1d(2) - 1)*3 = 42 - (1d3)*3 avg 36
ok, now 8 and 12 is fine, but it seems he dosen't have accomplished purpose enough
the thing confusing me more is
[melee_attack.cc in 0.18.1]
int melee_attack::player_aux_stat_modify_damage(int damage)
{
int dammod = 20;
if (you.strength() > 10)
dammod += random2(you.strength() - 9);
else if (you.strength() < 10)
dammod -= random2(11 - you.strength());
damage *= dammod;
damage /= 20;
return damage;
}
this is stat modifier for auxiliary attack, and it totally works!
so, main dammage calculation is broken while additional dammage calculation is correct.
???????????????????