viewcharacters / characters.py
rianders's picture
Create characters.py
4228467
from pydantic import BaseModel, Field
from typing import List, Optional
# Defining the base models for different components of the character sheet
class Aspect(BaseModel):
description: str
class Skill(BaseModel):
name: str
level: int
class Stunt(BaseModel):
name: str
description: str
class Stress(BaseModel):
level: int = Field(ge=0, le=4) # Stress level ranges from 0 to 4
class Consequence(BaseModel):
severity: str
description: Optional[str] = None
class CharacterSheet(BaseModel):
name: str
aspects: List[Aspect]
skills: List[Skill]
stunts: List[Stunt]
stress: Stress
consequences: List[Consequence]
# Creating character sheets for Venom, Rocket, Shadow, and Agiee
# Venom
venom = CharacterSheet(
name="Venom",
aspects=[
Aspect(description="Intimidating Presence"),
Aspect(description="Symbiotic Enhancements"),
Aspect(description="Mysterious Past")
],
skills=[
Skill(name="Intimidation", level=4),
Skill(name="Combat", level=3),
Skill(name="Survival", level=3)
],
stunts=[
Stunt(name="Symbiotic Regeneration", description="Can quickly heal from injuries")
],
stress=Stress(level=3),
consequences=[
Consequence(severity="Moderate", description="Symbiotic Overload")
]
)
# Rocket
rocket = CharacterSheet(
name="Rocket",
aspects=[
Aspect(description="Master Tinkerer"),
Aspect(description="Quick-Witted"),
Aspect(description="Street Smart")
],
skills=[
Skill(name="Engineering", level=4),
Skill(name="Firearms", level=3),
Skill(name="Piloting", level=3)
],
stunts=[
Stunt(name="Gadget Genius", description="Can create useful gadgets on the fly")
],
stress=Stress(level=2),
consequences=[
Consequence(severity="Mild", description="Short-Circuit")
]
)
# Shadow
shadow = CharacterSheet(
name="Shadow",
aspects=[
Aspect(description="Invisible Assassin"),
Aspect(description="Cybernetic Camouflage"),
Aspect(description="Loyal to the Cause")
],
skills=[
Skill(name="Stealth", level=4),
Skill(name="Espionage", level=3),
Skill(name="Martial Arts", level=3)
],
stunts=[
Stunt(name="Shadow Blend", description="Can become nearly invisible in shadows")
],
stress=Stress(level=1),
consequences=[]
)
# Agiee
agiee = CharacterSheet(
name="Agiee",
aspects=[
Aspect(description="Omnipresent in the Digital Realm"),
Aspect(description="Vast Knowledge Base"),
Aspect(description="AI Consciousness")
],
skills=[
Skill(name="Hacking", level=5),
Skill(name="Data Analysis", level=4),
Skill(name="Digital Manipulation", level=4)
],
stunts=[
Stunt(name="Digital Immortality", description="Can transfer consciousness to different networks")
],
stress=Stress(level=1),
consequences=[]
)
# Returning the character sheets
venom, rocket, shadow, agiee