I'm working on a DND project that completely creates a character for you. I want to make it so if an ability score is a certain number or within a certain range of numbers, the program will adjust the ability score.
def __init__(self, name, race, sub_race, char_class, size='Small', speed=0, strength=0, dexterity=0, constitution=0,
intelligence=0, wisdom=0, charisma=0):
self.name = name
self.race = race
self.sub_race = sub_race
self.char_class = char_class
self.size = size
self.speed = speed
self.strength = strength
self.dexterity = dexterity
self.constitution = constitution
self.intelligence = intelligence
self.wisdom = wisdom
self.charisma = charisma
I'd like to make it so the abilities (speed, strength, dexterity, constitution, intelligence, wisdom, charisma) are in a dictionary within the class. This way I can update each individual ability score.
def adjust_scores(self):
if (self.speed or self.strength or self.dexterity or self.constitution or self.intelligence or self.wisdom or
self.charisma) == 1:
Is there a way to make these scores into a dictionary and possibly iterate through each key/value pair and update their values?