Restoration Item Sliders (#595)

* Allows players to set custom restoration values for potions and milk

* Fixed a dumb oversight

* implemented fairy sliders
This commit is contained in:
earthcrafterman 2022-07-05 19:34:33 -04:00 committed by GitHub
parent 2b99e65d24
commit 306cfd0654
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 194 additions and 11 deletions

View File

@ -965,6 +965,65 @@ namespace SohImGui {
EnhancementCheckbox("No Heart Drops", "gNoHeartDrops"); EnhancementCheckbox("No Heart Drops", "gNoHeartDrops");
Tooltip("Disables heart drops, but not heart placements, like from a Deku Scrub running off. This simulates Hero Mode from other games in the series."); Tooltip("Disables heart drops, but not heart placements, like from a Deku Scrub running off. This simulates Hero Mode from other games in the series.");
if (ImGui::BeginMenu("Potion Values"))
{
EnhancementCheckbox("Change Red Potion Effect", "gRedPotionEffect");
Tooltip("Enable the following changes to the amount of health restored by Red Potions");
EnhancementSliderInt("Red Potion Health: %d", "##REDPOTIONHEALTH", "gRedPotionHealth", 1, 100, "");
Tooltip("Changes the amount of health restored by Red Potions");
EnhancementCheckbox("Red Potion Percent Restore", "gRedPercentRestore");
Tooltip("Toggles from Red Potions restoring a fixed amount of health to a percent of the player's current max health");
EnhancementCheckbox("Change Green Potion Effect", "gGreenPotionEffect");
Tooltip("Enable the following changes to the amount of mana restored by Green Potions");
EnhancementSliderInt("Green Potion Mana: %d", "##GREENPOTIONMANA", "gGreenPotionMana", 1, 100, "");
Tooltip("Changes the amount of mana restored by Green Potions, base max mana is 48, max upgraded mana is 96");
EnhancementCheckbox("Green Potion Percent Restore", "gGreenPercentRestore");
Tooltip("Toggles from Green Potions restoring a fixed amount of mana to a percent of the player's current max mana");
EnhancementCheckbox("Change Blue Potion Effects", "gBluePotionEffects");
Tooltip("Enable the following changes to the amount of health and mana restored by Blue Potions");
EnhancementSliderInt("Blue Potion Health: %d", "##BLUEPOTIONHEALTH", "gBluePotionHealth", 1, 100, "");
Tooltip("Changes the amount of health restored by Blue Potions");
EnhancementCheckbox("Blue Potion Health Percent Restore", "gBlueHealthPercentRestore");
Tooltip("Toggles from Blue Potions restoring a fixed amount of health to a percent of the player's current max health");
EnhancementSliderInt("Blue Potion Mana: %d", "##BLUEPOTIONMANA", "gBluePotionMana", 1, 100, "");
Tooltip("Changes the amount of mana restored by Blue Potions, base max mana is 48, max upgraded mana is 96");
EnhancementCheckbox("Blue Potion Mana Percent Restore", "gBlueManaPercentRestore");
Tooltip("Toggles from Blue Potions restoring a fixed amount of mana to a percent of the player's current max mana");
EnhancementCheckbox("Change Milk Effect", "gMilkEffect");
Tooltip("Enable the following changes to the amount of health restored by Milk");
EnhancementSliderInt("Milk Health: %d", "##MILKHEALTH", "gMilkHealth", 1, 100, "");
Tooltip("Changes the amount of health restored by Milk");
EnhancementCheckbox("Milk Percent Restore", "gMilkPercentRestore");
Tooltip("Toggles from Milk restoring a fixed amount of health to a percent of the player's current max health");
EnhancementCheckbox("Separate Half Milk Effect", "gSeparateHalfMilkEffect");
Tooltip("Enable the following changes to the amount of health restored by Half Milk.\nIf this is disabled, Half Milk will behave the same as Full Milk.");
EnhancementSliderInt("Half Milk Health: %d", "##HALFMILKHEALTH", "gHalfMilkHealth", 1, 100, "");
Tooltip("Changes the amount of health restored by Half Milk");
EnhancementCheckbox("Half Milk Percent Restore", "gHalfMilkPercentRestore");
Tooltip("Toggles from Half Milk restoring a fixed amount of health to a percent of the player's current max health");
EnhancementCheckbox("Change Fairy Effect", "gFairyEffect");
Tooltip("Enable the following changes to the amount of health restored by Fairies");
EnhancementSliderInt("Fairy: %d", "##FAIRYHEALTH", "gFairyHealth", 1, 100, "");
Tooltip("Changes the amount of health restored by Fairies");
EnhancementCheckbox("Fairy Percent Restore", "gFairyPercentRestore");
Tooltip("Toggles from Fairies restoring a fixed amount of health to a percent of the player's current max health");
EnhancementCheckbox("Change Fairy Revive Effect", "gFairyReviveEffect");
Tooltip("Enable the following changes to the amount of health restored by Fairy Revivals");
EnhancementSliderInt("Fairy Revival: %d", "##FAIRYREVIVEHEALTH", "gFairyReviveHealth", 1, 100, "");
Tooltip("Changes the amount of health restored by Fairy Revivals");
EnhancementCheckbox("Fairy Revive Percent Restore", "gFairyRevivePercentRestore");
Tooltip("Toggles from Fairy Revivals restoring a fixed amount of health to a percent of the player's current max health");
ImGui::EndMenu();
}
ImGui::EndMenu(); ImGui::EndMenu();
} }
@ -980,7 +1039,6 @@ namespace SohImGui {
ImGui::EndMenu(); ImGui::EndMenu();
} }
EnhancementCheckbox("Visual Stone of Agony", "gVisualAgony"); EnhancementCheckbox("Visual Stone of Agony", "gVisualAgony");
Tooltip("Displays an icon and plays a sound when Stone of Agony should be activated, for those without rumble"); Tooltip("Displays an icon and plays a sound when Stone of Agony should be activated, for those without rumble");
EnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots"); EnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots");

View File

@ -628,7 +628,21 @@ void func_80A0329C(EnElf* this, GlobalContext* globalCtx) {
if ((heightDiff > 0.0f) && (heightDiff < 60.0f)) { if ((heightDiff > 0.0f) && (heightDiff < 60.0f)) {
if (!func_80A01F90(&this->actor.world.pos, &refActor->actor.world.pos, 10.0f)) { if (!func_80A01F90(&this->actor.world.pos, &refActor->actor.world.pos, 10.0f)) {
Health_ChangeBy(globalCtx, 128); if (CVar_GetS32("gFairyEffect", 0) && !(this->fairyFlags & FAIRY_FLAG_BIG))
{
if (CVar_GetS32("gFairyPercentRestore", 0))
{
Health_ChangeBy(globalCtx, (gSaveContext.healthCapacity * CVar_GetS32("gFairyHealth", 100) / 100 + 15) / 16 * 16);
}
else
{
Health_ChangeBy(globalCtx, CVar_GetS32("gFairyHealth", 8) * 16);
}
}
else
{
Health_ChangeBy(globalCtx, 128);
}
if (this->fairyFlags & FAIRY_FLAG_BIG) { if (this->fairyFlags & FAIRY_FLAG_BIG) {
Magic_Fill(globalCtx); Magic_Fill(globalCtx);
} }

View File

@ -8234,7 +8234,21 @@ void func_80843AE8(GlobalContext* globalCtx, Player* this) {
LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_002878, 1.0f, 99.0f, LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_002878, 1.0f, 99.0f,
Animation_GetLastFrame(&gPlayerAnim_002878), ANIMMODE_ONCE, 0.0f); Animation_GetLastFrame(&gPlayerAnim_002878), ANIMMODE_ONCE, 0.0f);
} }
gSaveContext.healthAccumulator = 0x140; if (CVar_GetS32("gFairyReviveEffect", 0))
{
if (CVar_GetS32("gFairyRevivePercentRestore", 0))
{
gSaveContext.healthAccumulator = (gSaveContext.healthCapacity * CVar_GetS32("gFairyReviveHealth", 100) / 100 + 15) / 16 * 16;
}
else
{
gSaveContext.healthAccumulator = CVar_GetS32("gFairyReviveHealth", 20) * 16;
}
}
else
{
gSaveContext.healthAccumulator = 0x140;
}
this->unk_850 = -1; this->unk_850 = -1;
} }
} }
@ -12849,17 +12863,100 @@ void func_8084EAC0(Player* this, GlobalContext* globalCtx) {
} }
else { else {
s32 sp28 = D_808549FC[this->itemActionParam - PLAYER_AP_BOTTLE_POTION_RED]; s32 sp28 = D_808549FC[this->itemActionParam - PLAYER_AP_BOTTLE_POTION_RED];
if (sp28 & 1) { if (CVar_GetS32("gRedPotionEffect", 0) && this->itemActionParam == PLAYER_AP_BOTTLE_POTION_RED)
gSaveContext.healthAccumulator = 0x140; {
if (CVar_GetS32("gRedPercentRestore", 0))
{
gSaveContext.healthAccumulator = (gSaveContext.healthCapacity * CVar_GetS32("gRedPotionHealth", 100) / 100 + 15) / 16 * 16;
}
else
{
gSaveContext.healthAccumulator = CVar_GetS32("gRedPotionHealth", 20) * 16;
}
} }
else if (CVar_GetS32("gBluePotionEffects", 0) && this->itemActionParam == PLAYER_AP_BOTTLE_POTION_BLUE)
{
if (CVar_GetS32("gBlueHealthPercentRestore", 0))
{
gSaveContext.healthAccumulator = (gSaveContext.healthCapacity * CVar_GetS32("gBluePotionHealth", 100) / 100 + 15) / 16 * 16;
}
else
{
gSaveContext.healthAccumulator = CVar_GetS32("gBluePotionHealth", 20) * 16;
}
if (sp28 & 2) { if (CVar_GetS32("gBlueManaPercentRestore", 0))
Magic_Fill(globalCtx); {
if (gSaveContext.unk_13F0 != 10) {
Magic_Fill(globalCtx);
}
func_80087708(globalCtx, (gSaveContext.magicLevel * 48 * CVar_GetS32("gBluePotionMana", 100) / 100 + 15) / 16 * 16, 5);
}
else
{
if (gSaveContext.unk_13F0 != 10) {
Magic_Fill(globalCtx);
}
func_80087708(globalCtx, CVar_GetS32("gBluePotionMana", 100), 5);;
}
} }
else if (CVar_GetS32("gGreenPotionEffect", 0) && this->itemActionParam == PLAYER_AP_BOTTLE_POTION_GREEN)
{
if (CVar_GetS32("gGreenPercentRestore", 0))
{
if (gSaveContext.unk_13F0 != 10) {
Magic_Fill(globalCtx);
}
if (sp28 & 4) { func_80087708(globalCtx, (gSaveContext.magicLevel * 48 * CVar_GetS32("gGreenPotionMana", 100) / 100 + 15) / 16 * 16, 5);
gSaveContext.healthAccumulator = 0x50; }
else
{
if (gSaveContext.unk_13F0 != 10) {
Magic_Fill(globalCtx);
}
func_80087708(globalCtx, CVar_GetS32("gGreenPotionMana", 100), 5);;
}
}
else if (CVar_GetS32("gMilkEffect", 0) && (this->itemActionParam == PLAYER_AP_BOTTLE_MILK || this->itemActionParam == PLAYER_AP_BOTTLE_MILK_HALF))
{
if (CVar_GetS32("gMilkPercentRestore", 0))
{
gSaveContext.healthAccumulator = (gSaveContext.healthCapacity * CVar_GetS32("gMilkHealth", 100) / 100 + 15) / 16 * 16;
}
else
{
gSaveContext.healthAccumulator = CVar_GetS32("gMilkHealth", 5) * 16;
}
if (CVar_GetS32("gSeparateHalfMilkEffect", 0) && this->itemActionParam == PLAYER_AP_BOTTLE_MILK_HALF)
{
if (CVar_GetS32("gHalfMilkPercentRestore", 0))
{
gSaveContext.healthAccumulator = (gSaveContext.healthCapacity * CVar_GetS32("gHalfMilkHealth", 100) / 100 + 15) / 16 * 16;
}
else
{
gSaveContext.healthAccumulator = CVar_GetS32("gHalfMilkHealth", 5) * 16;
}
}
}
else
{
if (sp28 & 1) {
gSaveContext.healthAccumulator = 0x140;
}
if (sp28 & 2) {
Magic_Fill(globalCtx);
}
if (sp28 & 4) {
gSaveContext.healthAccumulator = 0x50;
}
} }
} }
@ -12972,7 +13069,21 @@ void func_8084EED8(Player* this, GlobalContext* globalCtx) {
func_8002F7DC(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); func_8002F7DC(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG);
} }
else if (LinkAnimation_OnFrame(&this->skelAnime, 47.0f)) { else if (LinkAnimation_OnFrame(&this->skelAnime, 47.0f)) {
gSaveContext.healthAccumulator = 0x140; if (CVar_GetS32("gFairyEffect", 0))
{
if (CVar_GetS32("gFairyPercentRestore", 0))
{
gSaveContext.healthAccumulator = (gSaveContext.healthCapacity * CVar_GetS32("gFairyHealth", 100) / 100 + 15) / 16 * 16;
}
else
{
gSaveContext.healthAccumulator = CVar_GetS32("gFairyHealth", 8) * 16;
}
}
else
{
gSaveContext.healthAccumulator = 0x140;
}
} }
} }