Game:
  Name: "60 Seconds example"
  Description: "This is an example of 60 Seconds as a text game."
  Version: 0.1

Commands:
  status:
    Description: "Show informations"
    Text: "Day $Day. Food: $Food, Water: $Water, Ted hunger: $Ted.Hunger, Dolores hunger: $Dolores.Hunger"
  nextday:
    Description: "Go to next day"
    StatePatch: "$Day+=1"
    Text: "Day: $Day."
  expedition:
    Description: "Start Expedition"
    Action: "Expedition"
  feed:
    Description: "Feed someone"
    Text: "Who do you want to feed?"
    Ask:
      Options:
        - Text: "Ted"
          If: "!$Ted.OnExpedition"
          StatePatch: "$Food > 0 && ($Ted.Hunger-=1) && ($Food-=1) ? 'Ted\\'s hunger decreased.' : 'Out of food.'"
        - Text: "Dolores"
          If: "!$Dolores.OnExpedition"
          StatePatch: "$Food > 0 && ($Dolores.Hunger-=1) && ($Food-=1) ? 'Dolores hunger decreased.' : 'Out of food.'"

State:
  Day: 1
  ExpeditionName: ""
  ExpeditionDays: 0
  Water: 0
  Food: 0
  People: 2
  Ted:
    HP: 3
    Hunger: 0
    OnExpedition: false
  Dolores:
    HP: 3
    Hunger: 0
    OnExpedition: false

Watch:
  Day:
    StatePatch: "(!$Ted.OnExpedition && ($Ted.Hunger+=1)); (!$Dolores.OnExpedition && ($Dolores.Hunger+=1)); $ExpeditionDays-=1"
    IncrementStory: 1
  ExpeditionDays:
    - If: "$newValue == 0"
      Text: "$ExpeditionName returned from the expedition."
      Action: "ExpeditionEnd"
  Ted.Hunger:
    - If: "!$Ted.OnExpedition && $newValue > 0 && $Ted.HP > 0"
      StatePatch: "$Ted.HP-=1"
    - If: "!$Ted.OnExpedition && $newValue > 1 && $Ted.HP > 0"
      Text: "Ted is very hungry."
    - If: "!$Ted.OnExpedition && $newValue > 0 && $newValue <= 1 && $Ted.HP > 0"
      Text: "Ted is hungry."
  Ted.HP:
    - If: "!$Ted.OnExpedition && $newValue == 0"
      Text: "Ted died."
      StatePatch: "$People-=1"
  People:
    - If: "$newValue == 1"
      GameOver: true

Actions:
  Expedition:
    - TextExpr: "!$ExpeditionName ? 'Who do you want to send on the expedition?' : 'Someone is already on the expedition.'"
      Ask:
        If: "!$ExpeditionName"
        Options:
          - Text: "Send Ted on the expedition."
            If: "!$Ted.OnExpedition"
            Effect:
              StatePatch: "$Ted.OnExpedition=true;$ExpeditionName='Ted';$ExpeditionDays=1"
              Text: "Ted goes on the expedition."
          - Text: "Send Dolores on the expedition."
            If: "!$Dolores.OnExpedition"
            Effect:
              StatePatch: "$Dolores.OnExpedition=true;$ExpeditionName='Dolores';$ExpeditionDays=1"
              Text: "Dolores goes on the expedition."
  ExpeditionEnd:
    - Random:
        - Text: "$ExpeditionName brought 1 water."
          Chance: 0.5
          StatePatch: "$Water+=1;$ExpeditionName='';$ExpeditionDays=0;"

        - Text: "$ExpeditionName brought 1 food."
          Chance: 0.5
          StatePatch: "$Food+=1;$ExpeditionName='';$ExpeditionDays=0;"


Story:
  - Text: "You are in your house. You have 60 seconds to prepare for the end of the world."
    Ask:
      Options:
        - Text: "Take 3 Water and 3 Food."
          Effect:
            StatePatch: "$Water+=3;$Food+=3"
        - Text: "Take 4 Water and 2 Food."
          Effect:
            StatePatch: "$Water+=4;$Food+=2"
        - Text: "Take 2 Water and 4 Food."
          Effect:
            StatePatch: "$Water+=2;$Food+=4"
      Effect:
        Text: "Day $Day. You have collected the necessary supplies. Decide what to do next using the commands: nextday, feed, expedition or status."

  - Text: "Somebody knocks on the door. What are you doing?"
    Ask:
      Options:
        - Text: "Open door."
          Effect:
            StatePatch: "$Water/=2;$Food/=2"
            Text: "You get robbed, you lose half your supplies."
        - Text: "Don't open."
          Effect:
            Text: "You decided not to open the door."

  - Text: "Somebody knocks on the door. What are you doing?"
    Ask:
      Options:
        - Text: "Open door."
          Effect:
            Text: "You are attacked."
            StatePatch: "$Ted.HP=0"
