Skip to content

Commit

Permalink
refactor: use getActionPointCost and getFatigueCost
Browse files Browse the repository at this point in the history
Instead of comparing preview values. I realized that it is ok to use these functions because they are based on CurrentProperties and we don't mess with that during update functions.
  • Loading branch information
LordMidas committed Apr 19, 2024
1 parent 881d66f commit 30677a7
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions scripts/skills/perks/perk_rf_fresh_and_furious.nut
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ this.perk_rf_fresh_and_furious <- ::inherit("scripts/skills/skill", {
if (this.m.IsSpent || this.m.RequiresRecover)
return;

// Use comparison of PreviewActionPoints vs ActionPoints and PreviewFatigue vs Fatigue to check if _previewedSkill is free to use
// We cannot use _previewedSkill.getActionPointCost() because we are in an update loop and there
// may be changes to the actor after this skill which may cause that function to return different value later
local actor = this.getContainer().getActor();
if (_previewedMovement != null || (actor.getPreviewActionPoints() == actor.getActionPoints() && actor.getPreviewFatigue() == actor.getFatigue()))
if (_previewedMovement != null || (_previewedSkill.getActionPointCost() == 0 && _previewedSkill.getFatigueCost() == 0))
{
foreach (skill in this.getContainer().getAllSkillsOfType(::Const.SkillType.Active))
{
Expand Down

0 comments on commit 30677a7

Please sign in to comment.