NSMonster: Fix oversight where targets would get overriden by AlertNearby()
Make it so Pain() has a random chance to change targets.
This commit is contained in:
parent
3fc7c477f0
commit
7ce222007c
1 changed files with 6 additions and 1 deletions
|
@ -160,6 +160,11 @@ NSMonster::AlertNearby(void)
|
|||
|
||||
//dprint(sprintf("Alert! %s get %s\n", w.classname, m_eEnemy.classname));
|
||||
NSMonster f = (NSMonster)w;
|
||||
|
||||
/* we shouldn't override this when they already got a target */
|
||||
if (f.m_eEnemy != __NULL__)
|
||||
continue;
|
||||
|
||||
f.m_eEnemy = m_eEnemy;
|
||||
}
|
||||
}
|
||||
|
@ -619,7 +624,7 @@ NSMonster::touch(void)
|
|||
void
|
||||
NSMonster::Pain(void)
|
||||
{
|
||||
if (!m_eEnemy)
|
||||
if (!m_eEnemy || (random() < 0.5))
|
||||
m_eEnemy = g_dmg_eAttacker;
|
||||
|
||||
AlertNearby();
|
||||
|
|
Loading…
Reference in a new issue