import { initialWeapon, initialArmor, initialNeck, initialRing, initialJewelry, initialpants, initialshoes, initialbracers, Equip } from '@/config'; export const type_monster = 'monster'; export const type_boss = 'boss'; export const difficultys = ['normal', 'hard', 'pain', 'xiaomi', 'dami']; export const show_lv_df = ['normal', 'hard', 'pain']; const base_attr_factor = { normal: 1, hard: 1.15, pain: 1.4, xiaomi: 1.6, dami: 3 }; const extra_factor = { normal: 0, hard: 0, pain: 0, xiaomi: 1, dami: 2 }; const rate_factor = { normal: 1, hard: 2, pain: 3, xiaomi: 4, dami: 5 }; export class Attribute { lv: number = 1; coins: number = 0; curHp: number = 200; hp: number = 200; hpPercent: number = 0; baseAtk: number = 0; atk: number = 0; atkPercent: number = 0; def: number = 0; defPercent: number = 0; reducPercent: number = 0; bloc: number = 0; blocPercent: number = 0; eva: number = 0; crit: number = 0; //暴击率 critDmg: number = 150; // 初始暴击伤害150% dmgPercent: number = 0; //伤害加成 dmgReduc: number = 0; //伤害减免 critAvoid: number = 0; //暴击避免 critDmgReduc: number = 0; //暴击伤害减免 moveSpeed: number = 0; //移动速度 dps: number = 0; skill: string = 'Attack'; constructor(ra?: RebornAttribute) { if (ra) { this.hp += ra.hp; this.atk += ra.atk; this.def += ra.def; this.bloc += ra.bloc; this.crit += ra.crit; this.critDmg += ra.critDmg; this.moveSpeed += ra.moveSpeed; } } } export class Player { lv: number = 1; layer: number = 1; coins: number = 0; weapon: Equip = initialWeapon(); armor: Equip = initialArmor(); neck: Equip = initialNeck(); ring: Equip = initialRing(); jewelry: Equip = initialJewelry(); pants: Equip = initialpants(); shoes: Equip = initialshoes(); bracers: Equip = initialbracers(); attribute: Attribute = new Attribute(); } export class RebornAttribute { hp: number = 0; atk: number = 0; crit: number = 0; critDmg: number = 0; def: number = 0; bloc: number = 0; recoverSpeed: number = 0; moveSpeed: number = 0; battleSpeed: number = 0; } export class RebornPoints extends RebornAttribute { count: number = 0; points: number = 0; } export class Monster extends Attribute { difficulty: string; type: string = type_monster; equipRates: number[]; extraRate: number[]; df: number; ef: number; lf: number; constructor(lv, difficulty: string, layer?: number) { super(); this.lv = lv; this.difficulty = difficulty; this.df = base_attr_factor[this.difficulty]; this.ef = extra_factor[difficulty]; layer = layer || 0; this.lf = ((this.lv + layer) / this.lv) ** 2; this.callAtk(2.5); this.callHp(17); this.callCoins(11); this.callCrit(5); this.callDef(); this.equipRates = [0.2 * this.df, 0.08 * this.df, 0.03 * this.df]; this.extraRate = [0, 0]; } callAtk = (variable) => { this.baseAtk = Math.ceil(this.lv ** 2.1 * (Math.random() * 0.2 + variable) * this.df * this.lf); this.atk = this.baseAtk; }; callHp = (variable) => { this.hp = Math.ceil(this.lv ** 2.1 * (Math.random() * 3 + variable) * this.df * this.lf); }; callCoins = (variable) => { this.coins = Math.ceil(this.lv ** 1.16 * (Math.random() * 5 + variable) * this.df * this.lf); }; callDef = () => { this.def = Math.ceil(50 * this.ef * this.lf); }; callCrit = (variable) => { this.crit = Math.ceil(variable * this.ef * this.lf); this.critDmg = Math.ceil((150 + 50 * this.ef) * this.lf ** 0.5); }; } export class BossMonster extends Monster { type: string = type_boss; constructor(lv, difficulty, layer?: number) { super(lv, difficulty, layer); this.callAtk(3.5); this.callHp(31); this.callCoins(30.5); this.callCrit(15); const rf = rate_factor[difficulty]; this.equipRates = [0.25 - 0.05 * rf, 0.55 - 0.1 * rf, 0.15 + 0.1 * rf, 0.05 + 0.05 * rf]; let uniqueRate = 0.02 * ((rf - 1) * 5 + 1); const colorfulRate = 0.04 * (rf - 3) * this.lf; if (uniqueRate + colorfulRate > 1) { uniqueRate = 1 - colorfulRate; } this.extraRate = [uniqueRate, colorfulRate]; } } export class Dungeon { lv: number; difficulty: string; monsters?: Monster[] = new Array(); needDps?: number; left: string = ''; right: string = ''; top: string = ''; constructor(lv: number, difficulty: string, layer?: number) { this.lv = lv; this.difficulty = difficulty; this.setDifficulty(difficulty, layer); } setDifficulty(difficulty: string, layer?: number) { const lv = this.lv; this.difficulty = difficulty; this.monsters = new Array(); for (let i = 0; i < 4; i++) { this.monsters.push(new Monster(lv, this.difficulty, layer)); } const boss = new BossMonster(lv, difficulty, layer); this.monsters.push(boss); this.needDps = Math.ceil(lv * lv ** 1.1 * 32.5 * base_attr_factor[this.difficulty]); } } export const createdDungeons = () => {};