The attached images show the vanilla functions. My proposed solution is written in the code block below.
Problem 1:
See attached image. The getActionPointCost()
function of skill.nut does not take into account the AP cost increase due to the character’s properties.AdditionalActionPointCost. The isAffordable()
function of skill.nut on the other hand calls getActionPointCost()
and then adds the character’s properties.AdditionalActionPointCost to the cost to determine if the skill is affordable.
This leads to the issue when the properties.AdditionalActionPointCost is modified, making the skill not affordable, but the UI and the skill’s AP cost in the tooltip is not updated to reflect the new AP cost!
Problem 2:
See attached image. While the isAffordable()
function adds the AdditionalActionPoint cost from character properties, other such functions such as isAffordableBasedOnAP()
and isAffordablePreview()
and isAffordableBasedOnAPPreview()
don’t. This is inconsistent and probably an oversight.
Solution:
Change the getActionPointCost()
function to the following to include the AdditionalActionPointCost character property. And remove the addition of this.getContainer().getActor().getCurrentProperties().AdditionalActionPointCost()
in the isAffordable()
function.
function getActionPointCost()
{
if (this.m.Container.getActor().getCurrentProperties().IsSkillUseFree)
{
return 0;
}
else if (this.m.Container.getActor().getCurrentProperties().IsSkillUseHalfCost)
{
return this.Math.max(1, this.Math.floor((this.m.ActionPointCost + this.getContainer().getActor().getCurrentProperties().AdditionalActionPointCost) / 2));
}
else
{
return this.m.ActionPointCost + this.getContainer().getActor().getCurrentProperties().AdditionalActionPointCost;
}
}
function isAffordable()
{
return this.getActionPointCost() <= this.m.Container.getActor().getActionPoints() && this.getFatigueCost() + this.m.Container.getActor().getFatigue() <= this.m.Container.getActor().getFatigueMax();
}