From aba3284e1d1de6ac32860f66a1fa8a4323b2a0d3 Mon Sep 17 00:00:00 2001 From: Semenar Date: Mon, 19 Aug 2024 02:03:27 +0400 Subject: [PATCH] Fix the division by 0 in Chest Mimic tile if the experience gain is zero If the experience gain is equal to 0 (for instance, by equipping a tiny consolation ribbon without having Testidunal Teachings permed), the Chest Mimic tile still tries to divide the experience needed for the next egg by the experience gain, generating a division by 0 error and crashing the script. Fixed so that if the experience gain is 0 or less, the tile says you cannot get the XP. --- .../TourGuide/Items of the Month/2024/Chest Mimic.ash | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/relay/TourGuide/Items of the Month/2024/Chest Mimic.ash b/Source/relay/TourGuide/Items of the Month/2024/Chest Mimic.ash index 7410713f..e85f85a4 100644 --- a/Source/relay/TourGuide/Items of the Month/2024/Chest Mimic.ash +++ b/Source/relay/TourGuide/Items of the Month/2024/Chest Mimic.ash @@ -9,7 +9,13 @@ void IOTMChestMimicGenerateResource(ChecklistEntry [int] resource_entries) int famExperienceGain = numeric_modifier("familiar experience") + 1; int chestExperience = ($familiar[chest mimic].experience); int famExpNeededForNextEgg = (50 - (chestExperience % 50)); - string fightsForNextEgg = pluralise(ceil(to_float(famExpNeededForNextEgg) / famExperienceGain), "fight", "fights"); + string fightsForNextEgg; + if (famExperienceGain > 0) { + fightsForNextEgg = pluralise(ceil(to_float(famExpNeededForNextEgg) / famExperienceGain), "fight", "fights"); + } + else { + fightsForNextEgg = "cannot get"; + } int mimicEggsLeft = clampi(11 - get_property_int("_mimicEggsObtained"), 0, 11); string [int] description;