TL;DR: I'm experiencing some slowdown with some code in a Javascript notetag. Can someone look at my code and tell me if there's a more optimal way of writing it?
I'm working on a tutorial boss fight for my game where the boss has a skill called Shield Pollen, which applies an effect of the same name. This effect is intended to teach the player about reading state tooltips (using Visustella State Tooltips plugin) to find out the state negates the boss' natural weakness to fire magic, but can be removed with a physical attack. I wanted to use this effect later in my game, since it's a fairly solid effect, but I only wanted it to negate weaknesses, not set all element rates to 100% (using Visustella Elements and Status Core). There is a javascript notetag that lets me do that, and I wrote out code for it like this:
It works as intended, negating the weakness, but I'm noticing the game slowing down when the player is using a fire spell while the effect is active. My guess is the code I'm using isn't the most optimal way of getting the desired effect. Anyone good with javascript care to tell me if there's a better way of doing this?
I'm working on a tutorial boss fight for my game where the boss has a skill called Shield Pollen, which applies an effect of the same name. This effect is intended to teach the player about reading state tooltips (using Visustella State Tooltips plugin) to find out the state negates the boss' natural weakness to fire magic, but can be removed with a physical attack. I wanted to use this effect later in my game, since it's a fairly solid effect, but I only wanted it to negate weaknesses, not set all element rates to 100% (using Visustella Elements and Status Core). There is a javascript notetag that lets me do that, and I wrote out code for it like this:
Code:
<JS Force Received Element 4 Rate: this.elementRate(4) > 1.0 ? 1.0 : this.elementRate(4)>