I'm going to give you my own, it may not be the right one as its rather subjective to what your looking for.
Attack will be the amount of damage done per tick / turn or individual attack.
Dexterity will be considered the speed of the character in this instance.
Defense we will subtract from the enemies attack with some random variation.
So for example
npc1.attacktimer = 0
game_loop/action loop ()
{
npc1.attacktimer += frame_time;
if (npc1.attacktimer >= 10.00 / dexterity)
{
//attack
npc2.health-= npc1.strength - (npc2.defense / 2 + rand(6)) // randon number between 1 & 6
npc1.attacktimer = 0;
if npc2.health <= 0
{
npc1.exp + 5;
}
}
}
This is a very general example, pseudocode, I'd suggest however setting up a message handling interface or a interaction interface further down the line though thats semi off topic.
Where you check other conditions, example.
npc1 control loop(current targets)
{
//checks whether combat is valid, then applies damage calculation.
combathandler.attack(me, target)
}
attack - defensefor damage, and leave dexterity completely out of it. \$\endgroup\$hp -= attack. Improve it later on when you have a playable version \$\endgroup\$