I didn’t do anything to trigger it. I just hit an enemy with the t5 hammer. The weapon was not cursed. This is most certainly a game breaking bug.

Edit: this is Experienced Pixel Dungeon