Advertisement
GPbl3YH

12e13

Feb 18th, 2021
924
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. from random import randint
  2.  
  3. class Warrior:
  4.     health = 0
  5.     damage = 0
  6.    
  7.     def __init__(self, health, damage):
  8.         self.health = health
  9.         self.damage = damage
  10.        
  11.     def get_health(self):
  12.         return self.health
  13.  
  14.     def get_damage(self):
  15.         return self.damage
  16.    
  17.     def take_damage(self, damage):
  18.         self.health -= damage
  19.  
  20. class Platoon:
  21.     list_of_warriors = []
  22.    
  23.     def __init__(self, members_count):
  24.         for i in range(members_count):
  25.             warrior = Warrior(randint(80,121), randint(7,13))
  26.             self.list_of_warriors.append(warrior)
  27.    
  28.     def show_members(self):
  29.         for i in self.list_of_warriors:
  30.             print(f'HP - {i.get_health()}, Damage - {i.get_damage()}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement