In order to have realistic combat, properties beyond just simple atk/def values are needed. For example, if you have a high def helmet and armor, but no boots or legs and a rat attacks you, you should get the full impact of it's attack, since it will attack you where you are unprotected (not counting evasion).
Also, the equation/algorithm for comparing attack to defense should be simple and independant of how the two values were computed. This is a problem I came across when trying to apply damage from non-RPEntity's in a meaningful way, since the existing code made assumptions about the "opponent" having defense values, when the amount of defense an inanimate object has little/no direct impact on damage it does. So the effective attack/defense values should be normalized (either [0-1] or some other linear values) that are comparable. This would allow any code that computes attack or defense values to be independant of any other code that may use those values (beyond the definition of their relative meaning).
In the real world (at least a medieval one), one has choose where to place emphasis during battle.. do you use all your force to strike your enemy with your sword, leaving little to defend with, the other way around, or a mixture of both?
To account for this, each item (or action) should be assigned a certain amount of energy drain. At the begining of each cycle, the RPEntity is assigned a certain amount of energy to use (perhaps based on some combination of their strength, endurance, and health state). As each item is used, it's amount of energy is deducted (proportional to the percentage of "full effort" used). This would allow a player to attack and/or defend against multiple enemies in a single cycle (or use a weapon more than once, or even different weapons).
At the end of a cycle, any left over energy could be used for one or more of:
- Added to the next cycle's energy
- Healing (if self healing if enabled)
- Endurance recovery
In the cases where more energy was used than available, the stress effect would cause negative impacts. Perhaps the character could loose HP and/or have a severe drop in endurance.
By defining items (and REntity's) as sets of strengths and weaknesses, different combinations of items/opponents may have different outcomes. For example a lowly heavy club or mid-atk hammer may do more damage to creature with hard scales than a traditionally high atk sword would, because the impact does the damage instead of the slicing of the sharp blade. So a scaled creature would be vulnerable to impacts, but less to cutting.
A primitive list of properties might be:
- impact: 9
- impact: 13
- impact: 10
- slash: 0
- impact: 15
- slash: 20
In this example, a club at full force used against a wood shield would have most of it's impact absorbed. The remaining amount would be applied to the rpentity and it's properties. After that reduction, anything left would be translated to damage.