Skip to content

Commit 6ba7b9b

Browse files
1SDANibriaguya0
authored andcommitted
Split damage multiplication into its own PR (#656)
* Split damage multiplication into its own PR * Found a more elegant implementation of the powers char*[]
1 parent 1981362 commit 6ba7b9b

File tree

2 files changed

+45
-9
lines changed

2 files changed

+45
-9
lines changed

libultraship/libultraship/ImGuiImpl.cpp

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ namespace SohImGui {
7272
"None"
7373
};
7474

75+
const char* powers[9] = {
76+
"Vanilla (1x)",
77+
"Double (2x)",
78+
"Quadruple (4x)",
79+
"Octuple (8x)",
80+
"Hexadecuple (16x)",
81+
"Duotrigintuple (32x)",
82+
"Quattuorsexagintuple (64x)",
83+
"Octoviginticentuple (128x)",
84+
"Hexaquinquagintiducentuple (256x)"
85+
};
86+
7587
std::map<std::string, std::vector<std::string>> hiddenwindowCategories;
7688
std::map<std::string, std::vector<std::string>> windowCategories;
7789
std::map<std::string, CustomWindow> customWindows;
@@ -886,12 +898,36 @@ namespace SohImGui {
886898

887899
if (ImGui::BeginMenu("Difficulty Options"))
888900
{
889-
EnhancementSliderInt("Damage Multiplier %dx", "##DAMAGEMUL", "gDamageMul", 1, 4, "");
890-
Tooltip("Modifies all sources of damage not affected by other sliders");
891-
EnhancementSliderInt("Fall Damage Multiplier %dx", "##FALLDAMAGEMUL", "gFallDamageMul", 1, 4, "");
892-
Tooltip("Modifies all fall damage");
893-
EnhancementSliderInt("Void Damage Multiplier %dx", "##VOIDDAMAGEMUL", "gVoidDamageMul", 1, 4, "");
894-
Tooltip("Modifies damage taken after falling into a void");
901+
ImGui::Text("Damage Multiplier");
902+
EnhancementCombobox("gDamageMul", powers, 9, 0);
903+
Tooltip("Modifies all sources of damage not affected by other sliders\n\
904+
2x: Can survive all common attacks from the start of the game\n\
905+
4x: Dies in 1 hit to any substantial attack from the start of the game\n\
906+
8x: Can only survive trivial damage from the start of the game\n\
907+
16x: Can survive all common attacks with max health without double defense\n\
908+
32x: Can survive all common attacks with max health and double defense\n\
909+
64x: Can survive trivial damage with max health without double defense\n\
910+
128x: Can survive trivial damage with max health and double defense\n\
911+
256x: Cannot survive damage");
912+
ImGui::Text("Fall Damage Multiplier");
913+
EnhancementCombobox("gFallDamageMul", powers, 8, 0);
914+
Tooltip("Modifies all fall damage\n\
915+
2x: Can survive all fall damage from the start of the game\n\
916+
4x: Can only survive short fall damage from the start of the game\n\
917+
8x: Cannot survive any fall damage from the start of the game\n\
918+
16x: Can survive all fall damage with max health without double defense\n\
919+
32x: Can survive all fall damage with max health and double defense\n\
920+
64x: Can survive short fall damage with double defense\n\
921+
128x: Cannot survive fall damage");
922+
ImGui::Text("Void Damage Multiplier");
923+
EnhancementCombobox("gVoidDamageMul", powers, 7, 0);
924+
Tooltip("Modifies damage taken after falling into a void\n\
925+
2x: Can survive void damage from the start of the game\n\
926+
4x: Cannot survive void damage from the start of the game\n\
927+
8x: Can survive void damage twice with max health without double defense\n\
928+
16x: Can survive void damage with max health without double defense\n\
929+
32x: Can survive void damage with max health and double defense\n\
930+
64x: Cannot survive void damage");
895931

896932
EnhancementCheckbox("No Random Drops", "gNoRandomDrops");
897933
Tooltip("Disables random drops, except from the Goron Pot, Dampe, and bosses");

soh/src/overlays/actors/ovl_player_actor/z_player.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3603,7 +3603,7 @@ s32 func_80837B18_modified(GlobalContext* globalCtx, Player* this, s32 damage, u
36033603
s32 modifiedDamage = damage;
36043604
if (modified)
36053605
{
3606-
modifiedDamage *= CVar_GetS32("gDamageMul", 1);
3606+
modifiedDamage *= (1 << CVar_GetS32("gDamageMul", 0));
36073607
}
36083608

36093609
return Health_ChangeBy(globalCtx, modifiedDamage);
@@ -3836,7 +3836,7 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) {
38363836

38373837
if (this->unk_A86 != 0) {
38383838
if (!Player_InBlockingCsMode(globalCtx, this)) {
3839-
Player_InflictDamageModified(globalCtx, -16 * CVar_GetS32("gVoidDamageMul", 1), false);
3839+
Player_InflictDamageModified(globalCtx, -16 * (1 << CVar_GetS32("gVoidDamageMul", 0)), false);
38403840
this->unk_A86 = 0;
38413841
}
38423842
}
@@ -8407,7 +8407,7 @@ s32 func_80843E64(GlobalContext* globalCtx, Player* this) {
84078407

84088408
impactInfo = &D_80854600[impactIndex];
84098409

8410-
if (Player_InflictDamageModified(globalCtx, impactInfo->damage * CVar_GetS32("gFallDamageMul", 1), false)) {
8410+
if (Player_InflictDamageModified(globalCtx, impactInfo->damage * (1 << CVar_GetS32("gFallDamageMul", 0)), false)) {
84118411
return -1;
84128412
}
84138413

0 commit comments

Comments
 (0)