![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Dragon20C |
I for the life of me cant add values to a dictionary its absolutely terrible as to why I cant add a simple function, I do dict[New_value] = Number that works fine but when I try to add another one it over writes it, why is it overwriting it, I didnt tell it to do that, why!!!
func calculate_stats(new_value):
level = new_value
stats[hp_max] = ((float(species.Base_hp * level) / 50.0) + 5.0)
stats[attack] = ((float(species.Base_attack * level) / 100.0) + 5.0)
stats[special_attack] = ((float(species.Base_special_attack * level) / 100.0) + 5.0)
stats[defence] = ((float(species.Base_defence * level) / 100.0) + 5.0)
stats[special_defence] = ((float(species.Base_special_defence * level) / 100.0) + 5.0)
stats[speed] = ((float(species.Base_speed * level) / 100.0) + 5.0)
print(stats[hp_max])
print(stats[attack])
print(stats)
Heres a function that I set the values to the dictionary, its doing some damage calculations its doing the calculations correct but its not storing them correctly, I print the dictionay called stats at the end, and it only shows one value, how do I resolve this!!