jmbjr / dungeoneer

1 stars 2 forks source link

crash: haven't been able to reproduce yet. related to enemies using items: #28

Open jmbjr opened 11 years ago

jmbjr commented 11 years ago

error coming from class BasicMonster(object), def take_turn

        if monster.fighter.inventory:
            #get random item from inv
            index = libtcod.random_get_int(0, 0, len(monster.fighter.inventory)-1)
            item = monster.fighter.inventory[index].item
            #item = monster.fighter.inventory[0].item
            useditem = item.use(Game, user=monster)
            print useditem + ': ' + monster.name + ' used ' + item.owner.name

one of the objects, monster.name or item.owner.name, is NoneType. need to spend some time to figure this one out

jmbjr commented 11 years ago

I put a stupid "try" command here and I it fails, the code keeps running

I probably should dig into this better later

Probably related to the sketchy way I deal with dead entities

Probably due to them dying and losing their inventory, then the code trying to do something with the inv that they've lost