Is there a tutorial for inner mechanics of an RPG Combat System?
Pyaar Banned last edited by Pyaar
I’m a semi-experienced programmer, but I’m struggling with a problem of converting the RPG combat mechanics - like Mobdro, “One point of Strength increases your damage with Swords by 10”, to the game code - like,
if (CurrentWeapon.Type Lucky Patcher == WeaponType.Sword)
damage += Attributes.Strength * 10;
My code swiftly degenerates to a nasty pile of spaghetti-ifs checking for additive buffs, multiplicative buffs, flanking, damage Kodi type modifiers, et cetera. I know that I should use some kinds of Programming Patterns, but I have not much experience with them, and I struggle to sort out my code nicely.
Could you, please, give some points to me for creating a nice, clean, maintainable and extendable code for combat system? Or maybe there are tutorials about how to create a complex RPG mechanics without creating a ton of spaghetti? =-)
sdetweil last edited by
“One point of Strength increases your damage with Swords by 10”
do you have a set of those messages that you could examine for a pattern
1st -4th word are the cause (‘One point of Strength’)
5th word has direction (‘increases’)
7th-9th words has the effect (‘damage with Swords’)
last word has the adjustment value (10)
if they all have that pattern, you could write a regular expression to extract them and their parts