Clean up the __str__ for a few Action subclasses
This commit is contained in:
parent
6f1d68db20
commit
e4f8aa5e80
1 changed files with 7 additions and 1 deletions
|
@ -101,6 +101,9 @@ class Action:
|
||||||
'''Create an ActionResult indicating success with no follow-up'''
|
'''Create an ActionResult indicating success with no follow-up'''
|
||||||
return ActionResult(self, success=True)
|
return ActionResult(self, success=True)
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return f'{self.__class__.__name__} for {self.actor!s}'
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f'{self.__class__.__name__}({self.actor!r})'
|
return f'{self.__class__.__name__}({self.actor!r})'
|
||||||
|
|
||||||
|
@ -127,6 +130,9 @@ class MoveAction(Action):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f'{self.__class__.__name__}({self.actor!r}, {self.direction!r})'
|
return f'{self.__class__.__name__}({self.actor!r}, {self.direction!r})'
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return f'{self.__class__.__name__} toward {self.direction} by {self.actor!s}'
|
||||||
|
|
||||||
class BumpAction(MoveAction):
|
class BumpAction(MoveAction):
|
||||||
'''Attempt to perform a movement action in a direction.
|
'''Attempt to perform a movement action in a direction.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue