# frozen_string_literal: true

module BCDice
  module GameSystem
    class MeikyuKingdomBasic
      RR236_TABLES = {
        "FCNT" => DiceTable::D66Table.new(
          "四字熟語系二つ名表",
          D66SortType::ASC,
          {
            11 => "人類最強（の）",
            12 => "天下無双（の）",
            13 => "電光石火（の）",
            14 => "冷静沈着（の）",
            15 => "星河一天（の）",
            16 => "幽玄美麗（の）",
            22 => "義理人情（の）",
            23 => "堅忍不抜（の）",
            24 => "忠勇義烈（の）",
            25 => "風林火山（の）",
            26 => "破顔一笑（の）",
            33 => "破顔一笑（の）",
            34 => "一騎当千（の）",
            35 => "阿鼻叫喚（の）",
            36 => "一蓮托生（の）",
            44 => "一期一会（の）",
            45 => "天涯孤独（の）",
            46 => "鬼哭啾々（の）",
            55 => "一宿一飯（の）",
            56 => "軽挙妄動（の）",
            66 => "贅沢三昧（の）",
          }
        ),
        "ASNT" => DiceTable::D66Table.new(
          "代入命名表",
          D66SortType::ASC,
          {
            11 => "［好きなもの／嫌いなもの］［呼び名表］",
            12 => "［行動表］が取り柄の",
            13 => "宮廷に［行動表］をうながす",
            14 => "二度と［行動表］しない",
            15 => "ベテラン［行動表］請負人",
            16 => "絶対［行動表］マン／ウーマン",
            22 => "［好きなもの／嫌いなもの］警察",
            23 => "［好きなもの／嫌いなもの］と生きる",
            24 => "［呼び名表］の中の［同じ単語の繰り返し］",
            25 => "［用語表］を呼ぶ［呼び名表／称号表］",
            26 => "王国［行動表］部部長",
            33 => "［用語表／行動表］省幹部",
            34 => "迷宮三大［呼び名表］の一人",
            35 => "猛き［用語表］の勇者",
            36 => "一級［行動表］資格所持者",
            44 => "［形容表］［行動表］の使い手",
            45 => "過激な［用語表／行動表］主義者",
            46 => "［行動表／好きなもの／嫌いなもの］界の大物",
            55 => "［形容表］［PCの名前］構文",
            56 => "特殊［行動表］技能士",
            66 => "［用語表］を［行動表］する影",
          }
        ),
        "FPNT" => DiceTable::D66Table.new(
          "名文句系二つ名表",
          D66SortType::ASC,
          {
            11 => "またお前か（の）",
            12 => "もう死んでいる",
            13 => "訴訟も辞さない",
            14 => "ですよねー（の）",
            15 => "そんなに悪くなかった",
            16 => "お値段以上（の）",
            22 => "ファイト一発（の）",
            23 => "それでもやってない",
            24 => "テストに出る",
            25 => "まるで成長していない",
            26 => "幸せならOKの",
            33 => "希望を乗せて走る",
            34 => "誰もお前を愛さない",
            35 => "すぐおいしい",
            36 => "毎日が新しい",
            44 => "本気になった",
            45 => "あなたとコンビに",
            46 => "50MG欲しい",
            55 => "またしても何も知らない",
            56 => "マジでこれの",
            66 => "めっちゃ厳つい",
          }
        ),
      }.freeze

      def mk_terminology_table(num)
        # 用語表
        table = [
          [11, "災厄／不幸（の）"],
          [12, "爆笑／哀切／憤怒（の）"],
          [13, "流星／疾風／光速（の）"],
          [14, "狂乱／暴虐／殺戮（の）"],
          [15, "稲妻／熱血（の）"],
          [16, "純白／灰色／漆黒（の）"],
          [22, "絶対／究極／至高（の）"],
          [23, "迷宮／世界／鉄（の）"],
          [24, "天階／深階（の）"],
          [25, "斬撃／打撃／衝撃（の）"],
          [26, "体制／革新（の）"],
          [33, "平和／神聖／自己防衛（の）"],
          [34, "男装／女装（の）"],
          [35, "マヨネーズ／じゃがいも（の）"],
          [36, "増税／権益（の）"],
          [44, "星術／召喚／科学（の）"],
          [45, "百獣／死神／異形（の）"],
          [46, "最強／万能（の）"],
          [55, "お祭り／平民／仮面（の）"],
          [56, "神秘／幻（の）"],
          [66, "未来／希望（の）"],
        ]
        return get_table_by_number(num, table)
      end

      def mk_behavior_table(num)
        # 行動表
        table = [
          [11, "建国（の）"],
          [12, "休憩（の）"],
          [13, "捜索（の）"],
          [14, "攻撃（の）"],
          [15, "号令（の）"],
          [16, "集中（の）"],
          [22, "支援（の）"],
          [23, "移動（の）"],
          [24, "取引（の）"],
          [25, "交渉（の）"],
          [26, "視察（の）"],
          [33, "計画（の）"],
          [34, "建設（の）"],
          [35, "遭遇（の）"],
          [36, "協調行動（の）"],
          [44, "補助（の）"],
          [45, "情報収集（の）"],
          [46, "逃走（の）"],
          [55, "割り込み（の）"],
          [56, "貿易（の）"],
          [66, "滅亡（の）"],
        ]
        return get_table_by_number(num, table)
      end

      def mk_descriptive_table(num)
        # 形容表
        table = [
          [11, "闇に潜む"],
          [12, "遥かなる"],
          [13, "百年に一度の"],
          [14, "笑わない"],
          [15, "燃える"],
          [16, "彷徨う"],
          [22, "歌う"],
          [23, "破滅を呼ぶ"],
          [24, "人を喰った"],
          [25, "ついてない"],
          [26, "国民的"],
          [33, "美しき"],
          [34, "七つの顔を持つ"],
          [35, "眠れる"],
          [36, "優しい"],
          [44, "もっとも神に近い"],
          [45, "踊る"],
          [46, "虫愛ずる"],
          [55, "死せる"],
          [56, "早すぎる"],
          [66, "親愛なる"],
        ]
        return get_table_by_number(num, table)
      end

      def mk_rr236_name_table(num)
        # 呼び名表
        table = [
          [11, "男／女"],
          [12, "詩人／俳人"],
          [13, "王／王者／女王"],
          [14, "閣下／殿下"],
          [15, "将軍／宰相"],
          [16, "画伯／絵師"],
          [22, "おじさん／おばさん"],
          [23, "暴れん坊／豪傑"],
          [24, "美丈夫／麗人"],
          [25, "哲人／賢者"],
          [26, "眼鏡"],
          [33, "イケメン／美女"],
          [34, "鉄人／巨人"],
          [35, "英雄／魔王"],
          [36, "支配者／主"],
          [44, "ヤンキー／ギャル"],
          [45, "頭脳／脳細胞"],
          [46, "戦士／ファイター"],
          [55, "父／母"],
          [56, "太夫／役者"],
          [66, "貴公子／令嬢"],
        ]
        return get_table_by_number(num, table)
      end

      def mk_title_table(num)
        # 称号表
        table = [
          [11, "お坊ちゃま／お嬢様"],
          [12, "申し子／落とし子"],
          [13, "神／神様"],
          [14, "天才／異端児"],
          [15, "爆弾／爆発"],
          [16, "超人"],
          [22, "紳士／乙女"],
          [23, "恐怖／悪夢"],
          [24, "天使／悪魔"],
          [25, "魂／権化"],
          [26, "神童／新星"],
          [33, "王子／王女"],
          [34, "劇場／舞台"],
          [35, "伝説／道"],
          [36, "鬼／怪物"],
          [44, "君／姫"],
          [45, "帝／皇帝／女皇帝"],
          [46, "名人／達人"],
          [55, "信者／教徒"],
          [56, "業者／界隈"],
          [66, "斬り／殺し"],
        ]
        return get_table_by_number(num, table)
      end

      def mk_combination_nickname_table()
        output = ""
        num1 = @randomizer.roll_once(6)
        num2 = @randomizer.roll_d66(D66SortType::ASC)
        num3 = @randomizer.roll_d66(D66SortType::ASC)
        @total = [num1, num2, num3]
        case num1
        when 1
          output = mk_terminology_table(num2) + "、" + mk_rr236_name_table(num3)
        when 2
          output = mk_terminology_table(num2) + "、" + mk_title_table(num3)
        when 3
          output = mk_behavior_table(num2) + "、" + mk_rr236_name_table(num3)
        when 4
          output = mk_behavior_table(num2) + "、" + mk_title_table(num3)
        when 5
          output = mk_descriptive_table(num2) + "、" + mk_rr236_name_table(num3)
        when 6
          output = mk_descriptive_table(num2) + "、" + mk_title_table(num3)
        end
        return output, @total.join(",")
      end
    end
  end
end
