import { BattleDataPool } from "../../tower/data/BattleDataPool";
import { BattleUtil } from "../../tower/data/BattleUtil";
import { HeroData } from "../../tower/data/HeroData";
import { ZombieHeroConf } from "../conf/ZombieHeroConf";
import { ZombieSkillDataPool } from "./ZombieSkillData";



export class ZombieHeroData extends HeroData{

    init(typeID:number, level:number, posID: number) {
        super._init();
        this.level = level;
        this.typeID = typeID;
        this.posID = posID;

        //读地图
        this.position = new BattleUtil.Vector2(0, 0);
        let heroConf = ZombieHeroConf.data[typeID]
        if (heroConf) {
            this.attackType = heroConf.AttackType;
            this._speed = heroConf.Speed;
            this.coolDown = this._speed
            this._attackRadius = heroConf.Radius;
            this._attackDamage = heroConf.Damage;
            this._critical = heroConf.Critical;
            this._criticalDamage = heroConf.CriticalDamage;
            this.skillList = heroConf.SkillArray

            for (let i = 0; i < this.skillList.length; i++) {
                let skillID = this.skillList[i];
                let skillData = ZombieSkillDataPool.getObject();
                skillData.init(skillID, this);
                this.skillDataList.push(skillData);
            }

            this.upDataLevel()
            return this;
        }
        return null;
    }

}
export let ZombieHeroDataPool = new BattleDataPool(ZombieHeroData,30)