Now with EXPLOSIONS!
This commit is contained in:
parent
591630b8a7
commit
746379bad6
|
@ -2,7 +2,7 @@
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
from random import choice, randint
|
from random import choice, randint
|
||||||
from typing import Optional
|
from typing import Optional, Any
|
||||||
|
|
||||||
from ..interfaces import Entity, FightingEntity, Map, InventoryHolder
|
from ..interfaces import Entity, FightingEntity, Map, InventoryHolder
|
||||||
from ..translations import gettext as _
|
from ..translations import gettext as _
|
||||||
|
@ -484,7 +484,7 @@ class LongRangeWeapon(Item):
|
||||||
self.damage = damage
|
self.damage = damage
|
||||||
self.range = rang
|
self.range = rang
|
||||||
|
|
||||||
def throw(self, direction: int) -> str:
|
def throw(self, direction: int) -> Any:
|
||||||
to_kill = None
|
to_kill = None
|
||||||
for entity in self.held_by.map.entities:
|
for entity in self.held_by.map.entities:
|
||||||
if entity.is_fighting_entity():
|
if entity.is_fighting_entity():
|
||||||
|
@ -509,6 +509,7 @@ class LongRangeWeapon(Item):
|
||||||
.format(name=to_kill.translated_name.capitalize())+ self.string + " " \
|
.format(name=to_kill.translated_name.capitalize())+ self.string + " " \
|
||||||
+ to_kill.take_damage(self.held_by, self.damage + \
|
+ to_kill.take_damage(self.held_by, self.damage + \
|
||||||
getattr(self.held_by, self.stat)))
|
getattr(self.held_by, self.stat)))
|
||||||
|
return (to_kill.x, to_kill.y) if to_kill else None
|
||||||
|
|
||||||
def equip(self) -> None:
|
def equip(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
@ -569,3 +570,15 @@ class FireBallStaff(LongRangeWeapon):
|
||||||
@property
|
@property
|
||||||
def string(self) -> str:
|
def string(self) -> str:
|
||||||
return " is shot by a fire ball."
|
return " is shot by a fire ball."
|
||||||
|
|
||||||
|
def throw(self, direction: int) -> None:
|
||||||
|
"""
|
||||||
|
Adds an explosion animation when killing something.
|
||||||
|
"""
|
||||||
|
A = super().throw(direction)
|
||||||
|
if A:
|
||||||
|
x=A[0]
|
||||||
|
y=A[1]
|
||||||
|
|
||||||
|
explosion = Explosion(y=y, x=x)
|
||||||
|
self.held_by.map.add_entity(explosion)
|
||||||
|
|
Loading…
Reference in New Issue