Original Post
I am trying to figure out how to work combat styles into my game, and I'm having a rough time of it. Basically there are different skill lines, such as 1h, 2h, duel weild, etc. With each skill line comes different attack styles which have different bonuses, such as attack rate increase, a bleed effect, damage bonus, etc. The problem I am running into, is how do I maintain these different attack styles? I was thinking of creating a basic attack sequence and then just plug in different information from an array of attacks. attack(attacker, defender, style) make sure the attacker has the style make sure the attacker is using the correct weapon for the style check attacker skill vs defender skill if the attacker misses, return MISSED else check attacker skill vs defender block skill if the defender blocks, return BLOCKED else check attacker skill vs defender parry skill if the defender blocks, return PARRIED else return HIT So now I have a switch that decides on what animation to play, based on the result of the combat check. case MISSED play the attackers MISSED animation for the weapon he is using. case BLOCKED play the defenders block animation for the shield he is using. calculate if and how much skill the defender should gain in BLOCK. case PARRIED play the defenders parry animation for the weapon he is using. calculate if and how much skill the defender should gain in PARRY. case HIT play the attackers animation for the style he is using calculate how much damage should be done based on the attackers weapon, base skill, and the defenders armor. remove damage from the defender play the defenders got hit animation calculate if and how much skill the attacker should gain in the weapon type. So in this system, attacker and defender are objects which contain pointers to their weapons and skills, and attack styles. The attack styles are also objects which contain information such as what animation goes with it, what weapon is required to do the attack, what sort of bonuses you get for the attack, how much stamina to drain, etc. Is this the best way? Or what do you guys suggest? I could post actual code, but it is all done in javascript. I wasn't sure if that would be better, or if just explaining it would be.