I have a function called attack:
def attack(name,minmultiplier,maxmultiplier,critchance,attacker,attackee):
print(attacker[0],"used",name)
multiplier=random.randint(minmultiplier,maxmultiplier)
crit=random.randint(critchance,100)
if crit==100 and ((attacker[2]*multiplier*2)-attackee[3]) > 0:
attackee[1]=attackee[1]-((attacker[2]*multiplier*2)-attackee[3])
elif ((attacker[2]*multiplier)-attackee[3]) > 0:
attackee[1]=attackee[1]-((attacker[2]*multiplier)-attackee[3])
else:
print("You fail to hit",attackee[0])
print(attackee[0],"'s health after",attacker[0],"'s attack is",attackee[1])
And I am making a few actual attacks for bosses and the player here:
boss=["Greed",1000,10,10,1]
slashp=attack("slash",1,2,5,player,boss)
slashb=attack("slash",1,2,5,boss,player)
kick=attack("kick",1,1,1,player,boss)
aiattacklist=[slashb]
attacknamelist=["slash","kick"]
attackfunclist=[slashp,kick]
Even though I am only saving these versions as variables, they are still being called:
template used slash
You fail to hit Greed
Greed 's health after template 's attack is 1000
Greed used slash
template 's health after Greed 's attack is 58
template used kick
You fail to hit Greed
Greed 's health after template 's attack is 1000
Is this something that python always does, or am I doing something wrong, because I don't want these to be called (sorry if I didn't use the correct terminology, I am kind of new)