adding sand strider npc generator
This commit is contained in:
parent
91fa27b86e
commit
2252a98798
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
{% set target = article.title.replace(' ', '_') %}
|
{% set target = article.title.replace(' ', '_') %}
|
||||||
{% if self.is_dm() or article.show_dm_content %}
|
{% if self.is_dm() or article.show_dm_content %}
|
||||||
<div class='location'>
|
<div class='location statblock'>
|
||||||
<div style='cursor: pointer;'
|
<div style='cursor: pointer;'
|
||||||
onclick="document.getElementById('{{target}}').style.display=((document.getElementById('{{ target }}').style.display=='none')?'':'none');" ><h3>{{ article.title }}</h3></div>
|
onclick="document.getElementById('{{target}}').style.display=((document.getElementById('{{ target }}').style.display=='none')?'':'none');" ><h3>{{ article.title }}</h3></div>
|
||||||
<div id="{{ target }}" style='display:none;'>
|
<div id="{{ target }}" style='display:none;'>
|
||||||
|
|
|
@ -9,6 +9,7 @@ from rolltable.tables import RollTable
|
||||||
from site_tools.shell.base import BasePrompt, command
|
from site_tools.shell.base import BasePrompt, command
|
||||||
from site_tools import campaign
|
from site_tools import campaign
|
||||||
from site_tools import jobs
|
from site_tools import jobs
|
||||||
|
from site_tools import striders
|
||||||
|
|
||||||
from reckoning.calendar import TelisaranCalendar
|
from reckoning.calendar import TelisaranCalendar
|
||||||
from reckoning.telisaran import Day
|
from reckoning.telisaran import Day
|
||||||
|
@ -19,6 +20,7 @@ import npc
|
||||||
BINDINGS = KeyBindings()
|
BINDINGS = KeyBindings()
|
||||||
|
|
||||||
ANCESTRY_PACK, ANCESTRIES = npc.load_ancestry_pack()
|
ANCESTRY_PACK, ANCESTRIES = npc.load_ancestry_pack()
|
||||||
|
ANCESTRIES['strider'] = striders
|
||||||
|
|
||||||
|
|
||||||
class DMShell(BasePrompt):
|
class DMShell(BasePrompt):
|
||||||
|
@ -211,16 +213,14 @@ class DMShell(BasePrompt):
|
||||||
"""
|
"""
|
||||||
Generate an NPC commoner
|
Generate an NPC commoner
|
||||||
"""
|
"""
|
||||||
char = npc.random_npc([parts[0]] if parts else [])
|
char = npc.random_npc([ANCESTRIES[parts[0]]] if parts else [])
|
||||||
self.console.print(char.ancestry.capitalize())
|
self.console.print(char.description + "\n")
|
||||||
self.console.print("\n".join([
|
if char.personality:
|
||||||
"",
|
self.console.print(f"Personality: {char.personality}\n")
|
||||||
f"{char.description}",
|
if char.flaw:
|
||||||
f"Personality: {char.personality}",
|
self.console.print(f"Flaw: {char.flaw}\n")
|
||||||
f"Flaw: {char.flaw}",
|
if char.goal:
|
||||||
f"Goal: {char.goal}",
|
self.console.print(f"Goal: {char.goal}\n")
|
||||||
"",
|
|
||||||
]))
|
|
||||||
|
|
||||||
@command(usage="""
|
@command(usage="""
|
||||||
[title]QUIT[/title]
|
[title]QUIT[/title]
|
||||||
|
|
85
deadsands/site_tools/striders.py
Normal file
85
deadsands/site_tools/striders.py
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
import random
|
||||||
|
import textwrap
|
||||||
|
|
||||||
|
from functools import cached_property
|
||||||
|
|
||||||
|
import npc
|
||||||
|
|
||||||
|
from language import types
|
||||||
|
from language.languages import lizardfolk
|
||||||
|
|
||||||
|
|
||||||
|
subspecies = [
|
||||||
|
('black', 'acid'),
|
||||||
|
('red', 'fire'),
|
||||||
|
('blue', 'lightning'),
|
||||||
|
('green', 'poison'),
|
||||||
|
('white', 'frost')
|
||||||
|
]
|
||||||
|
|
||||||
|
ages = types.WeightedSet(
|
||||||
|
('wyrmling', 0.2),
|
||||||
|
('young', 1.0),
|
||||||
|
('adult', 1.0),
|
||||||
|
('ancient', 0.5)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class SandStriderNameGenerator(types.NameGenerator):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__(
|
||||||
|
language=lizardfolk.Language,
|
||||||
|
templates=types.NameSet(
|
||||||
|
(types.NameTemplate("name,name"), 1.0),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class NPC(npc.types.NPC):
|
||||||
|
|
||||||
|
language = lizardfolk
|
||||||
|
|
||||||
|
has_tail = True
|
||||||
|
has_horns = True
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__(self)
|
||||||
|
self._personality = ''
|
||||||
|
self._flaw = ''
|
||||||
|
self._goal = ''
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def name(self) -> str:
|
||||||
|
return str(SandStriderNameGenerator())
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def fullname(self) -> str:
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def age(self) -> str:
|
||||||
|
return ages.random()
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def subspecies(self) -> tuple:
|
||||||
|
return random.choice(subspecies)
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def color(self) -> str:
|
||||||
|
return self.subspecies[0]
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def spit(self) -> str:
|
||||||
|
return self.subspecies[1]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def description(self) -> str:
|
||||||
|
return (
|
||||||
|
f"{self.name} is {npc.types.a_or_an(self.age)} {self.age} {self.color} sand strider "
|
||||||
|
f"with {self.horns} horns, {npc.types.a_or_an(self.nose)} {self.nose} snout, "
|
||||||
|
f"{self.body} body, and {self.tail} tail. {self.name} spits {self.spit}."
|
||||||
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def character_sheet(self) -> str:
|
||||||
|
return '\n'.join(textwrap.wrap(self.description, width=120))
|
Loading…
Reference in New Issue
Block a user