英雄技能相关字段修改
This commit is contained in:
@@ -1,61 +0,0 @@
|
||||
import { _decorator, Component, Node, RigidBody2D, tween, Vec3 } from 'cc';
|
||||
import { SkillCom } from './SkillCom';
|
||||
import { HeroViewComp } from '../hero/HeroViewComp';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
import { HeroModelComp } from '../hero/HeroModelComp';
|
||||
import { ecs } from '../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS';
|
||||
import { BoxSet } from '../common/config/BoxSet';
|
||||
import { MonModelComp } from '../hero/MonModelComp';
|
||||
import { SkillSet } from '../common/config/SkillSet';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('CdCom')
|
||||
export class CdCom extends Component {
|
||||
cd:number = 0;
|
||||
base:SkillCom = null
|
||||
time:number = 0;
|
||||
rigid:RigidBody2D = null
|
||||
start() {
|
||||
this.base =this.node.getComponent(SkillCom)
|
||||
this.rigid = this.getComponent(RigidBody2D);
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
if(smc.mission.pause) return
|
||||
this.cd+=deltaTime
|
||||
if(this.cd>=this.base.cd){
|
||||
if(this.base.is_destroy) return
|
||||
// this.node.setPosition(v3(-1000,0,0))
|
||||
this.rigid.sleep()
|
||||
this.rigid.wakeUp()
|
||||
if(this.base.tg==2) this.do_all_buff()
|
||||
this.cd=0
|
||||
}
|
||||
}
|
||||
do_all_buff(){
|
||||
let heros:any = ecs.query(ecs.allOf(HeroModelComp));
|
||||
if(this.base.box_group==BoxSet.MONSTER) heros = ecs.query(ecs.allOf(MonModelComp));
|
||||
for (let i = 0; i < heros.length; i++) {
|
||||
let hero:any = heros[i].HeroView;
|
||||
// if (hero.in_grave) continue
|
||||
if(SkillSet[this.base.s_uuid].hp > 0){ //buff加血
|
||||
// let increase_hp=Math.floor(this.base.hp/(this.base.in_time/this.base.cd))
|
||||
let increase_hp=Math.floor(this.base.hp)
|
||||
hero.add_hp(increase_hp)
|
||||
}
|
||||
if(SkillSet[this.base.s_uuid].apup > 0){ //buff加攻击
|
||||
// let increase_atk=Math.floor(this.base.apup/(this.base.in_time/this.base.cd))
|
||||
let increase_atk=Math.floor(this.base.apup)
|
||||
hero.add_ap(increase_atk)
|
||||
}
|
||||
if(SkillSet[this.base.s_uuid].shield > 0){ //buff护盾
|
||||
hero.add_shield(this.base.shield)
|
||||
}
|
||||
if(SkillSet[this.base.s_uuid].mhp > 0){ //hp最大值
|
||||
hero.add_hp_max(this.base.mhp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "38c6979b-18f3-46b3-9834-c1c9a3347a91",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ const { ccclass, property } = _decorator;
|
||||
export class debuff extends Component {
|
||||
base: timedCom = null
|
||||
hero:HeroViewComp = null
|
||||
cd: number = 0
|
||||
deff_cd: number = 0
|
||||
ap: number = 0
|
||||
start() {
|
||||
this.base =this.node.getComponent(timedCom)
|
||||
@@ -18,15 +18,15 @@ export class debuff extends Component {
|
||||
|
||||
update(deltaTime: number) {
|
||||
if(smc.mission.pause) return
|
||||
this.cd += deltaTime
|
||||
if(this.cd >=1){
|
||||
this.deff_cd += deltaTime
|
||||
if(this.deff_cd >=1){
|
||||
// this.node.setPosition(v3(-1000,0,0))
|
||||
if(this.hero){
|
||||
this.hero.in_atked()
|
||||
this.hero.hp_less(Math.ceil(this.base.ap/this.base.time))
|
||||
console.log("debuff 总扣血:"+this.base.ap+" 每秒: "+Math.ceil(this.base.ap/this.base.time))
|
||||
}
|
||||
this.cd=0
|
||||
this.deff_cd=0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user