Interesting basic system.
Since you are building a RPG style game, you can simplify combat by creating two tables when combat starts. The tables are arrays from 1 to 1000. Within those arrays, you fill them with integers such as this:
- Dodge
- Block
- Parry
- Critical Hit
- Hit
If you plan on having stats such as strength, stamina, agility, intelligence, wisdom, and spirit, and if you plan on having classes like priest, wizard, warrior, paladin, thief, ranger, etc… You can fill the table based on the stats between the two entities. There’s a lot of math involved in pulling this off. But to pick one, you do a roll from 1-1000 using the random class. After that, it’s all about probabilities.
- Strength: How hard you hit in melee and how good you block.
- Stamina: How much HP you have.
- Agility: How quickly you can move and dodge.
- Intelligence: How much mana/spell power you have.
- Wisdom: How hard you hit with spells.
- Spirit: How fast mana/spell power/health regenerates.
How this would interact with the different classes could be something like this:
- Warrior/Paladin: attack/parry: strength
- Thief/Ranger: attack/parry: agility
- Wizard/Priest: attack: wisdom, parry: 1/2 agility, 1/2 strength
Stats also have other side effects too. Stamina can determine how far you can travel on foot before you have to rest. Strength determines how much weight you can carry. All items have weight, but some items can modify those stats. Plate armor can increase strength and stamina. Leather armor can increase stamina and agility. Cloth armor can increase intelligence and wisdom. Anything can increase spirit. Some items modify all the stats. For example: In a very popular MMORPG, they have an item called “The One Ring” which is a ring that you wear. It increases all stats by 1. Then there’s “The Two Ring” which increases all stats by 2. It can be as easy or as complicated as you want.
But when calculating your attack table, you also have to consider the target stats too. The levels between the interacting entities comes into play as well. So if one entity is at a much higher level than the other, the lower level one may not even be able to hit the higher level entity which the higher level entity makes all critical hits.
There’s a REALLY good reddit post on this if you’re interested.
Implementing a system like this opens up a whole array of possibilities. You can have PvE and PvP situations with levels and stats playing critical roles in combat.
Have fun.