Adding alt_attack to bestiary csv file doesn't work...
Closed this issue · 1 comments
Don't know if I'll get a response, but it's worth a try...
I've got alt_attack (i.e. netting, grappling, constricting, etc) working with DnD.py, somewhat. So I added another column called 'alt_attack' to the beastiary.csv file but I can't get it to extract the data from the file. Here's my code:
if 'alt_attack' in self.settings and type(self.settings['alt_attack']) is list:
self.alt_attacks = []
for monoattack in self.settings['alt_attack']:
att = {'name': monoattack[0]}
att['attack'] = Dice(monoattack[1], 20)
att['damage_bonus'] = monoattack[2]
att['save'] = monoattack[3]
att['damage'] = Dice(bonus=monoattack[2], dice=monoattack[4:], avg=False, twinned=None, role='damage')
self.alt_attacks.append(att)
Other than that, the project is great!
Sorry I was away for two weeks.
Does your code work if initialised via a dictionary (DnD.Creature(**some_dict_of_settings)
) and not from the beastiary file?
In the case of self.settings['attack_parameters'])
there is a real mess and it tries to figure if it's a dictionary (generally user inputted from dictionary) or string (from beastiary).
Is your column field written as a JSON string? If so you'd need to parse it.
Cf. the line: type(self.settings['attack_parameters']) is str
I notice that my code as alt_attack as a dictionary, while yours as a list, I am understanding that you are considering the case for multiple alternative attack, right? And you have altered the behaviour (act()
) to use it as a list of dictionaries and to make sure there is right time for it, right?