Fix doc generation of all evadventure modules
This commit is contained in:
parent
4abca72077
commit
2a75ea8343
14 changed files with 58 additions and 45 deletions
|
|
@ -6,7 +6,6 @@ Character class.
|
|||
from evennia.objects.objects import DefaultCharacter
|
||||
from evennia.typeclasses.attributes import AttributeProperty
|
||||
from evennia.utils.evform import EvForm
|
||||
from evennia.utils.evmenu import EvMenu, ask_yes_no
|
||||
from evennia.utils.evtable import EvTable
|
||||
from evennia.utils.logger import log_trace
|
||||
from evennia.utils.utils import lazy_property
|
||||
|
|
@ -14,7 +13,6 @@ from evennia.utils.utils import lazy_property
|
|||
from . import rules
|
||||
from .equipment import EquipmentError, EquipmentHandler
|
||||
from .quests import EvAdventureQuestHandler
|
||||
from .utils import get_obj_stats
|
||||
|
||||
|
||||
class LivingMixin:
|
||||
|
|
|
|||
|
|
@ -3,10 +3,9 @@ EvAdventure character generation.
|
|||
|
||||
"""
|
||||
from django.conf import settings
|
||||
|
||||
from evennia import create_object
|
||||
from evennia.objects.models import ObjectDB
|
||||
from evennia.prototypes.spawner import spawn
|
||||
from evennia.utils.create import create_object
|
||||
from evennia.utils.evmenu import EvMenu
|
||||
|
||||
from .characters import EvAdventureCharacter
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ This establishes the basic building blocks for combat:
|
|||
|
||||
"""
|
||||
|
||||
from evennia import Command, create_script
|
||||
from evennia.scripts.scripts import DefaultScript
|
||||
from evennia.typeclasses.attributes import AttributeProperty
|
||||
from evennia.utils import evtable
|
||||
from evennia.utils.create import create_script
|
||||
|
||||
from . import rules
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ able to kill and be killed in the same turn).
|
|||
Unlike in twitch-like combat, there is no movement while in turn-based combat. Fleeing is a select
|
||||
action that takes several vulnerable turns to complete.
|
||||
|
||||
----
|
||||
|
||||
"""
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ EvAdventure Twitch-based combat
|
|||
|
||||
This implements a 'twitch' (aka DIKU or other traditional muds) style of MUD combat.
|
||||
|
||||
----
|
||||
|
||||
"""
|
||||
from evennia import AttributeProperty, CmdSet, default_cmds
|
||||
from evennia.commands.command import Command, InterruptCommand
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ of using an Enum over, say, a string is that if you make a typo using an unknown
|
|||
enum, Python will give you an error while a typo in a string may go through silently.
|
||||
|
||||
It's used as a direct reference:
|
||||
::
|
||||
|
||||
from enums import Ability
|
||||
|
||||
|
|
@ -13,6 +14,8 @@ It's used as a direct reference:
|
|||
To get the `value` of an enum (must always be hashable, useful for Attribute lookups), use
|
||||
`Ability.STR.value` (which would return 'strength' in our case).
|
||||
|
||||
----
|
||||
|
||||
"""
|
||||
from enum import Enum
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Knave has a system of Slots for its inventory.
|
|||
from evennia.utils.utils import inherits_from
|
||||
|
||||
from .enums import Ability, WieldLocation
|
||||
from .objects import BARE_HANDS, EvAdventureObject
|
||||
from .objects import EvAdventureObject, get_bare_hands
|
||||
|
||||
|
||||
class EquipmentError(TypeError):
|
||||
|
|
@ -170,7 +170,7 @@ class EquipmentHandler:
|
|||
if not weapon:
|
||||
weapon = slots[WieldLocation.WEAPON_HAND]
|
||||
if not weapon:
|
||||
weapon = BARE_HANDS
|
||||
weapon = get_bare_hands()
|
||||
return weapon
|
||||
|
||||
def display_loadout(self):
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from evennia.utils.utils import make_iter
|
|||
|
||||
from .characters import LivingMixin
|
||||
from .enums import Ability, WieldLocation
|
||||
from .objects import BARE_HANDS
|
||||
from .objects import get_bare_hands
|
||||
from .rules import dice
|
||||
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ class EvAdventureNPC(LivingMixin, DefaultCharacter):
|
|||
|
||||
is_idle = AttributeProperty(default=False, autocreate=False)
|
||||
|
||||
weapon = AttributeProperty(default=BARE_HANDS, autocreate=False) # instead of inventory
|
||||
weapon = AttributeProperty(default=get_bare_hands, autocreate=False) # instead of inventory
|
||||
coins = AttributeProperty(default=1, autocreate=False) # coin loot
|
||||
|
||||
# if this npc is attacked, everyone with the same tag in the current location will also be
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ from . import rules
|
|||
from .enums import Ability, ObjType, WieldLocation
|
||||
from .utils import get_obj_stats
|
||||
|
||||
_BARE_HANDS = None
|
||||
|
||||
|
||||
class EvAdventureObject(DefaultObject):
|
||||
"""
|
||||
|
|
@ -352,9 +354,20 @@ class WeaponBareHands(EvAdventureWeapon):
|
|||
attack_type = Ability.STR
|
||||
defense_type = Ability.ARMOR
|
||||
damage_roll = "1d4"
|
||||
quality = 100000 # let's assume fists are always available ...
|
||||
quality = None # let's assume fists are always available ...
|
||||
|
||||
|
||||
BARE_HANDS = search_object("Bare hands", typeclass=WeaponBareHands).first()
|
||||
if not BARE_HANDS:
|
||||
BARE_HANDS = create_object(WeaponBareHands, key="Bare hands")
|
||||
def get_bare_hands():
|
||||
"""
|
||||
Get the bare-hands singleton object.
|
||||
|
||||
Returns:
|
||||
WeaponBareHands
|
||||
"""
|
||||
global _BARE_HANDS
|
||||
|
||||
if not _BARE_HANDS:
|
||||
_BARE_HANDS = search_object("Bare hands", typeclass=WeaponBareHands).first()
|
||||
if not _BARE_HANDS:
|
||||
_BARE_HANDS = create_object(WeaponBareHands, key="Bare hands")
|
||||
return _BARE_HANDS
|
||||
|
|
|
|||
|
|
@ -1,25 +1,10 @@
|
|||
"""
|
||||
MUD ruleset based on the _Knave_ OSR tabletop RPG by Ben Milton (modified for MUD use).
|
||||
|
||||
The rules are divided into a set of classes. While each class (except chargen) could
|
||||
also have been stand-alone functions, having them as classes makes it a little easier
|
||||
to use them as the base for your own variation (tweaking values etc).
|
||||
The center of the rule system is the "RollEngine", which handles all rolling of dice
|
||||
and determining what the outcome is.
|
||||
|
||||
- Roll-engine: Class with methods for making all dice rolls needed by the rules. Knave only
|
||||
has a few resolution rolls, but we define helper methods for different actions the
|
||||
character will be able to do in-code.
|
||||
- Character generation - this is a container used for holding, tweaking and setting
|
||||
all character data during character generation. At the end it will save itself
|
||||
onto the Character for permanent storage.
|
||||
- Improvement - this container holds rules used with experience to improve the
|
||||
character over time.
|
||||
- Charsheet - a container with tools for visually displaying the character sheet in-game.
|
||||
|
||||
This module presents several singletons to import
|
||||
|
||||
- `dice` - the `EvAdventureRollEngine` for all random resolution and table-rolling.
|
||||
- `character_sheet` - the `EvAdventureCharacterSheet` visualizer.
|
||||
- `improvement` - the EvAdventureImprovement` class for handling char xp and leveling.
|
||||
----
|
||||
|
||||
"""
|
||||
from random import randint
|
||||
|
|
@ -245,8 +230,7 @@ class EvAdventureRollEngine:
|
|||
# tuple with range conditional, like ('1-5', "Blue") or ('10', "Purple")
|
||||
max_range = -1
|
||||
min_range = 10**6
|
||||
for (valrange, choice) in table_choices:
|
||||
|
||||
for valrange, choice in table_choices:
|
||||
minval, *maxval = valrange.split("-", 1)
|
||||
minval = abs(int(minval))
|
||||
maxval = abs(int(maxval[0]) if maxval else minval)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue