1
0
forked from 0ad/0ad

Take distance between attacker and target into account when fleeing. Patch by mimo. Fixes #1723.

This was SVN commit r13077.
This commit is contained in:
leper 2013-01-15 00:21:25 +00:00
parent 21a70c0399
commit 25de88a68b
2 changed files with 4 additions and 3 deletions

View File

@ -306,8 +306,9 @@ var UnitFsmSpec = {
},
"Order.Flee": function(msg) {
// TODO: if we were attacked by a ranged unit, we need to flee much further away
var ok = this.MoveToTargetRangeExplicit(this.order.data.target, +this.template.FleeDistance, -1);
// We use the distance between the enities to account for ranged attacks
var distance = DistanceBetweenEntities(this.entity, this.order.data.target) + (+this.template.FleeDistance);
var ok = this.MoveToTargetRangeExplicit(this.order.data.target, distance, -1);
if (ok)
{
// We've started fleeing from the given target

View File

@ -26,7 +26,7 @@
</ResourceGatherer>
<UnitAI>
<RoamDistance>8.0</RoamDistance>
<FleeDistance>32.0</FleeDistance>
<FleeDistance>24.0</FleeDistance>
<RoamTimeMin>2000</RoamTimeMin>
<RoamTimeMax>8000</RoamTimeMax>
<FeedTimeMin>15000</FeedTimeMin>