You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.4 KiB
73 lines
2.4 KiB
"""
|
|
Prototypes
|
|
|
|
A prototype is a simple way to create individualized instances of a
|
|
given `Typeclass`. For example, you might have a Sword typeclass that
|
|
implements everything a Sword would need to do. The only difference
|
|
between different individual Swords would be their key, description
|
|
and some Attributes. The Prototype system allows to create a range of
|
|
such Swords with only minor variations. Prototypes can also inherit
|
|
and combine together to form entire hierarchies (such as giving all
|
|
Sabres and all Broadswords some common properties). Note that bigger
|
|
variations, such as custom commands or functionality belong in a
|
|
hierarchy of typeclasses instead.
|
|
|
|
Example prototypes are read by the `@spawn` command but is also easily
|
|
available to use from code via `evennia.spawn` or `evennia.utils.spawner`.
|
|
Each prototype should be a dictionary. Use the same name as the
|
|
variable to refer to other prototypes.
|
|
|
|
Possible keywords are:
|
|
prototype_parent - string pointing to parent prototype of this structure.
|
|
key - string, the main object identifier.
|
|
typeclass - string, if not set, will use `settings.BASE_OBJECT_TYPECLASS`.
|
|
location - this should be a valid object or #dbref.
|
|
home - valid object or #dbref.
|
|
destination - only valid for exits (object or dbref).
|
|
|
|
permissions - string or list of permission strings.
|
|
locks - a lock-string.
|
|
aliases - string or list of strings.
|
|
|
|
ndb_<name> - value of a nattribute (the "ndb_" part is ignored).
|
|
any other keywords are interpreted as Attributes and their values.
|
|
|
|
See the `@spawn` command and `evennia.utils.spawner` for more info.
|
|
|
|
"""
|
|
|
|
# from random import randint
|
|
#
|
|
# GOBLIN = {
|
|
# "key": "goblin grunt",
|
|
# "health": lambda: randint(20,30),
|
|
# "resists": ["cold", "poison"],
|
|
# "attacks": ["fists"],
|
|
# "weaknesses": ["fire", "light"]
|
|
# }
|
|
#
|
|
# GOBLIN_WIZARD = {
|
|
# "prototype_parent": "GOBLIN",
|
|
# "key": "goblin wizard",
|
|
# "spells": ["fire ball", "lighting bolt"]
|
|
# }
|
|
#
|
|
# GOBLIN_ARCHER = {
|
|
# "prototype_parent": "GOBLIN",
|
|
# "key": "goblin archer",
|
|
# "attacks": ["short bow"]
|
|
# }
|
|
#
|
|
# This is an example of a prototype without a prototype
|
|
# (nor key) of its own, so it should normally only be
|
|
# used as a mix-in, as in the example of the goblin
|
|
# archwizard below.
|
|
# ARCHWIZARD_MIXIN = {
|
|
# "attacks": ["archwizard staff"],
|
|
# "spells": ["greater fire ball", "greater lighting"]
|
|
# }
|
|
#
|
|
# GOBLIN_ARCHWIZARD = {
|
|
# "key": "goblin archwizard",
|
|
# "prototype_parent" : ("GOBLIN_WIZARD", "ARCHWIZARD_MIXIN")
|
|
# }
|
|
|