import random class character: def _init_(self, name, health, attack_power, has_prosthetic_leg=true): self.name = name self.health = health self.attack_power = attack_power self.has_prosthetic_leg = has_prosthetic_leg self.dinar = 0 def attack(self, other): damage = random.randint(0, self.attack_power) other.health -= damage print(f"{self.name} attacks {other.name} for {damage} damage!") print(f"{other.name}'s health: {other.health}") def is_alive(self): return self.health > 0 def use_special_sword(self): print(f"{self.name} uses the special katana to rewind time!") self.health += 20 # örnek olarak sağlığı artırma print(f"{self.name}'s health is now: {self.health}") class enemy: def _init_(self, name, health, attack_power): self.name = name self.health = health self.attack_power = attack_power def battle(sabri, enemy): while sabri.is_alive() and enemy.health > 0: sabri.attack(enemy) if enemy.health > 0: enemy_damage = random.randint(0, enemy.attack_power) sabri.health -= enemy_damage print(f"{enemy.name} attacks {sabri.name} for {enemy_damage} damage!") print(f"{sabri.name}'s health: {sabri.health}") if sabri.is_alive(): print(f"{enemy.name} has been defeated!") sabri.dinar += 10 print(f"you earned 10 sabri eş parası! total: {sabri.dinar}") else: print(f"{sabri.name} has been defeated! game over.") def main(): sabri = character("sabri", 100, 20) asya = character("asya", 80, 15) enemies = [ enemy("uzaylı savaşçı", 60, 15), enemy("uzaylı lider", 80, 20), ] print("sabri and asya are on a quest to save the world from aliens!") for enemy in enemies: print(f"a {enemy.name} appears!") battle(sabri, enemy) if not sabri.is_alive(): break if sabri.is_alive(): print("sabri has defeated all enemies and saved the world together with asya!") else: print("the world remains in danger...") # zamana geri alma yeteneği if sabri.health < 100: print(f"{sabri.name} decides to rewind time using the special katana...") sabri.use_special_sword() if _name_ == "_main_": main() bu koddan oyun yap