Topic: Possible bug in src/logic/battle.cc
Warnuf Topic Opener |
Posted at:
2011-03-03, 10:54 UTC+1.0
I tried to write a simulator for fighting (according to http://wl.widelands.org/wiki/SoldierLevels/ ) and wondered what happens, when the defence level is higher than the attack value, as nothing is mentioned there. So I tried with a fully trained atlantean (defence 22) to fight a untrained barbarian (attack 12-16). The formula of SoldirLevels states that in this case every hit from the barbarian should heal the atlantean by 6-10 HP. Instead it does damage. While this is a good thing I wanted to know the true formula, so I took a look in src/logic/battle.cc In line 322 there is
It seems to me that defense is smaller by the factor 100 than stated by the wikipage. ![]() ![]() |
ixprefect |
Posted at:
2011-03-03, 20:53 UTC+1.0
The effect of that formula is that defense is interpreted as a percentage that is removed from the attack value. This reminds me of the infinite fight bug: This code should probably lower-bound the damage by 1. ![]() ![]() |
Warnuf Topic Opener |
Posted at:
2011-03-04, 15:49 UTC+1.0
Oh, thanks. I must have overread the 'attack *' part. But shouldn't defence be written with % in the documentation then? The example calculation in the documentation is also wrong. ![]() ![]() |
ixprefect |
Posted at:
2011-03-05, 14:07 UTC+1.0
You're right. Do you feel like changing the Wiki page to fix the incorrect documentation? ![]() ![]() |
Warnuf Topic Opener |
Posted at:
2011-03-05, 14:59 UTC+1.0
Yes, I'll change the article but not the image. The image looks like it was generated automatic and I don't know how. ![]() ![]() |
ixprefect |
Posted at:
2011-03-05, 15:44 UTC+1.0
Thank you! ![]() ![]() |