Slaying is sloppy in that it uses strstr. This, an item that has 'slaying giant' (like holyword of mostrai) will kill ants. strstr matching was most likely added to support comma seperated slaying lists (slaying demon,undead). However, the code should really insist on exact matching, and if necessarybreak apart the comma seperated list. Probably best to make something like a 'does_slay()' function which can be used all over the place (consistent behaviour is a good thing). If performance for this becomes an issue, making a slaying a set of pointers could be done (char **slaying), and it gets filled in at load time, and at save time, gets filled in the opposite direction. However, from a simple basis, a check in does_slay() can be done to see if slaying does contain a comma, and if not, just do simple strcmp, and only if it does does extra work need to be done. MSW 2003-03-28
(Is this actually [still] true? It looks like the code still uses strstr, but goes off of “race” rather than “name” - so “slaying giant” shouldn't affect ants [race: insect]. So long as the “race” names used throughout the arches are appropriate and carefully chosen this should work fine…and allow a hypothetical “firehose” spell having “slaying: fire” to affect any race with “fire” in it e.g. “fire elemental”- and “race” ends up being usable as glorified keywords? I think?) Epicanis 20070527
Actually it is still the case. hit_player_attacktype (attack.c:1229) still compares to the name of the archetype, thus there can be issues. Also, it would be nice to have one central test location, so for instance multiple slaying can be implemented. — Ryo Saeba 2007/05/29 15:22