Skip to content

Automatic conversion based on HP - #2320

Merged
Coronia merged 10 commits into
Phobos-developers:developfrom
obsidian14:feature/convert
Aug 3, 2026
Merged

Automatic conversion based on HP#2320
Coronia merged 10 commits into
Phobos-developers:developfrom
obsidian14:feature/convert

Conversation

@obsidian14

@obsidian14 obsidian14 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Automatic conversion based on HP

  • Units can now be converted into another unit by health percentage.
  • Convert.Health.AbovePercentdetermines the minimal health percentage at which a unit converts automatically.
  • Convert.Health.BelowPercentdetermines the maximum health percentage at which a unit converts automatically.
  • Convert.Health specify the new techno after the conversion. This unit must be of the same type of the original (infantry -> infantry, vehicle -> vehicle or aircraft -> aircraft).
  • Setting a negative number will disable the HP check, and when both checks are disabled, conversion will not occur.

In rulesmd.ini:

[SOMETECHNO]                         ; TechnoType, before conversion
Convert.Health.AbovePercent=-1.0     ; floating point value, percents or absolute
Convert.Health.BelowPercent=-1.0     ; floating point value, percents or absolute
Convert.Health=                      ; TechnoType, after conversion

@Coronia Coronia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This implementation is very problematic in performance. If you have a conversion type set it'll be executed every frame once the health condition meets. Should at least make it only happen when there's an actual change of health conditions, and make it bail out as early as possible by checking its current type and such

Comment thread src/Ext/Techno/Body.h Outdated
@obsidian14

Copy link
Copy Markdown
Contributor Author

I did my best to meet your requests. This is my solution. Could you please take a look?

@phoboscn-bot

Copy link
Copy Markdown

To Chinese users:
This pull request has been mentioned on Phobos CN. There might be relevant details there:

致中文用户:
此拉取请求已在 Phobos CN 上被提及。那里可能有相关详细信息:

https://www.phoboscn.top/t/topic/691/1

@Coronia Coronia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

did some regulation to tag names, code style and such. Notice that we already have a universal IsHealthInThreshold function to handle health condition, so no need to reimplement it again

@TaranDahl

Copy link
Copy Markdown
Contributor

It would be best to write the Chinese documentation as well. We have a skill for this.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@Coronia
Coronia merged commit e4f0c4f into Phobos-developers:develop Aug 3, 2026
7 checks passed
DeathFishAtEase added a commit to DeathFishAtEase/Phobos that referenced this pull request Aug 3, 2026
DeathFishAtEase added a commit to DeathFishAtEase/Phobos that referenced this pull request Aug 3, 2026
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.

5 participants