txt/terra/models/user_body/abstract_body_part.py

34 lines
989 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from abc import ABC
from typing import Optional
from models.weapon.abstract_weapon import AbstractWeapon
class AbstractBodyPart(ABC):
"""
Abstract body part
"""
name: type[str] = "Пятая конечность"
description: type[str] = "Непонятно откуда, но она у тебя есть"
hardness: type[int] = 0
health: type[int] = 0
def punch(
self,
weapon: AbstractWeapon,
):
if weapon.get_hit_chance(self, weapon=weapon):
if self.material.hardness <= 0:
print(
f"Вы ударились {weapon.name} об {self.name} и почуствовали ощутимую боль."
)
else:
print(
f"Вы ударились {weapon.name} обо что-то мягкое, этим оказалось {self.name} ."
)
else:
print("Вы промахнулись.")