Linting and tests...

This commit is contained in:
eichhornchen
2021-01-08 22:25:00 +01:00
parent 746379bad6
commit 9ff615a6b0
4 changed files with 160 additions and 45 deletions

View File

@ -605,7 +605,7 @@ class Entity:
from squirrelbattle.entities.monsters import Tiger, Hedgehog, \
Rabbit, TeddyBear, GiantSeaEagle
from squirrelbattle.entities.friendly import Merchant, Sunflower, \
Trumpet
Trumpet
return [BodySnatchPotion, Bomb, Heart, Hedgehog, Rabbit, TeddyBear,
Sunflower, Tiger, Merchant, GiantSeaEagle, Trumpet]
@ -697,7 +697,7 @@ class FightingEntity(Entity):
self.constitution = constitution
self.level = level
self.critical = critical
self.effects = [] #effects are temporary buff or weakening of the stats.
self.effects = [] # effects = temporary buff or weakening of the stats.
@property
def dead(self) -> bool:
@ -713,12 +713,13 @@ class FightingEntity(Entity):
for i in range(len(self.effects)):
self.effects[i][2] -= 1
l = self.effects[:]
for i in range(len(l)):
if l[i][2] <= 0:
setattr(self, l[i][0], getattr(self, l[i][0])-l[i][1])
self.effects.remove(l[i])
copy = self.effects[:]
for i in range(len(copy)):
if copy[i][2] <= 0:
setattr(self, copy[i][0],
getattr(self, copy[i][0]) - copy[i][1])
self.effects.remove(copy[i])
def hit(self, opponent: "FightingEntity") -> str:
"""
The entity deals damage to the opponent