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

States: Damage and recovery is rounded down instead of up #2343

Merged
merged 1 commit into from Sep 19, 2020
Merged

States: Damage and recovery is rounded down instead of up #2343

merged 1 commit into from Sep 19, 2020

Conversation

ghost
Copy link

@ghost ghost commented Sep 16, 2020

If an actor get damaged or recovered due to a state, the damage/recovery value is rounded down instead of up. This means that the damage/recovery value can even be zero if the damage/recovery percentage is set to a low value. Moreover a bug got fixed in SP damage/recovery: The SP damage/recovery percentage uses now the maximum SP instead of the maximum HP for the calculation.

Copy link
Member

@Ghabry Ghabry left a comment

@fmatthew5876
Please check if you see anything related to Delphi rounding here

int hp = state.hp_change_val + (int)(std::ceil(GetMaxHp() * state.hp_change_max / 100.0));
int sp = state.sp_change_val + (int)(std::ceil(GetMaxHp() * state.sp_change_max / 100.0));
int hp = state.hp_change_val + (GetMaxHp() * state.hp_change_max / 100.0);
int sp = state.sp_change_val + (GetMaxSp() * state.sp_change_max / 100.0);
Copy link
Contributor

@fmatthew5876 fmatthew5876 Sep 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no rounding done here by RPG_RT so this change is correct. However, RPG_RT also does integer division. Please change 100.0 to 100 and this will be correct.

Copy link
Author

@ghost ghost Sep 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the change and updated this PR.

If an actor get damaged or recovered due to a state, the damage/
recovery value is rounded down instead of up. This means that the
damage/recovery value can even be zero if the damage/recovery
percentage is set to a low value. Moreover a bug got fixed in SP
damage/recovery: The SP damage/recovery percentage uses now the
maximum SP instead of the maximum HP for the calculation.
@fdelapena fdelapena added this to the 0.6.3 milestone Sep 17, 2020
@Ghabry Ghabry added the backport to stable Pull requests with changes backported to our stable, maintenance branch label Sep 19, 2020
@Ghabry Ghabry merged commit d03acd8 into EasyRPG:master Sep 19, 2020
7 checks passed
@ghost ghost deleted the state-damagerounding branch Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport to stable Pull requests with changes backported to our stable, maintenance branch Battle
Development

Successfully merging this pull request may close these issues.

None yet

3 participants