HP: Difference between revisions
Line 58: | Line 58: | ||
=== Environment === | === Environment === | ||
{| class="wikitable" | |||
|- | |||
! Item(s) !! DEC !! Sector !! DEC (no hat) !! Sector (no hat) | |||
|- | |||
| Small Fall Damage || 8 || -2 || 12 || -3 | |||
|- | |||
| Lava || 12 || -3 || 18 || -4.5 | |||
|- | |||
| Big Fall Damage || 16 || -4 || 24 || -6 | |||
|} | |||
*If Mario remains in the squished state for 10 seconds straight, then his HP will be set to 255, and he will die as a result. | *If Mario remains in the squished state for 10 seconds straight, then his HP will be set to 255, and he will die as a result. | ||
*Note that going out of bounds, going near the death barrier, going into the whirlpool in DDD, and going into the quicksand in SSL all kill Mario, but they don't actually change his HP. | *Note that going out of bounds, going near the death barrier, going into the whirlpool in DDD, and going into the quicksand in SSL all kill Mario, but they don't actually change his HP. |
Revision as of 07:38, 30 June 2019
HP (also known as Health) is the measure of Mario’s health. If this reaches 0, Mario loses a life.
The variable that represents Mario’s HP is a short, which ranges from 0 to 2176 (or 0x0000 to 0x0880 in hexadecimal). Specifically, the upper byte represents how many full sectors of health Mario has, and the lower byte represents what portion of the next sector Mario has. Thus, one sector is equivalent to 256 HP units. The number of sectors displayed is the truncated version of the actual number of sectors. The maximum health is 2176 HP units (8.5 sectors). Mario will die if he goes below 256 HP units (1 sector).
The HP short is signed, so even if there was a way to push it below 0, it would not wrap around to 65535. Instead, you'd have to push it below -32768 to wrap it around to 32767. Of course, if HP is above 2176, it will just get set to 2176.
INC and DEC
There are two bytes related to health: the increase counter and the decrease counter. When Mario gains or loses an integer number of health sectors, it’s these counters that manage that. Specifically, these counters specify how many increments of 64 HP units (one quarter sector) Mario should gain or lose. For example, if Mario touches a goomba, the decrease counter increases to 4. Thus, over the next 4 frames, Mario will lose 64 HP units on each frame, resulting in one full health sector lost.
Once Mario's HP goes below 256 (1 sector), then he's dead, and there's no way to restore HP at that point. Mario can still collect coins to increase the INC counter, but the INC and DEC counters no longer function. For example, if you have 255 HP and collect a yellow coin, then INC will increase from 0 to 4, but it will just stay at 4 while Mario does the dying animation.
Separately, there are many things that change Mario’s HP directly, rather than going through the counter system. These include being underwater, being at the surface of water, being in cold water, being in toxic gas, and being burned by fire. Additionally, there are some things that set Mario’s HP to a particular value. These include being eaten by bubba, dying, selecting a save file, and letting the demo play.
Gaining Health
Item(s) | INC | Sector(s) |
---|---|---|
Yellow Coin and Heart Rotation | 4 | 1 |
Red Coin and Manta Ring | 8 | 2 |
Blue Coin and Air bubble | 20 | 5 |
Losing Health
Enemies
Item(s) | DEC | Sector | DEC (no hat) | Sector (no hat) |
---|---|---|---|---|
Shock | 4 | -1 | 8 | -2 |
1 Knockback | 4 | -1 | 8 | -2 |
2 Knockback | 8 | -2 | 12 | -3 |
3 Knockback | 12 | -3 | 20 | -5 |
Squish | 12 | -3 | 18 | -4.5 |
Enemies that shock: Amp
Enemies with a Knockback of 1: Bubble, Cheep Chomp, Goomba, Scuttlebug, Swoop
Enemies with a Knockback of 2: Big Cannonball, Big Goomba, Big Piranha Plant, Bob-omb, Boo, Bookend, Bubba, Chairs, Clam, Fly Guy, Lakitu, Moneybag, Mr I, Pokey, Skeeter, Small Cannonball, Small Piranha Plant, Snowman, Snufit, Spindrift, Spiny
Enemies with a Knockback of 3: Big Boo, Bullet Bill, Chain Chomp, Piano, Piranha Plant, Sushi, Unagi
Enemies that squish: Grindel, King Whomp, Spindel, Thwomp, Tox Box, Whomp
Enemies that don't do damage: Big Bullies, Bomp, Bullies, Chuckya, Heave Ho, Klepto, Koopa, Manta, Small Koopa
Environment
Item(s) | DEC | Sector | DEC (no hat) | Sector (no hat) |
---|---|---|---|---|
Small Fall Damage | 8 | -2 | 12 | -3 |
Lava | 12 | -3 | 18 | -4.5 |
Big Fall Damage | 16 | -4 | 24 | -6 |
- If Mario remains in the squished state for 10 seconds straight, then his HP will be set to 255, and he will die as a result.
- Note that going out of bounds, going near the death barrier, going into the whirlpool in DDD, and going into the quicksand in SSL all kill Mario, but they don't actually change his HP.