Ticket #3606: Health.js.patch

File Health.js.patch, 573 bytes (added by Matthew Guttag, 8 years ago)

This patch changes the health regen to only work on idle units, I am unsure if this is correct or if the description of the technology to only work on idle units is incorrect.

  • Health.js

     
    114114
    115115Health.prototype.ExecuteRegeneration = function()
    116116{
    117     var regen = this.GetRegenRate();
    118     if (regen > 0)
    119         this.Increase(regen);
    120     else
    121         this.Reduce(-regen);
     117    let regen = this.GetRegenRate();
     118    let cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
     119    if (cmpUnitAI && cmpUnitAI.IsIdle())
     120    {
     121        if (regen > 0)
     122            this.Increase(regen);
     123        else
     124            this.Reduce(-regen);
     125    }
    122126};
    123127
    124128/*