Skip to content

[Enhancement] Scale Enemy Health with Size #3393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions soh/soh/Enhancements/mods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,17 @@ void RegisterRandomizedEnemySizes() {
}

Actor_SetScale(actor, actor->scale.z * randomScale);

if (CVarGetInteger("gEnemySizeScalesHealth", 0) && (actor->category == ACTORCAT_ENEMY)) {
// Scale the health based on a smaller factor than randomScale
float healthScalingFactor = 0.8f; // Adjust this factor as needed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How much has this been playtested to make sure it makes sense?

I imagine the smallest enemy should probably be a one hit kill, whereas the largest probably should have like 3x the amount of health?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested it a bit, but I will do more testing today.

And bigger does mean tougher in this PR. That's the whole point..

float scaledHealth = actor->colChkInfo.health * (randomScale * healthScalingFactor);

// Ensure the scaled health doesn't go below zero
actor->colChkInfo.health = fmax(scaledHealth, 1.0f);
} else {
return;
}
});
}

Expand Down
5 changes: 5 additions & 0 deletions soh/soh/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,11 @@ void DrawEnhancementsMenu() {
UIWidgets::PaddedEnhancementCheckbox("Randomized Enemy Sizes", "gRandomizedEnemySizes", true, false);
UIWidgets::Tooltip("Enemies and Bosses spawn with random sizes.");

if (CVarGetInteger("gRandomizedEnemySizes", 0)) {
UIWidgets::EnhancementCheckbox("Scale Health with Size", "gEnemySizeScalesHealth");
UIWidgets::Tooltip("Scales normal enemies health with their randomized size. *This will NOT affect bosses*");
}

UIWidgets::PaddedEnhancementCheckbox("Ivan the Fairy (Coop Mode)", "gIvanCoopModeEnabled", true, false);
UIWidgets::Tooltip("Enables Ivan the Fairy upon the next map change. Player 2 can control Ivan and "
"press the C-Buttons to use items and mess with Player 1!");
Expand Down