# This is a combination of 2 commits.
# This is the 1st commit message: Rewrite! This is a full rewrite of the npc generator code to use the newly-refactored dnd-name-generator code # This is the commit message #2: bugfixen
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
from functools import cached_property
|
||||
from npc import types
|
||||
import textwrap
|
||||
import random
|
||||
|
||||
from language.languages import draconic
|
||||
|
||||
|
||||
class Dragon(types.NPC):
|
||||
|
||||
language = draconic
|
||||
is_noble = True
|
||||
|
||||
has_tail = True
|
||||
has_horns = True
|
||||
has_fangs = True
|
||||
has_wings = True
|
||||
|
||||
|
||||
@cached_property
|
||||
def age(self) -> str:
|
||||
return random.choice(['wyrmling', 'young', 'adult', 'ancient'])
|
||||
|
||||
@cached_property
|
||||
def pronouns(self) -> str:
|
||||
return 'they/they'
|
||||
|
||||
@property
|
||||
def skin_color(self):
|
||||
if not self._skin_color:
|
||||
self._skin_color = random.choice([
|
||||
'red',
|
||||
'white',
|
||||
'green',
|
||||
'black',
|
||||
'blue',
|
||||
'brass',
|
||||
'bronze',
|
||||
'copper',
|
||||
'silver',
|
||||
'gold',
|
||||
])
|
||||
return self._skin_color
|
||||
|
||||
@property
|
||||
def description(self):
|
||||
trait = random.choice([
|
||||
f'{self.eyes} eyes',
|
||||
f'{self.tail} tail',
|
||||
f'{self.eyebrows} eyebrows',
|
||||
f'{self.teeth} fangs',
|
||||
self.facial_structure,
|
||||
])
|
||||
return (
|
||||
f"{self.name} ({self.pronouns}) is {types.a_or_an(self.age)} {self.age} {self.skin_color} "
|
||||
f"{self.ancestry.lower()} with {types.a_or_an(self.nose)} {self.nose} snout, {self.body} body and {trait}."
|
||||
)
|
||||
|
||||
@property
|
||||
def character_sheet(self):
|
||||
desc = '\n'.join(textwrap.wrap(self.description, width=120))
|
||||
return f"""\
|
||||
|
||||
{desc}
|
||||
|
||||
Physical Traits:
|
||||
|
||||
Face: {self.face}, {self.eyebrows} eyebrows, {self.nose} nose, {self.lips} lips,
|
||||
{self.teeth} teeth, {self.facial_hair}
|
||||
Eyes: {self.eyes}
|
||||
Skin: {self.skin_tone}, {self.skin_color}
|
||||
Hair: {self.hair}
|
||||
Body: {self.body}
|
||||
Tail: {self.tail}
|
||||
Voice: {self.voice}
|
||||
|
||||
Details:
|
||||
|
||||
Personality: {self.personality}
|
||||
Flaw: {self.flaw}
|
||||
Goal: {self.goal}
|
||||
|
||||
Whereabouts: {self.whereabouts}
|
||||
|
||||
"""
|
||||
|
||||
|
||||
NPC = Dragon
|
||||
@@ -0,0 +1,9 @@
|
||||
from language.languages import undercommon
|
||||
from npc import types
|
||||
|
||||
|
||||
class Drow(types.NPC):
|
||||
language = undercommon
|
||||
|
||||
|
||||
NPC = Drow
|
||||
@@ -0,0 +1,9 @@
|
||||
from language.languages import dwarvish
|
||||
from npc import types
|
||||
|
||||
|
||||
class Dwarf(types.NPC):
|
||||
language = dwarvish
|
||||
|
||||
|
||||
NPC = Dwarf
|
||||
@@ -0,0 +1,9 @@
|
||||
from language.languages import elvish
|
||||
from npc import types
|
||||
|
||||
|
||||
class Elf(types.NPC):
|
||||
language = elvish
|
||||
|
||||
|
||||
NPC = Elf
|
||||
@@ -0,0 +1,9 @@
|
||||
from language.languages import halfling
|
||||
from npc import types
|
||||
|
||||
|
||||
class Halfling(types.NPC):
|
||||
language = halfling
|
||||
|
||||
|
||||
NPC = Halfling
|
||||
@@ -0,0 +1,9 @@
|
||||
from language.languages import orcish
|
||||
from npc import types
|
||||
|
||||
|
||||
class HalfOrc(types.NPC):
|
||||
language = orcish
|
||||
|
||||
|
||||
NPC = HalfOrc
|
||||
@@ -0,0 +1,9 @@
|
||||
from language.languages import common
|
||||
from npc import types
|
||||
|
||||
|
||||
class Human(types.NPC):
|
||||
language = common
|
||||
|
||||
|
||||
NPC = Human
|
||||
@@ -0,0 +1,104 @@
|
||||
from functools import cached_property
|
||||
import textwrap
|
||||
import random
|
||||
|
||||
from language.languages import lizardfolk
|
||||
from npc import types
|
||||
|
||||
|
||||
class Lizardfolk(types.NPC):
|
||||
language = lizardfolk
|
||||
|
||||
has_tail = True
|
||||
has_horns = True
|
||||
has_fangs = True
|
||||
|
||||
@property
|
||||
def age(self):
|
||||
if not self._age:
|
||||
self._age = random.choice([
|
||||
'hatchling',
|
||||
'juvenile',
|
||||
'adult',
|
||||
'ancient',
|
||||
])
|
||||
return self._age
|
||||
|
||||
@property
|
||||
def tail(self):
|
||||
if not self._tail:
|
||||
if random.random() <= -0.6:
|
||||
self._tail = super(self)
|
||||
else:
|
||||
self._tail = 'no'
|
||||
return self._tail
|
||||
|
||||
@cached_property
|
||||
def frills(self):
|
||||
if self.age in ('adult', 'ancient'):
|
||||
return random.choice([
|
||||
'orange',
|
||||
'red',
|
||||
'yellow',
|
||||
'green',
|
||||
'blue',
|
||||
'silvery',
|
||||
])
|
||||
|
||||
@property
|
||||
def skin_color(self):
|
||||
if not self._skin_color:
|
||||
self._skin_color = random.choice([
|
||||
'green',
|
||||
'blue',
|
||||
'grey',
|
||||
'brown',
|
||||
'tan',
|
||||
'sandy',
|
||||
'gold',
|
||||
])
|
||||
return self._skin_color
|
||||
|
||||
@property
|
||||
def description(self):
|
||||
trait = random.choice([
|
||||
f'{self.eyes} eyes',
|
||||
f'{self.tail} tail',
|
||||
f'{self.teeth} teeth',
|
||||
f'{self.frills} frills',
|
||||
self.facial_structure,
|
||||
])
|
||||
return (
|
||||
f"{self.fullname} ({self.pronouns}) is {types.a_or_an(self.age)} {self.age}, {self.skin_color}-scaled "
|
||||
f"{self.ancestry.lower()} with {types.a_or_an(self.nose)} {self.nose} snout, {self.body} body and {trait}."
|
||||
)
|
||||
|
||||
@property
|
||||
def character_sheet(self):
|
||||
desc = '\n'.join(textwrap.wrap(self.description, width=120))
|
||||
return f"""\
|
||||
|
||||
{desc}
|
||||
|
||||
Physical Traits:
|
||||
|
||||
Face: {self.face}, {self.nose} snout, {self.teeth} teeth
|
||||
Eyes: {self.eyes}
|
||||
Skin: {self.skin_tone}
|
||||
Scales: {self.skin_color}
|
||||
Body: {self.body}
|
||||
Tail: {self.tail}
|
||||
Voice: {self.voice}
|
||||
|
||||
Details:
|
||||
|
||||
Personality: {self.personality}
|
||||
Flaw: {self.flaw}
|
||||
Goal: {self.goal}
|
||||
|
||||
Whereabouts: {self.whereabouts}
|
||||
|
||||
"""
|
||||
|
||||
|
||||
NPC = Lizardfolk
|
||||
@@ -0,0 +1,32 @@
|
||||
import random
|
||||
|
||||
from language.languages import infernal
|
||||
from npc import types
|
||||
|
||||
|
||||
class Tiefling(types.NPC):
|
||||
language = infernal
|
||||
|
||||
has_tail = True
|
||||
has_horns = True
|
||||
has_fangs = True
|
||||
|
||||
@property
|
||||
def skin_color(self):
|
||||
if not self._skin_color:
|
||||
self._skin_color = random.choice([
|
||||
'reddish',
|
||||
'white',
|
||||
'green',
|
||||
'black',
|
||||
'blue',
|
||||
'brassy',
|
||||
'bronze',
|
||||
'coppery',
|
||||
'silvery',
|
||||
'gold',
|
||||
])
|
||||
return self._skin_color
|
||||
|
||||
|
||||
NPC = Tiefling
|
||||
Reference in New Issue
Block a user