updating for new npc generator

This commit is contained in:
evilchili 2023-12-04 22:00:37 -08:00
parent 6d62f46510
commit cdbd92397b
2 changed files with 15 additions and 25 deletions

View File

@ -3,8 +3,7 @@ import collections
from pathlib import Path from pathlib import Path
from rolltable.tables import RollTable from rolltable.tables import RollTable
from npc.generator.base import generate_npc from npc import random_npc
Crime = collections.namedtuple('Crime', ['name', 'min_bounty', 'max_bounty']) Crime = collections.namedtuple('Crime', ['name', 'min_bounty', 'max_bounty'])
@ -39,7 +38,7 @@ class BaseJob:
self._name = name self._name = name
self._details = details self._details = details
self._reward = reward self._reward = reward
self._contact = contact or generate_npc() self._contact = contact or random_npc()
self._location = location self._location = location
@property @property
@ -129,7 +128,7 @@ class Bounty(BaseJob):
@property @property
def target(self): def target(self):
if not self._target: if not self._target:
self._target = generate_npc() self._target = random_npc()
return self._target return self._target
@ -144,7 +143,7 @@ class Determinant(BaseJob):
class Escort(BaseJob): class Escort(BaseJob):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super().__init__(**kwargs) super().__init__(**kwargs)
self._contact = generate_npc() self._contact = random_npc()
self._location = generate_location('settlements') self._location = generate_location('settlements')
self._destination = generate_location('default') self._destination = generate_location('default')
self._reward = f"{nearest(random.randint(5, 20), step=5)} GP/day" self._reward = f"{nearest(random.randint(5, 20), step=5)} GP/day"

View File

@ -10,13 +10,16 @@ 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 npc.generator.base import generate_npc
from reckoning.calendar import TelisaranCalendar from reckoning.calendar import TelisaranCalendar
from reckoning.telisaran import Day from reckoning.telisaran import Day
from reckoning.telisaran import ReckoningError from reckoning.telisaran import ReckoningError
import npc
BINDINGS = KeyBindings() BINDINGS = KeyBindings()
ANCESTRY_PACK, ANCESTRIES = npc.load_ancestry_pack()
class DMShell(BasePrompt): class DMShell(BasePrompt):
def __init__(self, cache={}): def __init__(self, cache={}):
@ -203,31 +206,19 @@ class DMShell(BasePrompt):
[title]CLI[/title] [title]CLI[/title]
[link]npc --ancestry ANCESTRY[/link] [link]npc --ancestry ANCESTRY[/link]
""", completer=WordCompleter( """, completer=WordCompleter(list(ANCESTRIES.keys())))
[
'human',
'dragon',
'drow',
'dwarf',
'elf',
'highelf',
'halfling',
'halforc',
'tiefling',
'hightiefling',
]
))
def npc(self, parts=[]): def npc(self, parts=[]):
""" """
Generate an NPC commoner Generate an NPC commoner
""" """
c = generate_npc(ancestry=parts[0] if parts else None) char = npc.random_npc([parts[0]] if parts else [])
self.console.print(char.ancestry.capitalize())
self.console.print("\n".join([ self.console.print("\n".join([
"", "",
f"{c.description}", f"{char.description}",
f"Personality: {c.personality}", f"Personality: {char.personality}",
f"Flaw: {c.flaw}", f"Flaw: {char.flaw}",
f"Goal: {c.goal}", f"Goal: {char.goal}",
"", "",
])) ]))