取消掉副英雄

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

@@ -23,7 +23,6 @@ export class BarCompComp extends CCComp {
/** 视图层逻辑代码分离演示 */
protected onLoad(): void {
this.on(GameEvent.FightReady,this.readay,this)
this.on(GameEvent.FriendCalled,this.friend_called,this)
this.on(GameEvent.MasterCalled,this.master_called,this)
this.on(GameEvent.APChange,this.ap_change,this)
@@ -48,15 +47,7 @@ export class BarCompComp extends CCComp {
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[data.uuid].path);
});
}
private friend_called(e:any,data:any){
this.node.getChildByName("fbar").active=true
let show=this.node.getChildByName("fbar").getChildByName("hero")
var icon_path = "game/heros/herois"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = show.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[data.uuid].path);
});
}
private ap_change(e:any,data:any){
console.log("[barcomp]:ap_change",data)
if(data.is_master==true){

View File

@@ -16,7 +16,6 @@ export class EquipsComp extends Component {
boxs:Node=null
attrs:any={
hero_buff:getBuffNum(),
friend_buff:getBuffNum(),
enemy_buff:getBuffNum(),
}
/** 视图层逻辑代码分离演示 */
@@ -228,7 +227,6 @@ export class EquipsComp extends Component {
const all_special_attr=[...weapon_special_attr,...armor_special_attr,...accessory_special_attr]
let equip_special_attr=this.count_equip_special_attr(all_special_attr)
let friend_get_master_equip=equip_special_attr[EquipSpecialAttr.FRIEND_GET_MASTER_EQUIP]
oops.message.dispatchEvent(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,equip_special_attr)
// 合并所有装备属性
@@ -243,15 +241,9 @@ export class EquipsComp extends Component {
case EquipAttrTarget.HERO:
targetKey = 'hero_buff';
break;
case EquipAttrTarget.FRIEND:
targetKey = 'friend_buff';
break;
}
this.add_attr(targetKey,attr)
});
// 伙伴获取英雄装备属性加成
this.attrs.friend_buff.ATK+=this.attrs.hero_buff.ATK*friend_get_master_equip
this.attrs.friend_buff.HP+=this.attrs.hero_buff.HP*friend_get_master_equip
console.log("[EquipsComp]:debuff buff attrs ", this.attrs);
oops.message.dispatchEvent(GameEvent.EquipChange, this.attrs);
@@ -263,17 +255,12 @@ export class EquipsComp extends Component {
[EquipSpecialAttr.ICE]: 0,
[EquipSpecialAttr.FIRE]: 0,
[EquipSpecialAttr.WIND]: 0,
[EquipSpecialAttr.FRIEND_LIVE_CD]: 0,
[EquipSpecialAttr.ATK_ADD_FRIEND_ATK]: 0,
[EquipSpecialAttr.ATK_ADD_FRIEND_HP]: 0,
[EquipSpecialAttr.ATK_ADD_GLOD]: 0,
[EquipSpecialAttr.ATK_ADD_MASTER_ATK]: 0,
[EquipSpecialAttr.ATK_ADD_MASTER_HP]: 0,
[EquipSpecialAttr.DOUBLE_DEAD]: 0,
[EquipSpecialAttr.DOUBLE_ATKED]: 0,
[EquipSpecialAttr.FRIEND_ATKED_ADD_SKILL_STONE]: 0,
[EquipSpecialAttr.ATKED_ADD_SKILL_STONE]: 0,
[EquipSpecialAttr.ATK_ADD_VALUE]: 0,
[EquipSpecialAttr.FRIEND_GET_MASTER_EQUIP]: 0,
};
console.log("[EquipsComp]:all_special_attr",all_special_attr)
@@ -302,7 +289,6 @@ export class EquipsComp extends Component {
// 创建新的属性对象
const newAttrs = {
hero_buff: getBuffNum(),
friend_buff: getBuffNum(),
enemy_buff: getBuffNum(),
};
@@ -311,7 +297,6 @@ export class EquipsComp extends Component {
console.log("重置属性", {
hero_buff: this.attrs.hero_buff,
friend_buff: this.attrs.friend_buff,
enemy_buff: this.attrs.enemy_buff,
});
}

View File

@@ -17,24 +17,18 @@ const { ccclass, property } = _decorator;
export class FightConComp extends Component {
//装备 及 光环效果 物品存在生效 enemy_buff 是针对 怪物的debuff 偶尔也有buff 需要注意
hero_buff=getBuffNum()
friend_buff=getBuffNum()
enemy_buff=getBuffNum()
//注意临时buff和debuff 每种buff的值 必须都一样 多种值 战斗处理复杂 暂时放弃
atk_type:number=0;
//装备特殊属性 触发后 局内永久生效
friend_alive_cd:number=FightSet.FRIEND_LIVE_CD
atk_add_friend_atk:number=0
atk_add_friend_hp:number=0
atk_add_glod:number=0
atk_add_master_atk:number=0
atk_add_master_hp:number=0
double_dead:number=0
double_atked:number=0
friend_atked_add_skill_stone:number=0
atked_add_skill_stone:number=0
atk_add_value:number=0
friend_get_master_equip:number=0
//卡牌特效
card_atk_add:number=0 //卡牌特效 攻击提高攻击力效果 额外添加值
@@ -56,50 +50,34 @@ export class FightConComp extends Component {
}
protected start(): void {
this.friend_alive_cd=FightSet.FRIEND_LIVE_CD
}
change_equip_special_attr(e:GameEvent,data:any){
console.log("[FightConComp]:change_equip_special_attr",data)
this.atk_add_value=data[EquipSpecialAttr.ATK_ADD_VALUE]
this.atk_add_friend_atk=data[EquipSpecialAttr.ATK_ADD_FRIEND_ATK]+this.atk_add_value+(this.card_atk_add > 0 ? this.card_atk_add:0) //装备特殊属性 英雄/伙伴 攻击力增加
this.atk_add_friend_hp=data[EquipSpecialAttr.ATK_ADD_FRIEND_HP]+this.atk_add_value+(this.card_hp_add > 0 ? this.card_hp_add:0) //装备特殊属性 英雄/伙伴 生命值增加
this.atk_add_glod=data[EquipSpecialAttr.ATK_ADD_GLOD]
this.atk_add_master_atk=data[EquipSpecialAttr.ATK_ADD_MASTER_ATK]+this.atk_add_value+(this.card_atk_add > 0 ? this.card_atk_add:0) //装备特殊属性 英雄/伙伴 攻击力增加
this.atk_add_master_hp=data[EquipSpecialAttr.ATK_ADD_MASTER_HP]+this.atk_add_value+(this.card_hp_add > 0 ? this.card_hp_add:0) //装备特殊属性 英雄/伙伴 生命值增加
this.friend_alive_cd=FightSet.FRIEND_LIVE_CD-data[EquipSpecialAttr.FRIEND_LIVE_CD]
this.double_dead=data[EquipSpecialAttr.DOUBLE_DEAD]
this.double_atked=data[EquipSpecialAttr.DOUBLE_ATKED]
this.friend_atked_add_skill_stone=data[EquipSpecialAttr.FRIEND_ATKED_ADD_SKILL_STONE]
this.friend_get_master_equip=data[EquipSpecialAttr.FRIEND_GET_MASTER_EQUIP]
this.atked_add_skill_stone=data[EquipSpecialAttr.ATKED_ADD_SKILL_STONE]
}
private equip_change(e:GameEvent,equip:any){
let old_hero_hp=JSON.parse(JSON.stringify(this.hero_buff.HP))
let old_friend_hp=JSON.parse(JSON.stringify(this.friend_buff.HP))
let new_hero_hp=JSON.parse(JSON.stringify(equip.hero_buff.HP))
let new_friend_hp=JSON.parse(JSON.stringify(equip.friend_buff.HP))
this.hero_buff=equip.hero_buff
this.friend_buff=equip.friend_buff
this.enemy_buff=equip.enemy_buff
let hero_hp_add=new_hero_hp-old_hero_hp
let friend_hp_add=new_friend_hp-old_friend_hp
console.log("[FightConComp]:old_hero_hp:"+old_hero_hp+" new_hero_hp:"+new_hero_hp+" hero_hp_add:"+hero_hp_add)
if(hero_hp_add!==0){
oops.message.dispatchEvent(GameEvent.UpdateHP,{hp:hero_hp_add,is_master:true})
}
if(friend_hp_add!==0){
oops.message.dispatchEvent(GameEvent.UpdateHP,{hp:friend_hp_add,is_master:false})
}
this.scheduleOnce(()=>{
oops.message.dispatchEvent(GameEvent.UpdateVMData)
},0.1)
@@ -148,21 +126,13 @@ export class FightConComp extends Component {
private clearAlls() {
this.hero_buff=getBuffNum()
this.friend_buff=getBuffNum()
this.enemy_buff=getBuffNum()
this.friend_alive_cd=FightSet.FRIEND_LIVE_CD
this.atk_add_friend_atk=0
this.atk_add_friend_hp=0
this.atk_add_glod=0
this.atk_add_master_atk=0
this.atk_add_master_hp=0
this.double_dead=0
this.double_atked=0
this.friend_atked_add_skill_stone=0
this.atked_add_skill_stone=0
this.atk_add_value=0
this.friend_get_master_equip=0
this.card_atk_add=0
this.card_hp_add=0

View File

@@ -51,11 +51,11 @@ export class MissionComp extends CCComp {
private on_mon_wave_update(){
smc.vmdata.mission_data.current_wave++
let wave=smc.vmdata.mission_data.current_wave
if(wave==FightSet.FRIEND_WAVE_UP){
console.log("[任务系统] FRIEND_WAVE_UP 伙伴选择 :",wave,FightSet.FRIEND_WAVE_UP)
let node= this.node.getChildByName("new_hero")
tween(node).to(0.3, {position:v3(280,node.position.y,1)}).start()
}
// if(wave==FightSet.FRIEND_WAVE_UP){
// console.log("[任务系统] FRIEND_WAVE_UP 伙伴选择 :",wave,FightSet.FRIEND_WAVE_UP)
// let node= this.node.getChildByName("new_hero")
// tween(node).to(0.3, {position:v3(280,node.position.y,1)}).start()
// }
}
@@ -163,9 +163,10 @@ export class MissionComp extends CCComp {
private cleanComponents() {
ecs.query(ecs.allOf(HeroViewComp)).forEach(entity => {entity.remove(HeroViewComp);entity.destroy()});
}
hide_call_friend(){
let node =this.node.getChildByName("new_hero")
tween(node).to(0.3, {position:v3(480,node.position.y,1)}).start()
// let node =this.node.getChildByName("new_hero")
// tween(node).to(0.3, {position:v3(480,node.position.y,1)}).start()
}
/** 视图层逻辑代码分离演示 */

View File

@@ -18,7 +18,6 @@ const { ccclass, property } = _decorator;
@ecs.register('MissionHeroComp', false)
export class MissionHeroCompComp extends CCComp {
timer:Timer=new Timer(2)
Friend_alive_cd:Timer=new Timer(10)
Friend_is_dead:boolean=false
current_hero_uuid:number=0
onLoad(){
@@ -33,15 +32,10 @@ export class MissionHeroCompComp extends CCComp {
this.node.getChildByName("location").active=false
}
fight_ready(){
this.Friend_alive_cd=new Timer(FightSet.FRIEND_LIVE_CD)
}
protected update(dt: number): void {
if(smc.mission.status != 1) return
if(this.Friend_is_dead){
if(this.Friend_alive_cd.update(dt)){
console.log("alive friend")
}
}
}
@@ -52,10 +46,7 @@ export class MissionHeroCompComp extends CCComp {
console.log("[MissionHeroComp]:zhaohuan",args)
this.addHero(args.uuid,false,true)
}
up_friend_alive_cd(less:number){
}
private call_friend(event: string, args: any,is_master:boolean=false){
console.log("[MissionHeroComp]:call_hero addHero",args.uuid,is_master)
let hero_pos=1