Skip to content

refactor: Update legacy code with UnitIndex - #1505

Merged
OH296 merged 25 commits into
Adeptus-Dominus:mainfrom
OH296:refactor/combat_index
Sep 7, 2026
Merged

refactor: Update legacy code with UnitIndex#1505
OH296 merged 25 commits into
Adeptus-Dominus:mainfrom
OH296:refactor/combat_index

Conversation

@OH296

@OH296 OH296 commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Summary by cubic

Replaces obj_ncombat's legacy per-role counters and big_mofo gating with the UnitIndex system so unit tracking and battle narration come from a single source.

Refactors

  • Battle text in Alarm_1.gml builds role summaries from player_unit_index using role_count, plural_string_role, and sum_roles; dreadnought counts include Venerable dreadnoughts.
  • The battlecry speaker is chosen by a role priority list, with a named unit pulled from the index.
  • Ship boarding and ship demon summon battles route through the standard Roster/collect_role_group path; the duplicate scr_ship_battle script is removed.
  • scr_roster populates player_unit_index via add_to_index; legacy counter and big_mofo updates are dropped from scr_roster and scr_civil_roster.

Migration

  • big_mofo, important_dudes, and the per-role counters are no longer maintained; anything referencing them must read from player_unit_index instead.

Written for commit 2c3e3b5. Summary will update on new commits.

Review in cubic

@github-actions github-actions Bot added Size: Big Type: Refactor Rewriting/restructuring code, while keeping general behavior labels Sep 4, 2026

@cubic-dev-ai cubic-dev-ai Bot 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.

2 issues found across 9 files

Confidence score: 5/5

  • In scripts/scr_UnitGroup/scr_UnitGroup.gml, sum_roles uses roles instead of the required _roles naming convention; rename the argument and its loop references to keep local-variable style consistent.
  • In scripts/scr_UnitGroup/scr_UnitGroup.gml, plural_string_role uses role and use_x instead of _role and _use_x; update the arguments and all references to satisfy the naming convention.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/scr_UnitGroup/scr_UnitGroup.gml">

<violation number="1" location="scripts/scr_UnitGroup/scr_UnitGroup.gml:547">
P2: Custom agent: **Code Quality Review**

The new `plural_string_role` arguments violate the required local-variable naming convention. Rename `role` and `use_x` to `_role` and `_use_x`, and update their references.</violation>

<violation number="2" location="scripts/scr_UnitGroup/scr_UnitGroup.gml:551">
P2: Custom agent: **Code Quality Review**

The new `sum_roles` argument violates the required local-variable naming convention. Rename `roles` to `_roles` and update both references in the loop.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread objects/obj_ncombat/Alarm_1.gml Outdated
Comment thread objects/obj_ncombat/Alarm_1.gml Outdated
Comment thread objects/obj_ncombat/Alarm_1.gml Outdated
Comment thread scripts/scr_UnitGroup/scr_UnitGroup.gml Outdated
Comment thread objects/obj_ncombat/Alarm_1.gml Outdated
Comment thread objects/obj_ncombat/Alarm_1.gml Outdated
Comment thread scripts/ArtifactStruct/ArtifactStruct.gml Outdated
Comment thread scripts/ArtifactStruct/ArtifactStruct.gml Outdated
Comment thread scripts/scr_UnitGroup/scr_UnitGroup.gml Outdated
Comment thread objects/obj_ncombat/Alarm_1.gml Outdated
OH296 and others added 11 commits September 4, 2026 16:03
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

@cubic-dev-ai cubic-dev-ai Bot 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.

0 issues found across 2 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Auto-approval blocked by 5 unresolved issues from previous reviews.

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot 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.

1 issue found across 3 files (changes from recent commits).

Confidence score: 3/5

  • In objects/obj_ncombat/Alarm_1.gml, _dread_count excludes the Venerable <dreadnought> role while the Venerable Ancients advance is active, undercounting dreadnoughts and potentially causing count-dependent behavior to diverge from the previous dreadnoughts counter — include the venerable role in the count or retain the established counter.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="objects/obj_ncombat/Alarm_1.gml">

<violation number="1" location="objects/obj_ncombat/Alarm_1.gml:79">
P2: When the 'Venerable Ancients' advance is active, dreadnought units carry the role "Venerable <dreadnought>", so _dread_count only counts base Dreadnoughts and undercounts vs the old `dreadnoughts` counter, which counted both (scr_civil_roster.gml:548-556). This changes the armoured-division check `_dread_count + predators + land_raiders > 3` at Alarm_1.gml:228 and the `_others -= _dread_count` at line 206, so a force of only Venerable dreadnoughts no longer triggers the armoured-division narration. Count Venerable Dreadnought units as well (e.g. via role_groups(SPECIALISTS_DREADNOUGHTS)) so the index count matches the previous counter.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread objects/obj_ncombat/Alarm_1.gml Outdated
Comment thread objects/obj_ncombat/Alarm_1.gml Outdated

@cubic-dev-ai cubic-dev-ai Bot 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.

1 issue found across 1 file (changes from recent commits).

Confidence score: 3/5

  • In objects/obj_ncombat/Alarm_1.gml, the mismatched VenerableDreadnought lookup excludes venerable dreadnoughts from formation narration and role totals, producing incorrect battle reporting; use the indexed Venerable Dreadnought key.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="objects/obj_ncombat/Alarm_1.gml">

<violation number="1" location="objects/obj_ncombat/Alarm_1.gml:79">
P2: When a battle roster contains venerable dreadnoughts, this lookup uses `VenerableDreadnought` instead of the indexed `Venerable Dreadnought` key, so `_dread_count` excludes them from formation narration and role totals. Add the separator when constructing the venerable role name.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread objects/obj_ncombat/Alarm_1.gml Outdated
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

@cubic-dev-ai cubic-dev-ai Bot 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.

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Auto-approval blocked by 4 unresolved issues from previous reviews.

Re-trigger cubic

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

@cubic-dev-ai cubic-dev-ai Bot 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.

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Auto-approval blocked by 4 unresolved issues from previous reviews.

Re-trigger cubic

@OH296
OH296 requested a review from EttyKitty September 4, 2026 18:35
@OH296 OH296 changed the title refactor: update Legacy code with UnitIndex refactor: Update legacy code with UnitIndex Sep 4, 2026
EttyKitty
EttyKitty previously approved these changes Sep 4, 2026
@EttyKitty

Copy link
Copy Markdown
Collaborator

/review

Comment thread objects/obj_ncombat/Alarm_1.gml
Comment thread objects/obj_ncombat/Alarm_1.gml Outdated
Comment thread scripts/scr_UnitGroup/scr_UnitGroup.gml
Comment thread scripts/scr_UnitGroup/scr_UnitGroup.gml
Comment thread scripts/scr_civil_roster/scr_civil_roster.gml
Comment thread scripts/ArtifactStruct/ArtifactStruct.gml
Comment thread ChapterMaster.yyp Outdated
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread objects/obj_ncombat/Alarm_1.gml
Comment thread objects/obj_ncombat/Alarm_1.gml

@The-Real-Nyx The-Real-Nyx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I was kinda in rush so don't take my suggestions as absolutely correct or anything as I might've overlooked something.

Comment thread objects/obj_ncombat/Alarm_1.gml
Comment thread objects/obj_ncombat/Alarm_1.gml Outdated
Comment thread objects/obj_ncombat/Alarm_1.gml Outdated
Comment thread objects/obj_ncombat/Alarm_1.gml Outdated
@OH296

OH296 commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator Author

I was kinda in rush so don't take my suggestions as absolutely correct or anything as I might've overlooked something.

All good, all the points are valid in one way or the other

OH296 and others added 2 commits September 5, 2026 22:39
Co-authored-by: Nyx <80511023+The-Real-Nyx@users.noreply.github.com>
Co-authored-by: Nyx <80511023+The-Real-Nyx@users.noreply.github.com>

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread objects/obj_ncombat/Alarm_1.gml Outdated
Comment thread objects/obj_ncombat/Alarm_1.gml Outdated
Comment thread objects/obj_ncombat/Alarm_1.gml

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread objects/obj_ncombat/Alarm_1.gml Outdated
Comment thread objects/obj_ncombat/Alarm_1.gml Outdated

@cubic-dev-ai cubic-dev-ai Bot 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.

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Auto-approval blocked by 3 unresolved issues from previous reviews.

Re-trigger cubic

@EttyKitty EttyKitty left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is a code collapse. I'm not going to nitpick, because this is better than what was. A net positive.
If there are no bugs with this - it's fine. And I'm bad at spotting bugs with my eye on GH.

@OH296
OH296 merged commit a5aa5e5 into Adeptus-Dominus:main Sep 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size: Big Type: Refactor Rewriting/restructuring code, while keeping general behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants