Health
Last updated:    24-10-2022
-
Mechanics
Health is one of the 4 basic stats of a player.
It indicates how much Health Points a player has, which is shown by the red bar on top of the hotbar.The minimum amount of HP is 1,
and when the player has an HP ≤ 0, the player will die.
The player has a Base Health of 100,
This variable can be tuned in stats:init/settings.scoreboard players set Base_Health Stats.Settings 100
-
Scoreboard Variables
The scoreboard variables associated with Health are the following:
PS.Health    (Total Health)
PS.Health_HI (Held Item Bonus)
PS.Health_SB (Skill Bonus)
PS.Health_AB (Arena Bonus)
PS.Health_SM (Skill Multiplier)
PS.Health_AM (Arena Multiplier)
# Please note that SM, AM are in percentage values.
CurrentHealth (Health Left)
ExtraHealth   (Absorption Health)
Evaluation:
PS.Health = Stats.Settings[Base_Health]
PS.Health += PS.Health_HI
PS.Health += PS.Health_SB
PS.Health += PS.Health_AB
PS.Health *= PS.Health_SM / 100
PS.Health *= PS.Health_AM / 100
Source Code:
-
HP Calculation
The Current Player HP is calculated by 2 substats:
- CurrentHealth (Abbreviated as HP)
- ExtraHealth
CurrentHealth is the current player health, ExtraHealth is the absorption health for the players (a.k.a. golden hearts in vanilla Minecraft).
When the HP of a player is lower than their Max HP, ExtraHealth will be transferred over to CurrentHealth.
Evaluation Formula:
stats:health/extra_health
if ExtraHealth > 0 and CurrentHealth < PS.Health:
    CurrentHealth += ExtraHealth
    ExtraHealth = CurrentHealth - PS.Health
    if ExtraHealth < 0:
        ExtraHealth = 0
    CurrentHealth -= ExtraHealth
-
Recovery
The natural regeneration stat of the player is called Recovery.
Every 20 ticks (1 second),  players will lose 10 Hunger points and gain X% HP,
where  \(X = 20 - \frac{400000}{\hbox{PS.Recovery}  +  20000}\)
If the player is currently in combat, X will be divided by 2.
For natural regeneration to occur, the player must have at least 4000 Stamina and 100 Hunger.
The Base Recovery of a player is 2500.
This variable can be tuned in stats:init/settingsscoreboard players set Base_Recovery Stats.Settings 2500
Evaluation Formula:
stats:health/natural_regeneration
Quick Note: This formula caps at X = 20, as
\[\scriptsize X = \lim_{\hbox{PS.Recovery} \to \infty}(20 - \frac{400000}{\hbox{PS.Recovery}  +  20000}) = 20\]Therefore, maximum HP the player can regen is 20% per second.
-
Fall Damage
Fall Damage deals PERCENTAGE damage to the player.
When player falls and takes damage, damage is calculated through the following formula:
\(\hbox{Fall Damage \%} =\frac{\hbox{FallDistance}  -  30}{2} \times \frac{100}{\hbox{PS.Earth} - \hbox{Base\_Earth\_Def} + 100} \times \frac{1}{100}\)
If the player experiences fatal fall damage, the player will endure the fall with 1 HP, and receive Slowness and Blindness 6 for 5 seconds.
Evaluation Formula:
stats:health/fall_damage