Attack Computations

Many variables are considered when computing the damage done when attacking a monster.  And most are included in a non-linear fashion.  It seems quite impossible to summarize the results in a formula or in words.  So I have drawn a couple of flowcharts of the code.  The names of the variables in these flowcharts are commonly the names of the registers used to hold the variables in the Atari code.  Anyone who studies these diagrams and can suggest better names will find that I am eager to redraw the diagrams with the new names.  Moreover, I would very much like to include some description in words.  So if you can help me out, let me know.

One function, named 'DetermineThrowingDistance' is used in several places (and for different purposes, it seems) to determine the effectiveness of a weapon.  It should probably be renamed but I don't know yet what its name should be.  It takes into account the skill required to use the weapon or object and the condition of the Hero's hand that is manipulating the object and the weight of the object, etc.  There are 20 skills altogether, with the player seeing only the basic 'Strength', 'Dexterity', etc.

The function 'DeterminePhysicalAttackDamage' is called to determine the number of Hitpoints to subtract from a monster.  Notice that 'Non-Material' beings and the 'Vorpal Blade' and the 'Dispell' attack are treated as special cases in the code.  Also, the 'Diamond Edge' and the 'Executioner' are special cases.  Notice also that there are several places where the damage done is set to zero and in each of these cases the player's Stamina is changed by 2 or 3.  When the damage is non-zero stamina is changed by 4 to 7.

The function 'IsCharacterLucky' is called to determine if luck should play a part in the character's attack or defense.  Notice that it sometimes changes the characters current luck attribute to make the outcome more likely to be the opposite the next time it is called.  A bit strange, IMHO