# Represents a HQ
class Headquaters < Building
  MAX_LEVEL = 30
  MIN_LEVEL = 1
  STAFLE = [
    10, 2, 2, 3, 4, 4, 5, 6, 7, 9, 10,
    12, 15, 18, 21, 26, 31, 37, 44, 53,
    64, 77, 92, 110, 133, 159, 191, 229, 274, 330
  ]

  BUILD_REQ = {}
  NEEDS = {
    wood: [
      90, 113, 143, 180, 227, 286, 360, 454, 572, 720, 908, 1144, 1441, 1816,
      228, 2883, 3632, 4577, 5767, 7266, 9155, 11_535, 14_534, 18_313, 23_075,
      29_074, 36_633, 46_158, 58_159, 73_280
    ],
    clay: [
      80, 102, 130, 166, 211, 270, 344, 438, 559, 712, 908, 1158, 1476, 1882,
      2400, 3060, 3902, 4975, 6343, 8087, 10_311, 13_146, 16_762, 21_371,
      27_248, 34_741, 44_295, 56_476, 72_007, 91_809
    ],
    iron: [
      70, 88, 111, 140, 176, 222, 280, 353, 445, 560, 706, 890, 1121, 1412,
      1779, 2242, 2825, 3560, 4485, 5651, 7120, 8972, 11_304, 14_244, 17_949,
      22_613, 28_493, 35_901, 45_235, 56_996
    ],
    pop: [
      5, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 7, 8, 9, 10, 12, 15, 17, 19,
      23, 27, 31, 37, 43, 51, 59, 69
    ]
  }

  FACTOR = [
    95, 91, 86, 82, 78, 75, 71, 68, 64, 61, 58, 56,
    53, 51, 48, 46, 44, 42, 40, 38, 36, 34, 33, 31,
    30, 28, 27, 26, 24, 23
  ]
  BASE_BUILD_TIME = 15.0 # in seconds!

  def time_factor
    FACTOR[@level - 1] / 100.0
  end

  def can_destroy?
    @level > 14
  end
end
