取消掉副英雄

This commit is contained in:
panw
2025-07-14 16:53:39 +08:00
parent 0815d64f3c
commit fbcd12a5b9
19 changed files with 89 additions and 202 deletions

View File

@@ -9,6 +9,7 @@ import { HeroViewComp } from './HeroViewComp';
import { FightConComp } from '../map/FightConComp';
import { BuffAttr, DebuffAttr } from '../common/config/SkillSet';
import { GameEvent } from '../common/config/GameEvent';
import { FacSet } from '../common/config/BoxSet';
const { ccclass, property } = _decorator;
@ccclass('BuffComp')
@@ -89,8 +90,7 @@ export class BuffComp extends Component {
let buff=null
let info= null
if(!this.HeroView) return
if(this.HeroView.is_master) {info=smc.vmdata.hero;buff=this.FIGHTCON.hero_buff}
if(this.HeroView.is_friend) {info=smc.vmdata.friend;buff=this.FIGHTCON.friend_buff}
if(this.HeroView.fac==FacSet.HERO) {info=smc.vmdata.hero;buff=this.FIGHTCON.hero_buff}
if(this.HeroView.is_boss) {info=smc.vmdata.boss;buff=this.FIGHTCON.enemy_buff}
//if(this.HeroView.is_kalami) {target_key="enemy";buff_key="enemy"} 不显示小怪
if(info==null) return

View File

@@ -75,7 +75,6 @@ export class Hero extends ecs.Entity {
// const move = this.get(BattleMoveComp);
// move.direction = 1; // 向右移动
// move.targetX = 800; // 右边界'
oops.message.dispatchEvent(GameEvent.FriendCalled,{uuid:uuid})
}
hero_init(uuid:number=1001,node:Node,info:any={ap:0,hp:0,lv:1,crit:0,crit_d:0,dod:0,dod_no:false,crit_no:false}) {
var hv = node.getComponent(HeroViewComp)!;

View File

@@ -88,8 +88,6 @@ export class HeroViewComp extends CCComp {
stop_cd: number = 0; /*停止倒计时*/
speek_time:number = 0;
is_stop_temp:boolean = false
Friend_alive_cd:Timer=new Timer(10)
double_dead:boolean=false
double_atked:boolean=false
BUFF_DEFS: Array<{value: number, count: number}> = [] //防御提升
@@ -136,9 +134,7 @@ export class HeroViewComp extends CCComp {
}
/* 显示角色血量 */
this.node.getChildByName("top").getChildByName("hp").active = true;
if(this.is_friend){ //只有伙伴需要召唤后添加hp 怪物,和boss 不要设置减hp debuff 主要 一开始就战斗开始就存在,所以不需要
this.hp+=this.FIGHTCON.friend_buff.HP*this.hp_max/100
}
}
update(dt: number){
if(!smc.mission.play||smc.mission.pause) return
@@ -146,13 +142,7 @@ export class HeroViewComp extends CCComp {
// this.ent.destroy();
// return
// }
if(this.is_dead) {
// console.log("[HeroViewComp]:alive friend cd",this.Friend_alive_cd ,this.Friend_alive_cd.elapsedTime)
if(this.Friend_alive_cd.update(dt)){
this.to_alive()
}
}
if(this.timer.update(dt)){
// this.add_ap(10)
};
@@ -291,23 +281,12 @@ export class HeroViewComp extends CCComp {
}
}
}
master_count_atk_count(){ //主将攻击次数 主要有装备加成,需要单独处理
count_atk_count(){ //主将攻击次数 主要有装备加成,需要单独处理
if(!this.is_master) return
this.atk_count+=1
if(this.atk_count< FightSet.ATK_ADD_FRIEND_COUNT) return
if(this.atk_count< FightSet.ATK_ADD_COUNT) return
if(this.FIGHTCON.atk_add_glod >0) smc.vmdata.mission_data.gold+=this.FIGHTCON.atk_add_glod
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)
}
})
let master=ecs.query(ecs.allOf(MasterModelComp))
master.forEach(master=>{
@@ -323,19 +302,12 @@ export class HeroViewComp extends CCComp {
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_dead(){
this.do_dead_trigger()
this.Friend_alive_cd=new Timer(this.FIGHTCON.friend_alive_cd)
console.log("[HeroViewComp]:角色死亡",this.hero_uuid)
if(this.fac==FacSet.MON){
@@ -349,7 +321,7 @@ export class HeroViewComp extends CCComp {
}
}
if(this.is_master){
if(this.fac==FacSet.HERO){
console.log("[HeroViewComp]:英雄死亡")
oops.message.dispatchEvent(GameEvent.FightEnd,{victory:false})
}
@@ -358,8 +330,7 @@ export class HeroViewComp extends CCComp {
}
get_buff(){
let buff=null
if(this.is_master) buff=this.FIGHTCON.hero_buff
if(this.is_friend) buff=this.FIGHTCON.friend_buff
if(this.fac==FacSet.HERO) buff=this.FIGHTCON.hero_buff
if(this.is_boss) buff=this.FIGHTCON.enemy_buff
if(this.is_kalami) buff=this.FIGHTCON.enemy_buff
if(buff==null) return
@@ -572,16 +543,12 @@ export class HeroViewComp extends CCComp {
do_dead_trigger(){
if(this.is_dead||this.fac==FacSet.MON||this.is_master) return
let count = 1
if(this.double_dead) {
console.log("[HeroViewComp]:double_dead")
count =2
}
for(let i=0;i<count;i++){
console.log("[HeroViewComp]:dead"+i+"次")
}
}
do_atked_trigger(){
if(this.is_dead||this.fac==FacSet.MON||this.is_master) return
if(this.is_dead||this.fac==FacSet.MON) return
let count = 1
if(this.double_atked) {
console.log("[HeroViewComp]:double_atked")
@@ -598,13 +565,13 @@ export class HeroViewComp extends CCComp {
}
).start()
}
to_alive(){
this.is_dead=false
this.hp=this.hp_max*(100+this.buff_hp)/100
this.BUFFCOMP.vmdata_update(true)
this.node.setPosition(HeroPos[this.fight_pos].pos)
this.BUFFCOMP.heathed()
}
// to_alive(){
// this.is_dead=false
// this.hp=this.hp_max*(100+this.buff_hp)/100
// this.BUFFCOMP.vmdata_update(true)
// this.node.setPosition(HeroPos[this.fight_pos].pos)
// this.BUFFCOMP.heathed()
// }
//掉落物品
to_drop(){
// let Drops = getMonsterDrops(1, MonsterType.Normal, 1.2);

View File

@@ -52,15 +52,12 @@ export class SkillConComp extends CCComp {
if(this.HeroView.DEBUFF_STUN <= 0&&this.HeroView.DEBUFF_FROST <= 0) this.HeroView.at += dt;
let cd = this.get_cd(this.HeroView.cd,this.HeroView)
// console.log(this.HeroView.hero_name+(this.HeroView.is_master?"[主]":"[从] 准备释放")+SkillSet[this.HeroView.atk_skill].name+"=>"+"=>cd:"+cd+"=> count:"+count)
if (this.HeroView.is_atking &&(this.HeroView.at > cd)) {
if(this.HeroView.is_dead) return
const config = SkillSet[this.HeroView.atk_skill];
if (!config) return;
// console.log(this.HeroView.hero_name+(this.HeroView.is_master?"[主]":"[从] 释放")+"=>"+config.name+"=>"+count)
this.castSkill(config,this.check_wfuny());
this.HeroView.master_count_atk_count()
this.HeroView.friend_count_atk_count()
this.HeroView.count_atk_count()
this.HeroView.at = 0;
}
if (this.aoe_queues.length > 0) {
@@ -339,7 +336,6 @@ export class SkillConComp extends CCComp {
get_buff(view:HeroViewComp){
if(view.is_master) return this.FIGHTCON.hero_buff
if(view.is_friend) return this.FIGHTCON.friend_buff
if(view.is_boss||view.is_kalami) return this.FIGHTCON.enemy_buff
return null
}