Added a fire ball staff, closes #64
This commit is contained in:
parent
903a06c36c
commit
591630b8a7
|
@ -25,6 +25,7 @@ class TexturePack:
|
|||
CHESTPLATE: str
|
||||
EAGLE: str
|
||||
EMPTY: str
|
||||
FIRE_BALL_STAFF: str
|
||||
FLOOR: str
|
||||
HAZELNUT: str
|
||||
HEART: str
|
||||
|
@ -82,6 +83,7 @@ TexturePack.ASCII_PACK = TexturePack(
|
|||
EAGLE='µ',
|
||||
EMPTY=' ',
|
||||
EXPLOSION='%',
|
||||
FIRE_BALL_STAFF=':',
|
||||
FLOOR='.',
|
||||
LADDER='H',
|
||||
HAZELNUT='¤',
|
||||
|
@ -121,6 +123,7 @@ TexturePack.SQUIRREL_PACK = TexturePack(
|
|||
EAGLE='🦅',
|
||||
EMPTY=' ',
|
||||
EXPLOSION='💥',
|
||||
FIRE_BALL_STAFF='🪄',
|
||||
FLOOR='██',
|
||||
LADDER=('🪜', curses.COLOR_WHITE, (1000, 1000, 1000),
|
||||
curses.COLOR_WHITE, (1000, 1000, 1000)),
|
||||
|
|
|
@ -86,7 +86,7 @@ class Item(Entity):
|
|||
"""
|
||||
return [BodySnatchPotion, Bomb, Heart, Shield, Sword,\
|
||||
Chestplate, Helmet, RingCritical, RingXP, \
|
||||
ScrollofDamage, ScrollofWeakening, Ruler, Bow]
|
||||
ScrollofDamage, ScrollofWeakening, Ruler, Bow, FireBallStaff]
|
||||
|
||||
def be_sold(self, buyer: InventoryHolder, seller: InventoryHolder) -> bool:
|
||||
"""
|
||||
|
@ -505,9 +505,10 @@ class LongRangeWeapon(Item):
|
|||
self.held_by.x-entity.x<=self.range:
|
||||
to_kill = entity
|
||||
if to_kill:
|
||||
self.held_by.map.logs.add_message(_("{name} is shot by an arrow.")\
|
||||
.format(name=to_kill.translated_name.capitalize())+ " " \
|
||||
+ to_kill.take_damage(self.held_by, self.damage + getattr(self.held_by, self.stat)))
|
||||
self.held_by.map.logs.add_message(_("{name}")\
|
||||
.format(name=to_kill.translated_name.capitalize())+ self.string + " " \
|
||||
+ to_kill.take_damage(self.held_by, self.damage + \
|
||||
getattr(self.held_by, self.stat)))
|
||||
|
||||
def equip(self) -> None:
|
||||
"""
|
||||
|
@ -523,6 +524,12 @@ class LongRangeWeapon(Item):
|
|||
or intelligence for a magic staff.
|
||||
"""
|
||||
|
||||
@property
|
||||
def string(self) -> str:
|
||||
"""
|
||||
The string that is printed when we hit an ennemy.
|
||||
"""
|
||||
|
||||
class Bow(LongRangeWeapon):
|
||||
"""
|
||||
A type of long range weapon that deals damage based on the player's dexterity
|
||||
|
@ -538,3 +545,27 @@ class Bow(LongRangeWeapon):
|
|||
Here it is dexterity
|
||||
"""
|
||||
return "dexterity"
|
||||
|
||||
@property
|
||||
def string(self) -> str:
|
||||
return " is shot by an arrow."
|
||||
|
||||
class FireBallStaff(LongRangeWeapon):
|
||||
"""
|
||||
A type of long range weapon that deals damage based on the player's dexterity
|
||||
"""
|
||||
def __init__(self, name: str = "fire_ball_staff", price: int = 36,\
|
||||
damage: int = 6, rang: int = 4, *args, **kwargs):
|
||||
super().__init__(name=name, price=price, damage=damage, \
|
||||
rang=rang, *args, **kwargs)
|
||||
|
||||
@property
|
||||
def stat(self) -> str:
|
||||
"""
|
||||
Here it is dexterity
|
||||
"""
|
||||
return "intelligence"
|
||||
|
||||
@property
|
||||
def string(self) -> str:
|
||||
return " is shot by a fire ball."
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
from random import randint
|
||||
from typing import Dict, Optional, Tuple
|
||||
|
||||
from .items import Item, Bow
|
||||
from .items import Item
|
||||
from ..interfaces import FightingEntity, InventoryHolder
|
||||
|
||||
|
||||
|
|
|
@ -630,7 +630,7 @@ class Entity:
|
|||
Trumpet
|
||||
from squirrelbattle.entities.items import BodySnatchPotion, Bomb, \
|
||||
Heart, Sword, Shield, Chestplate, Helmet, RingCritical, RingXP, \
|
||||
ScrollofDamage, ScrollofWeakening, Ruler, Bow
|
||||
ScrollofDamage, ScrollofWeakening, Ruler, Bow, FireBallStaff
|
||||
return {
|
||||
"Tiger": Tiger,
|
||||
"Bomb": Bomb,
|
||||
|
@ -654,6 +654,7 @@ class Entity:
|
|||
"ScrollofDamage": ScrollofDamage,
|
||||
"ScrollofWeakening": ScrollofWeakening,
|
||||
"Bow": Bow,
|
||||
"FireBallStaff": FireBallStaff,
|
||||
}
|
||||
|
||||
def save_state(self) -> dict:
|
||||
|
|
Loading…
Reference in New Issue