problem in stat_modify_dammage


If you are interested in helping with tiles, vaults, patches or documentation, this is the place for that.

Dungeon Dilettante

Posts: 2

Joined: Monday, 19th December 2016, 05:06

Post Monday, 19th December 2016, 05:16

problem in stat_modify_dammage

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

힘8-12.png
str8-12
힘8-12.png (57.19 KiB) Viewed 517 times



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.

???????????????????

For this message the author Roleplayer has received thanks: 2
Brannock, neil
User avatar

Dungeon Master

Posts: 202

Joined: Thursday, 5th December 2013, 05:01

Post Monday, 19th December 2016, 18:11

Re: problem in stat_modify_dammage

Fixed, thank you for finding this. :)

Dungeon Dilettante

Posts: 2

Joined: Monday, 19th December 2016, 05:06

Post Monday, 19th December 2016, 21:22

Re: problem in stat_modify_dammage

How amazing
neglect horrible error for more than 1 year, (which is easily found by anyone trying to read the code)
tried to fix but failed,
and now, can't write just 2 number correctly


two questions,

1. Did you considered that this will be little buff for strength which is most powerful stat already?

heightening dammod from 39 to 42~46 will adjust this,
but I think buffing dex would be better


2. Do you have plan for fixing bugs and improving codes?

it is obvious that this is not the only error in dcss.
developers may have more time to do this if they stop meaningless things like killing 2 species and reviving ogre mage

Ziggurat Zagger

Posts: 3579

Joined: Friday, 8th May 2015, 17:51

Post Monday, 19th December 2016, 21:32

Re: problem in stat_modify_dammage

Yes, you should stop sending them checks probably... Maybe even fire them. What a horrible bug, Str 10 was equivalent of Str 11 for damage purposes, that's completely broken...
Underestimated: cleaving, Deep Elf, Formicid, Vehumet, EV
Overestimated: AC, GDS
Twin account of Sandman25

For this message the author VeryAngryFelid has received thanks: 2
Sprucery, ThreeInvisibleDucks

Blades Runner

Posts: 536

Joined: Friday, 1st April 2016, 18:15

Post Wednesday, 21st December 2016, 08:40

Re: problem in stat_modify_dammage

Bughunting, bugfixing, nitty-gritty individual additions, and long-term planning and discussion - all of these are important tasks for a developer.

*nods wisely*
twelwe wrote:It's like Blink, but you end up drowning.
User avatar

Barkeep

Posts: 1785

Joined: Saturday, 29th June 2013, 16:52

Post Wednesday, 21st December 2016, 15:02

Re: problem in stat_modify_dammage

Thank you, Roleplayer, but in the future, please use Mantis for bug reports, and if you're interested in influencing the development of Crawl, please try to be polite. Thread locked.

Return to Contributions

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.