2024-12-11 16:47:38 +01:00
|
|
|
from abc import ABC
|
2024-12-09 19:29:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Jednostka(ABC):
|
2024-12-11 16:21:28 +01:00
|
|
|
def __init__(self, zdrowie, sila_ataku, zasieg_ataku, szybkosc_ruchu, imie):
|
|
|
|
self.nazwa = ''
|
2024-12-09 19:29:11 +01:00
|
|
|
self.zdrowie = zdrowie
|
|
|
|
self.sila_ataku = sila_ataku
|
|
|
|
self.zasieg_ataku = zasieg_ataku
|
|
|
|
self.szybkosc_ruchu = szybkosc_ruchu
|
2024-12-11 16:21:28 +01:00
|
|
|
self.imie = imie
|
2024-12-09 19:29:11 +01:00
|
|
|
|
|
|
|
def otrzymaj_obrazenia(self, obrazenia):
|
|
|
|
print(f'Zadano {obrazenia} obrażeń')
|
|
|
|
self.zdrowie -= obrazenia
|
|
|
|
|
|
|
|
def czy_zyje(self):
|
|
|
|
if self.zdrowie > 0:
|
|
|
|
return True
|
|
|
|
return False
|
2024-12-09 19:59:28 +01:00
|
|
|
|
|
|
|
def wyswietl_stan(self):
|
2024-12-11 16:21:28 +01:00
|
|
|
print(self.nazwa)
|
2024-12-09 19:59:28 +01:00
|
|
|
print(f'Zdrowie: {self.zdrowie}')
|
|
|
|
print(f'Sila: {self.sila_ataku}')
|
|
|
|
print(f'Zasieg: {self.zasieg_ataku}')
|
|
|
|
print(f'Szybkosc: {self.szybkosc_ruchu}')
|