- Joined
- Jun 29, 2017
- Messages
- 380
- Reaction score
- 130
- First Language
- English
- Primarily Uses
- RMMV
When gaining HP from dealing damage, it can also be based on the amount of HP the target has.
If I do 36 critical damage and the target had 9 HP left, I get 4 HP absorbed from that.
If there's 1 HP remaining, I get 1 HP absorbed.
Code:
<Before Eval>
target._health = Math.max(1, parseInt(target.hp * 0.50));
</Before Eval>
<Post-Damage Eval>
if (target.result().hpDamage > 0 && user.hp / user.mhp < 1.00) {
user.gainHp(Math.min(Math.max(parseInt(value * 0.50), 1), target._health, user.mhp - user.hp));
}
</Post-Damage Eval>
<After Eval>
target._health = undefined;
</After Eval>
If I do 36 critical damage and the target had 9 HP left, I get 4 HP absorbed from that.
If there's 1 HP remaining, I get 1 HP absorbed.