Advanced event types

This commit is contained in:
2019-10-17 20:35:18 +02:00
parent d6d0d0fcbb
commit ad3b216a0d
9 changed files with 151 additions and 38 deletions

View File

@@ -94,6 +94,10 @@ class Enemy(Base):
events: Iterable["Event"] = relationship('Event', back_populates="enemy")
@property
def is_defeated(self):
return any([e for e in self.events if e.type == EventType.Victory])
def populate_from_form(self, form: "forms.EnemyForm"):
self.name = str(form.name.data)
self.boss = bool(form.is_boss.data)