Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.28 KB | None | 0 0
  1.  
  2.  
  3. import random
  4. def randMMD(minValue=4, maxValue=6, decimals=2):
  5.       return round(random.uniform(minValue,maxValue), decimals)
  6.  
  7. class Monster:
  8.    
  9.     def __init__(self, name, age, damage, attackspeed, defence, hp, dodge, crit, movementspeed  ):
  10.         self.name = name
  11.         self.age = age
  12.         self.damage = damage
  13.         self.attackspeed = attackspeed
  14.         self.defence = defence
  15.         self.maxhp = hp
  16.         self.hp = hp
  17.         self.dodge = dodge
  18.         self.crit = crit
  19.         self.movementspeed = movementspeed
  20.  
  21.  
  22.     def myfunc(self):
  23.         def randMMD(minValue=4, maxValue=6, decimals=2):
  24.             return round(random.uniform(minValue,maxValue), decimals)
  25.  
  26.  
  27.    
  28. damage = randMMD()
  29. attackspeed = randMMD()
  30. defence = randMMD()
  31. hp = randMMD()
  32. dodge = randMMD()
  33. crit = randMMD()
  34. movementspeed = randMMD()
  35. m1 = Monster("Frankenstein", "1", damage, attackspeed, defence, hp, dodge, crit, movementspeed )
  36. m1.myfunc()
  37. print("Name : " + m1.name )
  38. print("Age : " + m1.age )
  39. print("Damage : " + str(damage))
  40. print("Attack speed : " + str(attackspeed))
  41. print("Defence : " + str(defence))
  42. print("HP : " + str(hp))
  43. print("Dodge : " + str(dodge))
  44. print("Critical chance : " + str(crit))
  45. print("Movement speed : " + str(movementspeed))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement