Skip to content
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ https://github.com/nwnxee/unified/compare/build8193.37.13...HEAD
### Added
- Tweaks: added `NWNX_TWEAKS_RESIST_ENERGY_STACKS_WITH_EPIC_ENERGY_RESISTANCE` to make Resist Energy feats stack with Epic Energy Resistance.
- Tweaks: added `NWNX_TWEAKS_UNHARDCODE_SPECIAL_ABILITY_TARGET_TYPE` to allow special abilities to be used on target types other than creatures.
- Tweaks: added `NWNX_TWEAKS_CON_DOES_NOT_AFFECT_HP` to prevent constitution from affecting creature HP.

##### New Plugins
- N/A
Expand Down
3 changes: 2 additions & 1 deletion Plugins/Tweaks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ add_plugin(Tweaks
"CutsceneModeNoTURD.cpp"
"CanUseItemsWhilePolymorphed.cpp"
"ResistEnergyStacksWithEpicEnergyResistance.cpp"
"UnhardcodeSpecialAbilityTargetType.cpp")
"UnhardcodeSpecialAbilityTargetType.cpp"
"ConDoesNotAffectHP.cpp")
28 changes: 28 additions & 0 deletions Plugins/Tweaks/ConDoesNotAffectHP.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "nwnx.hpp"

#include "API/CNWSCreature.hpp"

namespace Tweaks {

using namespace NWNXLib;
using namespace NWNXLib::API;

void ConDoesNotAffectHP() __attribute__((constructor));
void ConDoesNotAffectHP()
{
if (!Config::Get<bool>("CON_DOES_NOT_AFFECT_HP", false)) return;

LOG_INFO("Constitution does not affect creature HP.");

static Hooks::Hook s_CNWSCreatureGetMaxHitPointsHook = Hooks::HookFunction(
Functions::_ZN12CNWSCreature15GetMaxHitPointsEi,
+[](CNWSCreature *pThis, BOOL bIncludeToughness) -> int16_t
{
int16_t maxHP = s_CNWSCreatureGetMaxHitPointsHook->CallOriginal<int16_t>(pThis, bIncludeToughness);

return maxHP - pThis->m_pStats->GetLevel() * pThis->m_pStats->m_nConstitutionModifier;
},
Hooks::Order::Late);
}

}
1 change: 1 addition & 0 deletions Plugins/Tweaks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Tweaks stuff. See below.
| `NWNX_TWEAKS_CAN_USE_ITEMS_WHILE_POLYMORPHED` | true or false | Allow all items to be used while polymorphed. |
| `NWNX_TWEAKS_RESIST_ENERGY_STACKS_WITH_EPIC_ENERGY_RESISTANCE` | true or false | Resist Energy feats stack with Epic Energy Resistance. |
| `NWNX_TWEAKS_UNHARDCODE_SPECIAL_ABILITY_TARGET_TYPE` | true or false | Allows special abilities to be used on target types other than creatures. |
| `NWNX_TWEAKS_CON_DOES_NOT_AFFECT_HP` | true or false | Constitution does not affect creature HP. |

## Environment variable values

Expand Down