possible explanation for [regaining hp over the limit of 500]
tl;dr:
the dark and max hp values are stored as an unsigned ints, and when the character first dies, the dark and max hp values are "less" than the current hp value, and so is set to the hp value (but since it is an unsigned int, it is "more"). when the character revives, his hp continuously regens
doesn't address the mp issues though, probably more crazy logic
Azriel~
tl;dr:
the dark and max hp values are stored as an unsigned ints, and when the character first dies, the dark and max hp values are "less" than the current hp value, and so is set to the hp value (but since it is an unsigned int, it is "more"). when the character revives, his hp continuously regens
Code:
Tag | Hex | Dec |
--------------------------------|
HP | 00 00 01 F4 | 500 |
Dark HP | 00 00 01 F4 | 500 |
Max HP | 00 00 01 F4 | 500 |
// perform first itr
injury -> 80 00 00 00 // -2147483648
// we perform the subtraction
00 00 01 F4
- 80 00 00 00
= 80 00 01 F4 // -2147483148 (not the same as the itr value)
// logic: hp = hp - (unsigned int) injury; // implicit cast
>> insert crazy logic here
// hypothetical, max hp and hp must be stored as unsigned ints
if (dark hp < hp) {
dark hp = hp;
}
if (max hp < hp) {
max hp = hp;
}
>> done logic
HP | 80 00 01 F4 | -2147483148 |
Dark HP | 00 00 01 F4 | 2147484148 |
Max HP | 00 00 01 F4 | 2147484148 |
// perform second itr
injury -> 80 00 00 00 // -2147483648
// we perform the subtraction
80 00 01 F4
- 80 00 00 00
= 00 00 01 F4
HP | 00 00 01 F4 | 500 | // back to normal
Dark HP | 00 00 01 F4 | 2147484148 |
Max HP | 00 00 01 F4 | 2147484148 |
// tada: "unlimited" hp regen
doesn't address the mp issues though, probably more crazy logic
Azriel~