Reformat some heckin' long initializers in object.py
This commit is contained in:
parent
d8dfe5c497
commit
d4c4b5d879
1 changed files with 26 additions and 13 deletions
|
@ -51,6 +51,15 @@ class Entity:
|
||||||
# A monotonically increasing identifier to help differentiate between entities that otherwise look identical
|
# A monotonically increasing identifier to help differentiate between entities that otherwise look identical
|
||||||
__next_identifier = 1
|
__next_identifier = 1
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
symbol: str,
|
||||||
|
*,
|
||||||
|
position: Optional[Point] = None,
|
||||||
|
blocks_movement: Optional[bool] = True,
|
||||||
|
render_order: RenderOrder = RenderOrder.ITEM,
|
||||||
|
fg: Optional[Tuple[int, int, int]] = None,
|
||||||
|
bg: Optional[Tuple[int, int, int]] = None):
|
||||||
self.identifier = Entity.__next_identifier
|
self.identifier = Entity.__next_identifier
|
||||||
self.position = position if position else Point()
|
self.position = position if position else Point()
|
||||||
self.foreground = fg if fg else (255, 255, 255)
|
self.foreground = fg if fg else (255, 255, 255)
|
||||||
|
@ -86,7 +95,10 @@ class Actor(Entity):
|
||||||
defense power, etc live.
|
defense power, etc live.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, symbol: str, *,
|
def __init__(
|
||||||
|
self,
|
||||||
|
symbol: str,
|
||||||
|
*,
|
||||||
position: Optional[Point] = None,
|
position: Optional[Point] = None,
|
||||||
blocks_movement: Optional[bool] = True,
|
blocks_movement: Optional[bool] = True,
|
||||||
render_order: RenderOrder = RenderOrder.ACTOR,
|
render_order: RenderOrder = RenderOrder.ACTOR,
|
||||||
|
@ -123,7 +135,8 @@ class Hero(Actor):
|
||||||
'''The hero, the player character'''
|
'''The hero, the player character'''
|
||||||
|
|
||||||
def __init__(self, position: Point):
|
def __init__(self, position: Point):
|
||||||
super().__init__('@',
|
super().__init__(
|
||||||
|
'@',
|
||||||
position=position,
|
position=position,
|
||||||
fighter=Fighter(maximum_hit_points=30, attack_power=5, defense=2),
|
fighter=Fighter(maximum_hit_points=30, attack_power=5, defense=2),
|
||||||
render_order=RenderOrder.HERO,
|
render_order=RenderOrder.HERO,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue