evennia.contrib.rpg.traits.tests¶
Unit test module for Trait classes.
-
class
evennia.contrib.rpg.traits.tests.
TraitHandlerTest
(methodName='runTest')[源代码]¶ 基类:
evennia.contrib.rpg.traits.tests._TraitHandlerBase
Testing for TraitHandler
Test traits related to each other via Trait.get_trait()
-
class
evennia.contrib.rpg.traits.tests.
TestTrait
(methodName='runTest')[源代码]¶ 基类:
evennia.contrib.rpg.traits.tests._TraitHandlerBase
Test the base Trait class
-
class
evennia.contrib.rpg.traits.tests.
TestTraitStatic
(methodName='runTest')[源代码]¶ 基类:
evennia.contrib.rpg.traits.tests._TraitHandlerBase
Test for static Traits
-
class
evennia.contrib.rpg.traits.tests.
TestTraitCounter
(methodName='runTest')[源代码]¶ 基类:
evennia.contrib.rpg.traits.tests._TraitHandlerBase
Test for counter- Traits
-
class
evennia.contrib.rpg.traits.tests.
TestTraitCounterTimed
(methodName='runTest')[源代码]¶ 基类:
evennia.contrib.rpg.traits.tests._TraitHandlerBase
Test for trait with timer component
-
class
evennia.contrib.rpg.traits.tests.
TestTraitGauge
(methodName='runTest')[源代码]¶ 基类:
evennia.contrib.rpg.traits.tests._TraitHandlerBase
-
class
evennia.contrib.rpg.traits.tests.
TestTraitGaugeTimed
(methodName='runTest')[源代码]¶ 基类:
evennia.contrib.rpg.traits.tests._TraitHandlerBase
Test for trait with timer component
-
class
evennia.contrib.rpg.traits.tests.
TestNumericTraitOperators
(methodName='runTest')[源代码]¶ 基类:
evennia.utils.test_resources.BaseEvenniaTestCase
Test case for numeric magic method implementations.
-
class
evennia.contrib.rpg.traits.tests.
DummyCharacter
[源代码]¶ 基类:
evennia.contrib.rpg.traits.tests._MockObj
-
strength
¶ Allows for applying traits as individual properties directly on the parent class instead for properties on the .traits handler. So with this you could access data e.g. as character.hp.value instead of character.traits.hp.value. This still uses the traitshandler under the hood.
Example:
from evennia.utils import lazy_property from evennia.contrib.rpg.traits import TraitProperty class Character(DefaultCharacter): strength = TraitProperty(name="STR", trait_type="static", base=10, mod=2) hunting = TraitProperty("Hunting Skill", trait_type="counter", base=10, mod=1, max=100) health = TraitProperty(trait_type="gauge", min=0, base=100)
- Type
Optional extra
-
hunting
¶ Allows for applying traits as individual properties directly on the parent class instead for properties on the .traits handler. So with this you could access data e.g. as character.hp.value instead of character.traits.hp.value. This still uses the traitshandler under the hood.
Example:
from evennia.utils import lazy_property from evennia.contrib.rpg.traits import TraitProperty class Character(DefaultCharacter): strength = TraitProperty(name="STR", trait_type="static", base=10, mod=2) hunting = TraitProperty("Hunting Skill", trait_type="counter", base=10, mod=1, max=100) health = TraitProperty(trait_type="gauge", min=0, base=100)
- Type
Optional extra
-
health
¶ Allows for applying traits as individual properties directly on the parent class instead for properties on the .traits handler. So with this you could access data e.g. as character.hp.value instead of character.traits.hp.value. This still uses the traitshandler under the hood.
Example:
from evennia.utils import lazy_property from evennia.contrib.rpg.traits import TraitProperty class Character(DefaultCharacter): strength = TraitProperty(name="STR", trait_type="static", base=10, mod=2) hunting = TraitProperty("Hunting Skill", trait_type="counter", base=10, mod=1, max=100) health = TraitProperty(trait_type="gauge", min=0, base=100)
- Type
Optional extra
-
-
class
evennia.contrib.rpg.traits.tests.
TestTraitFields
(methodName='runTest')[源代码]¶ 基类:
evennia.utils.test_resources.BaseEvenniaTestCase
Test the TraitField class.
-
class
evennia.contrib.rpg.traits.tests.
TraitContribTestingChar
(id, db_key, db_typeclass_path, db_date_created, db_lock_storage, db_account, db_sessid, db_location, db_home, db_destination, db_cmdset_storage)[源代码]¶ 基类:
evennia.objects.objects.DefaultCharacter
-
HP
¶ Allows for applying traits as individual properties directly on the parent class instead for properties on the .traits handler. So with this you could access data e.g. as character.hp.value instead of character.traits.hp.value. This still uses the traitshandler under the hood.
Example:
from evennia.utils import lazy_property from evennia.contrib.rpg.traits import TraitProperty class Character(DefaultCharacter): strength = TraitProperty(name="STR", trait_type="static", base=10, mod=2) hunting = TraitProperty("Hunting Skill", trait_type="counter", base=10, mod=1, max=100) health = TraitProperty(trait_type="gauge", min=0, base=100)
- Type
Optional extra
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶ 基类:
evennia.objects.objects.DefaultCharacter.MultipleObjectsReturned
-
path
= 'evennia.contrib.rpg.traits.tests.TraitContribTestingChar'¶
-
typename
= 'TraitContribTestingChar'¶
-
-
class
evennia.contrib.rpg.traits.tests.
TraitPropertyTestCase
(methodName='runTest')[源代码]¶ 基类:
evennia.utils.test_resources.EvenniaTest
Test atomic updating.
-
character_typeclass
¶
-