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

  • Author
  • #27836
    Avatar photolordmidas

    In the “else” block of the getFatigueCost() function in skill.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));
            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.