Question:
I am currently trying to implement an XP system. There has to be a round_max
for that to work. I define it as 3
, but when I check if it’s None
or not, it returns True
.
CODE:
def full_battle_over_check(enemy_list, heros, round=None, round_max = None):
t = []
for li in enemy_list:
if all(enemy.permissions == "dead" for enemy in enemy_list):
t.append(True)
else:
t.append(False)
if round is None:
if all(t):
print("You won!")
wait(1)
for hero in heros:
hero.exp += 100
print(f"{hero.name} got 100 exp!")
wait(0.5)
while True:
if hero.exp >= hero.limit:
hero.level += 1
hero.exp -= hero.limit
hero.limit = round(hero.limit * 1.75)
wait(0.5)
print(f"{hero.name} leveled up to level {hero.level}! {hero.exp} left!")
else:
break
else:
print("You lose.")
else:
if round_max is None:
print("ERROR: ROUND MAX NOT DEFINED")
return
if all(t):
print(f"You won round {round}!")
wait(0.5)
if round < 3:
print(f"{3 - round} round(s) left.")
elif round <= 0 or round >= 4:
raise InvalidInputError("Round Number Invalid")
else:
print("You Win!")
else:
print("You lose.")