Support Python 3.12

Python 3.12 no longer supports using non-integer values as arguments for
random functions (see [Changes in the Python API for 3.12][0]). This PR
casts `CONST_RARITY_MAX` to an integer to prevent a `TypeError` from
being raised.

[0]: https://docs.python.org/3/whatsnew/3.12.html#changes-in-the-python-api
pull/53/head
Noelle Leigh 2024-03-03 17:20:32 -05:00
parent ad0d78e133
commit c6aed375da
1 changed files with 1 additions and 1 deletions

View File

@ -164,7 +164,7 @@ class Plant:
def rarity_check(self): def rarity_check(self):
# 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,int(CONST_RARITY_MAX))
common_range = round((2.0/3)*CONST_RARITY_MAX) common_range = round((2.0/3)*CONST_RARITY_MAX)
uncommon_range = round((2.0/3)*(CONST_RARITY_MAX-common_range)) uncommon_range = round((2.0/3)*(CONST_RARITY_MAX-common_range))
rare_range = round((2.0/3)*(CONST_RARITY_MAX-common_range-uncommon_range)) rare_range = round((2.0/3)*(CONST_RARITY_MAX-common_range-uncommon_range))