|
|
|
import { BattleRole, callReducPercent, replace } from '@/tool';
|
N多功能新增与调整
1.新增装备属性:伤害加成,伤害减免,暴击避免,爆伤减免,移动速度,转生属性副本行进速度更改为移动速度
2.新增装备类型:饰品,裤子,鞋子,护腕
3.新增装备品质:多彩,多彩品质装备拥有独特的主被动技能
4.新增部分多彩品质装备(暂无产出途径)
5.调整战斗逻辑,适配新增属性和技能
6.调整护甲减伤比例(调低)
7.调整格挡属性数值(调低)
8.调整暴击率和暴击伤害数值随装备等级线性增长(1级为原来一半,100级与原来相等)
9.调整转生点对移动速度的加成(调低)
10.新增装备图标资源
11.装备图鉴显示方式调整
3 weeks ago
|
|
|
import { type_boss } from '@/config';
|
|
|
|
import i18n from '../i18n';
|
|
|
|
const { t } = i18n;
|
|
|
|
export interface Skill {
|
|
|
|
order: number;
|
|
|
|
lv?: number;
|
|
|
|
type: string;
|
|
|
|
name: string;
|
|
|
|
cd: number;
|
|
|
|
rmdCd: number;
|
|
|
|
desc(): string;
|
|
|
|
|
|
|
|
beforeBattle(owner: BattleRole, target: BattleRole): void;
|
|
|
|
beforeAtk(owner: BattleRole, target: BattleRole): void;
|
|
|
|
afterAtk(owner: BattleRole, target: BattleRole): void;
|
|
|
|
afterBattle(owner: BattleRole, target: BattleRole): void;
|
|
|
|
onAtked(owner: BattleRole, target: BattleRole): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const skill_type_action = 'action';
|
|
|
|
export const skill_type_passive = 'passive';
|
|
|
|
|
|
|
|
//主动技能
|
|
|
|
export abstract class ActionSkill implements Skill {
|
|
|
|
type: string = skill_type_action;
|
|
|
|
order: number = 10;
|
|
|
|
abstract name: string;
|
|
|
|
abstract cd: number;
|
|
|
|
rmdCd: number = 0;
|
|
|
|
abstract desc(): string;
|
|
|
|
beforeBattle(owner: BattleRole, target: BattleRole): void {}
|
|
|
|
beforeAtk(owner: BattleRole, target: BattleRole): void {
|
|
|
|
if (this.rmdCd > 0) {
|
|
|
|
this.rmdCd--;
|
|
|
|
} else if (owner.action) {
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
this.rmdCd = this.cd - 1;
|
|
|
|
owner.action = this;
|
|
|
|
// this.use(owner, target);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
abstract use(owner: BattleRole, target: BattleRole): void;
|
|
|
|
afterAtk(owner: BattleRole, target: BattleRole): void {}
|
|
|
|
afterBattle(owner: BattleRole, target: BattleRole): void {}
|
|
|
|
onAtked(owner: BattleRole, target: BattleRole): void {}
|
|
|
|
}
|
|
|
|
//被动技能
|
|
|
|
export abstract class PassiveSkill implements Skill {
|
|
|
|
type: string = skill_type_passive;
|
|
|
|
abstract name: string;
|
|
|
|
order: number = 1;
|
|
|
|
cd: number = 0;
|
|
|
|
last: number = 1;
|
|
|
|
rmdCd: number = 0;
|
|
|
|
rmdLast: number = -1;
|
|
|
|
abstract desc(): string;
|
|
|
|
beforeBattle(owner: BattleRole, target: BattleRole): void {}
|
|
|
|
beforeAtk(owner: BattleRole, target: BattleRole): void {}
|
|
|
|
check(owner: BattleRole, target: BattleRole): void {
|
|
|
|
if (this.rmdCd > 0) {
|
|
|
|
this.rmdCd--;
|
|
|
|
} else if (this.trigger(owner, target)) {
|
|
|
|
this.rmdCd = this.cd - 1;
|
|
|
|
this.rmdLast = this.last;
|
|
|
|
}
|
|
|
|
if (this.rmdLast > 0) {
|
|
|
|
this.rmdLast--;
|
|
|
|
this.takeEffect(owner, target);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
abstract trigger(owner: BattleRole, target: BattleRole): boolean;
|
|
|
|
abstract takeEffect(owner: BattleRole, target: BattleRole): void;
|
|
|
|
afterAtk(owner: BattleRole, target: BattleRole): void {}
|
|
|
|
afterBattle(owner: BattleRole, target: BattleRole): void {}
|
|
|
|
onAtked(owner: BattleRole, target: BattleRole): void {}
|
|
|
|
}
|
|
|
|
//攻击前触发的被动
|
|
|
|
export abstract class PrePassiveSkill extends PassiveSkill {
|
|
|
|
beforeAtk(owner: BattleRole, target: BattleRole): void {
|
|
|
|
this.check(owner, target);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//攻击后触发的被动
|
|
|
|
export abstract class SufPassiveSkill extends PassiveSkill {
|
|
|
|
afterAtk(owner: BattleRole, target: BattleRole): void {
|
|
|
|
this.check(owner, target);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//被攻击后触发的被动
|
|
|
|
export abstract class CounterSkill extends PassiveSkill {
|
|
|
|
onAtked(owner: BattleRole, target: BattleRole): void {
|
|
|
|
this.check(owner, target);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//收益技能
|
|
|
|
export abstract class GainsSkill implements Skill {
|
|
|
|
order: number = 1;
|
|
|
|
type: string = skill_type_passive;
|
|
|
|
abstract name: string;
|
|
|
|
cd: number = 0;
|
|
|
|
rmdCd: number = 0;
|
|
|
|
abstract desc(): string;
|
|
|
|
beforeBattle(owner: BattleRole, target: BattleRole): void {}
|
|
|
|
beforeAtk(owner: BattleRole, target: BattleRole): void {}
|
|
|
|
afterAtk(owner: BattleRole, target: BattleRole): void {}
|
|
|
|
abstract afterBattle(owner: BattleRole, target: BattleRole): void;
|
|
|
|
onAtked(owner: BattleRole, target: BattleRole): void {}
|
|
|
|
}
|
|
|
|
//吸血技能
|
|
|
|
export abstract class Vampire extends SufPassiveSkill {
|
|
|
|
abstract percent: number;
|
|
|
|
name: string = 'vampire';
|
|
|
|
rate: number = 100;
|
|
|
|
desc(): string {
|
|
|
|
return replace(t('skill.vampire.1'), [this.percent]);
|
|
|
|
}
|
|
|
|
trigger(owner: BattleRole, target: BattleRole): boolean {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
takeEffect(owner: BattleRole, target: BattleRole): void {
|
|
|
|
if (owner.dmg <= 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
let sneak = Math.ceil((owner.dmg * this.percent) / 100);
|
|
|
|
const tmp = owner.attr.hp - owner.attr.curHp;
|
|
|
|
sneak = sneak > tmp ? tmp : sneak;
|
|
|
|
owner.addHp(sneak);
|
|
|
|
if (sneak > 0) {
|
|
|
|
const log = replace(t('skill.vampire.2'), [sneak]);
|
|
|
|
owner.battleLog(log);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//控制技能
|
|
|
|
export abstract class Control extends ActionSkill {
|
|
|
|
abstract last: number;
|
|
|
|
abstract rate: number;
|
|
|
|
abstract bossRate: number;
|
|
|
|
use(owner: BattleRole, target: BattleRole) {
|
|
|
|
owner.dmg = 0;
|
|
|
|
const rate = target.type == type_boss ? this.bossRate : this.rate;
|
|
|
|
let log = t('skill.control.2');
|
|
|
|
if (Math.random() < rate / 100) {
|
|
|
|
target.control = target.control > this.last ? target.control : this.last;
|
|
|
|
log = replace(t('skill.control.1'), [t(target.type), this.last]);
|
|
|
|
}
|
|
|
|
log = log = replace(t('skill.control.0'), [t(owner.type), t('skill.' + this.name + '.0')]) + log;
|
|
|
|
owner.battleLog(log);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//普通攻击
|
|
|
|
export class Attack extends ActionSkill {
|
|
|
|
order: number = 999;
|
|
|
|
name: string = 'attack';
|
|
|
|
cd: number = 1;
|
|
|
|
extraAtk = 0;
|
|
|
|
precent: number = 100;
|
|
|
|
desc(): string {
|
|
|
|
return t('skill.attack.1');
|
|
|
|
}
|
|
|
|
use(owner: BattleRole, target: BattleRole) {
|
|
|
|
if (owner.control > 0) {
|
|
|
|
const log = replace(t('skill.control.3'), [t(owner.type), owner.control]);
|
|
|
|
owner.battleLog(log);
|
|
|
|
owner.control--;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const attr = owner.attr;
|
|
|
|
const baseAtk = attr.baseAtk + this.extraAtk;
|
|
|
|
let dmg = ((baseAtk * (1 + attr.atkPercent / 100) * this.precent) / 100) * (1 + attr.dmgPercent / 100);
|
|
|
|
// const reducPercent = callReducPercent(target.attr.def);
|
|
|
|
const reducPercent = target.attr.reducPercent;
|
|
|
|
dmg = dmg * (1 - reducPercent) * (1 - target.attr.dmgReduc / 100) - target.attr.bloc;
|
|
|
|
owner.crit = Math.random() < (owner.attr.crit - target.attr.critAvoid) / 100;
|
N多功能新增与调整
1.新增装备属性:伤害加成,伤害减免,暴击避免,爆伤减免,移动速度,转生属性副本行进速度更改为移动速度
2.新增装备类型:饰品,裤子,鞋子,护腕
3.新增装备品质:多彩,多彩品质装备拥有独特的主被动技能
4.新增部分多彩品质装备(暂无产出途径)
5.调整战斗逻辑,适配新增属性和技能
6.调整护甲减伤比例(调低)
7.调整格挡属性数值(调低)
8.调整暴击率和暴击伤害数值随装备等级线性增长(1级为原来一半,100级与原来相等)
9.调整转生点对移动速度的加成(调低)
10.新增装备图标资源
11.装备图鉴显示方式调整
3 weeks ago
|
|
|
let critLog = '';
|
|
|
|
if (owner.crit) {
|
|
|
|
let critDmg = owner.attr.critDmg - target.attr.critDmgReduc;
|
|
|
|
critDmg < 100 ? 100 : critDmg;
|
|
|
|
dmg *= critDmg / 100;
|
N多功能新增与调整
1.新增装备属性:伤害加成,伤害减免,暴击避免,爆伤减免,移动速度,转生属性副本行进速度更改为移动速度
2.新增装备类型:饰品,裤子,鞋子,护腕
3.新增装备品质:多彩,多彩品质装备拥有独特的主被动技能
4.新增部分多彩品质装备(暂无产出途径)
5.调整战斗逻辑,适配新增属性和技能
6.调整护甲减伤比例(调低)
7.调整格挡属性数值(调低)
8.调整暴击率和暴击伤害数值随装备等级线性增长(1级为原来一半,100级与原来相等)
9.调整转生点对移动速度的加成(调低)
10.新增装备图标资源
11.装备图鉴显示方式调整
3 weeks ago
|
|
|
critLog = t('skill.crit.0');
|
|
|
|
}
|
|
|
|
dmg = dmg < 1 ? 1 : dmg;
|
|
|
|
owner.dmg = Math.ceil(dmg);
|
|
|
|
target.addHp(-1 * owner.dmg);
|
|
|
|
const log = replace(t('skill.attack.2'), [t(owner.type), t('skill.' + this.name + '.0'), t(target.type), owner.dmg, critLog]);
|
|
|
|
owner.battleLog(log);
|
|
|
|
}
|
|
|
|
}
|