class Hero():
def __init__(self, nickname, aggressivity, life_value, money, armor):
self.nickname = nickname
self.aggressivity = aggressivity
self.life_value = life_value
self.money = money
self.armor = armor
def attack(self, enemy):
damage_value = self.aggressivity - enemy.armor
enemy.life_value -= damage_value
class Garen(Hero):
camp = 'Demacia'
def __init__(self, nickname,
aggressivity = 58,
life_value = 455,
money=100,
armor=10):
Hero.__init__(self, nickname, aggressivity, life_value, money, armor)
class Riven(Hero):
camp = 'Noxus'
def __init__(self, nickname,
aggressivity = 54,
life_value = 414,
money=1001,
armor=3):
Hero.__init__(self, nickname, aggressivity, life_value, money, armor)
class BlackCleaver:
def __init__(self, price=475,
aggrev=9,
life_value = 100):
self.price=price
self.aggrev = aggrev
self.life_value = life_value
def fire(self, enemy):
enemy.life_value -= 1000
def update(self, owner):
owner.money -= self.price
owner.aggressivity += self.aggrev
owner.life_value += self.life_value
r1 = Riven("草丛伦")
g1 = Garen("盖文")
b1 = BlackCleaver()
if r1.money > b1.price:
r1.b1 = b1
b1.update(r1)
print("r1 aggress",r1.aggressivity)
print("g1 armor", g1.armor)
print("g1 life_value", g1.life_value)
r1.attack(g1)
print("g1 life_value", g1.life_value)