adonutwithsprinklez / CodenameEmpty

A text based adventure roguelite
GNU General Public License v3.0
6 stars 0 forks source link

"A Missing Item" Event crashes upon generating sword #116

Closed adonutwithsprinklez closed 2 years ago

adonutwithsprinklez commented 2 years ago

When the event "A Missing Item" gives the player a sword, the game crashes due to an issue when setting its name.

Error log below:

Working on backlog...
A Missing Item
['say', 'You think to yourself that you might as well take whatever it is that someone left behind.']
['goto', ['#success', '#fail']]
['say', 'You dig the item up. Excitedly you pick it up and examine it, revealing an iron sword.']
['give', 'weapon_ironSword', 1]
Traceback (most recent call last):
  File "D:\Google Drive\CodeNameEmpty-NightlyDev\CodeNameEmpty\src\main.py", line 124, in <module>
    startApplication()
  File "D:\Google Drive\CodeNameEmpty-NightlyDev\CodeNameEmpty\src\main.py", line 99, in startApplication
    startGame(game)
  File "D:\Google Drive\CodeNameEmpty-NightlyDev\CodeNameEmpty\src\main.py", line 31, in startGame
    game.reactCurrentArea()
  File "D:\Google Drive\CodeNameEmpty-NightlyDev\CodeNameEmpty\src\gameClass.py", line 315, in reactCurrentArea
    result = self.currentArea.event.giveItem(action[1], action[2], self.player,
  File "D:\Google Drive\CodeNameEmpty-NightlyDev\CodeNameEmpty\src\eventClass.py", line 86, in giveItem
    player.inv.append(copy.copy(generateWeapon(weapons[itemId])), modifiers)
  File "D:\Google Drive\CodeNameEmpty-NightlyDev\CodeNameEmpty\src\itemGeneration.py", line 10, in generateWeapon
    newWeapon = Weapon(data, modifiers)
  File "D:\Google Drive\CodeNameEmpty-NightlyDev\CodeNameEmpty\src\weaponClass.py", line 50, in __init__
    newMod = modifiers[newMod[0]].getInfo()
TypeError: 'NoneType' object is not subscriptable
adonutwithsprinklez commented 2 years ago

Line 86 in eventClass.py is player.inv.append(copy.copy(generateWeapon(weapons[itemId])), modifiers). This is causing the error and should be corrected to player.inv.append(copy.copy(generateWeapon(weapons[itemId], modifiers))).

adonutwithsprinklez commented 2 years ago

Fixed in commit 22.08.22