{
    "AutoUseSpMedicationEntry": {
        "desc": "自动使用理智药剂任务入口",
        "pre_delay": 0,
        "anchor": {
            "ValuableStashValuablesTabInNext": "AutoUseSpMedicationChooseEmergencySanityBoosterExpSoon",
            "ValuableStashValuablesTabInNext2": "AutoUseSpMedicationChooseEmergencySanityBooster",
            "ValuableStashValuablesTabInNext3": "AutoUseSpMedicationUseNoEmergencySanityBooster"
        },
        "post_delay": 0,
        "next": [
            "ValuableStashValuablesTab"
        ],
        "focus": {
            "Node.Action.Starting": "即将进入珍贵物品标签页"
        }
    },
    "AutoUseSpMedicationChooseEmergencySanityBooster": {
        "desc": "选择应急理智加强剂",
        "recognition": {
            "type": "TemplateMatch",
            "param": {
                "roi": [
                    30,
                    80,
                    940,
                    560
                ],
                "template": "Valuables/EmergencySpBooster.png",
                "green_mask": true,
                "threshold": 0.84,
                "order_by": "Score"
            }
        },
        "action": "Click",
        "post_wait_freezes": 300,
        "next": [
            "AutoUseSpMedicationUseEmergencySpBooster"
        ],
        "focus": {
            "Node.Action.Starting": "开始选择药剂"
        }
    },
    "AutoUseSpMedicationChooseEmergencySanityBoosterExpSoon": {
        "desc": "选择红时限应急理智加强剂",
        "recognition": {
            "type": "TemplateMatch",
            "param": {
                "roi": [
                    30,
                    80,
                    940,
                    560
                ],
                "template": "Valuables/EmergencySpBoosterExpireSoon.png",
                "green_mask": true,
                "threshold": 0.84,
                "order_by": "Score"
            }
        },
        "action": "Click",
        "post_wait_freezes": 300,
        "next": [
            //"AutoUseSpMedicationIfExpireSoon" if option yes
            "AutoUseSpMedicationUseEmergencySpBooster"
        ],
        "focus": {
            "Node.Action.Starting": "开始选择即将过期的药剂"
        }
    },
    "AutoUseSpMedicationIfExpireSoon": {
        "desc": "详情页检测到红色限时",
        "recognition": {
            "type": "TemplateMatch",
            "param": {
                "roi": [
                    989,
                    203,
                    28,
                    26
                ],
                "template": "Valuables/ExpireSoon.png",
                "threshold": 0.8
            }
        },
        "anchor": {
            "AutoUseSpMedicationUseEmergencySpBoosterNext": "AutoUseSpMedicationAdd"
        },
        "next": [
            "AutoUseSpMedicationUseEmergencySpBooster"
        ]
    },
    "AutoUseSpMedicationQuickUse": {
        "desc": "确认使用理智药",
        "recognition": {
            "type": "And",
            "param": {
                "all_of": [
                    "YellowConfirmButtonType2",
                    {
                        "param": {
                            "expected": [
                                "快捷使用",
                                "Quick Use"
                            ],
                            "roi": [
                                190,
                                205,
                                155,
                                35
                            ]
                        },
                        "type": "OCR"
                    },
                    {
                        //冗余检测，避免用错
                        "type": "OCR",
                        "param": {
                            "expected": [
                                "应急理智加强剂",
                                "緊急理智加強劑",
                                "Emergency Sanity Booster"
                            ],
                            "roi": [
                                350,
                                335,
                                160,
                                40
                            ]
                        }
                    }
                ],
                "box_index": 0
            }
        },
        "action": "Click",
        "post_wait_freezes": 300,
        "timeout": 4000,
        "next": [
            "CloseRewardsButton"
        ]
    },
    "AutoUseSpMedicationQuickUseError": {
        "desc": "提示错误并结束任务",
        "recognition": "DirectHit",
        "action": "DoNothing",
        "focus": {
            "Node.Action.Failed": "快捷使用出错，结束任务"
        }
    },
    "AutoUseSpMedicationUseEmergencySpBooster": {
        "desc": "点击详情页的使用按钮",
        "recognition": {
            "type": "And",
            "param": {
                "all_of": [
                    "WhiteConfirmButtonType1"
                ],
                "box_index": 0
            }
        },
        "action": "Click",
        "post_wait_freezes": 300,
        "next": [
            "[Anchor]AutoUseSpMedicationUseEmergencySpBoosterNext", // AutoUseSpMedicationAdd
            "AutoUseSpMedicationQuickUse",
            "AutoUseSpMedicationQuickUseCancel"
        ]
    },
    "AutoUseSpMedicationQuickUseCancel": {
        "desc": "退出快捷使用",
        "recognition": {
            "type": "TemplateMatch",
            "param": {
                "roi": [
                    1084,
                    203,
                    33,
                    31
                ],
                "template": "Valuables/Close.png",
                "threshold": 0.8
            }
        },
        "action": "Click",
        "next": [
            "AutoUseSpMedicationQuickUseError"
        ],
        "focus": {
            "Node.Action.Failed": "无法使用理智药剂！"
        }
    },
    "AutoUseSpMedicationUseNoEmergencySanityBooster": {
        "desc": "提示没有应急理智加强剂并结束任务",
        "focus": {
            "Node.Action.Succeeded": "没有应急理智加强剂，结束任务"
        }
    },
    "AutoUseSpMedicationCloseDetailNotExpSoon": {
        "desc": "关闭详情页（非过期药误匹配），尝试应急药剂",
        "recognition": {
            "type": "And",
            "param": {
                "all_of": [
                    "WhiteConfirmButtonType1"
                ],
                "box_index": 0
            }
        },
        "action": {
            "type": "Click",
            "param": {
                "target": [
                    1084,
                    203,
                    33,
                    31
                ]
            }
        },
        "post_wait_freezes": 300,
        "next": [
            "AutoUseSpMedicationChooseEmergencySanityBooster",
            "AutoUseSpMedicationUseNoEmergencySanityBooster"
        ]
    },
    "AutoUseSpMedicationSkipRegular": {
        "desc": "用户选择不使用应急药剂，静默结束"
    },
    "AutoUseSpMedicationAdd": {
        "desc": "点击添加按钮",
        "max_hit": 14, // 理智上限为1000，最高使用14+1次总共加600理智
        "recognition": {
            "type": "TemplateMatch",
            "param": {
                "roi": [
                    1072,
                    415,
                    37,
                    37
                ],
                "template": [
                    "Valuables/AddButton.png",
                    "Valuables/AddButtonHover.png"
                ],
                "threshold": [
                    0.8,
                    0.9
                ]
            }
        },
        "action": "Click",
        "next": [
            "AutoUseSpMedicationAdd", //loop until add button unavailable
            "AutoUseSpMedicationCantAdd"
        ]
    },
    "AutoUseSpMedicationCantAdd": {
        "desc": "无法添加",
        "recognition": {
            "type": "TemplateMatch",
            "param": {
                "roi": [
                    1072,
                    415,
                    37,
                    37
                ],
                "template": "Valuables/DisabledAddButton.png",
                "threshold": 0.8
            }
        },
        "next": [
            "AutoUseSpMedicationQuickUse"
        ]
    }
}
