1
0
forked from 0ad/0ad

Prevent healers from healing themselves.

This was SVN commit r12398.
This commit is contained in:
Deiz 2012-08-13 02:56:51 +00:00
parent 61cf6a6040
commit 8c97458de7
2 changed files with 11 additions and 0 deletions

View File

@ -347,6 +347,10 @@ function getActionInfo(action, target)
// The check if the target is unhealable is done by targetState.needsHeal // The check if the target is unhealable is done by targetState.needsHeal
if (entState.Healer && hasClass(targetState, "Unit") && targetState.needsHeal && (playerOwned || allyOwned)) if (entState.Healer && hasClass(targetState, "Unit") && targetState.needsHeal && (playerOwned || allyOwned))
{ {
// Healers can't heal themselves.
if (entState.id == targetState.id)
return {"possible": false};
var unhealableClasses = entState.Healer.unhealableClasses; var unhealableClasses = entState.Healer.unhealableClasses;
for each (var unitClass in targetState.identity.classes) for each (var unitClass in targetState.identity.classes)
{ {

View File

@ -333,6 +333,13 @@ var UnitFsmSpec = {
return; return;
} }
// Healers can't heal themselves.
if (this.order.data.target == this.entity)
{
this.FinishOrder();
return;
}
// Check if the target is in range // Check if the target is in range
if (this.CheckTargetRange(this.order.data.target, IID_Heal)) if (this.CheckTargetRange(this.order.data.target, IID_Heal))
{ {