Skip to content

Add temporary HP support - #338

Open
1939323749 wants to merge 3 commits into
Alchyr:developfrom
1939323749:feature/temp-hp
Open

Add temporary HP support#338
1939323749 wants to merge 3 commits into
Alchyr:developfrom
1939323749:feature/temp-hp

Conversation

@1939323749

@1939323749 1939323749 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Adds a BaseLib Temporary HP mechanic backed by a hidden TempHpPower and public TempHpCmd/Creature extension helpers. The health bar renders a gold Temp HP chip and hover tip, with localized keyword/static hover/power text.

Damage resolves as Block -> Osty redirect -> Temporary HP -> late HP-loss modifiers such as Buffer -> real HP. Redirected damage consumes the final receiver's Temp HP, while overkill trampling back can consume the original target's Temp HP.

Adds the networked dev console command temphp [index] for granting Temp HP during combat; negative amounts remove all Temp HP.

2026-07-10.174936.mp4

@SoytheProton

Copy link
Copy Markdown
Contributor

Hello, the person working on the other PR (#162) here (though I hadn't touched it in a hot second due to other issues I had not yet gotten to). I saw the message you mentioned and wanted to briefly talk about a few things about your implementation. There are quite a few aspects of this implementation that I haven't gotten to, or think are handled better but there's also a few things I wanted to note.

Basing this off of the PowerModel is a practice I would generally consider to be questionable, since, while it does work, it also could likely result in unforeseen errors especially in something that's meant to be as vastly applicable to all mods as BaseLib is intended to be (Ex: an ability that purges all powers from a creature). I would say that a more responsible implementation would be through patches and SpireFields like I did in my implementation.

Speaking of which, this was a discussion I had previous with the general modding community over in the StS2 Discord server, and we had generally agreed that Temp Hp was a name we wanted to drop for StS2's implementation due to the fact that it often resulted in confusion about HP Interactions which was something we wanted to avoid with the name we decided on, Vitality.

That being said, I do quite appreciate the other features like a custom-drawn heart and a few of the features I had not yet gotten to. I wouldn't mind perhaps getting into further contact and using some of these assets to create an ultimately more fleshed out implementation now that there is some reasonable demand for it.

@1939323749

1939323749 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

Hello, the person working on the other PR (#162) here (though I hadn't touched it in a hot second due to other issues I had not yet gotten to). I saw the message you mentioned and wanted to briefly talk about a few things about your implementation. There are quite a few aspects of this implementation that I haven't gotten to, or think are handled better but there's also a few things I wanted to note.

Basing this off of the PowerModel is a practice I would generally consider to be questionable, since, while it does work, it also could likely result in unforeseen errors especially in something that's meant to be as vastly applicable to all mods as BaseLib is intended to be (Ex: an ability that purges all powers from a creature). I would say that a more responsible implementation would be through patches and SpireFields like I did in my implementation.

Speaking of which, this was a discussion I had previous with the general modding community over in the StS2 Discord server, and we had generally agreed that Temp Hp was a name we wanted to drop for StS2's implementation due to the fact that it often resulted in confusion about HP Interactions which was something we wanted to avoid with the name we decided on, Vitality.

That being said, I do quite appreciate the other features like a custom-drawn heart and a few of the features I had not yet gotten to. I wouldn't mind perhaps getting into further contact and using some of these assets to create an ultimately more fleshed out implementation now that there is some reasonable demand for it.

Hi, I've read your reply. Here are the points I think are worth discussing:

Basing this off of the PowerModel is a practice I would generally consider to be questionable, since, while it does work, it also could likely result in unforeseen errors especially in something that's meant to be as vastly applicable to all mods as BaseLib is intended to be (Ex: an ability that purges all powers from a creature).

This is the best implementation I've been able to come up with: simple, direct, fully reusing existing mechanisms, and adding no extra burden on the user. As for the "ability that purges all powers from a creature" case — that strikes me as quite an odd one. Is it worth taking the long way around for a scenario that only a very small fraction of mod authors would ever implement?

I would say that a more responsible implementation would be through patches and SpireFields like I did in my implementation.

Here I strongly disagree. First, the game is still in active development, so patches break easily — and in practice it's very common to run into cases where they simply don't work on Linux or macOS. Relying on a large number of patches significantly increases maintenance burden and may introduce unknown issues in multiplayer. PowerModel is the simple, direct route: automatic cleanup, no sync handling required, works across platforms, and so on. I see no reason to choose a more complex and less predictable implementation.

Speaking of which, this was a discussion I had previous with the general modding community over in the StS2 Discord server, and we had generally agreed that Temp Hp was a name we wanted to drop for StS2's implementation due to the fact that it often resulted in confusion about HP Interactions which was something we wanted to avoid with the name we decided on, Vitality.

This is something I hadn't considered. What I'm trying to build is a port of StsLib, to make it easier for me and other mod authors with StS1 experience to port existing mods or develop new ones. Still, a couple of points: first, I don't quite follow where the confusion with "Temp HP" comes from — is it about the timing of when it's deducted, or something else? Second, to be honest, "Vitality" isn't a term the Chinese modding community is familiar with. If a mod author types "vitality," it's unlikely to bring to mind the "Temp HP" that was so commonly used in StS1 mods.

Those are my (minor) thoughts — I think there's still plenty here worth discussing. :)

@SoytheProton

Copy link
Copy Markdown
Contributor

This is the best implementation I've been able to come up with: simple, direct, fully reusing existing mechanisms, and adding no extra burden on the user. As for the "ability that purges all powers from a creature" case — that strikes me as quite an odd one. Is it worth taking the long way around for a scenario that only a very small fraction of mod authors would ever implement?

Given my previous discussions with a past PR I made, I've generally seen that the answer would be yes. I'm not going to fully speak on Alchyr's behalf but they have had issue with a patch that "fixed" Dusty Tome's card getter (which simply gets a random Ancient character card) because of the fact that it could possibly cause issues for any mods that would want to utilize that "feature".

Here I strongly disagree. First, the game is still in active development, so patches break easily — and in practice it's very common to run into cases where they simply don't work on Linux or macOS. Relying on a large number of patches significantly increases maintenance burden and may introduce unknown issues in multiplayer. PowerModel is the simple, direct route: automatic cleanup, no sync handling required, works across platforms, and so on. I see no reason to choose a more complex and less predictable implementation.

I am fully aware of the downsides of patches and while it definitely causes possible issues, that's simply an unavoidable aspect of modding a game in active development as any updates run the risk of breaking mods. As for the mysterious issues that arise in Linux, macOS, or multiplayer I don't know any relevant information where this was the case, especially for a patch of a relatively minor scale that wouldn't already appear for patches that you've written for your implementation. And while the patch-focused implementation may be more complex, it see no reason why it would be less predictable.

This is something I hadn't considered. What I'm trying to build is a port of StsLib, to make it easier for me and other mod authors with StS1 experience to port existing mods or develop new ones. Still, a couple of points: first, I don't quite follow where the confusion with "Temp HP" comes from — is it about the timing of when it's deducted, or something else? Second, to be honest, "Vitality" isn't a term the Chinese modding community is familiar with. If a mod author types "vitality," it's unlikely to bring to mind the "Temp HP" that was so commonly used in StS1 mods.

To paraphrase the discussion, it was effectively due to HP Synergy and interactions. It caused confusion in that aspect of how it would/should interact in players, so we had decided it'd likely be better to avoid it. Also yes, while changing the name would clearly result in some players not immediately getting it's connection to temporary HP but I don't see rename that wouldn't cause that issue.

I do believe there is stuff worth discussing, although ultimately it's up to Alchyr's decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants