@Steven it seems to me like you are just subtracting the power levels directly. IMO that makes things too straightforward and boring.
A way to respect power levels but still add a random element, is to generate random numbers for both of them as their attack, then subtract the random numbers from the power levels until one of them dies. So the power levels would basically be HP.
This means even people at lower power levels can defeat those at higher power levels.
So you could generate a random number between 0 and 100,000 (if needed I could also use their power levels to determine their maximum attack).
Suppose we had two characters James (850,000) and John (400,000).
I wrote a small Python script to simulate a battle between two characters.
Python:
import random
from dataclasses import dataclass
@dataclass
class Character:
power: int
name: str
def battle(chars):
attacks = [0, 0]
while True:
attacks = (random.randint(0, 1e5), random.randint(0, 1e5))
chars[0].power -= attacks[1]
chars[1].power -= attacks[0]
if (min(chars, key=lambda x: x.power)).power <= 0:
break
print(f"{chars[0].name} has {chars[0].power} power left!\n")
print(f"{chars[1].name} has {chars[1].power} power left!\n")
john = Character(name="John", power=850000) # The first character.
james = Character(name="James", power=400000) # The second character.
battle([john, james])
If you want to use my code, just change the definitions of
john
and
james
to the names and powers you actually want.
Here's a screenshot of it running:
I think this would lead to more exciting battles than just subtracting power levels directly.
I can write a script for more interesting battle scenarios if you want. Just tell me how you want it to be calculated, and I would write the script.
What do you guys think?