aikaterna / gobcog

RPG Adventure Cog for Red v3
44 stars 69 forks source link

[Bug] divide by zero errors in console #376

Closed KingPin closed 2 years ago

KingPin commented 2 years ago

Complete these first

Expected Behavior

no division by zero errors

Current Behavior

Adventure version: 3.5.3 getting a "ZeroDivisionError: division by zero" error in the following two locations :

File "/data/cogs/CogManager/cogs/adventure/adventure.py", line 1668, in _result
  round((diplomacy / dipl) * 0.25),

and

hp = int(session.monster_modified_stats["hp"] * self.ATTRIBS[challenge_attrib][0] * session.monster_stats), line 1258

Traceback (most recent call last):
File "/data/cogs/CogManager/cogs/adventure/adventure.py", line 553, in _adventure
  reward, participants = await self._simple(ctx, adventure_msg, challenge)
File "/data/cogs/CogManager/cogs/adventure/adventure.py", line 888, in _simple
  await self._choice(ctx, adventure_msg)
File "/data/cogs/CogManager/cogs/adventure/adventure.py", line 996, in _choice
  return await self._result(ctx, adventure_msg)
File "/data/cogs/CogManager/cogs/adventure/adventure.py", line 1668, in _result
  round((diplomacy / dipl) * 0.25),
ZeroDivisionError: division by zero

Possible Solution

Steps to Reproduce

  1. this happens in the course of regular adventure games via [p]a

Context (Environment)

Detailed Description

Possible Implementation

DJTOMATO commented 2 years ago

I've solved this by making monsters not having less than 200 hp/dipl in my custom theme, not the best approach but works.