Пример #1
0
class Spell(ResourceMixin, db.Model):

    id = db.Column(db.Integer, primary_key=True)
    unique_name = db.Column(db.String(256),
                            nullable=False,
                            unique=True,
                            index=True)
    name = db.Column(db.String(256), nullable=False, index=True)
    ritual = db.Column(db.Boolean, nullable=False, index=True)
    level = db.Column(db.Integer, nullable=False, index=True)
    school_id = db.Column(db.Integer,
                          db.ForeignKey('school_of_magic.id'),
                          nullable=False,
                          index=True)
    school = db.relationship('SchoolOfMagic', back_populates='spells')

    casting_time = db.Column(db.Integer, nullable=False, index=True)
    range = db.Column(db.String(64), nullable=False, index=True)
    components = db.relationship('SpellComponent', back_populates='spell')
    material_components = db.Column(db.String(1024), nullable=True)
    description = db.Column(db.String(), nullable=True)
    higher_levels = db.Column(db.String())
    classes = db.relationship('CreatureClass',
                              secondary=creature_class_spell_map,
                              backref=db.backref('spells', lazy='dynamic'))
    damage_types = db.relationship('DamageType',
                                   secondary=damage_type_spell_map,
                                   backref=db.backref('spells',
                                                      lazy='dynamic'))
Пример #2
0
class Weapon(ResourceMixin, db.Model):
    id = db.Column(db.Integer, db.ForeignKey('item.id'), primary_key=True)
    item = db.relationship('Item')
    category = db.Column(db.Enum(WeaponCategory, native_enum=False),
                         nullable=False)
    classification = db.Column(db.Enum(WeaponClass, native_enum=False))
    properties = db.relationship('WeaponProperty',
                                 secondary=weapon_weapon_property_map)
Пример #3
0
class SpeedScore(ResourceMixin, db.Model):
    __table_args__ = (db.UniqueConstraint('speed_type_id', 'stat_block_id'), )
    id = db.Column(db.Integer, primary_key=True)
    speed_type_id = db.Column(db.Integer,
                              db.ForeignKey('speed_type.id'),
                              nullable=False)
    speed_type = db.relationship('SpeedType')
    stat_block_id = db.Column(db.Integer,
                              db.ForeignKey('stat_block.id'),
                              nullable=False)
    stat_block = db.relationship('StatBlock', back_populates='speed_scores')
    base_value = db.Column(db.Integer, default=0, nullable=False, index=True)
Пример #4
0
class AbilityScore(ResourceMixin, db.Model):
    __table_args__ = (db.UniqueConstraint('ability_id', 'stat_block_id'), )
    id = db.Column(db.Integer, primary_key=True)
    ability_id = db.Column(db.Integer,
                           db.ForeignKey('ability.id'),
                           nullable=False)
    ability = db.relationship('Ability')
    stat_block_id = db.Column(db.Integer,
                              db.ForeignKey('stat_block.id'),
                              nullable=False)
    stat_block = db.relationship('StatBlock', back_populates='ability_scores')
    base_value = db.Column(db.Integer, default=10)
Пример #5
0
class StatBlockClass(ResourceMixin, db.Model):
    __table_args__ = (db.UniqueConstraint('stat_block_id',
                                          'creature_class_id'), )

    id = db.Column(db.Integer, primary_key=True)
    stat_block_id = db.Column(db.Integer, db.ForeignKey('stat_block.id'))
    creature_class_id = db.Column(db.Integer,
                                  db.ForeignKey('creature_class.id'))
    level = db.Column(db.Integer, nullable=False, index=True)
    hit_die = db.Column(db.Enum(DieType))
    creature_class = db.relationship('CreatureClass')
    stat_block = db.relationship('StatBlock', back_populates='classes')
    current_hit_dice = db.Column(db.Integer, nullable=False, default=0)
Пример #6
0
class CoinType(ResourceMixin, db.Model):
    id = db.Column(db.Integer, db.ForeignKey('item.id'), primary_key=True)
    item = db.relationship('Item')
    abbreviation = db.Column(db.String(8),
                             nullable=False,
                             unique=True,
                             index=True)
Пример #7
0
class SavingThrowProficiency(ResourceMixin, db.Model):
    id = db.Column(db.Integer, primary_key=True)
    ability_score_id = db.Column(db.Integer,
                                 db.ForeignKey('ability_score.id'),
                                 unique=True)
    ability_score = db.relationship('AbilityScore')
    proficiency_multiplier = db.Column(db.Integer, default=0, nullable=False)
Пример #8
0
class Armor(ResourceMixin, db.Model):
    id = db.Column(db.Integer, db.ForeignKey('item.id'), primary_key=True)
    item = db.relationship('Item')
    category = db.Column(db.Enum(ArmorCategories, native_enum=False),
                         nullable=False)
    base_armor_class = db.Column(db.Integer, nullable=False, index=True)
    strength_requirement = db.Column(db.Integer,
                                     nullable=False,
                                     index=True,
                                     default=0)
    stealth_effect = db.Column(db.String, index=True)
Пример #9
0
class Attack(ResourceMixin, db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(64), nullable=False, unique=True, index=True)
    display_name = db.Column(db.String(64), nullable=False)
    required_number_of_hands = db.Column(db.Integer, nullable=False)
    ability_id = db.Column(db.Integer, db.ForeignKey('ability.id'))
    ability = db.relationship('Ability')
    melee_range = db.Column(db.Integer)
    short_range = db.Column(db.Integer)
    long_range = db.Column(db.Integer)
    uses_proficiency = db.Column(db.Boolean(), default=True)
Пример #10
0
class StatBlock(ResourceMixin, db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(256), nullable=False, index=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=True)
    user = db.relationship(account.User)
    classes = db.relationship('StatBlockClass')
    background_id = db.Column(db.Integer,
                              db.ForeignKey('background.id'),
                              nullable=True,
                              index=True)
    background = db.relationship('Background')
    race_id = db.Column(db.Integer,
                        db.ForeignKey('race.id'),
                        nullable=False,
                        index=True)
    race = db.relationship('Race')
    alignment = db.Column(db.Enum(Alignment, native_enum=False), index=True)
    experience_points = db.Column(db.Integer, index=True, default=0)

    proficiency_bonus = db.Column(db.Integer)

    ability_scores = db.relationship('AbilityScore',
                                     back_populates='stat_block')

    base_hit_point_max = db.Column(db.Integer)
    current_hit_points = db.Column(db.Integer)
    temporary_hit_points = db.Column(db.Integer)

    speed_scores = db.relationship('SpeedScore', back_populates='stat_block')

    personality_traits = db.Column(db.String)
    ideals = db.Column(db.String)
    bonds = db.Column(db.String)
    flaws = db.Column(db.String)
Пример #11
0
class SpellComponent(db.Model):
    __table_args__ = (db.UniqueConstraint('type', 'spell_id'), )

    id = db.Column(db.Integer, primary_key=True)
    type_ = db.Column('type',
                      db.Enum('V', 'S', 'M', native_enum=False),
                      nullable=False,
                      index=True)
    spell_id = db.Column(db.Integer,
                         db.ForeignKey('spell.id'),
                         nullable=False,
                         index=True)
    spell = db.relationship('Spell', back_populates='components')
Пример #12
0
class Shield(ResourceMixin, db.Model):
    id = db.Column(db.Integer, db.ForeignKey('item.id'), primary_key=True)
    item = db.relationship('Item')
Пример #13
0
class SchoolOfMagic(ResourceMixin, db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(64), nullable=False, unique=True, index=True)
    spells = db.relationship('Spell', back_populates='school')
Пример #14
0
class SkillProficiency(ResourceMixin, db.Model):
    id = db.Column(db.Integer, primary_key=True)
    skill_id = db.Column(db.Integer, db.ForeignKey('skill.id'))
    skill = db.relationship('Skill')
    stat_block_id = db.Column(db.Integer, db.ForeignKey('stat_block.id'))
    proficiency_multiplier = db.Column(db.Integer, default=0, nullable=False)
Пример #15
0
class Race(ResourceMixin, db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(64), unique=True, nullable=False, index=True)
    description = db.Column(db.String)
    creature_type_id = db.Column(db.Integer, db.ForeignKey('creature_type.id'))
    creature_type = db.relationship('CreatureType')