// 军团诸侯混战城池表
import { readFileAndParse, parseNumberList } from '../util'
import { FILENAME } from '../../consts'

export interface DicCityActivity {

    // 城池id
    readonly id: number;
    // 城池类型
    readonly type: number;
    // 下一次自动宣战城池
    readonly nextCity: number;
    // 上一个可解锁的
    readonly preCity: number[];
    // 难度系数
    readonly difficult: number;
    // 相应的出兵表
    readonly warid: number;
    // 可开启星期
    readonly week: number[];
    // 保底血量
    readonly hp: number;
    // 城门倍率
    readonly hpN: number;
    // 城门用于计算血量的攻击值模板
    readonly atkTemplate: number;
}

export const dicJuniorCities: number[] = [];
export const dicCityActivity = new Map<number, DicCityActivity>();
export function loadCityActivity() {
    dicJuniorCities.splice(0, dicJuniorCities.length);
    dicCityActivity.clear();
    let arr = readFileAndParse(FILENAME.DIC_CITY_ACTIVITY);

    arr.forEach(o => {
        o.preCity = parseNumberList(o.preCity);
        o.week = parseNumberList(o.week);
        dicCityActivity.set( o.id, o );
        if(o.type == 1) dicJuniorCities.push(o.id);
    });
    arr = undefined;
}