todo 技能存在时间准确性问题

This commit is contained in:
panw
2025-01-10 11:07:53 +08:00
parent b4158a0a29
commit 1d9af24c66
20 changed files with 315 additions and 457 deletions

View File

@@ -8,22 +8,20 @@ const { ccclass, property } = _decorator;
export class BuffCom extends Component {
cd:number = 0;
base:SkillCom = null
time:number = 0;
start() {
this.base =this.node.getComponent(SkillCom)
tween(this.node).to( this.base.in_time,
{ position: new Vec3(this.node.position.x,this.node.position.y) },
{
onComplete: (target?: object) => {
this.base.is_destroy=true
},
}
).start();
}
update(deltaTime: number) {
if(smc.mission.pause) return
this.cd+=deltaTime
this.time+=deltaTime
if(this.time>=this.base.in_time){
this.base.is_destroy = true
}
if(this.cd>=this.base.cd){
if(this.base.is_destroy) return
// this.node.setPosition(v3(-1000,0,0))
this.node.active = false
this.node.active = true

View File

@@ -22,7 +22,7 @@ export class Skill extends ecs.Entity {
super.destroy();
}
load(pos: Vec3 = Vec3.ZERO,group:number,parent:Node,uuid:number=1001,
ap:number =10,t_pos:Vec3 = null,is_crit:boolean=false,crit_add:number=0)
ap:number =10,t_pos:Vec3 = null,is_crit:boolean=false,crit_add:number=0,hp:number=0)
{
var path = "game/skills/"+SkillSet[uuid].sp_name;
var prefab: Prefab = oops.res.get(path, Prefab)!;
@@ -45,7 +45,11 @@ export class Skill extends ecs.Entity {
// console.log(group+" "+SkillSet[uuid].name+"angle:"+angle)
sv.s_uuid = uuid;
sv.s_name = SkillSet[uuid].name;
sv.ap = ap*SkillSet[uuid].ap;
sv.ap = ap*SkillSet[uuid].ap/100; // 技能伤害
sv.apup = ap*SkillSet[uuid].apup/100; // 伤害增量
sv.hp = hp*SkillSet[uuid].hp/100; // 回复hp增量
sv.mhp = SkillSet[uuid].mhp/100; // hpmax增量 %
sv.shield =SkillSet[uuid].shield; // 护甲增量
sv.cd = SkillSet[uuid].cd;
sv.tg = SkillSet[uuid].tg;
sv.debtime = SkillSet[uuid].debtime;

View File

@@ -21,6 +21,10 @@ export class SkillCom extends CCComp {
speed:number = 200;
scale:number = 1;
ap:number = 10;
apup:number = 0;//
mhp:number = 0;
hp:number = 0; //治疗总量
shield:number = 0;//护甲总量
cd:number = 1;
debuff:number = 0;
debtime:number = 0;
@@ -72,20 +76,23 @@ export class SkillCom extends CCComp {
do_buff(hero:any){
this.to_console(" do_buff hero: ",hero)
if(SkillSet[this.s_uuid].hp > 0){ //buff加血
let increase_hp=Math.floor(SkillSet[this.s_uuid].hp*this.ap/(this.in_time/this.cd))
let increase_hp=Math.floor(this.hp/(this.in_time/this.cd))
hero.add_hp(increase_hp)
}
if(SkillSet[this.s_uuid].apup > 0){ //buff加攻击
let increase_atk=Math.floor(SkillSet[this.s_uuid].apup*this.ap/(this.in_time/this.cd))
let increase_atk=Math.floor(this.apup/(this.in_time/this.cd))
hero.add_ap(increase_atk)
}
if(SkillSet[this.s_uuid].shield > 0){ //buff护盾
console.log("do_buff shield: ",SkillSet[this.s_uuid].shield*this.ap/(this.in_time/this.cd))
hero.add_shield(SkillSet[this.s_uuid].shield*this.ap/(this.in_time/this.cd))
console.log("do_buff shield: ",this.shield)
hero.add_shield(this.shield)
}
if(SkillSet[this.s_uuid].mhp > 0){ //hp最大值
console.log("do_buff mhp: ",this.mhp/(this.in_time/this.cd))
hero.add_hp_max(this.mhp/(this.in_time/this.cd))
}
}
update(deltaTime: number) {
if(smc.mission.pause) return