import { TD } from "../../../../../App";
import { PetEquip, PlayerPetOV } from "../../../../../consts/API";
import GAttributeBase from "../GAttributeBase";

//宠物装备属性
export default class GPetEquipAttribute extends GAttributeBase{

    //宠物信息
    equips:PetEquip[];

    constructor(equips:PetEquip[]){

        super();
        this.equips = equips;

        //固定属性直接计算
        this.compute();
        
    }

    //计算属性
    compute(){

        this.attributes = {};

        //获取全部属性信息
        TD.TbGAttribute.getDataList().forEach(attr => {
            //默认 0
            this.attributes[attr.id] = 0;
        });

        //*************** 宠物初始属性 **************************
        this.equips.forEach(equip => {
            equip.equipBaseAttributes.forEach(attr => {
                this.attributes[attr.id] += attr.value
            })
            equip.equipHighAttributes.forEach(attr => {
                this.attributes[attr.id] += attr.value
            })
        })

    }

    //刷新属性
    update(): void { }

}


