Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # תבנית של דמות
- class Character:
- #אתחול כל המאפיינים של דמות
- def __init__(self,name,defence,power,att):
- self.name=name
- self.life=100
- self.energy=100
- self.defence=defence
- self.power=power
- self.attacks=att
- # פונקציה להדפסת המידע
- def print_details(self):
- print(f'{self.name}: {self.defence}')
- # תבנית של התקפה
- class Attack:
- # איפוס/אתחול כל המאפיינים של התקפה
- def __init__(self):
- self.attack_type=0 #מס' התקפה (זיהוי)
- self.chance=0 # אחוזי פגיעה
- self.energy = 0 # הורדת אנרגיה עצמית
- self.life = 0 # הורדת חיים יריב
- c1 = Character('elf',80,15,[1,4,6])
- c1.print_details()
- c2 = Character('wizard',20,90,[1,2,5])
- c3 = Character('knight',60,50,[2,6,7])
- c1.defence=20
- c1.print_details()
- c2.print_details()
- c3.print_details()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement