MZ Visustella Skill Core Adjust HP Costs

I was wondering how would I go about adjusting the HP cost of a skill if an actor has a certain state. For example "Slash" requires 10% HP to use. If an actor has the state, "Buff" the skill "Slash" will 5% HP to use as long as they have the state.
replace the 42 with thestate's id
Code:
<JS HPCost>
cost = user.isStateAffected(42) ? Math.ceil(user.mmp*.05) :  Math.ceil(user.mmp*.1);
</JS HP Cost>

Original thread: https://forums.rpgmakerweb.com/threads/visustella-skill-core-adjust-hp-costs.175267/