Talk:Mind flayer

Mind Flayer AI
As this discussion has application in four articles, I want to post it here and give some time before making changes.

First off, regarding just this creature: "In combat, a mind flayer prefers spellcasting (by 30, for those who work with AI scripts)" This information is used by the script (increasing nMagic by 30) but in practice has no effect, (nMagic is already 55 + HD + Random(10), all criteria for setting this value lower or decreasing it are not satisfied by the mindflayer creature, and nMagic is only checked for being greater than 50 or for being greater than 0). "and is flagged to use a more randomized spell selection than other creatures might." This is only called in x0_i0_talent under the command GetCreatureTalent (which is in only place nw_i0_generic ever accesses the command GetCreatureTalentBest). GetCreatureTalent can only be called in two different ways, one by which GetCreatureTalentRandom is always used, and the other where GetCreatureTalentBest is used by default, but is overridden to GetCreatureTalentRandom in the presence of the variable on the mindflayer). As the talent category is never checked, this potentially randomizes more than just spells (as hard-coded feats can also belong), and ensures that nw_i0_generic never uses GetCreatureTalentBest.  However, mindflayer abilities are scattered throughout many of the talent categories (e.g. mass concussion is 1, the charm monster is 2, inertial barrier is 13, and the mindblasts are both 11) so the only spells that this randomizes amongst each other are the mind blasts.

Now for the things that pertain to all four using the scripted AI. As this information seems to be spread across four articles without too many of them being synchronized I am blockquoting with the article that it came from identified at the beginning. "Mind flayer: If in combat with a creature of a playable race who is neither petrified nor polymorphed, but is stunned or paralyzed, then the mind flayer will move to be 1.5 meters from that creature and use its extract brain ability." Daze is also considered as reflected in the alhoon article. "Alhoon: If the target is dazed, an alhoon will perform an extract brain attack 9% of the time, a psionic mind blast that does not count against the daily limit 21% of the time, and use normal attacks the remaining 70% of the time." The 9% and 21% are a result of performing the check twice (likely the intended behavior was to check once and use extract brain 30% of the time and not use the psionic mind blast). "Mind flayer: (If the target becomes polymorphed or loses the debilitating condition before the mind flayer is in position, it will use a psionic mind blast that does not count against the daily limit instead of extracting the brain.)" This is not the case because the condition is carried out after the action is queued but before it takes place. As there is no delay command used here the second check is done at the same time as the first. "Mind flayer: There are a few quirks (bugs) associated with this. First, a creature of the Tiefling subrace (case sensitive) is considered a playable race and is considered stunned/paralyzed. (This was probably an attempt to account for Valen Shadowbreath in the Hordes of the Underdark campaign, but not intended to bypass the stunned/paralyzed check.) Second, a creature subject to a spell failure effect (not from equipment) is considered stunned/paralyzed by mind flayers. (Instead of spell failure, the intent was to detect the visual effect associated with being paralyzed, but this was incorrectly implemented.)" For the Tiefling subrace the mindflayer is scheduled to perform the psionic mind blast which does not consume uses (unless the tiefling is already afflicted by one of the extract brain conditions, in which case it will use extract brain (or if dazed 70% psionic mind blast 30% extract brain). The rest is correct, and should cover all the obvious bases.  There are non-obvious ones (like the mind flayer ignores creatures scheduled to bash at a door for its special AI attack). WhiZard 00:34, November 28, 2011 (UTC)