Merge remote-tracking branch 'origin/master' into display

# Conflicts:
#	dungeonbattle/entities/player.py
#	dungeonbattle/game.py
#	dungeonbattle/interfaces.py
#	dungeonbattle/mapdisplay.py
#	dungeonbattle/settings.py
#	dungeonbattle/tests/settings_test.py
#	dungeonbattle/texturepack.py
This commit is contained in:
Yohann D'ANELLO
2020-11-06 20:04:24 +01:00
17 changed files with 495 additions and 107 deletions

View File

@ -1,33 +1,36 @@
from ..interfaces import Entity, FightingEntity
from ..interfaces import Entity, FightingEntity, Map
class Item(Entity):
held:bool
held: bool
def __init__(self, *args, **kwargs):
super().__init__(self, *args, **kwargs)
super().__init__(*args, **kwargs)
self.held = False
def drop(self, x:int, y:int):
def drop(self, y: int, x: int) -> None:
self.held = False
self.move(x, y)
def hold(self):
self.move(y, x)
def hold(self) -> None:
self.held = True
class Bomb(Item):
damage:int = 5
exploding:bool
damage: int = 5
exploding: bool
def __init__(self, *args, **kwargs):
super().__init__(self, *args, **kwargs)
super().__init__(*args, **kwargs)
self.exploding = False
def drop(self, x:int, y:int):
super.drop(self, x, y)
def drop(self, x: int, y: int) -> None:
super().drop(x, y)
self.exploding = True
def act(self, map):
def act(self, m: Map) -> None:
if self.exploding:
for e in map.entities:
if abs (e.x - self.x) + abs (e.y - self.y) <= 1 and isinstance(e,FightingEntity):
for e in m.entities:
if abs(e.x - self.x) + abs(e.y - self.y) <= 1 and \
isinstance(e, FightingEntity):
e.take_damage(self, self.damage)

View File

@ -1,9 +1,11 @@
from ..interfaces import FightingEntity
from ..interfaces import FightingEntity, Map
class Monster(FightingEntity):
def act(self, map):
def act(self, m: Map) -> None:
pass
class Squirrel(Monster):
maxhealth = 10
strength = 3

View File

@ -1,9 +1,22 @@
from ..interfaces import FightingEntity
class Player(FightingEntity):
maxhealth = 20
strength = 5
def move_up(self) -> bool:
return self.check_move(self.y - 1, self.x, True)
def move_down(self) -> bool:
return self.check_move(self.y + 1, self.x, True)
def move_left(self) -> bool:
return self.check_move(self.y, self.x - 1, True)
def move_right(self) -> bool:
return self.check_move(self.y, self.x + 1, True)
currentXP: int
maxXP: int