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:
parent
21a70c0399
commit
25de88a68b
@ -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
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user