N多功能新增与调整
1.新增装备属性:伤害加成,伤害减免,暴击避免,爆伤减免,移动速度,转生属性副本行进速度更改为移动速度
2.新增装备类型:饰品,裤子,鞋子,护腕
3.新增装备品质:多彩,多彩品质装备拥有独特的主被动技能
4.新增部分多彩品质装备(暂无产出途径)
5.调整战斗逻辑,适配新增属性和技能
6.调整护甲减伤比例(调低)
7.调整格挡属性数值(调低)
8.调整暴击率和暴击伤害数值随装备等级线性增长(1级为原来一半,100级与原来相等)
9.调整转生点对移动速度的加成(调低)
10.新增装备图标资源
11.装备图鉴显示方式调整
3 weeks ago
|
|
|
import { Equip, Skills, Monster, Attribute, Player } from '@/config';
|
|
|
|
import { randonBootyEquip, deepCopy } from '@/tool';
|
|
|
|
import i18n from '@/config/i18n';
|
|
|
|
const { t } = i18n;
|
|
|
|
|
|
|
|
export class BattleRole {
|
|
|
|
attr: Attribute;
|
|
|
|
actions: Skills.Skill[] = new Array();
|
|
|
|
passives: Skills.Skill[] = new Array();
|
|
|
|
commit;
|
|
|
|
type: string;
|
|
|
|
control: number = 0;
|
|
|
|
//临时状态
|
|
|
|
action: Skills.ActionSkill | null = null;
|
|
|
|
dmg: number = 0;
|
|
|
|
crit: boolean = false;
|
|
|
|
|
|
|
|
constructor(attr: Attribute, commit, type: string) {
|
|
|
|
this.attr = attr;
|
|
|
|
this.commit = commit;
|
|
|
|
this.type = type;
|
|
|
|
this.addSkill(attr.skill); //添加默认主动技能普通攻击
|
|
|
|
}
|
|
|
|
|
|
|
|
addSkill = (skillName, lv?) => {
|
|
|
|
lv = lv || 1;
|
|
|
|
const skills = createSkill(skillName, lv);
|
|
|
|
skills.forEach((skill) => {
|
|
|
|
const type = skill.type;
|
|
|
|
if (type == Skills.skill_type_action) {
|
|
|
|
this.actions.push(skill); //主动技能
|
|
|
|
} else if (type == Skills.skill_type_passive) {
|
|
|
|
this.passives.push(skill); //被动技能
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
onStartBattle = (target: BattleRole) => {
|
|
|
|
//技能排序
|
|
|
|
this.actions.sort((a, b) => {
|
|
|
|
return (a.order = b.order);
|
|
|
|
});
|
|
|
|
//战斗开始前触发的技能
|
|
|
|
this.passives.forEach((skill) => {
|
|
|
|
skill.beforeBattle(this, target);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
attack = (target: BattleRole) => {
|
|
|
|
//选择使用的主动技能
|
|
|
|
this.actions.forEach((skill) => {
|
|
|
|
skill.beforeAtk(this, target);
|
|
|
|
});
|
|
|
|
//攻击前触发的被动技能
|
|
|
|
this.passives.forEach((skill) => {
|
|
|
|
skill.beforeAtk(this, target);
|
|
|
|
});
|
|
|
|
this.action?.use(this, target);
|
|
|
|
//攻击后触发的被动技能
|
|
|
|
this.passives.forEach((skill) => {
|
|
|
|
skill.afterAtk(this, target);
|
|
|
|
});
|
|
|
|
//触发攻击目标的反制技能
|
|
|
|
target.onAttacked(this);
|
|
|
|
//初始化临时状态
|
|
|
|
this.action = null;
|
|
|
|
this.dmg = 0;
|
|
|
|
this.crit = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
onAttacked = (target: BattleRole) => {
|
|
|
|
//触发反制技能
|
|
|
|
this.passives.forEach((skill) => {
|
|
|
|
skill.onAtked(this, target);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
battleLog = (log: string) => {
|
|
|
|
this.commit('set_sys_info', { type: 'battle', msg: log });
|
|
|
|
};
|
|
|
|
|
|
|
|
addHp = (hp: number) => {
|
|
|
|
if (this.type == 'player') {
|
|
|
|
this.commit('add_player_curhp', hp);
|
|
|
|
} else {
|
|
|
|
this.attr.curHp += hp;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
getBootys = (target: BattleRole) => {
|
|
|
|
//战斗结束后触发的技能
|
|
|
|
this.passives.forEach((skill) => {
|
|
|
|
skill.afterBattle(this, target);
|
|
|
|
});
|
|
|
|
const equips = randonBootyEquip(target.attr);
|
|
|
|
const coins = target.attr.coins;
|
|
|
|
return { equips: equips, coins: coins };
|
|
|
|
};
|
|
|
|
|
|
|
|
isDeath = () => {
|
|
|
|
return this.attr.curHp <= 0;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export const createBattleRole = (player: Player, monster: Monster, commit) => {
|
|
|
|
const playerRole = new BattleRole(player.attribute, commit, 'player');
|
|
|
|
const palyerEquips = [player.weapon, player.armor, player.neck, player.ring, player.jewelry];
|
|
|
|
palyerEquips.forEach((equip) => {
|
|
|
|
equip && playerRole.addSkill(equip.base.skill);
|
N多功能新增与调整
1.新增装备属性:伤害加成,伤害减免,暴击避免,爆伤减免,移动速度,转生属性副本行进速度更改为移动速度
2.新增装备类型:饰品,裤子,鞋子,护腕
3.新增装备品质:多彩,多彩品质装备拥有独特的主被动技能
4.新增部分多彩品质装备(暂无产出途径)
5.调整战斗逻辑,适配新增属性和技能
6.调整护甲减伤比例(调低)
7.调整格挡属性数值(调低)
8.调整暴击率和暴击伤害数值随装备等级线性增长(1级为原来一半,100级与原来相等)
9.调整转生点对移动速度的加成(调低)
10.新增装备图标资源
11.装备图鉴显示方式调整
3 weeks ago
|
|
|
});
|
|
|
|
|
|
|
|
monster = deepCopy(monster);
|
|
|
|
monster.curHp = monster.hp;
|
|
|
|
const monsterRole = new BattleRole(monster, commit, monster.type);
|
|
|
|
|
|
|
|
return { player: playerRole, monster: monsterRole };
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 初始化装备技能
|
|
|
|
* @param equip 装备
|
|
|
|
* @returns
|
|
|
|
*/
|
|
|
|
export const createEquipSkill = (equip): Skills.Skill[] => {
|
|
|
|
if (!equip) {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
return createSkill(equip.base.skill, equip.lv);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 初始化技能
|
|
|
|
* @param skillName 技能名称
|
|
|
|
* @returns
|
|
|
|
*/
|
|
|
|
export const createSkill = (skillName, lv): Skills.Skill[] => {
|
|
|
|
const skills: Skills.Skill[] = new Array();
|
|
|
|
if (!skillName) {
|
|
|
|
return skills;
|
|
|
|
}
|
|
|
|
const names: string[] = skillName.split(',');
|
|
|
|
names.forEach((name) => {
|
|
|
|
const clazz = Skills[name];
|
|
|
|
if (clazz) {
|
|
|
|
const skill: Skills.Skill = new clazz();
|
|
|
|
skill.lv = lv;
|
|
|
|
skills.push(skill);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return skills;
|
|
|
|
};
|