Update fight.py

This commit is contained in:
Matyáš Caras 2022-04-19 12:38:45 +02:00 committed by GitHub
parent 1cb78c4b8a
commit f0eae367b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,9 +4,10 @@ from lib.game import Item
from .ascii import * from .ascii import *
from colorama import Fore from colorama import Fore
import keyboard import keyboard
from random import randrange
class FightHandler: class FightHandler:
def __init__(self,message:str,name:str,hp:int,attacks:list,lang:dict,eq:Item,img:str="") -> None: def __init__(self,message:str,name:str,hp:int,attacks:dict,lang:dict,eq:Item,img:str="") -> None:
self.selected = 0 self.selected = 0
keyboard.add_hotkey("up",self.up) keyboard.add_hotkey("up",self.up)
keyboard.add_hotkey("down",self.down) keyboard.add_hotkey("down",self.down)
@ -56,5 +57,5 @@ class FightHandler:
print(f" {selection}") print(f" {selection}")
def attack(self): def attack(self):
self.hp self.hp -= self.attacks[randrange(len(self.attacks))][atk].
input() input()