multiple attributes being affected at once
<p>When I change the <code>stats.hp</code> or <code>base_stats.hp</code> value for the <code>Creature</code> class, it always sets <strong>both</strong> values at once, which is a problem because it means I cannot reset the creature's hp to it's base value. Here's some of the code that deals with this</p>

<pre><code>class Stats:

    def __init__ (self,hp,height,strength,speed,skill,agility,perception):
        x = random.randint(-2,2)
        self.hp = hp+x
        x = random.randint(-10,10)
        self.height = height+x
        x = random.randint(-2,2)
        self.strength = strength+x
        x = random.randint(-2,2)
        self.speed = speed+x
        x = random.randint(-1,1)
        self.skill = skill+x
        x = random.randint(-2,2)
        self.agility = agility+x
        x = random.randint(-2,2)
        self.perception = perception+x

class Creature:

    def __init__ (self,name,stats,top_image,side_image):
        self.name = name
        self.base_stats = stats
        self.stats = stats
        # More code here for rest of attributes
</code></pre>

<p>Maybe the problem is because the <code>Creature.stats</code> and <code>Creature.base_stats</code> are referencing the same <code>stats</code> variable?</p>

<p>(edit)</p>

<p>The <code>stats</code> referenced in the <code>__init__</code> of the Creature class is a <code>Stats</code> object</p>

<p>Yes. They reference the same object. You could use <a href="https://docs.python.org/2/library/copy.html" rel="nofollow">copy</a>, instead.</p>

<pre><code>from copy import copy
self.base_stats = copy(stats)
self.stats = copy(stats)
</code></pre>

python class