This commit is contained in:
walkpan
2024-09-02 09:03:43 +08:00
parent 9028b86d4e
commit f367d1817a
27 changed files with 3953 additions and 3233 deletions

View File

@@ -11,6 +11,7 @@ import { BoxSet, GameSet } from "../common/config/BoxSet";
import { smc } from "../common/SingletonModuleComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { HeroModelComp } from "./HeroModelComp";
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -50,7 +51,7 @@ export class CSkillComp extends CCComp {
if(smc.skills[this.skill_uuid].type == 1){
this.shoot()
}
if(smc.skills[this.skill_uuid].type == 9){
if(smc.skills[this.skill_uuid].type > 90){
this.add_buff()
}
@@ -86,6 +87,17 @@ export class CSkillComp extends CCComp {
skill.load(pos,speed,dis,scale,this.node,this.skill_uuid,atk,angle,t_pos);
}
add_buff(){
// 1 远距离攻击,碰撞后 结束
// 2 远距离攻击,碰撞后 持续,直到技能结束
// 3 远距离攻击,碰撞后 持续,带击退功能
// 4 双技能技能1技能结束后触发2技能
// 5: 特殊技能,触发特殊弹窗选项
// 9 buff物品
// 91: 单体buff物品加最少血临时
// 92单体buff物品随机临时
// 93: 群体buff物品
// 94role 临时buff
// 95role 永久buff
let uuid= this.skill_uuid;
let atk:number=smc.Role.RoleView.atk
let args:any = {
@@ -94,19 +106,32 @@ export class CSkillComp extends CCComp {
shield:atk*GameSet.ATK_TO_SHIELD_RATIO,
}
let heros:any = ecs.query(ecs.allOf(HeroModelComp));
let heros_hp:any=[]
let least_hp:number=999999
let t_hero:any= null
if (heros.length > 0) {
if(SkillSet[uuid].type==92){
heros[0].MonsterBuff.add_buff(uuid,args);
if(SkillSet[uuid].type==92){ //随机添加buff
let i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
console.log("i %%length:",i,heros.length)
heros[i].MonsterBuff.add_buff(uuid,args);
}else{
for (let i = 0; i < heros.length; i++) {
let hero = heros[i];
if(SkillSet[uuid].type==99){
// console.log(" CSkillComp hero",hero);
if(SkillSet[uuid].type==91){ //血量最少单体
console.log(" CSkillComp hero 91",hero,least_hp,t_hero);
if(hero.MonsterView.hp < least_hp){
least_hp = hero.MonsterView.hp
t_hero = hero
}
}else{ //群体
hero.MonsterBuff.add_buff(uuid,args);
}
}
}
if(t_hero){ //血量最少单体
t_hero.MonsterBuff.add_buff(uuid,args);
}
}
}