Move most of the basic actions logs to debug (probably just for now)
This commit is contained in:
parent
4084d98efd
commit
d236b827cd
1 changed files with 14 additions and 14 deletions
|
@ -28,7 +28,7 @@ from .object import Actor, Item
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .engine import Engine
|
from .engine import Engine
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger('actions')
|
||||||
|
|
||||||
class ActionResult:
|
class ActionResult:
|
||||||
'''The result of an Action.
|
'''The result of an Action.
|
||||||
|
@ -158,12 +158,12 @@ class BumpAction(MoveAction):
|
||||||
else:
|
else:
|
||||||
entity_occupying_position = None
|
entity_occupying_position = None
|
||||||
|
|
||||||
LOG.info('Bumping %s into %s (in_bounds:%s walkable:%s overlaps:%s)',
|
LOG.debug('Bumping %s into %s (in_bounds:%s walkable:%s overlaps:%s)',
|
||||||
self.actor,
|
self.actor,
|
||||||
new_position,
|
new_position,
|
||||||
position_is_in_bounds,
|
position_is_in_bounds,
|
||||||
position_is_walkable,
|
position_is_walkable,
|
||||||
entity_occupying_position)
|
entity_occupying_position)
|
||||||
|
|
||||||
if not position_is_in_bounds or not position_is_walkable:
|
if not position_is_in_bounds or not position_is_walkable:
|
||||||
return self.failure()
|
return self.failure()
|
||||||
|
@ -180,7 +180,7 @@ class WalkAction(MoveAction):
|
||||||
def perform(self, engine: 'Engine') -> ActionResult:
|
def perform(self, engine: 'Engine') -> ActionResult:
|
||||||
new_position = self.actor.position + self.direction
|
new_position = self.actor.position + self.direction
|
||||||
|
|
||||||
LOG.info('Moving %s to %s', self.actor, new_position)
|
LOG.debug('Moving %s to %s', self.actor, new_position)
|
||||||
self.actor.position = new_position
|
self.actor.position = new_position
|
||||||
|
|
||||||
return self.success()
|
return self.success()
|
||||||
|
@ -200,11 +200,11 @@ class MeleeAction(MoveAction):
|
||||||
return self.failure()
|
return self.failure()
|
||||||
|
|
||||||
damage = self.actor.fighter.attack_power - self.target.fighter.defense
|
damage = self.actor.fighter.attack_power - self.target.fighter.defense
|
||||||
if damage > 0:
|
if damage > 0 and self.target:
|
||||||
LOG.info('%s attacks %s for %d damage!', self.actor, self.target, damage)
|
LOG.debug('%s attacks %s for %d damage!', self.actor, self.target, damage)
|
||||||
self.target.fighter.hit_points -= damage
|
self.target.fighter.hit_points -= damage
|
||||||
else:
|
else:
|
||||||
LOG.info('%s attacks %s but does no damage!', self.actor, self.target)
|
LOG.debug('%s attacks %s but does no damage!', self.actor, self.target)
|
||||||
|
|
||||||
if self.target.fighter.is_dead:
|
if self.target.fighter.is_dead:
|
||||||
LOG.info('%s is dead!', self.target)
|
LOG.info('%s is dead!', self.target)
|
||||||
|
@ -216,18 +216,18 @@ class WaitAction(Action):
|
||||||
'''Wait a turn'''
|
'''Wait a turn'''
|
||||||
|
|
||||||
def perform(self, engine: 'Engine') -> ActionResult:
|
def perform(self, engine: 'Engine') -> ActionResult:
|
||||||
LOG.info('%s is waiting a turn', self.actor)
|
LOG.debug('%s is waiting a turn', self.actor)
|
||||||
return self.success()
|
return self.success()
|
||||||
|
|
||||||
class DieAction(Action):
|
class DieAction(Action):
|
||||||
'''Kill an Actor'''
|
'''Kill an Actor'''
|
||||||
|
|
||||||
def perform(self, engine: 'Engine') -> ActionResult:
|
def perform(self, engine: 'Engine') -> ActionResult:
|
||||||
LOG.info('%s dies', self.actor)
|
LOG.debug('%s dies', self.actor)
|
||||||
engine.entities.remove(self.actor)
|
engine.entities.remove(self.actor)
|
||||||
|
|
||||||
if self.actor.yields_corpse_on_death:
|
if self.actor.yields_corpse_on_death:
|
||||||
LOG.info('%s leaves a corpse behind', self.actor)
|
LOG.debug('%s leaves a corpse behind', self.actor)
|
||||||
corpse = Item(kind=items.Corpse, name=f'{self.actor.name} Corpse', position=self.actor.position)
|
corpse = Item(kind=items.Corpse, name=f'{self.actor.name} Corpse', position=self.actor.position)
|
||||||
return ActionResult(self, alternate=DropItemAction(self.actor, corpse))
|
return ActionResult(self, alternate=DropItemAction(self.actor, corpse))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue