伤害计算 需要统一
This commit is contained in:
@@ -14,7 +14,7 @@ const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('FightConComp')
|
||||
export class FightConComp extends Component {
|
||||
|
||||
//装备 及 光环效果 物品存在生效
|
||||
hero_buff=getBuffNum()
|
||||
friend_buff=getBuffNum()
|
||||
enemy_buff=getBuffNum()
|
||||
@@ -22,16 +22,10 @@ export class FightConComp extends Component {
|
||||
hero_debuff=geDebuffNum()
|
||||
friend_debuff=geDebuffNum()
|
||||
enemy_debuff=geDebuffNum()
|
||||
//注意临时buff和debuff 每种buff的值 必须都一样 多种值 战斗处理复杂 暂时放弃
|
||||
temp_hero_buff = this.getInitTempBuff();
|
||||
temp_friend_buff = this.getInitTempBuff();
|
||||
temp_enemy_buff = this.getInitTempBuff();
|
||||
|
||||
temp_hero_debuff = this.getInitTempDebuff();
|
||||
temp_friend_debuff = this.getInitTempDebuff();
|
||||
temp_enemy_debuff = this.getInitTempDebuff();
|
||||
//注意临时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
|
||||
@@ -65,9 +59,9 @@ export class FightConComp extends Component {
|
||||
this.friend_alive_cd=FightSet.FRIEND_LIVE_CD
|
||||
|
||||
}
|
||||
change_equip_special_attr(e:GameEvent,data:any){
|
||||
change_equip_special_attr(e:GameEvent,data:any){
|
||||
console.log("[FightConComp]:change_equip_special_attr",data)
|
||||
this.atk_add_friend_atk=data.atk_add_friend_atk+(this.card_atk_add > 0 ? this.card_atk_add:0) //装备特殊属性 英雄/伙伴 攻击力增加
|
||||
this.atk_add_friend_atk=data.atk_add_friend_atk+(this.card_atk_add > 0 ? this.card_atk_add:0) //装备特殊属性 英雄/伙伴 攻击力增加
|
||||
this.atk_add_friend_hp=data.atk_add_friend_hp+(this.card_hp_add > 0 ? this.card_hp_add:0) //装备特殊属性 英雄/伙伴 生命值增加
|
||||
this.atk_add_glod=data.atk_add_glod
|
||||
this.atk_add_master_atk=data.atk_add_master_atk+(this.card_atk_add > 0 ? this.card_atk_add:0) //装备特殊属性 英雄/伙伴 攻击力增加
|
||||
@@ -90,47 +84,6 @@ export class FightConComp extends Component {
|
||||
this.clearAlls()
|
||||
}
|
||||
|
||||
// 添加临时buff
|
||||
addTempBuff(target: 'hero'|'ally'|'enemy'|'friend', buffId: number, value: number, count: number) {
|
||||
const key = `temp_${target}_buff`;
|
||||
if (!this[key][buffId]) {
|
||||
this[key][buffId] = { value, count };
|
||||
} else {
|
||||
this[key][buffId].value += value;
|
||||
this[key][buffId].count += count;
|
||||
}
|
||||
}
|
||||
|
||||
// 触发一次buff效果后减少次数
|
||||
triggerTempBuff(target: 'hero'|'ally'|'enemy'|'friend', buffId: number) {
|
||||
const key = `temp_${target}_buff`;
|
||||
if (this[key][buffId]) {
|
||||
this[key][buffId].count -= 1;
|
||||
if (this[key][buffId].count <= 0) {
|
||||
delete this[key][buffId];
|
||||
}
|
||||
}
|
||||
}
|
||||
// 初始化所有buff/debuff为0
|
||||
private getInitTempBuff() {
|
||||
const obj = {};
|
||||
for (const key in BuffAttr) {
|
||||
if (!isNaN(Number(key))) {
|
||||
obj[Number(key)] = { value: 0, count: 0 };
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
private getInitTempDebuff() {
|
||||
const obj = {};
|
||||
for (const key in DebuffAttr) {
|
||||
if (!isNaN(Number(key))) {
|
||||
obj[Number(key)] = { value: 0, count: 0 };
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
private use_special_card(e:GameEvent,data:any){
|
||||
console.log("[FightConComp]:use_special_card:",SuperCards[data.uuid])
|
||||
@@ -214,13 +167,6 @@ export class FightConComp extends Component {
|
||||
this.friend_debuff=geDebuffNum()
|
||||
this.enemy_debuff=geDebuffNum()
|
||||
|
||||
this.temp_hero_buff = this.getInitTempBuff()
|
||||
this.temp_friend_buff = this.getInitTempBuff()
|
||||
this.temp_enemy_buff = this.getInitTempBuff()
|
||||
|
||||
this.temp_hero_debuff = this.getInitTempDebuff()
|
||||
this.temp_friend_debuff = this.getInitTempDebuff()
|
||||
this.temp_enemy_debuff = this.getInitTempDebuff()
|
||||
this.friend_alive_cd=FightSet.FRIEND_LIVE_CD
|
||||
this.atk_add_friend_atk=0
|
||||
this.atk_add_friend_hp=0
|
||||
|
||||
Reference in New Issue
Block a user