Спрайк Спрайкович
Мастер
(1685)
6 месяцев назад
class Character:
def __init__(self, name, char_type, weapon_class):
self.name = name
self.char_type = char_type
self.weapon_class = weapon_class
class Hero(Character):
def __init__(self, name, char_type, weapon_class, health, mood, weapon_skill, health_damage, mood_damage):
super().__init__(name, char_type, weapon_class)
self.health = health
self.mood = mood
self.weapon_skill = weapon_skill
self.health_damage = health_damage
self.mood_damage = mood_damage
def display_info(self):
print(f"Name: {self.name}")
print(f"Type: {self.char_type}")
print(f"Weapon Class: {self.weapon_class}")
print(f"Health: {self.health}")
print(f"Mood: {self.mood}")
print(f"Weapon Skill: {self.weapon_skill}")
print(f"Health Damage: {self.health_damage}")
print(f"Mood Damage: {self.mood_damage}")
class Enemy(Character):
def __init__(self, name, char_type, weapon_class, health, threat_type, weapon_skill):
super().__init__(name, char_type, weapon_class)
self.health = health
self.threat_type = threat_type
self.weapon_skill = weapon_skill
def display_info(self):
print(f"Name: {self.name}")
print(f"Type: {self.char_type}")
print(f"Weapon Class: {self.weapon_class}")
print(f"Health: {self.health}")
print(f"Threat Type: {self.threat_type}")
print(f"Weapon Skill: {self.weapon_skill}")
# Пример использования классов
john = Hero("John", "Hero", "Archer", 100, "Happy", "Master", 20, 10)
john.display_info()
zombie = Enemy("Zombie", "Undead", "Melee", 50, "Health Threat", "Novice")
zombie.display_info()