from character import Character from monster import Monster from weapon import Weapon from armor import Armor import random def attack_someone(attacker, defender): throw_result = random.randint(1, 6) attack = attacker.attack + attacker.weapon.bonus defense = defender.defense + defender.armor.bonus damage = attack + throw_result - defense if damage > 0: defender.hp = defender.hp - damage character = Character("You", 3, 10, 2, Weapon("Sword", 2), Armor("Helmet", 2)) monster = Monster("Goblin", 6, 1, 1, Weapon("Axe", 3), Armor("Shield", 1)) attack_someone(character, monster) if(monster.hp <= 0): print("You defeated the", monster.name, "!") else: attack_someone(monster, character) monster2 = Monster("Troll", 20, 3, 2)