# coding=utf-8
#!/usr/bin/env python2

# Welcome to {Game Title}
# This is a text based game inspired by Fallout written in Python
#
# @copyright   2015            Alexander Young, Noah Hayes
# @license     MIT Licence     <https://github.com/meun5/camel-game-python/blob/master/LICENSE>
# @link        Github          <https://github.com/meun5/camel-game-python/>
# @version     alpha-dev       0.1.1
#
# Credits:
# @author      Alexander Young <youngale@urbandaleschools.com>
# @designer    Noah Hayes      <hayesnoa@urbandaleschools.com>
#
# Fallout is Copyright Bethesda Game Studios
# Copyright infringement was not the intent of this game

from __future__ import print_function
from datetime import date, timedelta
from sys import exit
import random
import string
import time
import json
import os.path, os
import datetime

gameTitle = "sudo apt-get install a-virus.pyc#!=="
gameTitle += ''.join(random.choice(string.hexdigits) for i in range(36))

save_name = "save.json"

# The story begins on 23/10/2287
curr_date = datetime.date(2287, 10, 23)

maxTravel = {
    "user": {
        "max": 547,
        "min": 120,
    },
    "haters": {
        "max": 176,
        "min": 15,
    }
}

maxGain = 45

inv = {
    "cola": 3,
    "radroach": 3,
    "kilometres": 46495,
    "haters_back": 150,
    "day": 1,
    "stats": {
        "health": 100,
        "thirst": 75,
        "bandwidth": 250,
    },
    "need_bandwidth": False,
}

limits = {
    "eat": 3,
    "drink": 300,
    "deduct_min": {
        "health": 2,
        "thirst": 2,
        "bandwidth": 4,
    },
    "deduct_max": {
        "health": 7,
        "thirst": 9,
        "bandwidth": 8,
    },
    "generate": {
        "health": "4|37",
        "drink": "7|29",
    }
}

senarios = {
    "general": {
        "haters": "The haters are {amount} kilometres behind you.",
        "travel": "You traveled {amount} kilometres",
        "call_isp": "You are out of Bandwidth. Call Bell Canada at 1-866-310-2355.",
        "eat": "You ate {limit} radroach meat and gained {amount} health. Thats about it.",
        "drink": "You drank {limit} litres of Nuka Cola and quenched {amount} thirst. Nothing else happened.",
    },
    "travel": {
        0: {
            "message": "Nothing interseting happened today.",
            "gained": "You traveled {amount} kilometres",
            "special": "kilometres|same",
            "type": "kilometres",
            "event": "none",
        },
        1: {
            "message": "You got stuck in a boring conversation and it took all day to get out.",
            "gained": "You didn't travel at all today",
            "special": "kilometres|none",
            "type": "kilometres",
            "event": "none"
        },
        2: {
            "message": "Whilst traveling you found a stash of food!",
            "gained": "You gained {amount} radroach meats",
            "special": "radroach|inc",
            "type": "radroach",
            "event": "none",
        },
        3: {
            "message": "While you where traveling you happened to find a vending machine with Nuka Cola in it!",
            "gained": "You gained {amount} litres of Nuka Cola",
            "special": "cola|inc",
            "type": "cola",
            "event": "none",
        },
        4: {
            "message": "Whilst traveling you where attacked by a deathclaw. In your confusion you traveled in the wrong direction.",
            "gained": "You traveled {amount} kilometres back",
            "special": "kilometres|half",
            "type": "kilometres",
            "event": "battle",
        },
        5: {
            "message": "Whilst traveling you passed by a friendly internet cafe. Some generous trolls gave some Nuka Cola",
            "gained": "You gain {amount} litres of Nuka Cola",
            "special": "cola|inc",
            "type": "cola",
            "event": "none",
        },
        6: {
            "message": "While you where traveling you where MITM'ed by a hatin' sysadmin. While you battled with him, the haters gained ground.",
            "gained": "You traveled {amount} kilometres",
            "special": "haters_back|inc",
            "type": "kilometres",