{
  "schemaVersion": 20,
  "operationSchemaVersion": 4,
  "name": "配札から全員確認・終了まで",
  "version": 1,
  "metadata": {
    "description": "2人で2枚ずつ配り、交互に選択して出し、全員確認後にリザルトへ進む最小の通し例です。",
    "minPlayers": 2,
    "maxPlayers": 2,
    "genres": [
      "カードゲーム"
    ],
    "durationRange": "10-30",
    "rules": [
      {
        "id": "rule",
        "title": "操作",
        "body": "自分の手番で手札1枚を選び、出すを押します。全4枚を出したら全員が確認し、結果を表示します。両者2点となる進行機能の例です。"
      }
    ]
  },
  "tabs": [
    {
      "id": "main",
      "name": "メイン",
      "type": "standard",
      "hidden": false
    }
  ],
  "background": {
    "color": "#075b42",
    "size": "landscape",
    "grid": false
  },
  "items": [
    {
      "id": "deck",
      "kind": "card",
      "name": "4枚の山札",
      "tab": "main",
      "x": 20,
      "y": 50,
      "width": 100,
      "height": 140,
      "canMove": false,
      "faceUp": false,
      "cards": [],
      "count": 4,
      "variableDefs": [
        {
          "name": "strength",
          "type": "number"
        }
      ],
      "cardDefs": [
        {
          "id": "one",
          "name": "1",
          "copies": 1,
          "variables": {
            "strength": "1"
          }
        },
        {
          "id": "two",
          "name": "2",
          "copies": 1,
          "variables": {
            "strength": "2"
          }
        },
        {
          "id": "three",
          "name": "3",
          "copies": 1,
          "variables": {
            "strength": "3"
          }
        },
        {
          "id": "four",
          "name": "4",
          "copies": 1,
          "variables": {
            "strength": "4"
          }
        }
      ]
    },
    {
      "id": "table",
      "kind": "box",
      "name": "出した札",
      "tab": "main",
      "x": 55,
      "y": 50,
      "width": 280,
      "height": 170,
      "boxType": "holder",
      "boxShuffle": false
    },
    {
      "id": "progress",
      "kind": "text",
      "name": "進行表示",
      "tab": "main",
      "x": 50,
      "y": 20,
      "width": 600,
      "height": 50,
      "fontSize": 24,
      "textParts": [
        {
          "kind": "value",
          "value": {
            "kind": "global-variable",
            "variableId": "progress"
          }
        }
      ]
    }
  ],
  "settings": {
    "handsEnabled": true,
    "turn": {
      "enabled": true,
      "playerOnly": true,
      "multipleAllowed": false,
      "allowOwnHand": true,
      "allowOwnTab": true
    },
    "markers": [],
    "globalVariables": [
      {
        "id": "played",
        "name": "出した枚数",
        "type": "number",
        "defaultValue": "0"
      },
      {
        "id": "progress",
        "name": "進行表示",
        "type": "text",
        "defaultValue": "手札を1枚選んで出してください"
      }
    ],
    "playerVariables": [
      {
        "id": "score",
        "name": "得点",
        "type": "number",
        "defaultValue": "0",
        "visible": true,
        "publication": "public"
      }
    ],
    "initialActions": [
      {
        "id": "shuffle",
        "type": "shuffle",
        "source": "deck",
        "target": "all",
        "amount": {
          "kind": "number",
          "value": 0
        },
        "showAnimation": false
      },
      {
        "id": "deal",
        "type": "move",
        "target": "all",
        "playerTarget": {
          "kind": "all"
        },
        "amount": {
          "kind": "number",
          "value": 2
        },
        "sourceAmountMode": "per-destination",
        "cardSelector": {
          "location": {
            "kind": "initial-cards",
            "cardSetId": "deck"
          },
          "condition": {
            "kind": "all"
          }
        },
        "destinationLocations": [
          {
            "kind": "hand",
            "players": {
              "kind": "all"
            }
          }
        ],
        "face": "up",
        "handVisibility": "owner",
        "showAnimation": false
      },
      {
        "id": "sort",
        "type": "sort",
        "target": "all",
        "amount": {
          "kind": "number",
          "value": 0
        },
        "cardSelector": {
          "location": {
            "kind": "hand",
            "players": {
              "kind": "all"
            }
          },
          "condition": {
            "kind": "all"
          }
        },
        "mode": "ascending"
      }
    ],
    "actionButtons": [
      {
        "id": "play",
        "name": "出す",
        "phaseId": "start",
        "displayCommonCondition": {
          "kind": "comparison",
          "left": {
            "kind": "card-count",
            "cards": {
              "location": {
                "kind": "hand",
                "players": {
                  "kind": "actor"
                }
              },
              "condition": {
                "kind": "selected-by-actor"
              }
            }
          },
          "operator": "=",
          "right": {
            "kind": "fixed",
            "value": 1
          }
        },
        "activeCommonCondition": {
          "kind": "comparison",
          "left": {
            "kind": "card-count",
            "cards": {
              "location": {
                "kind": "hand",
                "players": {
                  "kind": "actor"
                }
              },
              "condition": {
                "kind": "selected-by-actor"
              }
            }
          },
          "operator": "=",
          "right": {
            "kind": "fixed",
            "value": 1
          }
        },
        "actions": [
          {
            "id": "put",
            "type": "move",
            "source": "selected-hand",
            "destination": "table",
            "target": "actor",
            "amount": {
              "kind": "number",
              "value": 1
            },
            "face": "up",
            "showAnimation": false
          },
          {
            "id": "score-one",
            "type": "variable",
            "source": "player:score",
            "mode": "add",
            "playerTarget": {
              "kind": "actor"
            },
            "target": "actor",
            "amount": {
              "kind": "number",
              "value": 1
            },
            "variableValue": {
              "kind": "fixed",
              "value": 1
            }
          },
          {
            "id": "count-one",
            "type": "variable",
            "source": "global:played",
            "mode": "add",
            "target": "actor",
            "amount": {
              "kind": "number",
              "value": 1
            },
            "variableValue": {
              "kind": "fixed",
              "value": 1
            }
          },
          {
            "id": "finish-or-next",
            "type": "condition",
            "target": "actor",
            "amount": {
              "kind": "number",
              "value": 0
            },
            "branches": [
              {
                "id": "all-played",
                "left": {
                  "kind": "global",
                  "source": "played"
                },
                "operator": "=",
                "right": {
                  "kind": "number",
                  "value": 4
                },
                "actions": [
                  {
                    "id": "end-label",
                    "type": "variable",
                    "source": "global:progress",
                    "mode": "set",
                    "target": "actor",
                    "amount": {
                      "kind": "number",
                      "value": 0
                    },
                    "variableValue": {
                      "kind": "fixed-text",
                      "value": "ゲーム終了"
                    }
                  },
                  {
                    "id": "confirm",
                    "type": "notice",
                    "target": "all",
                    "playerTarget": {
                      "kind": "all"
                    },
                    "amount": {
                      "kind": "number",
                      "value": 0
                    },
                    "notice": {
                      "mode": "acknowledge",
                      "title": "ラウンド結果の確認"
                    },
                    "message": "全員が確認するとリザルトへ進みます。"
                  },
                  {
                    "id": "end",
                    "type": "gameEnd",
                    "target": "actor",
                    "amount": {
                      "kind": "number",
                      "value": 0
                    }
                  }
                ]
              }
            ],
            "elseActions": [
              {
                "id": "next",
                "type": "marker",
                "source": "turn",
                "mode": "move",
                "playerTarget": {
                  "kind": "turn",
                  "position": "next"
                },
                "target": "actor",
                "amount": {
                  "kind": "number",
                  "value": 1
                }
              }
            ]
          }
        ]
      }
    ],
    "result": {
      "mode": "individual",
      "ranking": [
        {
          "value": {
            "kind": "player-variable",
            "variableId": "score",
            "players": {
              "kind": "actor"
            }
          },
          "order": "descending"
        }
      ],
      "metrics": [
        {
          "id": "score",
          "label": "出した枚数",
          "value": {
            "kind": "player-variable",
            "variableId": "score",
            "players": {
              "kind": "actor"
            }
          },
          "unit": "点"
        }
      ],
      "objectives": [],
      "successTitle": "終了",
      "failureTitle": "終了"
    }
  }
}
