装备加成错误解决

This commit is contained in:
2025-06-13 15:10:47 +08:00
parent 3ec7c18ace
commit 008cd2ffc5
7 changed files with 107 additions and 81 deletions

View File

@@ -16,14 +16,14 @@ export class FightConComp extends Component {
enemy_debuff=geDebuffNum()
friend_debuff=geDebuffNum()
//注意临时buff和debuff 每种buff的值 必须都一样 多种值 战斗处理复杂 暂时放弃
temp_hero_buff = this.getInitTempDebuff();
temp_ally_buff = this.getInitTempDebuff();
temp_enemy_buff = this.getInitTempDebuff();
temp_friend_buff = this.getInitTempDebuff();
temp_hero_debuff = this.getInitTempBuffDebuff();
temp_ally_debuff = this.getInitTempBuffDebuff();
temp_enemy_debuff = this.getInitTempBuffDebuff();
temp_friend_debuff = this.getInitTempBuffDebuff();
temp_hero_buff = this.getInitTempBuff();
temp_ally_buff = this.getInitTempBuff();
temp_enemy_buff = this.getInitTempBuff();
temp_friend_buff = this.getInitTempBuff();
temp_hero_debuff = this.getInitTempDebuff();
temp_ally_debuff = this.getInitTempDebuff();
temp_enemy_debuff = this.getInitTempDebuff();
temp_friend_debuff = this.getInitTempDebuff();
onLoad(){
// console.log("fight con start")
@@ -38,17 +38,7 @@ export class FightConComp extends Component {
this.friend=equip.friend
}
private fight_ready(e:GameEvent){
this.hero=this.ally=this.enemy=this.friend=getBuffNum()
this.hero_debuff=this.ally_debuff=this.enemy_debuff=this.friend_debuff=geDebuffNum()
this.clearAllTempBuffs()
// console.log("临时英雄buff:",this.temp_hero_buff)
// console.log("临时英雄debuff:",this.temp_hero_debuff)
// console.log("临时全部buff:",this.temp_ally_buff)
// console.log("临时全部debuff:",this.temp_ally_debuff)
// console.log("临时敌方buff:",this.temp_enemy_buff)
// console.log("临时敌方debuff:",this.temp_enemy_debuff)
// console.log("临时友军buff:",this.temp_friend_buff)
// console.log("临时友军debuff:",this.temp_friend_debuff)
this.clearAlls()
}
// 添加临时buff
@@ -73,7 +63,7 @@ export class FightConComp extends Component {
}
}
// 初始化所有buff/debuff为0
private getInitTempBuffDebuff() {
private getInitTempBuff() {
const obj = {};
for (const key in BuffAttr) {
if (!isNaN(Number(key))) {
@@ -93,9 +83,23 @@ export class FightConComp extends Component {
return obj;
}
private clearAllTempBuffs() {
this.temp_hero_buff = this.temp_ally_buff = this.temp_enemy_buff = this.temp_friend_buff = this.getInitTempBuffDebuff();
this.temp_hero_debuff = this.temp_ally_debuff = this.temp_enemy_debuff = this.temp_friend_debuff = this.getInitTempDebuff();
private clearAlls() {
this.hero=getBuffNum()
this.ally=getBuffNum()
this.enemy=getBuffNum()
this.friend=getBuffNum()
this.hero_debuff=geDebuffNum()
this.ally_debuff=geDebuffNum()
this.enemy_debuff=geDebuffNum()
this.friend_debuff=geDebuffNum()
this.temp_hero_buff = this.getInitTempBuff()
this.temp_ally_buff = this.getInitTempBuff()
this.temp_enemy_buff = this.getInitTempBuff()
this.temp_friend_buff = this.getInitTempBuff()
this.temp_hero_debuff = this.getInitTempDebuff()
this.temp_ally_debuff = this.getInitTempDebuff()
this.temp_enemy_debuff = this.getInitTempDebuff()
this.temp_friend_debuff = this.getInitTempDebuff()
}
update(deltaTime: number) {