Linting
This commit is contained in:
parent
a6cd075b8c
commit
20aeb5fd4a
|
@ -5,8 +5,9 @@ from dungeonbattle.term_manager import TermManager
|
|||
|
||||
class Bootstrap:
|
||||
"""
|
||||
The bootstrap object is used to bootstrap the game so that it starts properly.
|
||||
(It was initially created to avoid circulary imports between the Game and
|
||||
The bootstrap object is used to bootstrap the game so that it starts
|
||||
properly.
|
||||
(It was initially created to avoid circular imports between the Game and
|
||||
Display classes)
|
||||
"""
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@ from typing import Optional
|
|||
|
||||
from dungeonbattle.settings import Settings
|
||||
|
||||
#This file contains a few useful enumeration classes used elsewhere in the code
|
||||
# This file contains a few useful enumeration classes used elsewhere in the code
|
||||
|
||||
|
||||
class DisplayActions(Enum):
|
||||
"""
|
||||
Display actions options for the callable displayaction Game uses
|
||||
(it just calls the same action on the display object displayaction refers to)
|
||||
It just calls the same action on the display object displayaction refers to.
|
||||
"""
|
||||
REFRESH = auto()
|
||||
UPDATE = auto()
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from random import randint
|
||||
from typing import Any, Optional,Generator
|
||||
from typing import Any, Optional
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
from .entities.player import Player
|
||||
from .enums import GameMode, KeyValues, DisplayActions
|
||||
|
@ -110,15 +111,15 @@ class Game:
|
|||
elif option == menus.MainMenuValues.EXIT:
|
||||
sys.exit(0)
|
||||
|
||||
def save_state(self) -> dict():
|
||||
def save_state(self) -> dict:
|
||||
"""
|
||||
Saves the game to a dictionnary
|
||||
Saves the game to a dictionary
|
||||
"""
|
||||
return self.map.save_state()
|
||||
|
||||
def load_state(self, d: dict) -> None:
|
||||
"""
|
||||
Loads the game from a dictionnary
|
||||
Loads the game from a dictionary
|
||||
"""
|
||||
self.map.load_state(d)
|
||||
|
||||
|
|
|
@ -146,7 +146,8 @@ class Map:
|
|||
self.currentx = d["currentx"]
|
||||
self.currenty = d["currenty"]
|
||||
self.map = self.load_dungeon_from_string(d["map"])
|
||||
#add entities
|
||||
# add entities
|
||||
|
||||
|
||||
class Tile(Enum):
|
||||
"""
|
||||
|
@ -168,7 +169,8 @@ class Tile(Enum):
|
|||
|
||||
def char(self, pack: TexturePack) -> str:
|
||||
"""
|
||||
Translates a Tile to the corresponding character according to the texture pack
|
||||
Translates a Tile to the corresponding character according
|
||||
to the texture pack
|
||||
"""
|
||||
return getattr(pack, self.name)
|
||||
|
||||
|
@ -300,7 +302,7 @@ class Entity:
|
|||
d["y"] = self.y
|
||||
return d
|
||||
|
||||
def recover_state(self, d : dict) -> None:
|
||||
def recover_state(self, d: dict) -> None:
|
||||
"""
|
||||
Loads the coordinates of the entity from a dictionnary
|
||||
"""
|
||||
|
@ -364,18 +366,19 @@ class FightingEntity(Entity):
|
|||
"""
|
||||
Returns a fighting entities specific attributes
|
||||
"""
|
||||
return ["maxhealth", "health", "level", "dead", "strength", "intelligence", "charisma", "dexterity", "constitution"]
|
||||
return ["maxhealth", "health", "level", "dead", "strength",
|
||||
"intelligence", "charisma", "dexterity", "constitution"]
|
||||
|
||||
def save_state(self) -> dict:
|
||||
"""
|
||||
Saves the state of the entity into a dictionnary
|
||||
Saves the state of the entity into a dictionary
|
||||
"""
|
||||
d = super().save_state()
|
||||
for name in self.keys():
|
||||
d[name] = self.__getattribute__(name)
|
||||
return d
|
||||
|
||||
def recover_state(self, d : dict) -> None:
|
||||
def recover_state(self, d: dict) -> None:
|
||||
"""
|
||||
Loads the state of an entity from a dictionary
|
||||
"""
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import sys
|
||||
from enum import Enum
|
||||
from typing import Any, Optional
|
||||
|
||||
|
|
Loading…
Reference in New Issue