Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. # תבנית של דמות
  2. class Character:
  3. #אתחול כל המאפיינים של דמות
  4. def __init__(self,name,defence,power,att):
  5. self.name=name
  6. self.life=100
  7. self.energy=100
  8. self.defence=defence
  9. self.power=power
  10. self.attacks=att
  11.  
  12. # פונקציה להדפסת המידע
  13. def print_details(self):
  14. print(f'{self.name}: {self.defence}')
  15.  
  16.  
  17. # תבנית של התקפה
  18. class Attack:
  19. # איפוס/אתחול כל המאפיינים של התקפה
  20. def __init__(self):
  21. self.attack_type=0 #מס' התקפה (זיהוי)
  22. self.chance=0 # אחוזי פגיעה
  23. self.energy = 0 # הורדת אנרגיה עצמית
  24. self.life = 0 # הורדת חיים יריב
  25.  
  26. c1 = Character('elf',80,15,[1,4,6])
  27. c1.print_details()
  28. c2 = Character('wizard',20,90,[1,2,5])
  29. c3 = Character('knight',60,50,[2,6,7])
  30. c1.defence=20
  31. c1.print_details()
  32. c2.print_details()
  33. c3.print_details()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement