Add a WaitAction and trigger it with .
This commit is contained in:
parent
85423e739c
commit
4f7e477b24
2 changed files with 14 additions and 3 deletions
|
@ -178,3 +178,10 @@ class MeleeAction(MoveAction):
|
|||
def perform(self, engine: 'Engine') -> ActionResult:
|
||||
LOG.info('Attack! %s', self.target)
|
||||
return ActionResult(self, success=True)
|
||||
|
||||
class WaitAction(Action):
|
||||
'''Wait a turn'''
|
||||
|
||||
def perform(self, engine: 'Engine') -> ActionResult:
|
||||
LOG.info('%s is waiting a turn', self.entity)
|
||||
return ActionResult(self, success=True)
|
||||
|
|
|
@ -8,7 +8,7 @@ from typing import MutableSet, Optional, TYPE_CHECKING
|
|||
|
||||
import tcod
|
||||
|
||||
from .actions import Action, ActionResult, ExitAction, RegenerateRoomsAction, BumpAction
|
||||
from .actions import Action, ActionResult, ExitAction, RegenerateRoomsAction, BumpAction, WaitAction
|
||||
from .geometry import Direction
|
||||
from .object import Entity
|
||||
|
||||
|
@ -77,8 +77,10 @@ class EventHandler(tcod.event.EventDispatch[Action]):
|
|||
if result.success:
|
||||
LOG.info('Action succeded!')
|
||||
break
|
||||
else:
|
||||
LOG.info('Action failed!')
|
||||
|
||||
if result.done:
|
||||
LOG.info('Action failed!')
|
||||
break
|
||||
|
||||
return result
|
||||
|
||||
|
@ -110,5 +112,7 @@ class EventHandler(tcod.event.EventDispatch[Action]):
|
|||
action = BumpAction(hero, Direction.NorthWest)
|
||||
case tcod.event.KeySym.SPACE:
|
||||
action = RegenerateRoomsAction()
|
||||
case tcod.event.KeySym.PERIOD:
|
||||
action = WaitAction(hero)
|
||||
|
||||
return action
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue