Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ class AttackScreenLocations @Inject constructor(
fun supportCheckRegion(card: CommandCard.Face) =
affinityRegion(card) + Location(-50, 100)

fun supportCheckNewRegion(card: CommandCard.Face): Region {
val region = affinityRegion(card) + Location(-40, 155)
val newHeight = 120
val newWidth = 250
return Region(region.x, region.y, newWidth, newHeight)
}

fun supportCheckNewRegion2(card: CommandCard.Face): Region {
val region = affinityRegion(card) + Location(100, 170)
val newHeight = 100
val newWidth = 100
return Region(region.x, region.y, newWidth, newHeight)
}

val backClick =
(if (isWide)
Location(-325, 1310)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ class ServantTracker @Inject constructor(

if (supportSlot == null && isSupport) {
supportSlot = teamSlot
} else if (!isSupport) {
// Don't useSameSnapIn here, since we open a dialog
initFaceCard(teamSlot, slot)
}

// We now always want to init the face card, so that there is a fallback for support servant detection failing
// Don't useSameSnapIn here, since we open a dialog
initFaceCard(teamSlot, slot)
}

private fun initFaceCard(teamSlot: TeamSlot, slot: FieldSlot, addAnotherImage: Boolean = false) {
Expand Down Expand Up @@ -200,16 +201,20 @@ class ServantTracker @Inject constructor(
supportSlot?.let { supportSlot ->
if (supportSlot in deployed.values) {
val matched = cardsRemaining.filter { card ->
images[Images.Support] in locations.attack.supportCheckRegion(card)
images[Images.Support] in locations.attack.supportCheckNewRegion(card)
}.toSet()

cardsRemaining -= matched
result[supportSlot] = matched
}
}

// Fallback for if the support servant is not found
val currentSupportSlot = supportSlot
val isSupportFound = if (currentSupportSlot != null) (result.getOrElse(currentSupportSlot) { emptySet() }).isNotEmpty() else false

val ownedServants = faceCardImages
.filterKeys { it != supportSlot && it in deployed.values }
.filterKeys { (!isSupportFound || it != supportSlot) && it in deployed.values }
cardsRemaining
.groupBy { card ->
// find the best matching Servant which isn't the support
Expand Down