Partial Healing

==Partial Healing Mode==
by @mike_the_monk
===Summary===
Normally, you fully heal upon leveling up. Players who want an added challenge can instead only partially heal upon level up. This script gives two options for doing so: either you can heal a set amount each level (for example, if you want to heal 4.5 HP upon leveling up, that's what will happen instead of fully healing) or you can heal a percentage (for example, if you want to heal 50% of your remaining health, that means if you are at 30 HP, you would heal 50% of that, or 15 HP). If you don't want to heal at all upon leveling up, enter 0.
If you ever want to change the value or percent, follow the instructions on how to update the script (found in a section below). If you ever want to revert to fully healing, you can delete the webhook by going to Settings > API.
Due to the way the script works, you won't see your health update correctly immediately. You will need to Sync before changes appear. So, when you level up, you can expect to initially see your health at 50, but as soon as you sync, your health will be set to the correct value according to the settings you chose.
If you level up but your health stays at full even after syncing, try waiting five seconds and pressing + or - on any Habit, then sync again. The reason is: in order to not overload the Habitica servers, I’ve set the script to not register every time you click a task, it waits at least five seconds between each. So, there is an extremely unlikely chance that if you click a bunch of tasks in a row (faster than five-second delay) and the final one levels you up, that it hasn’t registered it in the script yet. Clicking any additional task after waiting five seconds should work.
====Code====
*https://raw.githubusercontent.com/mike-the-monk/Habitica-customizations/main/Game%20Modes/Partial%20Healing%20Mode
====Required Customizations====
On level-up, you can either gain a set amount of HP or gain a percent of how much health will bring you up to full.
*VERSION If you want to gain a set amount of HP each time you level up, set this number to 2. If you want to gain a percent each time, set it to 3.
How much do you want to gain each time? Go to the correct one (set amount or percent) and choose what amount or what percentage you want to gain each level-up.
*HP_SET_VALUE_PER_LEVEL If you want to gain a set of value of HP each time you level up, enter the amount you want to gain here. It can be any number between 0 and 50.
*HP_PERCENT_PER_LEVEL If you want to gain a percentage of the health that would fully heal you, enter the percent here. It can be any number between 0 and 100. Do not enter the percent sign after the number, only enter the number.
*If you want to change from healing a set value to healing a percent (or vice versa), or if you want to change the amount/percent healed, go back to the Google App Script page (script.google.com) and edit those customizations according to the instructions earlier on this wiki page. Then, follow the instructions above to make sure Habitica is using the updated version.
Category:Extensions, Add-Ons, and Customizations
zh:部分回血