Topic: Potential logic error in getFatigueCost() of actor.nut

  • Author
    Posts
  • #27836
    lordmidas
    Participant

    In the “else” block of the getFatigueCost() function in actor.nut, it checks for this.m.Container whereas the “else” block only runs when this.m.Container is null. This can potentially throw an error if the code ever gets to the else block.

    function getFatigueCost()
    {
        if (this.m.Container != null)
        {
            return this.Math.max(0, this.Math.round(this.Math.ceil(this.m.FatigueCost * this.m.FatigueCostMult * this.m.Container.getActor().getCurrentProperties().FatigueEffectMult) + this.m.Container.getActor().getCurrentProperties().FatigueOnSkillUse));
        }
        else
        {
            return this.Math.ceil(this.m.FatigueCost * this.m.Container.getActor().getCurrentProperties().FatigueEffectMult);
        }
    }

    The “else” block should probably only return this.m.FatigueCost.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.