Jan-02-2024, 09:56 AM
You should post your code. I'm don't really understand what you are asking for. Something like this maybe?
def damage_calc(damage, prev_damage): return max(prev_damage / 2, min(prev_damage * 2, damage)) print(damage_calc(220, 100)) print(damage_calc(25, 100)) print(damage_calc(75, 100))
Output:200
50.0
75
This code clips the damage value to be in the range prev_damage / 2 to prev_damage * 2.