Start combat unit testing
This commit is contained in:
parent
890cee5c91
commit
3f96004e99
2 changed files with 36 additions and 2 deletions
|
|
@ -785,8 +785,8 @@ class _CmdCombatBase(Command):
|
||||||
|
|
||||||
self.args = self.args.strip()
|
self.args = self.args.strip()
|
||||||
|
|
||||||
if not self.caller.location:
|
if not self.caller.location or not self.callerlocation.allow_combat:
|
||||||
self.caller.msg("Can't fight here!")
|
self.msg("Can't fight here!")
|
||||||
raise InterruptCommand()
|
raise InterruptCommand()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,40 @@ from ..npcs import EvAdventureMob
|
||||||
from ..objects import EvAdventureConsumable, EvAdventureRunestone, EvAdventureWeapon
|
from ..objects import EvAdventureConsumable, EvAdventureRunestone, EvAdventureWeapon
|
||||||
from .mixins import EvAdventureMixin
|
from .mixins import EvAdventureMixin
|
||||||
|
|
||||||
|
|
||||||
|
class EvAdventureCombatHandlerTest(EvAdventureMixin, BaseEvenniaTest):
|
||||||
|
"""
|
||||||
|
Test methods on the turn-based combat handler
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
maxDiff = None
|
||||||
|
|
||||||
|
# make sure to mock away all time-keeping elements
|
||||||
|
@patch(
|
||||||
|
"evennia.contrib.tutorials.evadventure.combat_turnbased.EvAdventureCombatHandler.interval",
|
||||||
|
new=-1,
|
||||||
|
)
|
||||||
|
@patch(
|
||||||
|
"evennia.contrib.tutorials.evadventure.combat_turnbased.delay",
|
||||||
|
new=MagicMock(return_value=None),
|
||||||
|
)
|
||||||
|
def setUp(self):
|
||||||
|
super().setUp()
|
||||||
|
self.location.allow_combat = True
|
||||||
|
self.location.allow_death = True
|
||||||
|
self.combatant = self.character
|
||||||
|
self.target = create.create_object(
|
||||||
|
EvAdventureMob,
|
||||||
|
key="testmonster",
|
||||||
|
location=self.location,
|
||||||
|
attributes=(("is_idle", True),),
|
||||||
|
)
|
||||||
|
|
||||||
|
# this already starts turn 1
|
||||||
|
self.combathandler = combat_turnbased.join_combat(self.combatant, self.target)
|
||||||
|
|
||||||
|
|
||||||
# class EvAdventureTurnbasedCombatHandlerTest(EvAdventureMixin, BaseEvenniaTest):
|
# class EvAdventureTurnbasedCombatHandlerTest(EvAdventureMixin, BaseEvenniaTest):
|
||||||
# """
|
# """
|
||||||
# Test methods on the turn-based combat handler.
|
# Test methods on the turn-based combat handler.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue