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 usedpull/37/head
parent
f243391418
commit
85d51f40f5
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue