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

ChangeHP, AddState and RemoveState changes - single commit #1481

Merged
merged 1 commit into from Nov 7, 2018

Conversation

Projects
None yet
4 participants
@fmatthew5876
Copy link
Contributor

fmatthew5876 commented Nov 5, 2018

The way RPG_RT works:

  • You cannot change a battler's HP when they're dead.
  • If ChangeHP kills a character, it adds the Death state to that battler.
  • When Death state is cured, even if alone, it always sets the HP to 1, instead of other functions.
  • When a character is caused Death, all the other states are erased; the defense, charge, gauge and stat modifiers are reset, and the current attribute shifts erased.

We implement all of this, with these particular changes:

  • Now there is no difference between Game_Actor::ChangeHP and Game_Enemy::ChangeHP, so we delete this function from both and add the ChangeHP characteristics to the superclass Game_Battler.
  • In Game_Battler::UseItem, the function now doesn't have to set the HP. However, it needs to have an int "revived" that checks if the character was revived, so in case the function heals HP too after dead, it substracts 1 since that value is automatically put after the Death state is removed. We also move the state cure before the HP change, so the Death State is cured before ChangeHP is executed (if this function was executed before Death state was cured, due to our new conditions, it wouldn't do anything).
  • When you rest on an inn and when the command FullHeal, we move the RemoveAllStates function before the ChangeHP too.
  • We move in UseSkill the state before the ChangeHP too. We also add that, if the character is still dead, then the HP and SP changes can't happen (you can't throw a Cure spell to a dead character).
ChangeHP, AddState and RemoveState changes.
The way RPG_RT works:
 - You cannot change a battler's HP when they're dead.
 - If ChangeHP kills a character, it adds the Death state to that battler.
 - When Death state is cured, even if alone, it always sets the HP to 1, instead of other functions.
 - When a character is caused Death, all the other states are erased; the defense, charge, gauge and stat modifiers are reset, and the current attribute shifts erased.

We implement all of this, with these particular changes:
 - Now there is no difference between Game_Actor::ChangeHP and Game_Enemy::ChangeHP, so we delete this function from both and add the ChangeHP characteristics to the superclass Game_Battler.
 - In Game_Battler::UseItem, the function now doesn't have to set the HP. However, it needs to have an int "revived" that checks if the character was revived, so in case the function heals HP too after dead, it substracts 1 since that value is automatically put after the Death state is removed. We also move the state cure before the HP change, so the Death State is cured before ChangeHP is executed (if this function was executed before Death state was cured, due to our new conditions, it wouldn't do anything).
 - When you rest on an inn and when the command FullHeal, we move the RemoveAllStates function before the ChangeHP too.
 - We move in UseSkill the state before the ChangeHP too. We also add that, if the character is still dead, then the HP and SP changes can't happen (you can't throw a Cure spell to a dead character).

@fmatthew5876 fmatthew5876 changed the title ChangeHP, AddState and RemoveState changes. ChangeHP, AddState and RemoveState changes - single commit Nov 5, 2018

@fmatthew5876

This comment has been minimized.

Copy link
Contributor Author

fmatthew5876 commented Nov 5, 2018

@Ghabry I pulled this directly from an old copy of Albeleons original branch I had in my fork. You didn't make any changes to it in #1394 did you?

@Ghabry

Ghabry approved these changes Nov 5, 2018

Copy link
Member

Ghabry left a comment

should be fine

@fmatthew5876

This comment has been minimized.

Copy link
Contributor Author

fmatthew5876 commented Nov 7, 2018

Battle 2 needs this guy. Otherwise curing death state on battle end will not work.

if (hp_change > 0 && !HasFullHp()) {
ChangeHp(hp_change);
ChangeHp(hp_change - revived);

This comment has been minimized.

@Ghabry

Ghabry Nov 7, 2018

Member

You always find something by looking long enough at it...
Any idea what this "- revived" is supposed to do here? It substracts 0 or 1? o.O

This comment has been minimized.

@fmatthew5876

fmatthew5876 Nov 7, 2018

Author Contributor

It looks like it's trying to account for the fact that RemoveState(1) heals 1 hp implicitly so you don't want to overshoot by 1. A but ugly in how it's done here.

@carstene1ns
Copy link
Member

carstene1ns left a comment

LGTM

@carstene1ns carstene1ns merged commit 00a1e8f into EasyRPG:master Nov 7, 2018

6 checks passed

Android (armeabi-v7a) Build finished.
Details
GNU/Linux Build finished.
Details
OSX Build finished.
Details
Windows (x64) Build finished.
Details
Windows (x86) Build finished.
Details
web Build finished.
Details

@carstene1ns carstene1ns added the Battle label Nov 7, 2018

@Ghabry

This comment has been minimized.

Copy link
Member

Ghabry commented Nov 7, 2018

Okay this is also merged now but I would vote for adding a comment about this non obvious line of code in one of the other thousand battle PRs we have already open. xD

@fmatthew5876 fmatthew5876 deleted the fmatthew5876:alb_state branch Nov 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.