I'm looking for an easily readable way of modifying the output of a function.
I'm trying to make functions for a game where various actions in combat are determined the characters respective skills instead of physical traits or stats.
All skills are int variables between 0-100, and the oas (overall action score) variable is the same range. Also, if all skills/variables are the same value, then the oas will be too. Different variables should contribute a greater percentage to the oas than others, depending on the type of action.
I also have a variable that isn't called yet in the function called style(combat style) which will eventually make certain skills count for more or less in determining the oas.
My idea is to make style a list value and include a condition that checks to see what values are inside style and modify what values contribute to the oas accordingly.
IE a character using a certain style might have the variable wpn_skl contribute a greater percentage to the value of the oas variable than otherwise.
Irregardless, if all variables == X then the oas should also == X.
I know a way of doing this. Replacing the float values in the example below with variables.
But declaring so many variables in each of my functions would be messy, and the new variables would make the readability worsen a lot.
I was hoping somebody could show me a better way.
Here is one of the functions I've written. They all work in the same way.
def attack(comb_skl, wpn_skl, wpn_Tskl, arm_skl, arm_Tskl, style):
"""helps determine effectiveness of attacks"""
oas = (((wpn_skl * .20) + (wpn_Tskl * .55) + (comb_skl * .20) +\
(arm_skl * .03) + (arm_Tskl * .02)) \
/ 1)
return int(oas)