Improved flee AI.
This commit is contained in:
parent
749b600471
commit
9d443b9ee8
@ -10398,25 +10398,23 @@ Vector positionOffsetForShipInRotationToAlignment(ShipEntity* ship, Quaternion q
|
||||
jink.x = (ranrot_rand() % 256) - 128.0;
|
||||
jink.y = (ranrot_rand() % 256) - 128.0;
|
||||
jink.z = z;
|
||||
if (accuracy >= COMBAT_AI_IS_SMART)
|
||||
|
||||
// make sure we don't accidentally have near-zero jink
|
||||
if (jink.x < 0.0)
|
||||
{
|
||||
// make sure we don't accidentally have near-zero jink
|
||||
if (jink.x < 0.0)
|
||||
{
|
||||
jink.x -= 128.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
jink.x += 128.0;
|
||||
}
|
||||
if (jink.y < 0)
|
||||
{
|
||||
jink.y -= 128.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
jink.y += 128.0;
|
||||
}
|
||||
jink.x -= 128.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
jink.x += 128.0;
|
||||
}
|
||||
if (jink.y < 0)
|
||||
{
|
||||
jink.y -= 128.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
jink.y += 128.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -417,6 +417,14 @@
|
||||
behaviour = BEHAVIOUR_FLEE_TARGET;
|
||||
[self setEvasiveJink:400.0];
|
||||
frustration = 0.0;
|
||||
if (accuracy > COMBAT_AI_ISNT_AWFUL)
|
||||
{
|
||||
// alert! they've got us in their sights! react!!
|
||||
if ([self approachAspectToPrimaryTarget] > 0.9995)
|
||||
{
|
||||
behaviour = randf() < 0.15 ? BEHAVIOUR_EVASIVE_ACTION : BEHAVIOUR_FLEE_EVASIVE_ACTION;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user