From c6aed375da38beca9b493317e8f7f8f8f01c2da2 Mon Sep 17 00:00:00 2001 From: Noelle Leigh Date: Sun, 3 Mar 2024 17:20:32 -0500 Subject: [PATCH] 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 --- plant.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plant.py b/plant.py index 9375bdb..420d701 100644 --- a/plant.py +++ b/plant.py @@ -164,7 +164,7 @@ class Plant: def rarity_check(self): # Generate plant rarity 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) uncommon_range = round((2.0/3)*(CONST_RARITY_MAX-common_range)) rare_range = round((2.0/3)*(CONST_RARITY_MAX-common_range-uncommon_range))