import math
import collections

CreepsConsts = collections.namedtuple(
    'CreepsConsts', 'health, speed, reward, power')
TowersConsts = collections.namedtuple(
    'TowersConsts', 'damage, range, speed, price')
Point = collections.namedtuple('Point', 'row, col')


UNITS = {'creeps': {'Peon': CreepsConsts(50, 20, 10, 35),
                    'Grunt': CreepsConsts(100, 15, 15, 50),
                    'Raider': CreepsConsts(80, 25, 20, 50),
                    'Blademaster': CreepsConsts(90, 20, 25, 50),
                    'Shaman': CreepsConsts(75, 15, 20, 35),
                    'Footman': CreepsConsts(40, 15, 0, 35)},
         'towers': {'ArcaneTower': TowersConsts(15, 3, 5, 10),
                    'GuardTower': TowersConsts(25, 2, 5, 15),
                    'CanonTower': TowersConsts(35, 1.5, 3, 20),
                    'MagicTower': TowersConsts(25, 2.5, 5, 30),
                    'BarracksTower': TowersConsts(0, 3, 1, 50)}}

MAX_HEALTH = {'Peon': 50,
              'Grunt': 100,
              'Raider': 80,
              'Blademaster': 90,
              'Shaman': 75,
              'Footman': 40}

TITLE = 'Tower Defense'
START_GOLD = 100
ENEMIES_ALLOWED = 5
PORTAL = Point(10, 0)
CASTLE = Point(10, 39)
CREEPS_IN_WAVE = 5

LEVEL1 = ['GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG',
          'GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG',
          'GGGGGGGGG       GGGGGGGGGGGGGGGGGGGGGGGG',
          'GGGGGGGGG GGGGG GGGG      GGGGGGGGGGGGGG',
          'GGGGGGGGG GGGGG GGGG GGGG GGG     GGGGGG',
          'GGGGGGGGG GGGGG GGGG GGGG GGG GGG GGGGGG',
          'GGGGGGGGG GGGGG GGGG GGGG GGG GGG GGGGGG',
          'GGGGGGGGG GGGGG GGGG GGGG GGG GGG GGGGGG',
          'GGGGGGGGG GGGGG GGGG GGGG GGG GGG GGGGGG',
          'GGGGGGGGG GGGGG GGGG GGGG GGG GGG GGGGGG',
          'P   GGGGG GGGGG GGGG GGGG GGG GGG GG   C',
          'GGG GGGGG GGGGG GGGG GGGG GGG GGG GG GGG',
          'GGG GGGGG GGGGG GGGG GGGG GGG GGG GG GGG',
          'GGG GGGGG GGGGG GGGG GGGG GGG GGG GG GGG',
          'GGG GGGGG GGGGG GGGG GGGG GGG GGG GG GGG',
          'GGG GGGGG GGGGG GGGG GGGG GGG GGG    GGG',
          'GGG GGGGG GGGGG GGGG GGGG     GGGGGGGGGG',
          'GGG GGGGG GGGGG      GGGGGGGGGGGGGGGGGGG',
          'GGG       GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG',
          'GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG',
          'GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG']

LEVEL2 = ['GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG',
          'GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG',
          'GGG                                  GGG',
          'GGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG GGG',
          'GGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG GGG',
          'GGG GGGG         GGGGGGGGGGGGGGGGGGG GGG',
          'GGG GGGG GGGGGGG GGGGGG       GGGGGG GGG',
          'GGG GGGG GGGGGGG GGGGGG GGGGG GGGGGG GGG',
          'GGG GGGG GGGGGGG GGGGGG GGGGG GGGGGG GGG',
          'GGG GGGG GGGGGGG GGGGGG GGGGG GGGGGG GGG',
          'P        GGGGGGG GGGGGG GGGGG GGG      C',
          'GGG GGGGGGGGGGGG GGGGGG GGGGG GGG GG GGG',
          'GGG GGGGGGGGGGGG GGGGGG GGGGG GGG GG GGG',
          'GGG GGGGGGGGGGGG GGGGGG GGGGG GGG GG GGG',
          'GGG GGGGGGGGGGGG GGGGGG GGGGG     GG GGG',
          'GGG GGGGGGGGGGGG        GGGGGGGGGGGG GGG',
          'GGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG GGG',
          'GGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG GGG',
          'GGG                                  GGG',
          'GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG',
          'GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG']

LEVEL3 = ['GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG',
          'GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG',
          'GGG       GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG',
          'GGG GGGGG       GGGGGGGGGGGGGGGGGGGGGGGG',
          'GGG GGGGGGGGGGG      GGGGGGGGGGGGGGGGGGG',
          'GGG GGGGGGGGGGGGGGGG      GGGGGGGGGGGGGG',
          'GGG GGGGGGGGGGGGGGGGGGGGG     GGGGGGGGGG',
          'GGG GGGGGGGGGGGGGGGGGGGGGGGGG     GGGGGG',
          'GGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGG    GGG',
          'GGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG GGG',
          'P   GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG   C',
          'GGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG GGG',
          'GGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGG    GGG',
          'GGG GGGGGGGGGGGGGGGGGGGGGGGGG     GGGGGG',
          'GGG GGGGGGGGGGGGGGGGGGGGG     GGGGGGGGGG',
          'GGG GGGGGGGGGGGGGGGG      GGGGGGGGGGGGGG',
          'GGG GGGGGGGGGGG      GGGGGGGGGGGGGGGGGGG',
          'GGG GGGGG       GGGGGGGGGGGGGGGGGGGGGGGG',
          'GGG       GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG',
          'GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG',
          'GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG']

LEVELS = [LEVEL1, LEVEL2, LEVEL3]

TOWERS_NAMES = ['ArcaneTower', 'CanonTower', 'GuardTower', 'MagicTower', 'BarracksTower']
MAGIC_NAMES = ['FireMagic', 'IceMagic']
CONTROL_NAMES = ['Reset', 'Pause', 'Slower', 'Faster', 'Restart']

LABEL_NAMES = ['Gold', 'Enemies']

TEXTURES_FOLDER = 'field'
ICON_PATH = '{}/Icon.png'.format(TEXTURES_FOLDER)
START_LOGO_PATH = '{}/StartLogo.png'.format(TEXTURES_FOLDER)
DEFEAT_LOGO_PATH = '{}/DefeatLogo.png'.format(TEXTURES_FOLDER)
CURSOR_PATH = '{}/Cursor.png'.format(TEXTURES_FOLDER)
BORDER_PATH = '{}/Border.png'.format(TEXTURES_FOLDER)
PLAY_PATH = '{}/Play.png'.format(TEXTURES_FOLDER)
PAUSE_PATH = '{}/Pause.png'.format(TEXTURES_FOLDER)
AURA_PATH = '{}/Aura.png'.format(TEXTURES_FOLDER)
FIRE_PATH = '{}/Fire.png'.format(TEXTURES_FOLDER)
WIND_PATH = '{}/Ice.png'.format(TEXTURES_FOLDER)

PROCESS_NAME = 'python tower_defense.py'

UVS = [1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0]
INDICES = [0, 1, 2, 1, 2, 3]

REDRAW_TIME = math.ceil(1000 / 60)
SPAWN_WAVE_TIME = 15000
SPAWN_CREEP_TIME = 15000
MOVE_CREEP_TIME = 5000
TOWER_ATTACK_TIME = 5000
ATTACK_DELETE_TIME = 200

DEFAULT_MULTIPLIER = 1
MAX_MULTIPLIER = 6
MIN_MULTIPLIER = 0.5
DEFAULT_MULTIPLIER_INDEX = 5
MULTIPLIERS = [0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6]

FIRE_RADIUS = 3
FIRE_DAMAGE = 100
FIRE_DURATION = 200
FIRE_PRICE = 150
ICE_RADIUS = 3
ICE_SLOWDOWN = 10
ICE_DURATION = 5000
ICE_PRICE = 100
