matteoferla / DnD-battler

A 5e D&D encounter simulator written for my own amusement to test some hypotheses.
MIT License
80 stars 31 forks source link

AttributeError: 'str' object has no attribute 'alignment' #15

Closed RichardScottOZ closed 2 years ago

RichardScottOZ commented 2 years ago

image

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_38768/420916305.py in <module>
----> 1 arena = Encounter(level2, 'badger')

j:\clone\dnd-battler\DnD_battler\encounter\_base.py in __init__(self, *lineup)
     20         self.combattants.extend(lineup)
     21         for chap in lineup:
---> 22             self.append(chap)
     23 
     24     def blank(self, hard=True):

j:\clone\dnd-battler\DnD_battler\encounter\_base.py in append(self, newbie)
     45         self.combattants.append(newbie)
     46         newbie.arena = self
---> 47         self.blank()
     48 
     49     def extend(self, iterable):

j:\clone\dnd-battler\DnD_battler\encounter\_base.py in blank(self, hard)
     24     def blank(self, hard=True):
     25         # this resets the teams
---> 26         self.sides = set([dude.alignment for dude in self])
     27         self.tally['battles'] = 0
     28         self.tally['rounds'] = 0

j:\clone\dnd-battler\DnD_battler\encounter\_base.py in <listcomp>(.0)
     24     def blank(self, hard=True):
     25         # this resets the teams
---> 26         self.sides = set([dude.alignment for dude in self])
     27         self.tally['battles'] = 0
     28         self.tally['rounds'] = 0

AttributeError: 'str' object has no attribute 'alignment'
RichardScottOZ commented 2 years ago

This is I am guessing not converting to a class instance problem?

RichardScottOZ commented 2 years ago

Believe this is good.