Read only comments in Portuguese, the question of self is in comments in the code, now the events will be down there.
class LOL:
class Champions:
class MasterYi:
def __init__(self):
#YiAttributes
self.YiAD = 66
self.YiLevel = 1
self.YiQ = 25 + self.YiAD
def Name(self):
return 'MasterYi'
class Q:
def Use(self, target):
print( "[MasterYi] Q In %s" % ( target ) )
def Damage(self):
return self.YiQ #Como Eu Conseguiria Pegar O self.YiQ Da Classe MasterYi ?
class Zed:
def __init__(self):
#ZedAttributes
self.ZedAD = 84
self.ZedLevel = 1
self.ZedQ = 75 + self.ZedAD
def Name(self):
return 'Zed'
class Q:
def Use(self, target):
print( "[Zed] Q In %s" % ( target ) )
def Damage(self):
return self.ZedQ #Mesmo Caso Do self.YiQ
class Match:
def Start(self, Tuple):
print( "------ Starting Match ------\n" )
if (len(Tuple) == 1):
print( "Champions: %s" % ( Tuple[0].Name() ) )
elif (len(Tuple) == 2):
print( "Champions: %s, %s" % ( Tuple[0].Name(), Tuple[1].Name() ) )
def Finish(self):
print( "\n------ Finishing Match ------" )
#Creating Objects
Match = LOL.Match()
MasterYi = LOL.Champions.MasterYi()
Zed = LOL.Champions.Zed()
#Starting
Match.Start( ( MasterYi, Zed ) )
MasterYi.Q().Use( Zed.Name() )
print( "YiQ Damage: %g" % ( MasterYi.Q().Damage() ) )
#Finishing
Match.Finish()
I would need an event inside the class MasterYi that would cause every time the variable self.YiLevel to be incremented by 1, variables like self.YiAD and others that I did not put here in the code would be increased by specific values
I left the creation part of the objects in the code because then you can pick up and test the code.
And also how do I do the self.YiLevel
incrementing in the code, I could already do the incrementing in the other variables together, but in the future, in this code, I'll need to know how to make custom events wanting or not, so I'd rather ask a question with a simpler example.
Another detail of these two classes 'MasterYi' and 'Zed' are similar, but there will be more dozens of classes and I assure that most will be different, in these two the self.Q calculation works almost the same way, only which in other classes will be for example self.Q = 30 + self.AP others will make percent calculations type self.Q = self.AP * 30/100 + self.AD * 10/100.
Then will not always be (some number + AD), it still has the question that n is only Q
and yes (Q, W, E, R)