Advertisement
Kovitikus

Untitled

Aug 27th, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.85 KB | None | 0 0
  1. from evennia import DefaultCharacter
  2. from evennia.utils.create import create_object
  3. from evennia.utils.utils import (list_to_string, inherits_from, lazy_property)
  4. from world.combat_handler import CombatHandler
  5.  
  6.  
  7. class Character(DefaultCharacter):
  8.     pass
  9.  
  10. class Player_Character(DefaultCharacter):
  11.  
  12.     @lazy_property
  13.     def combat(self):
  14.         return CombatHandler(self)
  15.  
  16.     def at_object_creation(self):
  17.         # Stats
  18.         if not self.attributes.get('def_skills'):
  19.             self.attributes.add('gsp', 10)
  20.         if not self.attributes.get('def_skills'):
  21.             self.attributes.add('hp', {'max_hp': 100, 'current_hp': 100})
  22.  
  23.         # Statuses
  24.         if not self.attributes.has('approached'):
  25.             self.attributes.add('approached', [])
  26.         if not self.attributes.has('ko'):
  27.             self.attributes.add('ko', False)
  28.         if not self.attributes.has('feinted'):
  29.             self.attributes.add('feinted', None)
  30.         if not self.attributes.has('busy'):
  31.             self.attributes.add('busy', False)
  32.         if not self.attributes.has('hands'):
  33.             self.attributes.add('hands', {'left': None, 'right': None})
  34.         if not self.attributes.has('wielding'):
  35.             self.attributes.add('wielding', {'left': None, 'right': None, 'both': None})
  36.         if not self.attributes.has('stance'):
  37.             self.attributes.add('stance', None)
  38.         if not self.attributes.has('standing'):
  39.             self.attributes.add('standing', True)
  40.         if not self.attributes.has('kneeling'):
  41.             self.attributes.add('kneeling', False)
  42.         if not self.attributes.has('sitting'):
  43.             self.attributes.add('sitting', False)
  44.         if not self.attributes.has('lying'):
  45.             self.attributes.add('lying', False)
  46.  
  47.         # Skills
  48.         if not self.attributes.has('def_skills'):
  49.             self.attributes.add('def_skills', {'weapon': {'high': {}, 'mid': {}, 'low': {}}, 'dodge': {'high': {}, 'mid': {}, 'low': {}}, 'shield': {'high': {}, 'mid': {}, 'low': {}}})
  50.         if not self.attributes.has('def_rb'):
  51.             self.attributes.add('def_rb', {'high': 0, 'mid': 0, 'low': 0})
  52.  
  53.        
  54.        
  55.  
  56.     def return_appearance(self, looker, **kwargs):
  57.         if not looker:
  58.             return ""
  59.        
  60.         # get description, build string
  61.         string  = self.create_desc()
  62.         return string
  63.  
  64.     def create_desc(self):
  65.         desc = ""
  66.        
  67.         figure = self.db.figure
  68.         facial = self.db.facial
  69.         hair = self.db.hair
  70.  
  71.         height = figure.get('height')
  72.         build = figure.get('build')
  73.         sex = figure.get('gender')
  74.  
  75.         eye_color = facial.get('eye_color')
  76.         nose = facial.get('nose')
  77.         lips = facial.get('lips')
  78.         chin = facial.get('chin')
  79.         face = facial.get('face')
  80.         skin_color = facial.get('skin_color')
  81.  
  82.         length = hair.get('length')
  83.         texture = hair.get('texture')
  84.         hair_color = hair.get('hair_color')
  85.         style = hair.get('style')
  86.  
  87.         # The figure should result in "You see a <height> <build> <gender>."
  88.         gender = ('man' if sex == 'male' else 'woman')
  89.         desc += f"You see a {height} {build} {gender}. "
  90.        
  91.         # The facial should result in "He has <color> eyes set above an <shape> nose, <shape> lips and a <shape> chin in a <shape> <color> face."
  92.         gender = ('He' if sex == 'male' else 'She')
  93.         desc += (f"{gender} has {eye_color} eyes set above a {nose} nose, "
  94.                 f"{lips} lips and a {chin} chin in a {face} {skin_color} face. ")
  95.  
  96.         # The hair should result in "<gender> has <length> <texture> <color> hair <style>."
  97.         if length == 'bald':
  98.             desc += f"{gender} is {length}. "
  99.         else:
  100.             desc += f"{gender} has {length} {texture} {hair_color} hair {style}. "
  101.         return desc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement