- type: htnCompound
  id: CMUZombieSummonerZombieCompound
  branches:
  - preconditions:
    - !type:HasOrdersPrecondition
      orders: enum.ZombieSummonerOrderType.Halt
    tasks:
    - !type:HTNCompoundTask
      task: IdleCompound
  - preconditions:
    - !type:HasOrdersPrecondition
      orders: enum.ZombieSummonerOrderType.Attack
    tasks:
    - !type:HTNCompoundTask
      task: CMUZombieSummonerHostileCompound
  - preconditions:
    - !type:HasOrdersPrecondition
      orders: enum.ZombieSummonerOrderType.Follow
    tasks:
    - !type:HTNCompoundTask
      task: FollowCompound
  - preconditions:
    - !type:HasOrdersPrecondition
      orders: enum.ZombieSummonerOrderType.CheeseEm
    tasks:
    - !type:HTNCompoundTask
      task: CMUZombieSummonerTargetAttackCompound
  - tasks:
    - !type:HTNCompoundTask
      task: CMUZombieSummonerHostileCompound

- type: htnCompound
  id: CMUZombieSummonerTargetAttackCompound
  branches:
  - tasks:
    - !type:HTNPrimitiveTask
      operator: !type:ZombieSummonerOrderedTargetOperator
    - !type:HTNCompoundTask
      task: CMUZombieSummonerBeforeMeleeAttackOrderedTargetCompound
  - tasks:
    - !type:HTNCompoundTask
      task: FollowCompound
  - tasks:
    - !type:HTNCompoundTask
      task: IdleCompound

- type: htnCompound
  id: CMUZombieSummonerHostileCompound
  branches:
  - tasks:
    - !type:HTNCompoundTask
      task: CMUZombieSummonerHostileCombatCompound
  - tasks:
    - !type:HTNCompoundTask
      task: IdleCompound

- type: htnCompound
  id: CMUZombieSummonerHostileCombatCompound
  branches:
  - tasks:
    - !type:HTNPrimitiveTask
      operator: !type:UtilityOperator
        proto: NearbyMeleeTargets
    - !type:HTNCompoundTask
      task: CMUZombieSummonerBeforeMeleeAttackTargetCompound

- type: htnCompound
  id: CMUZombieSummonerBeforeMeleeAttackTargetCompound
  branches:
  - preconditions:
    - !type:BuckledPrecondition
      isBuckled: true
    tasks:
    - !type:HTNPrimitiveTask
      operator: !type:UnbuckleOperator
        shutdownState: TaskFinished
  - preconditions:
    - !type:PulledPrecondition
      isPulled: true
    tasks:
    - !type:HTNPrimitiveTask
      operator: !type:UnPullOperator
        shutdownState: TaskFinished
  - preconditions:
    - !type:InContainerPrecondition
      isInContainer: true
    tasks:
    - !type:HTNCompoundTask
      task: EscapeCompound
  - preconditions:
    - !type:ActiveHandComponentPrecondition
      components:
      - type: MeleeWeapon
        damage:
          types:
            Blunt: 0
      invert: true
    tasks:
    - !type:HTNCompoundTask
      task: PickupMeleeCompound
  - tasks:
    - !type:HTNCompoundTask
      task: CMUZombieSummonerMeleeAttackTargetCompound

- type: htnCompound
  id: CMUZombieSummonerMeleeAttackTargetCompound
  branches:
  - preconditions:
    - !type:KeyExistsPrecondition
      key: Target
    tasks:
    - !type:HTNPrimitiveTask
      operator: !type:MoveToOperator
        shutdownState: PlanFinished
        pathfindInPlanning: true
        removeKeyOnFinish: false
        targetKey: TargetCoordinates
        pathfindKey: TargetPathfind
        rangeKey: MeleeRange
    - !type:HTNPrimitiveTask
      operator: !type:MeleeOperator
        targetKey: Target
      preconditions:
      - !type:KeyExistsPrecondition
        key: Target
      - !type:TargetInRangePrecondition
        targetKey: Target
        rangeKey: MeleeRange
      services:
      - !type:UtilityService
        id: MeleeService
        proto: NearbyMeleeTargets
        key: Target

- type: htnCompound
  id: CMUZombieSummonerBeforeMeleeAttackOrderedTargetCompound
  branches:
  - preconditions:
    - !type:BuckledPrecondition
      isBuckled: true
    tasks:
    - !type:HTNPrimitiveTask
      operator: !type:UnbuckleOperator
        shutdownState: TaskFinished
  - preconditions:
    - !type:PulledPrecondition
      isPulled: true
    tasks:
    - !type:HTNPrimitiveTask
      operator: !type:UnPullOperator
        shutdownState: TaskFinished
  - preconditions:
    - !type:InContainerPrecondition
      isInContainer: true
    tasks:
    - !type:HTNCompoundTask
      task: EscapeCompound
  - preconditions:
    - !type:ActiveHandComponentPrecondition
      components:
      - type: MeleeWeapon
        damage:
          types:
            Blunt: 0
      invert: true
    tasks:
    - !type:HTNCompoundTask
      task: PickupMeleeCompound
  - tasks:
    - !type:HTNCompoundTask
      task: CMUZombieSummonerMeleeAttackOrderedTargetCompound

- type: htnCompound
  id: CMUZombieSummonerMeleeAttackOrderedTargetCompound
  branches:
  - preconditions:
    - !type:KeyExistsPrecondition
      key: Target
    tasks:
    - !type:HTNPrimitiveTask
      operator: !type:MoveToOperator
        shutdownState: PlanFinished
        pathfindInPlanning: true
        removeKeyOnFinish: false
        targetKey: TargetCoordinates
        pathfindKey: TargetPathfind
        rangeKey: MeleeRange
    - !type:HTNPrimitiveTask
      operator: !type:MeleeOperator
        targetKey: Target
      preconditions:
      - !type:KeyExistsPrecondition
        key: Target
      - !type:TargetInRangePrecondition
        targetKey: Target
        rangeKey: MeleeRange

- type: localizedDataset
  id: ZombieSummonerCommandHalt
  values:
    prefix: cmu-zombie-summoner-command-halt-
    count: 3

- type: localizedDataset
  id: ZombieSummonerCommandAttack
  values:
    prefix: cmu-zombie-summoner-command-attack-
    count: 3

- type: localizedDataset
  id: ZombieSummonerCommandFollow
  values:
    prefix: cmu-zombie-summoner-command-follow-
    count: 2

- type: localizedDataset
  id: ZombieSummonerCommandCheeseEm
  values:
    prefix: cmu-zombie-summoner-command-cheese-
    count: 4
