-
Notifications
You must be signed in to change notification settings - Fork 8
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
Update regen to depend on Health module #12
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just a deletion/move of where the regen is managed.
I see that the RegenSystem you deleted used a RegenerationComponent
. Do you intend to delete that as well?
@@ -53,6 +54,7 @@ public RegenerationAlterationEffect(Context context) { | |||
* @param magnitude The magnitude of the regen effect. | |||
* @param duration The duration of the regen effect. | |||
*/ | |||
@SuppressWarnings("CheckStyle") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this shouldn't be included. We usually want to fix rather than suppress checkstyle issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was unintentional, I thought suppressing some issues will not show up in code. I will remove this in next commit.
* @param magnitude The magnitude of the regen effect. | ||
* @param duration The duration of the regen effect. | ||
*/ | ||
@Override | ||
public void applyEffect(EntityRef instigator, EntityRef entity, String id, float magnitude, long duration) { | ||
applyEffect(instigator, entity, magnitude, duration); | ||
//applyEffect(instigator, entity, magnitude, duration); | ||
entity.send(new ActivateRegenEvent(id, (int) magnitude, ((float) duration) / 1000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slight nitpick here. Do we want to round down, round up or use natural rounding?
Ie, if we use this method twice with 0.3 & 0.7 what should the event send?
Down →0 & 0 (this is the current method)
Natural →0 & 1
Up →1 & 1
I can see legitimate arguments for all of these. I would personally go for natural but it's up to you which one you pick. Just make sure you've considered the options.
Additionally, we can avoid sending an ActivateRegenEvent when the magnitude is 0 because it just won't do anything correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that the RegenComponent
is saving the regen value in floats. But the event does not take floats. Calls for an update in the event, which would resolve this issue, leaving it for regen scheduler to handle
Removes regeneration authority system, as new regen has a scheduler to handle regen.
How to test:
setRegenRate 0
, so that base regeneration does not affect the potiondamage 50
to cause damage to player.potions:regenpotion
, and activate it, which regenerates player at 3 hp/s for 10 seconds