{
  "schemaVersion": 20,
  "operationSchemaVersion": 4,
  "name": "秘密の入力から公開結果だけを作る",
  "version": 1,
  "metadata": {
    "description": "0〜9の入力値は本人限定に保持し、5以上かどうかだけを明示公開します。秘密投票や完全なゲームではなく、公開範囲の機能例です。",
    "minPlayers": 1,
    "maxPlayers": 2,
    "genres": [
      "その他"
    ],
    "durationRange": "10-30",
    "rules": [
      {
        "id": "rule",
        "title": "操作",
        "body": "入力して判定を押します。数値そのものは他の人へ出さず、5以上かどうかだけ全員へ通知します。"
      }
    ]
  },
  "tabs": [
    {
      "id": "main",
      "name": "共有盤面",
      "type": "standard",
      "hidden": false
    }
  ],
  "items": [],
  "background": {
    "color": "#edf6ff",
    "size": "landscape",
    "grid": false
  },
  "settings": {
    "handsEnabled": false,
    "globalVariables": [
      {
        "id": "verdict",
        "name": "公開判定",
        "type": "text",
        "defaultValue": "未判定"
      }
    ],
    "playerVariables": [
      {
        "id": "secret",
        "name": "本人の数字",
        "type": "number",
        "defaultValue": "0",
        "visible": false,
        "publication": "owner"
      }
    ],
    "commonProcesses": [
      {
        "id": "derive",
        "name": "秘密から公開可能な判定だけを反映",
        "parameters": [],
        "actions": [
          {
            "id": "judge",
            "type": "condition",
            "target": "actor",
            "amount": {
              "kind": "number",
              "value": 0
            },
            "temporaryBindings": {
              "branches.0.condition": {
                "kind": "binary",
                "operator": ">=",
                "left": {
                  "kind": "property",
                  "source": {
                    "kind": "game-value",
                    "referenceId": "game.actor"
                  },
                  "path": [
                    "variables",
                    "secret"
                  ]
                },
                "right": {
                  "kind": "literal",
                  "value": {
                    "type": "number",
                    "collection": "single",
                    "data": 5,
                    "visibility": {
                      "kind": "public"
                    }
                  }
                }
              }
            },
            "branches": [
              {
                "id": "at-least-five",
                "left": {
                  "kind": "number",
                  "value": 1
                },
                "operator": "=",
                "right": {
                  "kind": "number",
                  "value": 1
                },
                "actions": [
                  {
                    "id": "publish-high",
                    "type": "variable",
                    "target": "actor",
                    "source": "global:verdict",
                    "mode": "set",
                    "amount": {
                      "kind": "number",
                      "value": 0
                    },
                    "variableValue": {
                      "kind": "fixed-text",
                      "value": "入力は5以上です"
                    },
                    "temporaryPublish": true
                  }
                ]
              }
            ],
            "elseActions": [
              {
                "id": "publish-low",
                "type": "variable",
                "target": "actor",
                "source": "global:verdict",
                "mode": "set",
                "amount": {
                  "kind": "number",
                  "value": 0
                },
                "variableValue": {
                  "kind": "fixed-text",
                  "value": "入力は5未満です"
                },
                "temporaryPublish": true
              }
            ]
          }
        ]
      }
    ],
    "actionButtons": [
      {
        "id": "ask",
        "phaseId": "start",
        "name": "入力して判定",
        "actions": [
          {
            "id": "input",
            "type": "inputWindow",
            "target": "actor",
            "playerTarget": {
              "kind": "actor"
            },
            "amount": {
              "kind": "number",
              "value": 0
            },
            "inputWindow": {
              "title": "本人だけの数字",
              "label": "0〜9の整数",
              "format": "number",
              "minimum": 0,
              "maximum": 9,
              "integerOnly": true,
              "answerVisibility": "respondent",
              "resultScope": "player",
              "resultVariableId": "secret"
            }
          },
          {
            "id": "derive-call",
            "type": "commonCall",
            "commonProcessId": "derive",
            "temporaryBindings": {"commonProcessId":{"kind":"literal","value":{"type":"text","collection":"single","data":"derive","visibility":{"kind":"public"}}}},
            "target": "actor",
            "amount": {
              "kind": "number",
              "value": 0
            }
          },
          {
            "id": "public-notice",
            "type": "notice",
            "target": "all",
            "playerTarget": {
              "kind": "all"
            },
            "amount": {
              "kind": "number",
              "value": 0
            },
            "notice": {
              "mode": "notify",
              "title": "公開してよい判定だけ通知"
            },
            "messageParts": [
              {
                "kind": "value",
                "value": {
                  "kind": "global-variable",
                  "variableId": "verdict"
                }
              }
            ]
          }
        ]
      }
    ]
  }
}
