装备特殊加成 继续完善

This commit is contained in:
2025-06-17 16:19:02 +08:00
parent 0a1e2b7813
commit d7b6dd375a
11 changed files with 171 additions and 113 deletions

View File

@@ -13,6 +13,8 @@ import { FightConComp } from "../map/FightConComp";
import { EquipSpecialAttr } from "../common/config/Equips";
import { FightSet } from "../common/config/Mission";
import { HeroPos } from "../common/config/heroSet";
import { FriendModelComp } from "./FriendModel";
import { MasterModelComp } from "./MasterModel";
const { ccclass, property } = _decorator;
@@ -69,7 +71,7 @@ export class HeroViewComp extends CCComp {
atk_count: number = 0;
atked_count: number = 0;
atk_add_count:number=0;
stop_cd: number = 0; /*停止倒计时*/
yun_cd: number = 0; //眩晕倒计时
ice_cd: number = 0; //冰冻倒计时
@@ -91,7 +93,8 @@ export class HeroViewComp extends CCComp {
this.as = this.getComponent(HeroSpine);
this.FIGHTCON=this.node.parent.getComponent(FightConComp);
console.log("[HeroViewComp]:hero view comp ",this.FIGHTCON)
this.on(GameEvent.ChangeATK,this.change_atk,this)
this.on(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,this.change_atk,this)
// let anm = this.node.getChildByName("anm")
// anm.setScale(anm.scale.x*0.8,anm.scale.y*0.8);
}
@@ -138,24 +141,18 @@ export class HeroViewComp extends CCComp {
this.processDamageQueue();
}
change_atk(e:GameEvent,data:any){
switch(data){
case EquipSpecialAttr.ICE:
this.atk_skill=6001
break
case EquipSpecialAttr.FIRE:
this.atk_skill=6002
break
case EquipSpecialAttr.WIND:
this.atk_skill=6003
break
default:
this.atk_skill=6001
break
if(data.ice){
this.atk_skill=6001
}else if(data.fire){
this.atk_skill=6002
}else if(data.wind){
this.atk_skill=6003
}else{
this.atk_skill=6001
}
}
get isActive() {
return this.ent.has(HeroViewComp) && this.node?.isValid;
}
@@ -251,7 +248,48 @@ export class HeroViewComp extends CCComp {
}
}
}
master_count_atk_count(){ //主将攻击次数 主要有装备加成,需要单独处理
if(!this.is_master) return
this.atk_count+=1
if(this.atk_count< FightSet.ATK_ADD_FRIEND_COUNT) return
if(this.FIGHTCON.atk_add_glod >0) smc.mission.add_gold(this.FIGHTCON.atk_add_glod)
this.do_friend_atk_add()
this.do_master_atk_add()
this.atk_count=0
}
friend_count_atk_count(){ //伙伴攻击次数 有装备加成,需要单独处理
if(this.is_master) return
if(this.atk_add_count==0) return
this.atk_count+=1
if(this.atk_count < this.atk_add_count) return
}
do_friend_atk_add(){
let friends=ecs.query(ecs.allOf(FriendModelComp))
friends.forEach(friend=>{
let friend_view=friend.get(HeroViewComp)
if(this.FIGHTCON.atk_add_friend_atk>0) {
friend_view.add_ap(this.FIGHTCON.atk_add_friend_atk)
}
if(this.FIGHTCON.atk_add_friend_hp>0) {
friend_view.add_hp_max(this.FIGHTCON.atk_add_friend_hp)
}
})
}
do_master_atk_add(){
let master=ecs.query(ecs.allOf(MasterModelComp))
master.forEach(master=>{
let master_view=master.get(HeroViewComp)
if(this.FIGHTCON.atk_add_master_atk>0) {
master_view.add_ap(this.FIGHTCON.atk_add_master_atk)
}
if(this.FIGHTCON.atk_add_master_hp>0) {
master_view.add_hp_max(this.FIGHTCON.atk_add_master_hp)
}
})
}
do_change(){
this.BUFFCOMP.update_info_ap()
this.BUFFCOMP.update_info_hp()
@@ -266,7 +304,7 @@ export class HeroViewComp extends CCComp {
do_dead(){
this.Friend_alive_cd=new Timer(this.FIGHTCON.Friend_alive_cd)
this.Friend_alive_cd=new Timer(this.FIGHTCON.friend_alive_cd)
console.log("[HeroViewComp]:角色死亡",this.hero_uuid)
if(this.is_master){
console.log("[HeroViewComp]:英雄死亡")