fork download
  1. class Magic:
  2.  
  3. def __init__(self, magic, source, power):
  4. self.magic = magic
  5. self.source = source
  6. self.power = power
  7.  
  8. def Use(self, target):
  9. print("{source} {magic} In {target}".format(source=self.source, magic=self.magic, target=target))
  10.  
  11. def Damage(self):
  12. return self.power
  13.  
  14. class Q(Magic, object):
  15.  
  16. def __init__(self, source, ad, power):
  17. power = power + ad
  18. Magic.__init__(self, 'Q', source, power)
  19.  
  20. class W(Magic, object):
  21.  
  22. def __init__(self, source, ad, power):
  23. power = power + ad * 30 / 100
  24. Magic.__init__(self, 'W', source, power)
  25.  
  26. class E(Magic, object):
  27.  
  28. def __init__(self, source, power):
  29. self.source = source
  30. self.power = power
  31. Magic.__init__(self, 'E', source, power)
  32.  
  33. class R(Magic, object):
  34.  
  35. def __init__(self, source, ad, power):
  36. power = power + ad / 100
  37. Magic.__init__(self, 'R', source, power)
  38.  
  39. class Magics:
  40.  
  41. def __init__(self, source, ad, q, w, e, r):
  42. self.Q = Q(source, ad, q)
  43. self.W = W(source, ad, w)
  44. self.E = E(source, e)
  45. self.R = R(source, ad, r)
  46.  
  47. class Champion:
  48.  
  49. def __init__(self, name, ad, level, powerQ, powerW, powerE, powerR):
  50. self.name = name
  51. self.ad = ad
  52. self.level = level
  53. self.powerQ = powerQ
  54. self.powerW = powerW
  55. self.powerE = powerE
  56. self.powerR = powerR
  57.  
  58. self.Magics = Magics(self.name, self.ad, self.powerQ, powerW, powerE, powerR)
  59.  
  60. class LOL:
  61.  
  62. @staticmethod
  63. def MasterYi():
  64. return Champion(name='MasterYi', ad=66, level=1, powerQ=25, powerW=14, powerE=20, powerR=99)
  65.  
  66. @staticmethod
  67. def Zed():
  68. return Champion(name='Zed', ad=84, level=1, powerQ=75, powerW=34, powerE=10, powerR=33)
  69.  
  70. class Match:
  71.  
  72. @staticmethod
  73. def Start(Champions):
  74. print("--- Start Match ---\n")
  75. print("Champions: {champions}".format(champions=", ".join(c.name for c in Champions)))
  76.  
  77. @staticmethod
  78. def Finish():
  79. print("\n--- Finished Match ---")
  80.  
  81. MasterYi = LOL.MasterYi()
  82. Zed = LOL.Zed()
  83.  
  84. Match.Start((MasterYi, Zed))
  85.  
  86. MasterYi.Magics.Q.Use(Zed.name)
  87. print("YiQ Damage: {damage}".format(damage=MasterYi.Magics.Q.Damage()))
  88. Zed.Magics.W.Use(MasterYi.name)
  89. print("ZedW Damage: {damage}".format(damage=Zed.Magics.W.Damage()))
  90.  
  91. Match.Finish()
Success #stdin #stdout 0.01s 7896KB
stdin
Standard input is empty
stdout
--- Start Match ---

Champions: MasterYi, Zed
MasterYi Q In Zed
YiQ Damage: 91
Zed W In MasterYi
ZedW Damage: 59

--- Finished Match ---