{
  "_resourceType": "script",
  "id": "5a060925-e335-4b93-8af5-2a63051e70e8",
  "name": "CombatTurn",
  "description": "",
  "variables": {
    "V0": {
      "id": "V0",
      "name": "Variable A",
      "passByReference": true
    }
  },
  "actors": {},
  "symbol": "script_9",
  "script": [
    {
      "command": "EVENT_MENU",
      "args": {
        "variable": "12",
        "items": 2,
        "option1": "Attack",
        "option2": "Heal",
        "option3": "Spell",
        "option4": "",
        "option5": "",
        "option6": "",
        "option7": "",
        "option8": "",
        "cancelOnB": false,
        "layout": "menu",
        "__collapse": true
      },
      "id": "234a6b96-3b78-42a4-942f-0228b3698eac"
    },
    {
      "command": "EVENT_IF",
      "args": {
        "condition": {
          "type": "eq",
          "valueA": {
            "type": "variable",
            "value": "12"
          },
          "valueB": {
            "type": "number",
            "value": 1
          }
        },
        "__collapseElse": true,
        "__collapse": false,
        "__comment": false
      },
      "children": {
        "true": [
          {
            "command": "EVENT_SET_VALUE",
            "args": {
              "variable": "11",
              "value": {
                "type": "expression",
                "value": "1 + rnd($05$ - 1)"
              },
              "__collapse": true
            },
            "id": "0a4d9b93-2df2-4362-b67f-0783fae55434"
          },
          {
            "command": "EVENT_TEXT",
            "args": {
              "text": [
                "You dealt \n$11$ damage(s)"
              ],
              "__section": "text",
              "avatarId": "",
              "minHeight": 4,
              "maxHeight": 7,
              "textX": 1,
              "textY": 1,
              "textHeight": 5,
              "position": "bottom",
              "clearPrevious": true,
              "showFrame": "true",
              "speedIn": -1,
              "speedOut": -1,
              "closeWhen": "key",
              "closeButton": "a",
              "closeDelayTime": 0.5,
              "closeDelayFrames": 30,
              "__collapse": true
            },
            "id": "7bbd8b85-5906-4a0c-9f5a-156aadba7337"
          },
          {
            "command": "EVENT_SET_VALUE",
            "args": {
              "variable": "1",
              "value": {
                "type": "expression",
                "value": "max(0, $01$ - $11$)"
              },
              "__collapse": true,
              "text": [
                "max(0, $01$ - $V0$)"
              ],
              "__section": "text",
              "avatarId": "",
              "minHeight": 4,
              "maxHeight": 7,
              "textX": 1,
              "textY": 1,
              "textHeight": 5,
              "position": "bottom",
              "clearPrevious": true,
              "showFrame": "true",
              "speedIn": -1,
              "speedOut": -1,
              "closeWhen": "key",
              "closeButton": "a",
              "closeDelayTime": 0.5,
              "closeDelayFrames": 30
            },
            "id": "03cc80da-c447-46e8-8590-ccd1f3e1ee3f"
          },
          {
            "command": "EVENT_IF",
            "args": {
              "condition": {
                "type": "lte",
                "valueA": {
                  "type": "variable",
                  "value": "1"
                },
                "valueB": {
                  "type": "number",
                  "value": 0
                }
              },
              "__collapseElse": false,
              "__collapse": false
            },
            "children": {
              "true": [
                {
                  "command": "EVENT_TEXT",
                  "args": {
                    "text": [
                      "You've killed\nthe Monster!"
                    ],
                    "__section": "text",
                    "avatarId": "",
                    "minHeight": 4,
                    "maxHeight": 7,
                    "textX": 1,
                    "textY": 1,
                    "textHeight": 5,
                    "position": "bottom",
                    "clearPrevious": true,
                    "showFrame": "true",
                    "speedIn": -1,
                    "speedOut": -1,
                    "closeWhen": "key",
                    "closeButton": "a",
                    "closeDelayTime": 0.5,
                    "closeDelayFrames": 30,
                    "__collapse": true
                  },
                  "id": "7d3de43e-29d9-4b1f-be1b-896ec6da14c0"
                },
                {
                  "command": "EVENT_SOUND_PLAY_EFFECT",
                  "args": {
                    "type": "9447a6ae-4924-4c38-8d51-904f9664f139",
                    "priority": "medium",
                    "pitch": 4,
                    "frequency": 200,
                    "duration": 0.5,
                    "wait": true,
                    "effect": 25,
                    "__collapse": false
                  },
                  "id": "0b1d90a5-8dc5-47a9-9a2a-a839fee2921d"
                }
              ],
              "false": [
                {
                  "command": "EVENT_SOUND_PLAY_EFFECT",
                  "args": {
                    "type": "9447a6ae-4924-4c38-8d51-904f9664f139",
                    "priority": "medium",
                    "pitch": 4,
                    "frequency": 200,
                    "duration": 0.5,
                    "wait": true,
                    "effect": 20
                  },
                  "id": "ce4f7a97-6ba0-4d18-ad1d-3fa21bc8b348"
                }
              ]
            },
            "id": "6d1e9707-c479-4058-a5ad-f8372b7166a8"
          },
          {
            "command": "EVENT_SET_VALUE",
            "args": {
              "variable": "3",
              "value": {
                "type": "expression",
                "value": "$03$ + $11$\n"
              },
              "__collapse": true
            },
            "id": "70f6e351-b495-4c50-b11b-5c39ddf1d157"
          },
          {
            "command": "EVENT_LOOP_WHILE",
            "args": {
              "condition": {
                "type": "expression",
                "value": "$03$ >= $05$*4"
              },
              "__collapse": false
            },
            "children": {
              "true": [
                {
                  "command": "EVENT_SET_VALUE",
                  "args": {
                    "variable": "3",
                    "value": {
                      "type": "expression",
                      "value": "$03$-$05$*4"
                    },
                    "__collapse": true
                  },
                  "id": "7e2119de-55e8-49ed-9eb8-78c35a218665"
                },
                {
                  "command": "EVENT_INC_VALUE",
                  "args": {
                    "variable": "5",
                    "__collapse": true
                  },
                  "id": "680ef6c6-e208-4473-aa5d-87a74e3e6f49"
                }
              ]
            },
            "id": "a3f15833-91f4-4749-9ccb-0d4b0e7d0e04"
          }
        ],
        "false": []
      },
      "id": "b353ca00-9c81-4216-8111-38ff22019048"
    },
    {
      "command": "EVENT_IF",
      "args": {
        "condition": {
          "type": "eq",
          "valueA": {
            "type": "variable",
            "value": "12"
          },
          "valueB": {
            "type": "number",
            "value": 2
          }
        },
        "__collapseElse": true,
        "__collapse": false
      },
      "children": {
        "true": [
          {
            "command": "EVENT_SET_VALUE",
            "args": {
              "variable": "11",
              "value": {
                "type": "expression",
                "value": "$06$ + rnd(max(0, $01$ / 2 - $06$))"
              },
              "__collapse": true
            },
            "id": "cb744e25-b732-452a-8d6c-d432067e5aba"
          },
          {
            "command": "EVENT_TEXT",
            "args": {
              "text": [
                "You healed for\n$11$ HPs"
              ],
              "__section": "text",
              "avatarId": "",
              "minHeight": 4,
              "maxHeight": 7,
              "textX": 1,
              "textY": 1,
              "textHeight": 5,
              "position": "bottom",
              "clearPrevious": true,
              "showFrame": "true",
              "speedIn": -1,
              "speedOut": -1,
              "closeWhen": "key",
              "closeButton": "a",
              "closeDelayTime": 0.5,
              "closeDelayFrames": 30,
              "__collapse": true
            },
            "id": "a34b4173-1ba0-41da-8d00-45b2fdb076e2"
          },
          {
            "command": "EVENT_SET_VALUE",
            "args": {
              "variable": "0",
              "value": {
                "type": "expression",
                "value": "min($14$, $00$ + $11$)"
              },
              "__collapse": false
            },
            "id": "5f3fd47b-937f-417f-bbfe-b22a573aa0b5"
          },
          {
            "command": "EVENT_SOUND_PLAY_EFFECT",
            "args": {
              "type": "9447a6ae-4924-4c38-8d51-904f9664f139",
              "priority": "medium",
              "pitch": 4,
              "frequency": 200,
              "duration": 0.5,
              "wait": true,
              "effect": 18
            },
            "id": "6414e1de-3528-4bf7-a984-d675f1b9ec60"
          },
          {
            "command": "EVENT_SET_VALUE",
            "args": {
              "variable": "4",
              "value": {
                "type": "expression",
                "value": "$04$ + $11$"
              },
              "__collapse": true
            },
            "id": "357d0ac1-f49d-4013-8e28-5e5e3ed2e0b1"
          },
          {
            "command": "EVENT_LOOP_WHILE",
            "args": {
              "condition": {
                "type": "expression",
                "value": "$04$ >= $06$*3"
              },
              "__collapse": true
            },
            "children": {
              "true": [
                {
                  "command": "EVENT_SET_VALUE",
                  "args": {
                    "variable": "4",
                    "value": {
                      "type": "expression",
                      "value": "$04$-$06$*3"
                    },
                    "__collapse": true
                  },
                  "id": "bdb4fea2-9079-4287-8c13-97c0cd1857f5"
                },
                {
                  "command": "EVENT_INC_VALUE",
                  "args": {
                    "variable": "6",
                    "__collapse": true
                  },
                  "id": "85c8935d-2d7e-4f2d-aa3e-47848d0d9a7c"
                }
              ]
            },
            "id": "56f208bb-1360-4ba9-941c-9708f6fd061f"
          }
        ],
        "false": [
          {
            "command": "EVENT_IF",
            "args": {
              "condition": {
                "type": "eq",
                "valueA": {
                  "type": "variable",
                  "value": "12"
                },
                "valueB": {
                  "type": "number",
                  "value": 3
                }
              },
              "__collapseElse": true
            },
            "children": {
              "true": [
                {
                  "command": "EVENT_TEXT",
                  "args": {
                    "text": [
                      "Whoosh."
                    ],
                    "__section": "text",
                    "avatarId": "",
                    "minHeight": 4,
                    "maxHeight": 7,
                    "textX": 1,
                    "textY": 1,
                    "textHeight": 5,
                    "position": "bottom",
                    "clearPrevious": true,
                    "showFrame": "true",
                    "speedIn": -1,
                    "speedOut": -1,
                    "closeWhen": "key",
                    "closeButton": "a",
                    "closeDelayTime": 0.5,
                    "closeDelayFrames": 30,
                    "__collapse": true
                  },
                  "id": "2353f7fd-25ce-4cea-b1e9-1f75ac3b83a5"
                }
              ],
              "false": []
            },
            "id": "8f0a6115-c406-416c-8635-3ac74e0fd218"
          }
        ]
      },
      "id": "9d0a216f-5622-4edb-8be4-fdccc585da14"
    },
    {
      "command": "EVENT_IF",
      "args": {
        "condition": {
          "type": "gt",
          "valueA": {
            "type": "variable",
            "value": "1"
          },
          "valueB": {
            "type": "number",
            "value": 0
          }
        },
        "__collapseElse": true,
        "__collapse": false
      },
      "children": {
        "true": [
          {
            "command": "EVENT_SET_VALUE",
            "args": {
              "variable": "12",
              "value": {
                "type": "expression",
                "value": "rnd(2)"
              },
              "__collapse": false
            },
            "id": "b1ab22f9-88af-4cce-b7d8-559267a871c6"
          },
          {
            "command": "EVENT_IF",
            "args": {
              "condition": {
                "type": "eq",
                "valueA": {
                  "type": "variable",
                  "value": "12"
                },
                "valueB": {
                  "type": "number",
                  "value": 0
                }
              },
              "__collapseElse": true,
              "__collapse": false
            },
            "children": {
              "true": [
                {
                  "command": "EVENT_SET_VALUE",
                  "args": {
                    "variable": "11",
                    "value": {
                      "type": "expression",
                      "value": "1 + rnd($05$-1)"
                    }
                  },
                  "id": "40b7531f-0f34-48df-aa69-3bf2b6893d9b"
                },
                {
                  "command": "EVENT_TEXT",
                  "args": {
                    "text": [
                      "The enemy dealt\n$11$ damage(s)"
                    ],
                    "__section": "text",
                    "avatarId": "",
                    "minHeight": 4,
                    "maxHeight": 7,
                    "textX": 1,
                    "textY": 1,
                    "textHeight": 5,
                    "position": "bottom",
                    "clearPrevious": true,
                    "showFrame": "true",
                    "speedIn": -1,
                    "speedOut": -1,
                    "closeWhen": "key",
                    "closeButton": "a",
                    "closeDelayTime": 0.5,
                    "closeDelayFrames": 30,
                    "__collapse": false
                  },
                  "id": "d93a10f5-9cef-4624-b034-738d13fd5fa1"
                },
                {
                  "command": "EVENT_SET_VALUE",
                  "args": {
                    "variable": "0",
                    "value": {
                      "type": "expression",
                      "value": "max(0, $00$ - $11$)"
                    },
                    "__collapse": false
                  },
                  "id": "f5aafac1-e985-47f2-b2e8-7aebd0804b20"
                },
                {
                  "command": "EVENT_IF",
                  "args": {
                    "condition": {
                      "type": "lte",
                      "valueA": {
                        "type": "variable",
                        "value": "0"
                      },
                      "valueB": {
                        "type": "number",
                        "value": 0
                      }
                    },
                    "__collapseElse": false,
                    "__collapse": false
                  },
                  "children": {
                    "true": [
                      {
                        "command": "EVENT_SOUND_PLAY_EFFECT",
                        "args": {
                          "type": "9447a6ae-4924-4c38-8d51-904f9664f139",
                          "priority": "medium",
                          "pitch": 4,
                          "frequency": 200,
                          "duration": 0.5,
                          "wait": true,
                          "effect": 25,
                          "__collapse": false
                        },
                        "id": "e3c4c939-a481-4cf8-a395-397980a7239e"
                      },
                      {
                        "command": "EVENT_CALL_CUSTOM_EVENT",
                        "args": {
                          "customEventId": "058cb3f2-19ed-4fdd-a966-a97ae6b63e60",
                          "__collapse": false
                        },
                        "id": "ed5412b7-50ac-4897-8a10-2a9394bd7d1d"
                      }
                    ],
                    "false": [
                      {
                        "command": "EVENT_SOUND_PLAY_EFFECT",
                        "args": {
                          "type": "9447a6ae-4924-4c38-8d51-904f9664f139",
                          "priority": "medium",
                          "pitch": 4,
                          "frequency": 200,
                          "duration": 0.5,
                          "wait": true,
                          "effect": 21,
                          "__collapse": false
                        },
                        "id": "4daaef0f-502d-40c4-9245-2b54fdc1d3ba"
                      },
                      {
                        "command": "EVENT_CAMERA_SHAKE",
                        "args": {
                          "time": 0.5,
                          "frames": 30,
                          "shakeDirection": "horizontal",
                          "magnitude": {
                            "type": "number",
                            "value": 3
                          }
                        },
                        "id": "24a33721-3144-4817-b391-8907d40dab35"
                      }
                    ]
                  },
                  "id": "f3011093-5d2f-4a70-bed7-935d94b9a062"
                }
              ],
              "false": []
            },
            "id": "f842f2e5-3ec7-4eb6-a7e4-297f6ac1acfe"
          },
          {
            "command": "EVENT_IF",
            "args": {
              "condition": {
                "type": "eq",
                "valueA": {
                  "type": "variable",
                  "value": "12"
                },
                "valueB": {
                  "type": "number",
                  "value": 1
                }
              },
              "__collapseElse": true,
              "__collapse": false
            },
            "children": {
              "true": [
                {
                  "command": "EVENT_SET_VALUE",
                  "args": {
                    "variable": "11",
                    "value": {
                      "type": "expression",
                      "value": "rnd($06$)"
                    },
                    "__collapse": false
                  },
                  "id": "27caa270-55d2-4a5e-90d5-fe54ae4bf626"
                },
                {
                  "command": "EVENT_TEXT",
                  "args": {
                    "text": [
                      "The enemy healed \n$11$ HPs"
                    ],
                    "__section": "text",
                    "avatarId": "",
                    "minHeight": 4,
                    "maxHeight": 7,
                    "textX": 1,
                    "textY": 1,
                    "textHeight": 5,
                    "position": "bottom",
                    "clearPrevious": true,
                    "showFrame": "true",
                    "speedIn": -1,
                    "speedOut": -1,
                    "closeWhen": "key",
                    "closeButton": "a",
                    "closeDelayTime": 0.5,
                    "closeDelayFrames": 30,
                    "__collapse": true
                  },
                  "id": "915ecbab-229d-404e-8524-f5e7a2138ccd"
                },
                {
                  "command": "EVENT_SET_VALUE",
                  "args": {
                    "variable": "1",
                    "value": {
                      "type": "expression",
                      "value": "min(8, $01$ + $11$)"
                    },
                    "__collapse": false
                  },
                  "id": "db91e0e5-c11e-432f-83ef-6bbf54ecc377"
                },
                {
                  "command": "EVENT_SOUND_PLAY_EFFECT",
                  "args": {
                    "type": "9447a6ae-4924-4c38-8d51-904f9664f139",
                    "priority": "medium",
                    "pitch": 4,
                    "frequency": 200,
                    "duration": 0.5,
                    "wait": true,
                    "effect": 18
                  },
                  "id": "0f908cc3-cad2-4bad-b4e5-e1659e92597c"
                }
              ],
              "false": []
            },
            "id": "615d25ae-0c8a-432c-a308-6b4b323bbd3a"
          }
        ],
        "false": []
      },
      "id": "5cd3130a-52bc-405e-a4ef-f5fb725ef201"
    }
  ]
}