

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 示例：创建水平不对等的团队（猎人对战怪物）
<a name="match-examples-2"></a>

此示例描述了一组玩家搜捕单个怪物的游戏模式。玩家可以选择猎人或怪物角色。猎人指定他们希望对战的怪物的最低技能水平。可随时间推移放宽猎人团队的最小规模以完成对战游戏。此方案规定了以下说明：
+ 创建一个包含五个猎人的团队。
+ 创建一个包含单个怪物的团队。
+ 包含以下玩家属性：
  + 玩家的技能水平（如果未提供，则默认为 10）。
  + 玩家首选的怪物技能水平 (如果未提供，则默认为 10)。
  + 玩家是否想成为怪物 (如果未提供，则默认为 0 或 false)。
+ 根据以下条件选择将成为怪物的玩家：
  + 玩家必须请求怪物角色。
  + 玩家必须满足或超过已添加到猎人团队的玩家的首选最高技能水平。
+ 根据以下条件选择将加入猎人团队的玩家：
  + 请求怪物角色的玩家无法加入猎人团队。
  + 如果怪物角色已填充，玩家必须要有低于建议怪物技能的怪物技能水平。
+ 如果对战游戏未快速填满，则放宽猎人团队的最小规模，如下所示：
  + 30 秒后，允许启动猎人团队只包含四个玩家的游戏。
  + 60 秒后，允许启动猎人团队只包含三个玩家的游戏。

使用此规则集的说明：
+ 通过为猎人和怪物分别创建两个单独的团队，您可以根据不同的条件评估团队成员。

```
{
    "name": "players_vs_monster_5_vs_1",
    "ruleLanguageVersion": "1.0",
    "playerAttributes": [{
        "name": "skill",
        "type": "number",
        "default": 10
    },{
        "name": "desiredSkillOfMonster",
        "type": "number",
        "default": 10
    },{
        "name": "wantsToBeMonster",
        "type": "number",
        "default": 0
    }],
    "teams": [{
        "name": "players",
        "maxPlayers": 5,
        "minPlayers": 5
    }, {
        "name": "monster",
        "maxPlayers": 1,
        "minPlayers": 1 
    }],
    "rules": [{
        "name": "MonsterSelection",
        "description": "Only users that request playing as monster are assigned to the monster team",
        "type": "comparison",
        "measurements": ["teams[monster].players.attributes[wantsToBeMonster]"],
        "referenceValue": 1, 
        "operation": "="
    },{
        "name": "PlayerSelection",
        "description": "Do not place people who want to be monsters in the players team",
        "type": "comparison",
        "measurements": ["teams[players].players.attributes[wantsToBeMonster]"],
        "referenceValue": 0,
        "operation": "="
    },{
        "name": "MonsterSkill",
        "description": "Monsters must meet the skill requested by all players",
        "type": "comparison",
        "measurements": ["avg(teams[monster].players.attributes[skill])"],
        "referenceValue": "max(teams[players].players.attributes[desiredSkillOfMonster])",
        "operation": ">="
    }],
    "expansions": [{
        "target": "teams[players].minPlayers",
        "steps": [{
            "waitTimeSeconds": 30,
            "value": 4 
        },{
            "waitTimeSeconds": 60,
            "value": 3 
        }]
    }]
}
```