光环和装备加成 都改为buff 不再使用buff
This commit is contained in:
@@ -19,9 +19,7 @@ export class EquipsComp extends Component {
|
||||
attrs:any={
|
||||
hero_buff:getBuffNum(),
|
||||
friend_buff:getBuffNum(),
|
||||
hero_debuff:geDebuffNum(),
|
||||
friend_debuff:geDebuffNum(),
|
||||
enemy_debuff:geDebuffNum(),
|
||||
enemy_debuff:getBuffNum(),
|
||||
}
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
onLoad() {
|
||||
@@ -166,13 +164,13 @@ export class EquipsComp extends Component {
|
||||
// 根据目标类型获取对应的key
|
||||
switch (target) {
|
||||
case EquipAttrTarget.HERO:
|
||||
targetKey = 'hero_debuff';
|
||||
targetKey = 'hero_buff';
|
||||
break;
|
||||
case EquipAttrTarget.FRIEND:
|
||||
targetKey = 'friend_debuff';
|
||||
targetKey = 'friend_buff';
|
||||
break;
|
||||
case EquipAttrTarget.ENEMY:
|
||||
targetKey = 'enemy_debuff';
|
||||
targetKey = 'enemy_debuff'; //都是敌人的减益
|
||||
break;
|
||||
}
|
||||
this.add_debuff(targetKey,attr)
|
||||
@@ -241,8 +239,28 @@ export class EquipsComp extends Component {
|
||||
}
|
||||
|
||||
add_debuff(targetKey:string,attr:any){
|
||||
if(targetKey){
|
||||
this.attrs[targetKey][DebuffAttr[attr.type]] += attr.value;
|
||||
switch(attr.type){
|
||||
case DebuffAttr.BURN:
|
||||
this.attrs[targetKey][BuffAttr.DEF] -= attr.value; //免伤, 负的免伤 就是加伤害
|
||||
break
|
||||
case DebuffAttr.DECD:
|
||||
this.attrs[targetKey][BuffAttr.ATK_CD] -= attr.value; //加cd值 技能释放中 按-cd 计算 所以 cd 值负数实际是加cd
|
||||
break
|
||||
case DebuffAttr.DEHP:
|
||||
this.attrs[targetKey][BuffAttr.HP] -= attr.value;
|
||||
break
|
||||
case DebuffAttr.DEATK:
|
||||
this.attrs[targetKey][BuffAttr.ATK] -= attr.value;
|
||||
break
|
||||
case DebuffAttr.DECOUNT:
|
||||
this.attrs[targetKey][BuffAttr.ATK_COUNT] -= attr.value;
|
||||
break
|
||||
case DebuffAttr.CRITICAL:
|
||||
this.attrs[targetKey][BuffAttr.CRITICAL] -= attr.value;
|
||||
break
|
||||
case DebuffAttr.DODGE:
|
||||
this.attrs[targetKey][BuffAttr.DODGE] -= attr.value;
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,9 +270,7 @@ export class EquipsComp extends Component {
|
||||
const newAttrs = {
|
||||
hero_buff: getBuffNum(),
|
||||
friend_buff: getBuffNum(),
|
||||
hero_debuff: geDebuffNum(),
|
||||
friend_debuff: geDebuffNum(),
|
||||
enemy_debuff: geDebuffNum(),
|
||||
enemy_debuff: getBuffNum(),
|
||||
};
|
||||
|
||||
// 替换整个 attrs 对象
|
||||
@@ -262,9 +278,7 @@ export class EquipsComp extends Component {
|
||||
|
||||
console.log("重置属性", {
|
||||
hero_buff: this.attrs.hero_buff,
|
||||
hero_debuff: this.attrs.hero_debuff,
|
||||
friend_buff: this.attrs.friend_buff,
|
||||
friend_debuff: this.attrs.friend_debuff,
|
||||
enemy_debuff: this.attrs.enemy_debuff,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user