chaostrom wrote
Hmm, if that's possible, do you think you can tie in the hostiles going for equipment to their int stat as well?
they partially are: i'm limiting their LOS.
// do not go too far away
int range = Max(1, GetLOSRange());
const int IntStat = GetAttribute(INTELLIGENCE);
if (IntStat < 5) range = Min(range, 2); // kobolds! ;-)
else if (IntStat < 10) range = Min(range, 4);
else if (IntStat < 14) range = Min(range, 6);
else if (IntStat < 16) range = Min(range, 7);
else if (IntStat < 20) range = Min(range, 8);
else if (IntStat < 22) range = Min(range, 11);
else range = Min(range, 14);
this is basically as much as i can do with the current code. this is because the code itself is quite dumb: the monster re-evaluates everything on each turn, completely from the scratch. so it have to select the best equipment, otherwise poor thing will endlessly oscillate between several items.
i got this bug with dark mage, lol: it's AI doesn't include call to check items on the ground, so it cannot wield things. but finder AI didn't know about it, and forces the mage to go to the sword. as monster position itself is not checked, the mage was dancing around the sword, unable to pick it up.
i just wanted to make the code work first, so it's quite simple. i will prolly make it more advanced later: the monsters will remember what they've seen, prioritize selections, pick unfit weapons sometimes because they look cool, and such. here Int will play a much bigger role.
p.s.: of course, i'd like to hear other ideas too. if you're interested, the algorithm by which the monster selects what it wants to wield is very simple: wield the thing, simulate the fight with the player, select the thing which allows us to last longer/kill faster. i.e. the good old danger level calculation. some monsters have hard-coded weapon preferences (mistresses will only use whips, for example), but that's all. of course, monster weapon skills matters too — due to combat simulation, the monster will choose the weapon it is more skilled with.
this prolly could be extended a little. maybe some monsters can always prefer some weapons over others. hate some weapons. prefer/hate materials. and such.
p.p.s.: ah. i also made the monsters to not pick up amulet of life saving, because it cannot be taken from the dead body.

rings of teleport and polymorph are ignored too, unless the monster have a way to control their effects.
also, another fun bug from the first draft of the code. the monster physically wield the thing to simulate the fight. i.e. the code takes the thing, equips the monster, runs the simulation, and puts the thing back. which was using monster coordinates to select the square to drop the thing. yeah, the mistress teleported out half of the shop this way, and nobody noticed.