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
pull/37/head
J.M. de Jong 2021-01-23 14:30:31 +01:00 committed by GitHub
parent f243391418
commit 85d51f40f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -174,10 +174,10 @@ class Plant(object):
# Generate plant rarity # Generate plant rarity
CONST_RARITY_MAX = 256.0 CONST_RARITY_MAX = 256.0
rare_seed = random.randint(1,CONST_RARITY_MAX) rare_seed = random.randint(1,CONST_RARITY_MAX)
common_range = round((2/3)*CONST_RARITY_MAX) common_range = round((2.0/3)*CONST_RARITY_MAX)
uncommon_range = round((2/3)*(CONST_RARITY_MAX-common_range)) uncommon_range = round((2.0/3)*(CONST_RARITY_MAX-common_range))
rare_range = round((2/3)*(CONST_RARITY_MAX-common_range-uncommon_range)) rare_range = round((2.0/3)*(CONST_RARITY_MAX-common_range-uncommon_range))
legendary_range = round((2/3)*(CONST_RARITY_MAX-common_range-uncommon_range-rare_range)) legendary_range = round((2.0/3)*(CONST_RARITY_MAX-common_range-uncommon_range-rare_range))
common_max = common_range common_max = common_range
uncommon_max = common_max + uncommon_range uncommon_max = common_max + uncommon_range