How can i modify a copy of a class without the original class being changed as well?
when i have a class like this:
class enemymob:
def __init__(self, name, level, damage, health, maxhealth, armour):
self.name = name
self.level = level
self.damage = damage
self.health = health
self.maxhealth = maxhealth
self.armour = armour
Goblin = enemymob("Goblin", 1, 10, 50, 50, 5)
and then i set enemy = Goblin:
enemy = Goblin
when i modify the value of the enemy, it also changes the value of the instance goblin as well. But for my code i need the instance Goblin's values to stay the same, and only change the value for it's copy, the enemy. How can i do that?
enemy.damage += 100
print(enemy.damage)
print(Goblin.damage)
110
110
Process exited with code: 0