About to introduce knockback and stun into my combat system.
Since it's an rpg, the current system is a bit D&D like:
/* Determine if we have hit another character */
public function hit(character:Character):int{
attackCount = 0;
var attackRoll:Number = Math.random();
if(attackRoll >= CRITICAL_HIT)
return CRITICAL;
else if(attackRoll <= CRITICAL_MISS)
return MISS
else if(attack + attackRoll + (weapon ? weapon.attack : 0) > character.defense + (character.armour ? character.armour.defense : 0))
return HIT;
return MISS;
}
So a critical attack roll (like rolling a 20) will automatically hit doing double damage. A standard attack is a a roll combining their attack stat plus their weapon attack bonus.
This goes up against the defender's defence stat plus their armour defence bonus.
Knockback I could easily throw in as an addition to the damage - or should I?
Stun I'm a bit more confused on how to implement, because not only is there a chance to stun, but a stun duration. I'd like to boil stun down to a simple stat that I can have as a racial bonus or a weapon bonus. And then have armour or races that counteract that stun advantage.
Any thoughts?