Files
heros/assets/script/game/skills/ZhanCom.ts
2025-01-16 09:44:28 +08:00

87 lines
2.8 KiB
TypeScript

import { _decorator, Component, instantiate, Node, Prefab } from 'cc';
import { SkillCom } from './SkillCom';
import { ecs } from 'db://oops-framework/libs/ecs/ECS';
import { Hero } from '../hero/Hero';
import { BoxSet } from '../common/config/BoxSet';
import { Monster } from '../hero/Mon';
import { HeroViewComp } from '../hero/HeroViewComp';
import { smc } from '../common/SingletonModuleComp';
import { HeroInfo } from '../common/config/heroSet';
import { oops } from 'db://oops-framework/core/Oops';
const { ccclass, property } = _decorator;
@ccclass('ZhanCom')
export class ZhanCom extends Component {
base:SkillCom = null
start() {
this.base =this.node.getComponent(SkillCom)
let pos = this.node.position
let hero:any=null
if(this.base.box_group==BoxSet.HERO) {
hero = ecs.getEntity<Hero>(Hero);
let scale = 1
hero.load(pos,scale,this.base.hero);
}
if(this.base.box_group==BoxSet.MONSTER) hero = ecs.getEntity<Monster>(Monster);
}
update(deltaTime: number) {
}
call_hero() {
let scale = 1
let box_group=BoxSet.HERO
var path = "game/heros/"+HeroInfo[this.base.hero].path;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
var scene = smc.map.MapView.scene;
node.parent = scene.entityLayer!.node!
node.setPosition(this.node.position)
oops.message.dispatchEvent("hero_load",this)
var hv = node.getComponent(HeroViewComp)!;
// console.log("hero_init",buff)
let hero= HeroInfo[this.base.hero] // 共用英雄数据数据
hv.scale = scale;
hv.box_group = box_group;
hv.hero_uuid= this.base.hero;
hv.hero_name= hero.name;
hv.speed =hv.ospeed = hero.speed;
hv.dis = hero.dis;
hv.pw = hero.pw;
hv.pwm= hero.pwm;
hv.pws= hero.pws
hv.apw=hero.apw;
hv.uapw=hero.uapw;
hv.cpw=hero.cpw;
hv.dpw=hero.dpw;
hv.dopw=hero.dopw;
hv.type = hero.type;
let slv = hv.slv = 1;
hv.sk1 = hero.sk1[slv];
hv.sk2 = hero.sk2[slv];
hv.sk3 = hero.sk3[slv];
hv.akc = hero.akc[slv];
hv.uac = hero.uac[slv];
hv.crc = hero.crc[slv];
hv.dgc = hero.dgc[slv];
hv.akr = hero.akr[slv];
hv.uar = hero.uar[slv];
hv.crr = hero.crr[slv];
hv.dgr = hero.dgr[slv];
hv.rhp_max=this.base.hp
hv.ap = this.base.ap
hv.def=this.base.def
hv.cd = hero.a_cd
hv.crit = hero.crit; //暴击率
hv.crit_add = hero.crit_add;//暴击伤害加成
hv.dodge = hero.dodge; //闪避率
hv.aexp=hero.aexp;
hv.uaexp=hero.uaexp;
hv.cexp=hero.cexp
hv.doexp=hero.doexp
hv.dexp=hero.dexp;
}
}