From 85d51f40f591aff4ee6800491d1d1c8347d315ac Mon Sep 17 00:00:00 2001 From: "J.M. de Jong" Date: Sat, 23 Jan 2021 14:30:31 +0100 Subject: [PATCH] Stop making all plants godly python2 division of integers always results in an integer, so `(2/3)` would result in `0`. This caused all plants to get "godly" as rarity. This change makes sure a float division is being used --- botany.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/botany.py b/botany.py index 6d199c8..63f7046 100755 --- a/botany.py +++ b/botany.py @@ -174,10 +174,10 @@ class Plant(object): # Generate plant rarity CONST_RARITY_MAX = 256.0 rare_seed = random.randint(1,CONST_RARITY_MAX) - common_range = round((2/3)*CONST_RARITY_MAX) - uncommon_range = round((2/3)*(CONST_RARITY_MAX-common_range)) - rare_range = round((2/3)*(CONST_RARITY_MAX-common_range-uncommon_range)) - legendary_range = round((2/3)*(CONST_RARITY_MAX-common_range-uncommon_range-rare_range)) + common_range = round((2.0/3)*CONST_RARITY_MAX) + uncommon_range = round((2.0/3)*(CONST_RARITY_MAX-common_range)) + rare_range = round((2.0/3)*(CONST_RARITY_MAX-common_range-uncommon_range)) + legendary_range = round((2.0/3)*(CONST_RARITY_MAX-common_range-uncommon_range-rare_range)) common_max = common_range uncommon_max = common_max + uncommon_range