Added a second scroll object closes #60
This commit is contained in:
@ -630,7 +630,7 @@ class Entity:
|
||||
Trumpet
|
||||
from squirrelbattle.entities.items import BodySnatchPotion, Bomb, \
|
||||
Heart, Sword, Shield, Chestplate, Helmet, RingCritical, RingXP, \
|
||||
ScrollofDamage
|
||||
ScrollofDamage, ScrollofWeakening
|
||||
return {
|
||||
"Tiger": Tiger,
|
||||
"Bomb": Bomb,
|
||||
@ -651,6 +651,7 @@ class Entity:
|
||||
"RingCritical": RingCritical,
|
||||
"RingXP": RingXP,
|
||||
"ScrollofDamage": ScrollofDamage,
|
||||
"ScrollofWeakening": ScrollofWeakening,
|
||||
}
|
||||
|
||||
def save_state(self) -> dict:
|
||||
@ -693,6 +694,7 @@ class FightingEntity(Entity):
|
||||
self.constitution = constitution
|
||||
self.level = level
|
||||
self.critical = critical
|
||||
self.effects = [] #effects are temporary buff or weakening of the stats.
|
||||
|
||||
@property
|
||||
def dead(self) -> bool:
|
||||
@ -701,13 +703,26 @@ class FightingEntity(Entity):
|
||||
"""
|
||||
return self.health <= 0
|
||||
|
||||
def act(self, m: Map) -> None:
|
||||
"""
|
||||
Refreshes all current effects.
|
||||
"""
|
||||
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])
|
||||
|
||||
def hit(self, opponent: "FightingEntity") -> str:
|
||||
"""
|
||||
The entity deals damage to the opponent
|
||||
based on their respective stats.
|
||||
"""
|
||||
diceroll = randint(1, 100)
|
||||
damage = self.strength
|
||||
damage = max(0, self.strength)
|
||||
string = " "
|
||||
if diceroll <= self.critical: # It is a critical hit
|
||||
damage *= 4
|
||||
|
Reference in New Issue
Block a user