Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplier as function #65

Closed
wants to merge 1 commit into from
Closed

Multiplier as function #65

wants to merge 1 commit into from

Conversation

Kopekk
Copy link

@Kopekk Kopekk commented Oct 23, 2022

In classes that export the Effect class, we have a handleEnable method.
In this method we are creating new MultiplierModifier with uuid, and modifier as Double.
Value of modifier is obtained from config.

The problem is that it is only obtained at the beginning. And the handle method uses the previously retrieved value.
If you set a dynamic value in config, like multiplier: "%level% * 2" the handleEnable method will be executed when the pet is created and when pet is lvl1, the multipler value in this example will be set to 2.
The problem arises when the pet's level is changed, for example it reaches level 2. The new multipler value in our example should be 4.
However, since the handleEnable method was done before, the MultiplierModifier still holds the old value.

Imo best solution to this problem would be to change to MultiplierModifier to make it not store a static Double value but only a pointer to the config. Then the value would be taken in the handle method.

@WillFP
Copy link
Member

WillFP commented Oct 23, 2022

Implemented already on dev - sorry! Also did all the cleanup / abstraction changes that make this a lot better

@WillFP WillFP closed this Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants