changeset 161:c37826d80f2a

plugin tarot: fixed bad score calculation
author Goffi <goffi@goffi.org>
date Fri, 06 Aug 2010 12:11:18 +0800
parents f494cba56a9e
children ae50b53ff868
files plugins/plugin_misc_tarot.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/plugin_misc_tarot.py	Fri Aug 06 12:10:43 2010 +0800
+++ b/plugins/plugin_misc_tarot.py	Fri Aug 06 12:11:18 2010 +0800
@@ -272,7 +272,7 @@
                 bouts.append(card.value)
             score += card.points
         
-        #We now check if there is no bug in score calculation
+        #We we do a basic check on score calculation
         check_score = 0
         defenseurs = game_data['players'][:]
         defenseurs.remove(game_data['attaquant'])
@@ -302,11 +302,12 @@
         elif game_data['contrat'] == 'Garde Contre':
             contrat_mult = 6
         else:
-            error(_('Internal error: contrat not managed (mispelled ?)'))
+            error(_('INTERNAL ERROR: contrat not managed (mispelled ?)'))
+            assert(False)
 
         victory = (score >= point_limit)
-        margin = score - point_limit
-        points_defenseur = (-margin + 25) * contrat_mult
+        margin = abs(score - point_limit)
+        points_defenseur = (margin + 25) * contrat_mult * (-1 if victory else 1)
         winners = []
         loosers = []
         player_score = {}