The simple answer is:
There are two formulas for attack damage for enemies. The standard range is
from:
(EnemyStrength - HeroDefense / 2) / 4,
to:
(EnemyStrength - HeroDefense / 2) / 2
Moderator: Moderators
There are two formulas for attack damage for enemies. The standard range is
from:
(EnemyStrength - HeroDefense / 2) / 4,
to:
(EnemyStrength - HeroDefense / 2) / 2
Unsigned char means that your attack & defense values are in range 0..255?DRW wrote:For example, this calculation:
damage = attack / (100 / (100 + defense));
where all variables are global zeropage variables of type unsigned char, requires 11 scanlines worth of CPU time.
Use of "he" to mean "he or she" is older usage that may have been more common in previous decades.nocash wrote:PS. Just wondering "giving him more initial energy" means that the opponents are all males?
I've recently found a similar gendered sentence in old source code that I had written a few decades ago : )
Probably in the higher range, i.e. not just 1-15.nocash wrote:Unsigned char means that your attack & defense values are in range 0..255?
Or is it only smaller range like 0..15?
It was a calculation that I found on the internet. I didn't actually use it myself. But yeah, for int values, that's indeed not a good approach.nocash wrote:Ehm, how or why do you calculate "100 / (100 + defense)"?
Seriously?nocash wrote:PS. Just wondering "giving him more initial energy" means that the opponents are all males?