-
-
Notifications
You must be signed in to change notification settings - Fork 313
feat: Add NP/Star Conditions, Update Target Dialog, and Skill Priority Drag-Sort on Spam Screen #2103
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
base: master
Are you sure you want to change the base?
feat: Add NP/Star Conditions, Update Target Dialog, and Skill Priority Drag-Sort on Spam Screen #2103
Conversation
…Pattern (api-utility)
… target order (data)
…pamSkillState (data)
…kill index (api-utility)
…new cooldown detection (core)
…ity, and select targets using AutoSkillAction (core)
…ction constants (core)
…ck in SkillSpam (core)
…g-sort (ui)
- Replace simple ListDialog with a condition dialog for Spam mode, NP Condition, Star Condition, and Repeat Until Used
- Update Target selection UI from simple ListDialog to AutoSkillAction-based UI
- Add DragSortView and DragSortAdapter to set skill usage priority
|
Well, I'll be damned. NP detection was just what I wanted for my own pull request. Magical. Also @erectorOps your screenshots are not working. |
I see, so attachments uploaded in my own repository can’t be displayed. |
|
You could use this instead of using recycle view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds NP conditions, star conditions, and skill priority drag-sort functionality to the Spam screen. It replaces image-based skill detection with color/HSV-based detection and introduces a new target selection UI.
Key changes:
- Added NP gauge detection using HSV color analysis and visual bar length measurement
- Added critical star detection using Tesseract OCR
- Replaced skill image detection with HSV-based cooldown detection
- Added skill priority drag-sort functionality with visual ordering
- Introduced new conditional fields (NP, Star) to skill spam configuration
Reviewed Changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| SkillSpam.kt | Core spam logic with NP/star detection and priority-based skill execution |
| CriticalStarTracker.kt | New module for OCR-based critical star detection |
| Caster.kt | Enhanced skill casting with cooldown detection and Eternal Sleep handling |
| SpamConfig.kt | Extended configuration model with new conditional fields |
| BattleScreenLocations.kt | Added regions for NP gauge, skill cooldown, and star detection |
| SpamScreen.kt | Updated UI with new condition selection and target picker |
| DragSortSkillPriorityAdapter.kt | New drag-sort adapter for skill priority management |
| libautomata/*.kt | Extended automation API with HSV detection and OCR capabilities |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // TODO: NpType3 reuses ServantTarget.ABC, so it's affected by deployed state. It should be independent of servant count. | ||
| actualSlot = when (deployed.size) { | ||
| 1 -> FieldSlot.B | ||
| 2 -> { | ||
| if (actualSlot == FieldSlot.B) { | ||
| when (null) { | ||
| deployed[FieldSlot.A] -> FieldSlot.A | ||
| deployed[FieldSlot.C] -> FieldSlot.C | ||
| else -> FieldSlot.A // Assume Left when Slot B is empty | ||
| } | ||
| } else actualSlot | ||
| } | ||
| else -> actualSlot | ||
| } |
Copilot
AI
Sep 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The when (null) expression on line 212 will never match any conditions since it's comparing null to non-null values from the map. This should likely be checking for null values in the deployed map entries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is based on the type analysis assumption that the Map’s values are non-null, so the when(null) would never match. However, in reality, if a key does not exist in the Map, deployed[slot] returns null, so this comment is incorrect. That said, my code currently returns the empty slot as actualSlot, which is not the intended behavior, so I will fix it.
| else -> true | ||
| } | ||
|
|
||
| val starCond = when(star) { |
Copilot
AI
Sep 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after when. Should be when (star).
| val starCond = when(star) { | |
| val starCond = when (star) { |
| * ⚠️ When calling this function inside `useSameSnapIn`, be aware that it may | ||
| * reuse a gray cached snapshot and return incorrect results. |
Copilot
AI
Sep 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This warning about useSameSnapIn appears in multiple places but the function name is inconsistent. It should be useSameSnapIn consistently throughout the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// OCR Accuracy Report
// 0 1 2 3 4 5 6 7 8 9
// TW: ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
// CN: ✅ ⚠️ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
// KO: ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
// JA: ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
// EN: ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
// ⚠️: Sometimes a “1” is misrecognized as a “4”.
// Safe with current Star Condition options.It seems that it is checking comments containing useSameSnapIn, so I believe there is no issue.
| } | ||
|
|
||
| private fun isSkillConfirmDialogOkButtonDisabled(): Boolean { | ||
| val brightness = locations.battle.skillUseOkRegion.getPattern().getAverageBrightness() |
Copilot
AI
Sep 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating a pattern object just to get average brightness is inefficient. Consider adding a direct brightness check method to the region API to avoid pattern creation overhead.
| * @param invert if true, the binary result is inverted. | ||
| * Set to true for white text |
Copilot
AI
Sep 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment uses full-width spaces ( ) instead of regular spaces. This should use regular ASCII spaces for consistency.
| * @param invert if true, the binary result is inverted. | |
| * Set to true for white text | |
| * Set to true for white text |
| context, when(item.servantIndex) { | ||
| 1 -> R.color.servant1_primary_text | ||
| 2 -> R.color.servant2_primary_text | ||
| 3 -> R.color.servant3_primary_text | ||
| 4 -> R.color.servant4_primary_text | ||
| 5 -> R.color.servant5_primary_text | ||
| else -> R.color.servant6_primary_text |
Copilot
AI
Sep 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The color selection logic is duplicated three times in this function. Consider extracting this into a helper function to reduce code duplication and improve maintainability.
| val row = gray.row(y) | ||
| if (Core.countNonZero(row) > 0) count++ | ||
| row.release() |
Copilot
AI
Sep 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OpenCV Mat objects created by gray.row(y) and gray.col(x) should be released in a try-finally block to ensure proper cleanup even if an exception occurs.
…ng pattern creation overhead
|
Thanks for the reviews, @ArthurKun21 and Copilot! I’ve applied the suggested fixes and improvements. I really appreciate your insights and guidance. |
|
I think after this has been merged, I'll probably make a pull request to make use of this new system in the default command line processing. So that you can do the following:
|
feat: Add NP/Star Conditions, Update Target Dialog, and Skill Priority Drag-Sort on Spam Screen
Note
This PR has not been rebased onto the #2076 PR.
It was created from upstream/master and manually includes changes equivalent to #2076.
Therefore, merging both this PR and #2076 simultaneously may cause conflicts.
This PR is currently combined into a single one, but if needed, it can be split into separate PRs by the following categories:
bugfixapi-utilitydatacoreuiRelated Issue
Spam doesn't work #2072
Spam Skill on NP Turn #903
Feature request: Use skill on turn when Noble Phantasm spam is up #1048
Auto-skill does not detect availability of some skills #1150
Description
Added NP conditions to Servant skill settings in Spam mode
Added Star conditions
Improved skill cooldown detection
Added Repeat Until Used option for Kishinami Hakuno’s “Sparks Route ∞”
Replaced skill target selection dialog with AutoSkillAction UI
Added DragSort at the bottom to adjust skill priority
Bug Fixes
Screenshots
Spam screen

Skill priority drag-sort at the bottom of the screen
Spam mode dialog

Shows new condition fields
Target selection UI

AutoSkillAction (directly reused without modification)
Cooldown detection (zoomed)


Checks whether the mean HSV of the region is within the HSV range
NP Charged detection (zoomed)


Checks whether the mean HSV of the region is within the HSV range
NP Visual bar detection (zoomed)

Checks 1×8 pixels per column for HSV range and measures bar length to determine NP value
Critical Star OCR detection & normalized image (zoomed)


Testing Notes
Python script for Cooldown detection
Python script for NP detection
Python script for Star detection