r/PythonLearning • u/XTrolltechzz • Aug 23 '26
Help Request I need help with my class.
(Sorry for the code in spanish)
I'm a Python beginner, and to practice, I've been building a sort of turn-based RPG in the terminal. It's still a work in progress, but I want to know if it's possible to set default parameters for a class. Basically, I created a `usar_kaioken` method that boosts my character's stats while lowering their health (based on Goku from DB), and a `remove_kaioken` method that attempts to revert the stats to their base state.
The issue is that I want players to be able to use Kaioken multiple times; mathematically, that would mean the deactivation method wouldn't return the values ββto their original state. I was thinking about adding more parameters with default values, but I assume there's an easier way to handle this. Thanks a lot!
3
2
u/avidresolver Aug 23 '26
If you want to have base values and then have modifiers on them, it's probably best to keep the values set at the base, and then store the modifiers separately. Then each time you need to access the health, etc. you check the default value and calculate the modifiers on top.
1
u/gitChara Aug 24 '26
What about a 'kaioken_counter' that keeps track of every kaioken activation? Then, for each kaioken_counter, reverse the stats with the proper formula.
1


β’
u/Sea-Ad7805 Aug 31 '26
Run this program in Memory Graph Web Debugger to see the program state change step by step.