prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Functional Test 1 - Effect expiry 
  We want to check that the effect can expire. This would be as follows:
  
  Place an avatar on the map in one of the cells.
  Place a pickup somewhere.
  Make a move in some direction, towards the pickup.
  Call `avatar.pickup.effect.onturn()` 10 times until the effect expires.
  Make sure that the avatar holds *no effect* (not pickup!).
  
  </issue>
  <code>
  [start of aimmo-game/simulation/effects.py]
  1 from abc import ABCMeta, abstractmethod
  2 
  3 import math
  4 
  5 import sys
  6 
  7 
  8 class _Effect(object):
  9     __metaclass__ = ABCMeta
  10 
  11     def __init__(self, avatar):
  12         self._avatar = avatar
  13         self.is_expired = False
  14 
  15     @abstractmethod
  16     def on_turn(self):
  17         raise NotImplementedError()
  18 
  19 
  20 class _TimedEffect(_Effect):
  21     __metaclass__ = ABCMeta
  22     EFFECT_TIME = 10
  23 
  24     def __init__(self, *args):
  25         super(_TimedEffect, self).__init__(*args)
  26         self._time_remaining = self.EFFECT_TIME
  27 
  28     def remove(self):
  29         try:
  30             self._avatar.effects.remove(self)
  31         except KeyError as e:
  32             raise KeyError("The avatar object does not exist! Cannot remove the effect.")
  33 
  34     def on_turn(self):
  35         self._time_remaining -= 1
  36         if self._time_remaining <= 0:
  37             self.is_expired = True
  38 
  39 
  40 class InvulnerabilityPickupEffect(_TimedEffect):
  41     def __init__(self, *args):
  42         super(InvulnerabilityPickupEffect, self).__init__(*args)
  43         self._avatar.resistance += 1000
  44 
  45     def remove(self):
  46         super(InvulnerabilityPickupEffect, self).remove()
  47         self._avatar.resistance -= 1000
  48 
  49 
  50 class DamageBoostPickupEffect(_TimedEffect):
  51     def __init__(self, damage_boost, *args):
  52         # For now we have no maximum damage boost constraints, so infinity needs to be casted into a max int.
  53         if math.isinf(damage_boost):
  54             damage_boost = sys.maxsize
  55 
  56         self._damage_boost = int(round(damage_boost))
  57         super(DamageBoostPickupEffect, self).__init__(*args)
  58         self._avatar.attack_strength += self._damage_boost
  59 
  60     def remove(self):
  61         super(DamageBoostPickupEffect, self).remove()
  62         self._avatar.attack_strength -= self._damage_boost
  63
  [end of aimmo-game/simulation/effects.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/aimmo-game/simulation/effects.py b/aimmo-game/simulation/effects.py
  --- a/aimmo-game/simulation/effects.py
  +++ b/aimmo-game/simulation/effects.py
  @@ -1,9 +1,10 @@
   from abc import ABCMeta, abstractmethod
   
   import math
  -
   import sys
   
  +INVULNERABILITY_RESISTANCE = 1000
  +
   
   class _Effect(object):
       __metaclass__ = ABCMeta
  @@ -40,11 +41,11 @@
   class InvulnerabilityPickupEffect(_TimedEffect):
       def __init__(self, *args):
           super(InvulnerabilityPickupEffect, self).__init__(*args)
  -        self._avatar.resistance += 1000
  +        self._avatar.resistance += INVULNERABILITY_RESISTANCE
   
       def remove(self):
           super(InvulnerabilityPickupEffect, self).remove()
  -        self._avatar.resistance -= 1000
  +        self._avatar.resistance -= INVULNERABILITY_RESISTANCE
   
   
   class DamageBoostPickupEffect(_TimedEffect):
  
verification_info: {"golden_diff": "diff --git a/aimmo-game/simulation/effects.py b/aimmo-game/simulation/effects.py\n--- a/aimmo-game/simulation/effects.py\n+++ b/aimmo-game/simulation/effects.py\n@@ -1,9 +1,10 @@\n from abc import ABCMeta, abstractmethod\n \n import math\n-\n import sys\n \n+INVULNERABILITY_RESISTANCE = 1000\n+\n \n class _Effect(object):\n     __metaclass__ = ABCMeta\n@@ -40,11 +41,11 @@\n class InvulnerabilityPickupEffect(_TimedEffect):\n     def __init__(self, *args):\n         super(InvulnerabilityPickupEffect, self).__init__(*args)\n-        self._avatar.resistance += 1000\n+        self._avatar.resistance += INVULNERABILITY_RESISTANCE\n \n     def remove(self):\n         super(InvulnerabilityPickupEffect, self).remove()\n-        self._avatar.resistance -= 1000\n+        self._avatar.resistance -= INVULNERABILITY_RESISTANCE\n \n \n class DamageBoostPickupEffect(_TimedEffect):\n", "issue": "Functional Test 1 - Effect expiry \nWe want to check that the effect can expire. This would be as follows:\n\nPlace an avatar on the map in one of the cells.\nPlace a pickup somewhere.\nMake a move in some direction, towards the pickup.\nCall `avatar.pickup.effect.onturn()` 10 times until the effect expires.\nMake sure that the avatar holds *no effect* (not pickup!).\n", "before_files": [{"content": "from abc import ABCMeta, abstractmethod\n\nimport math\n\nimport sys\n\n\nclass _Effect(object):\n    __metaclass__ = ABCMeta\n\n    def __init__(self, avatar):\n        self._avatar = avatar\n        self.is_expired = False\n\n    @abstractmethod\n    def on_turn(self):\n        raise NotImplementedError()\n\n\nclass _TimedEffect(_Effect):\n    __metaclass__ = ABCMeta\n    EFFECT_TIME = 10\n\n    def __init__(self, *args):\n        super(_TimedEffect, self).__init__(*args)\n        self._time_remaining = self.EFFECT_TIME\n\n    def remove(self):\n        try:\n            self._avatar.effects.remove(self)\n        except KeyError as e:\n            raise KeyError(\"The avatar object does not exist! Cannot remove the effect.\")\n\n    def on_turn(self):\n        self._time_remaining -= 1\n        if self._time_remaining <= 0:\n            self.is_expired = True\n\n\nclass InvulnerabilityPickupEffect(_TimedEffect):\n    def __init__(self, *args):\n        super(InvulnerabilityPickupEffect, self).__init__(*args)\n        self._avatar.resistance += 1000\n\n    def remove(self):\n        super(InvulnerabilityPickupEffect, self).remove()\n        self._avatar.resistance -= 1000\n\n\nclass DamageBoostPickupEffect(_TimedEffect):\n    def __init__(self, damage_boost, *args):\n        # For now we have no maximum damage boost constraints, so infinity needs to be casted into a max int.\n        if math.isinf(damage_boost):\n            damage_boost = sys.maxsize\n\n        self._damage_boost = int(round(damage_boost))\n        super(DamageBoostPickupEffect, self).__init__(*args)\n        self._avatar.attack_strength += self._damage_boost\n\n    def remove(self):\n        super(DamageBoostPickupEffect, self).remove()\n        self._avatar.attack_strength -= self._damage_boost\n", "path": "aimmo-game/simulation/effects.py"}]}