继续完善 装备buff

This commit is contained in:
2025-06-12 16:24:23 +08:00
parent 4c0d1023a0
commit cb38aa55a4
12 changed files with 227 additions and 190 deletions

View File

@@ -2,7 +2,8 @@ import { _decorator, Component, Node, resources, Sprite, SpriteAtlas } from 'cc'
import { oops } from 'db://oops-framework/core/Oops';
import { GameEvent } from '../common/config/GameEvent';
import { smc } from '../common/SingletonModuleComp';
import { EquipInfo, EquipType, EquipAttr, EquipAttrTarget } from '../common/config/Equips';
import { EquipInfo, EquipType, EquipAttrTarget} from '../common/config/Equips';
import { BuffAttr, getBuffNum } from '../common/config/SkillSet';
const { ccclass, property } = _decorator;
@ccclass('EquipsComp')
@@ -15,50 +16,10 @@ export class EquipsComp extends Component {
skill3:any=null
boxs:Node=null
attrs:any={
hero:{
ATK:0, // 攻击力
ATK_COUNT:0, // 攻击个数
ATK_CD:0, // 攻击速度
HP:0, // 生命值
DEF:0, // 免伤
SKILL_DMG:0, // 技能效果
SKILL_CD:0, // 技能冷却缩减
CARD_EFFECT:0, // 卡牌效果
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
},
ally:{
ATK:0, // 攻击力
ATK_COUNT:0, // 攻击个数
ATK_CD:0, // 攻击速度
HP:0, // 生命值
DEF:0, // 免伤
SKILL_DMG:0, // 技能效果
SKILL_CD:0, // 技能冷却缩减
CARD_EFFECT:0, // 卡牌效果
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
},
enemy:{
ATK:0, // 攻击力
ATK_COUNT:0, // 攻击个数
ATK_CD:0, // 攻击速度
HP:0, // 生命值
DEF:0, // 免伤
SKILL_DMG:0, // 技能效果
SKILL_CD:0, // 技能冷却缩减
CARD_EFFECT:0, // 卡牌效果
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
},
friend:{
ATK:0, // 攻击力
ATK_COUNT:0, // 攻击个数
ATK_CD:0, // 攻击速度
HP:0, // 生命值
DEF:0, // 免伤
SKILL_DMG:0, // 技能效果
SKILL_CD:0, // 技能冷却缩减
CARD_EFFECT:0, // 卡牌效果
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
}
hero:getBuffNum(),
ally:getBuffNum(),
enemy:getBuffNum(),
friend:getBuffNum(),
}
/** 视图层逻辑代码分离演示 */
onLoad() {
@@ -166,31 +127,31 @@ export class EquipsComp extends Component {
if (targetKey) {
switch (attr.type) {
case EquipAttr.ATK:
case BuffAttr.ATK:
this.attrs[targetKey].ATK += attr.value;
break;
case EquipAttr.ATK_COUNT:
case BuffAttr.ATK_COUNT:
this.attrs[targetKey].ATK_COUNT += attr.value;
break;
case EquipAttr.ATK_CD:
case BuffAttr.ATK_CD:
this.attrs[targetKey].ATK_CD += attr.value;
break;
case EquipAttr.HP:
case BuffAttr.HP:
this.attrs[targetKey].HP += attr.value;
break;
case EquipAttr.DEF:
case BuffAttr.DEF:
this.attrs[targetKey].DEF += attr.value;
break;
case EquipAttr.SKILL_DMG:
case BuffAttr.SKILL_DMG:
this.attrs[targetKey].SKILL_DMG += attr.value;
break;
case EquipAttr.SKILL_CD:
case BuffAttr.SKILL_CD:
this.attrs[targetKey].SKILL_CD += attr.value;
break;
case EquipAttr.CARD_EFFECT:
case BuffAttr.CARD_EFFECT:
this.attrs[targetKey].CARD_EFFECT += attr.value;
break;
case EquipAttr.CARD_COUNT:
case BuffAttr.CARD_COUNT:
this.attrs[targetKey].CARD_COUNT += attr.value;
break;
}
@@ -202,11 +163,7 @@ export class EquipsComp extends Component {
// 重置所有属性为0
private reset_attrs() {
Object.keys(this.attrs).forEach(key => {
Object.keys(this.attrs[key]).forEach(attrKey => {
this.attrs[key][attrKey] = 0;
});
});
this.attrs.hero=this.attrs.ally=this.attrs.enemy=this.attrs.friend=getBuffNum()
}
// 根据目标类型获取对应的key