changeset 507:507d446dc6cf

Divide the damages inflicted by the number of players.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 17 Nov 2013 17:36:47 +0100
parents 08d9e6730364
children 1bc014f9d572
files pytouhou/game/enemy.pyx
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/game/enemy.pyx
+++ b/pytouhou/game/enemy.pyx
@@ -396,6 +396,13 @@ cdef class Enemy(Element):
                 else:
                     damages //= 7
 
+            nb_players = len(self._game.players)
+            if nb_players > 1:
+                if damages <= nb_players:
+                    damages = 1 if damages else 0
+                else:
+                    damages //= nb_players
+
             # Apply damages
             self.life -= damages