Take this example, a player has a sword composed of the handle and a blade. Together, they generate a strength of X and that combination adds qualitative attributes (induce more damage to fire creatures). If the player encounter 2 enemies, both at same defence level, but one is made of fire. Then, I need to calculate the probability of hitting the enemies, knowing that it may be higher for the fire creature.
Given the example, I need to calculate the:
- Weapon's strength, by combining different parts?
- Probability of the outcome of an encounter?
- Inclusion of qualitative attributes in the calculation?
So far, I though of the following and I am not sure if it is good enough.
For the weapon, I would associate a value to each component. Then, I would determine that the handle represents 25% of the total strength; allowing me to calculate the total strength
The enemy will get a defence value.
For the encounter, I would generate a random number between 1 and the (player strength)+(enemy defence). If that number is higher than the enemy's defence, than it's a hit. This means that if they are equal, then it's 50% chance of success.
For the physical attributes, if the enemies has a weakness towards an elements, then I would deduct a certain value of he's defence before calculating the probability.
Is this a viable approach? If not, what would be a suitable implementation? or where can I find more ressources on these kinds of problems.