More work on tech demo area

This commit is contained in:
Griatch 2022-07-12 11:51:05 +02:00
parent 1ed7ffa095
commit afadb1001e
16 changed files with 275 additions and 252 deletions

View file

@ -5,10 +5,11 @@ Base Character and NPCs.
from evennia.objects.objects import DefaultCharacter, DefaultObject
from evennia.typeclasses.attributes import AttributeProperty
from evennia.utils.utils import lazy_property, int2str
from .objects import EvAdventureObject
from evennia.utils.utils import int2str, lazy_property
from . import rules
from .enums import Ability, WieldLocation
from .objects import EvAdventureObject
class EquipmentError(TypeError):
@ -290,11 +291,12 @@ class EquipmentHandler:
in the list after all).
"""
return [obj for obj in slots[WieldLocation.BACKPACK]
if obj.inventory_use_slot in (
WieldLocation.WEAPON_HAND,
WieldLocation.TWO_HANDS,
WieldLocation.SHIELD_HAND)]
return [
obj
for obj in slots[WieldLocation.BACKPACK]
if obj.inventory_use_slot
in (WieldLocation.WEAPON_HAND, WieldLocation.TWO_HANDS, WieldLocation.SHIELD_HAND)
]
def get_wearable_objects_from_backpack(self):
"""
@ -307,11 +309,11 @@ class EquipmentHandler:
in the list after all).
"""
return [obj for obj in slots[WieldLocation.BACKPACK]
if obj.inventory_use_slot in (
WieldLocation.BODY,
WieldLocation.HEAD
)]
return [
obj
for obj in slots[WieldLocation.BACKPACK]
if obj.inventory_use_slot in (WieldLocation.BODY, WieldLocation.HEAD)
]
def get_usable_objects_from_backpack(self):
"""
@ -327,7 +329,7 @@ class EquipmentHandler:
class LivingMixin:
"""
Helpers shared between all living things.
Mixin class to use for all living things.
"""
@ -488,64 +490,3 @@ class EvAdventureCharacter(LivingMixin, DefaultCharacter):
Called when character dies.
"""
class EvAdventureNPC(LivingMixin, DefaultCharacter):
"""
This is the base class for all non-player entities, including monsters. These
generally don't advance in level but uses a simplified, abstract measure of how
dangerous or competent they are - the 'hit dice' (HD).
HD indicates how much health they have and how hard they hit. In _Knave_, HD also
defaults to being the bonus for all abilities. HP is 4 x Hit die (this can then be
customized per-entity of course).
Morale is set explicitly per-NPC, usually between 7 and 9.
Monsters don't use equipment in the way PCs do, instead they have a fixed armor
value, and their Abilities are dynamically generated from the HD (hit_dice).
If wanting monsters or NPCs that can level and work the same as PCs, base them off the
EvAdventureCharacter class instead.
"""
hit_dice = AttributeProperty(default=1)
armor = AttributeProperty(default=11)
morale = AttributeProperty(default=9)
hp = AttributeProperty(default=8)
@property
def strength(self):
return self.hit_dice
@property
def dexterity(self):
return self.hit_dice
@property
def constitution(self):
return self.hit_dice
@property
def intelligence(self):
return self.hit_dice
@property
def wisdom(self):
return self.hit_dice
@property
def charisma(self):
return self.hit_dice
@property
def hp_max(self):
return self.hit_dice * 4
def at_object_creation(self):
"""
Start with max health.
"""
self.hp = self.hp_max