Bale
Minion
Now that we have integer IDs for most monsters, could we have a function that converts an int to a monster?
Obvious application is if you are scanning through the monster manuel and you see that a monster has ID 468, it would be helpful to convert that to a monster. Right now the only way to do this is to iterate over the set of all monsters in KoLmafia...
Sure that would work, but it seems like a bit much for what I believe should be a basic KoLmafia function.
Actually, since missingManuel would do this many hundreds of times, it would definitely be more efficient to do that like this:
In that example, the function is quite optional since the map could be accessed directly, but I wanted to include it for clarity.
Obvious application is if you are scanning through the monster manuel and you see that a monster has ID 468, it would be helpful to convert that to a monster. Right now the only way to do this is to iterate over the set of all monsters in KoLmafia...
Code:
monster to_monster(int id) {
foreach mob in $monsters[mob]
if(mob.id == id)
return id;
return id;
}
Sure that would work, but it seems like a bit much for what I believe should be a basic KoLmafia function.
Actually, since missingManuel would do this many hundreds of times, it would definitely be more efficient to do that like this:
Code:
static {
monster [int] mon_id;
foreach mob in $monsters[]
mon_id[ mob.id ] = mob;
}
monster to_monster(int id) {
return mon_id[ id ];
}
In that example, the function is quite optional since the map could be accessed directly, but I wanted to include it for clarity.