Skip to content

Commit 024fcb7

Browse files
authored
Handle Storm Pod dialogues (#2008)
1 parent 1411ee7 commit 024fcb7

File tree

9 files changed

+13
-6
lines changed

9 files changed

+13
-6
lines changed
4.55 KB
Loading
7.16 KB
Loading
7.7 KB
Loading
5.37 KB
Loading
4.98 KB
Loading

app/src/main/java/io/github/fate_grand_automata/imaging/DroidCvPattern.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ class DroidCvPattern(
7676
}
7777

7878
private fun match(template: Pattern): Mat? {
79-
val result = Mat()
8079
if (template is DroidCvPattern) {
8180
if (template.width <= width && template.height <= height) {
81+
val result = Mat()
8282
Imgproc.matchTemplate(
8383
mat,
8484
template.mat,

scripts/src/main/java/io/github/fate_grand_automata/scripts/Images.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ enum class Images(val path: String) {
8989
OkKR("ok-kr.png"),
9090
Execute("execute.png"),
9191
SupportBlankCE("support_blank_ce.png"),
92+
StartQuest("start_quest.png"),
9293
StateON("state_on.png"),
9394
GrandCeLabel("grand_ce_label.png"),
9495
BondCeEffectDefault("bond_ce_effect_default.png"),

scripts/src/main/java/io/github/fate_grand_automata/scripts/entrypoints/AutoBattle.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class AutoBattle @Inject constructor(
9898
loop()
9999
} catch (e: BattleExitException) {
100100
throw ExitException(e.reason, makeExitState())
101-
} catch (e: ScriptAbortException) {
101+
} catch (_: ScriptAbortException) {
102102
throw ExitException(ExitReason.Abort, makeExitState())
103103
} catch (e: Exception) {
104104
val reason = ExitReason.Unexpected(e)
@@ -339,11 +339,12 @@ class AutoBattle @Inject constructor(
339339
locations.resultMatRewardsRegion.click()
340340
}
341341

342-
private fun isInOrdealCallOutOfPodsScreen(): Boolean {
343-
// Lock the Ordeal Call for JP server
344-
if (prefs.gameServer !is GameServer.Jp) return false
342+
private fun isInOrdealCallConfirmPodUseScreen(): Boolean {
343+
return findImage(locations.ordealCallConfirmPodUseRegion, Images.StartQuest)
344+
}
345345

346-
return images[Images.Close] in locations.ordealCallOutOfPodsRegion
346+
private fun isInOrdealCallOutOfPodsScreen(): Boolean {
347+
return findImage(locations.ordealCallOutOfPodsRegion, Images.Close)
347348
}
348349

349350
private fun ordealCallOutOfPods() {
@@ -520,15 +521,18 @@ class AutoBattle @Inject constructor(
520521

521522
var closeScreen = false
522523
var inventoryFull = false
524+
var confirmPodUsage = false
523525

524526
useSameSnapIn {
525527
closeScreen = isInOrdealCallOutOfPodsScreen()
526528
inventoryFull = isInventoryFull()
529+
confirmPodUsage = isInOrdealCallConfirmPodUseScreen()
527530
}
528531

529532
when {
530533
closeScreen -> throw BattleExitException(ExitReason.LimitRuns(state.runs))
531534
inventoryFull -> throw BattleExitException(ExitReason.InventoryFull)
535+
confirmPodUsage -> locations.ordealCallConfirmPodUseRegion.center.click()
532536
}
533537

534538
refill.refill()

scripts/src/main/java/io/github/fate_grand_automata/scripts/locations/Locations.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class Locations @Inject constructor(
3434

3535
val inventoryFullRegion = Region(-280, 860, 560, 190).xFromCenter()
3636

37+
val ordealCallConfirmPodUseRegion = Region(190, 1096, 420, 62).xFromCenter()
38+
3739
val ordealCallOutOfPodsRegion = Region(-112, 1088, 219, 72).xFromCenter()
3840

3941
val ordealCallOutOfPodsClick = Location(-2, 1124).xFromCenter()

0 commit comments

Comments
 (0)