From 2375c38a19ab87a95dc18596527b01f09e2f71c5 Mon Sep 17 00:00:00 2001 From: nhydock Date: Mon, 26 Sep 2011 09:10:59 -0400 Subject: [PATCH] Keep maximum and minimum values that can be added/subtracted from the rock so plu/minGain doesn't exceed the value limit --- src/Scorekeeper.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Scorekeeper.py b/src/Scorekeeper.py index b52df8741..5bde46536 100644 --- a/src/Scorekeeper.py +++ b/src/Scorekeeper.py @@ -322,8 +322,10 @@ def getScoreMultiplier(self): _rockLo = _rockMax/3.0 _multHi = 4 _multBassHi = 6 -_minBase = 400 +_minBase = 400.0 +_minMax = 900.0 _pluBase = 15 +_pluMax = 750.0 _minGain = 2 _pluGain = 7 @@ -335,7 +337,6 @@ def __init__(self, instrument, coOp = None, battle = None): self.percentage = .5 self.failing = False #is the player failing self.inGreen = False #is the player in the top percentile - self.player = player #player/instrument this rockmeter belongs to self.coOp = coOp #co-op type self.battle = battle #battle self.minusRock = _minBase #amount of rock to subtract when decreasing @@ -356,7 +357,7 @@ def start(self): def increaseRock(self, vScore = 0): if not self.coOp: - if self.player.isVocal: + if self.instrument.isVocal: rockPlusAmt = 500 + (500 * (vScore-2)) self.rock += rockPlusAmt return @@ -364,8 +365,8 @@ def increaseRock(self, vScore = 0): if self.instrument.isDrum: self.drumStart = True - self.plusRock += _pluGain*self.mult - self.rock += self.plusRock*self.mult + self.plusRock = min(self.plusRock + _pluGain*self.mult, _pluMax) + self.rock += self.plusRock self.minusRock = _minBase @@ -375,7 +376,7 @@ def decreaseRock(self, more = False, less = False, vScore = 0): rockMinusAmount = 0 if not self.coOp: - if self.player.isVocal: + if self.instrument.isVocal: rockMinusAmount = 500 * (3 - vScore) self.rock -= rockMinusAmount return @@ -413,7 +414,7 @@ def run(self): if not self.coOp: multMax = _multHi - if self.player.isBassGuitar: + if self.instrument.isBassGuitar: multMax = _multBassHi else: multMax = _multHi