Clean up last reference and finish nuking floatfloor. One less method! (ouch my test!)

This commit is contained in:
Ebag333
2017-02-24 17:07:05 -08:00
parent 3411eca1e7
commit c24798ad2f
3 changed files with 3 additions and 35 deletions

View File

@@ -1,31 +0,0 @@
# ===============================================================================
# Copyright (C) 2010 Anton Vorobyov
#
# This file is part of eos.
#
# eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# eos is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
import decimal
def floorFloat(value):
"""Round float down to integer"""
# We have to convert float to str to keep compatibility with
# decimal module in python 2.6
value = str(value)
# Do the conversions for proper rounding down, avoiding float
# representation errors
result = int(decimal.Decimal(value).to_integral_value(rounding=decimal.ROUND_DOWN))
return result

View File

@@ -1159,8 +1159,8 @@ class Fit(object):
@property
def remoteReps(self):
force_recalc = False
for remoterep_type in self.__remoteReps:
if self.__remoteReps[remoterep_type] is None:
for remote_type in self.__remoteReps:
if self.__remoteReps[remote_type] is None:
force_recalc = True
break

View File

@@ -25,7 +25,6 @@ from math import floor
import eos.db
from eos.effectHandlerHelpers import HandledItem, HandledCharge
from eos.enum import Enum
from eos.mathUtils import floorFloat
from eos.modifiedAttributeDict import ModifiedAttributeDict, ItemAttrShortcut, ChargeAttrShortcut
from eos.saveddata.citadel import Citadel
@@ -233,7 +232,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
chance = self.getModifiedChargeAttr("crystalVolatilityChance")
damage = self.getModifiedChargeAttr("crystalVolatilityDamage")
crystals = self.numCharges
numShots = floorFloat(float(crystals * hp) / (damage * chance))
numShots = floor((crystals * hp) / (damage * chance))
else:
# Set 0 (infinite) for permanent crystals like t1 laser crystals
numShots = 0