Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Binary file added app/src/main/assets/En/skill_strengthened.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/Jp/skill_strengthened.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,24 @@ private fun PreferredSupport(
)
)
}
Row(
Comment thread
sheng-28 marked this conversation as resolved.
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(16.dp)
) {
Text(
// // todo: need localized versions?
stringResource(R.string.p_strengthened_skills),
modifier = Modifier.weight(1f)
)

StrengthenedSkills(
skills = listOf(
config.skill1Strengthened,
config.skill2Strengthened,
config.skill3Strengthened
)
)
}
}
}
}
Expand Down Expand Up @@ -289,4 +307,37 @@ private fun MaxSkills(
}
}
}
}

@Composable
private fun StrengthenedSkills(
skills: List<Pref<Int>>
) {
Row(verticalAlignment = Alignment.CenterVertically) {
skills.forEachIndexed { index, pref ->
if (index != 0) {
Text("/", modifier = Modifier.padding(horizontal = 8.dp))
}

var rankUp by pref.remember()

Card(
elevation = cardElevation(5.dp),
colors = CardDefaults.cardColors(
containerColor = if (rankUp > 0) MaterialTheme.colorScheme.secondary else MaterialTheme.colorScheme.surfaceVariant,
contentColor = if (rankUp > 0) MaterialTheme.colorScheme.onSecondary else MaterialTheme.colorScheme.onSurfaceVariant
)
) {
Box(
contentAlignment = Alignment.Center,
// change to '(rankUp + 1) % 4' in future if there's 3 rank up quests on the same skill
modifier = Modifier
.clickable { rankUp = (rankUp + 1) % 3 }
.size(40.dp)
) {
Text(rankUp.toString())
}
}
}
}
}
1 change: 1 addition & 0 deletions app/src/main/res/values/localized.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Skills"</string>
<string name="p_battle_config_support_friend_name_hint">"Friend name images can be added using 'Support Image Maker' script"</string>
<string name="p_battle_config_support_also_check_all">"Also check All"</string>
<string name="p_max_skills">"Max Skills"</string>
<string name="p_strengthened_skills">"Strengthened Skills"</string>
<string name="p_game_server">"Game Server"</string>
<string name="p_game_server_auto_detect">"Auto-detect"</string>
<string name="p_spam_summary">"Danger mode requires Auto-targeting"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ internal class SupportPreferences(
override val skill2Max by prefs.skill2Max
override val skill3Max by prefs.skill3Max

override val skill1Strengthened by prefs.skill1Strengthened
override val skill2Strengthened by prefs.skill2Strengthened
override val skill3Strengthened by prefs.skill3Strengthened

override val grandServant by prefs.grandServant
override val bondCEEffect by prefs.bondCEEffect
override val requireBothNormalAndRewardMatch by prefs.requireBothNormalAndRewardMatch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class SupportPrefsCore(
val skill2Max = maker.bool("support_skill_max_2")
val skill3Max = maker.bool("support_skill_max_3")

val skill1Strengthened = maker.int("support_skill_strengthened_1")
val skill2Strengthened = maker.int("support_skill_strengthened_2")
val skill3Strengthened = maker.int("support_skill_strengthened_3")

val grandServant = maker.bool("support_grand_servant")
val bondCEEffect = maker.enum(
"support_bond_ce_effect",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,5 @@ enum class Images(val path: String) {
GrandCeLabel("grand_ce_label.png"),
BondCeEffectDefault("bond_ce_effect_default.png"),
BondCeEffectNP("bond_ce_effect_np.png"),
SkillStrengthened("skill_strengthened.png"),
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ interface ISupportPreferences {
val skill2Max: Boolean
val skill3Max: Boolean

val skill1Strengthened: Int
val skill2Strengthened: Int
val skill3Strengthened: Int

val grandServant: Boolean
val bondCEEffect: BondCEEffectEnum
val requireBothNormalAndRewardMatch: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ class ServantSelection @Inject constructor(
!skillCheckNeeded || checkMaxedSkills(needMaxedSkills, whichSkillsAreMaxed(bounds.region))
}

.filter {
val needStrengthenedSkills = listOf(
supportPrefs.skill1Strengthened,
supportPrefs.skill2Strengthened,
supportPrefs.skill3Strengthened
)

val skillStrengthenedCheckNeeded = needStrengthenedSkills.any { it > 0}

!skillStrengthenedCheckNeeded || checkStrengthenedSkills(bounds.region, needStrengthenedSkills).all{ it }
}

return matched.isNotEmpty()
}

Expand Down Expand Up @@ -102,7 +114,7 @@ class ServantSelection @Inject constructor(
skillRegion.exists(images[Images.SkillTen], similarity = 0.68)
}
}

private fun checkMaxedSkills(expectedSkills: List<Boolean>, actualSkills: List<Boolean>): Boolean {
val result = expectedSkills
.zip(actualSkills) { expected, actual ->
Expand All @@ -118,4 +130,29 @@ class ServantSelection @Inject constructor(

return result.all { it }
}
}

/**
* Check if the skill is strengthened(rank-up quest cleared)
* Currently restricted to level 2 (2 rank-up quests) for each skill, can modify in UI [PreferredSupportScreen.kt] to allow more
*/
private fun checkStrengthenedSkills(bounds: Region, needStrengthenedSkills: List<Int>): List<Boolean> {
val y = bounds.y + 325 + 28
val x = bounds.x + 1610 + 41
val skillMargin = 90
val rankUpMargin = 18

return needStrengthenedSkills.mapIndexed { index, requirement ->
Comment thread
sheng-28 marked this conversation as resolved.
if (requirement > 0) {
Comment thread
sheng-28 marked this conversation as resolved.
Outdated
val loc = Location(
x + index * skillMargin,
y - (requirement - 1) * rankUpMargin
)
val skillRegion = Region(loc, Size(24, 24))
Comment thread
ArthurKun21 marked this conversation as resolved.
Outdated
skillRegion.exists(images[Images.SkillStrengthened], similarity = 0.68)
} else {
// If requirement is 0, this skill passes automatically
true
}
}
}
}