-1
from random import randint
class PersonagemP:
def __init__(self, nome):
self.nome = nome
self.posicao = str('DEF')
self.pontosATK = int(randint(5, 20))
self.pontosDEF = int(randint(5, 20))
self.pontosRFL = int(randint(5, 20))
self.pontosLife = int(50)
self.barraEspecial = int(3)
class Invocador(PersonagemP):
def __init__(self, nome):
super().__init__(nome, pontosATK, pontosDEF, pontosRFL, pontosLife, barraEspecial)
self.nome = nome
self.pontos_ATK = pontosATK - 3
self.pontos_DEF = pontosDEF - 3
self.pontos_RFL = pontosRFL - 3
self.pontos_Life = pontosLife + 5
self.barra_Especial = barraEspecial + 3
Main1 = Invocador('Pedro')
print(Main1)
print(Main1.nome)
print(Main1.pontosATK)
In this case I’m making a class for a role-playing game, but I need to use another class to make another type of character, in this case the first is to make the base character and the second is the heiress is forming a new type of character, but I’m not getting.
Just a hint,
randint
returns an integer so no need to convert usingint
. The same goes forstr("DEF")
,int(50)
and the others.– fernandosavio