You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
132 lines
3.6 KiB
132 lines
3.6 KiB
3 weeks ago
|
import { initialWeapon, initialArmor, initialNeck, initialRing, initialJewelry, initialpants, initialshoes, initialbracers, Equip } from '@/config';
|
||
|
const monster_attr_factor = [0.9, 1, 1.15, 1.4];
|
||
|
export const type_monster = 'monster';
|
||
|
export const type_boss = 'boss';
|
||
|
|
||
|
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;
|
||
|
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: number;
|
||
|
type: string = type_monster;
|
||
|
equipRates: number[];
|
||
|
extraRate: number;
|
||
|
|
||
|
constructor(lv, difficulty) {
|
||
|
super();
|
||
|
this.lv = lv;
|
||
|
this.difficulty = difficulty;
|
||
|
const df = monster_attr_factor[this.difficulty];
|
||
|
this.baseAtk = Math.ceil(lv * lv ** 1.1 * (Math.random() * 1 + 2) * df);
|
||
|
this.atk = this.baseAtk;
|
||
|
this.hp = Math.ceil(lv * lv ** 1.1 * (Math.random() * 5 + 16) * df);
|
||
|
this.coins = Math.ceil(lv ** 1.16 * (Math.random() * 5 + 11) * df);
|
||
|
this.equipRates = [0.2 * df, 0.08 * df, 0.03 * df];
|
||
|
this.extraRate = 0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export class BossMonster extends Monster {
|
||
|
type: string = type_boss;
|
||
|
constructor(lv, difficulty) {
|
||
|
super(lv, difficulty);
|
||
|
const df = monster_attr_factor[this.difficulty];
|
||
|
this.baseAtk = Math.ceil(lv * lv ** 1.1 * (Math.random() * 1 + 3) * df);
|
||
|
this.atk = this.baseAtk;
|
||
|
this.hp = Math.ceil(lv * lv ** 1.1 * (Math.random() * 5 + 30) * df);
|
||
|
this.coins = Math.ceil(lv ** 1.16 * (Math.random() * 10 + 28) * df);
|
||
|
this.equipRates = [0.25 - 0.05 * df, 0.55 - 0.15 * df, 0.15 + 0.15 * df, 0.05 + 0.05 * df];
|
||
|
this.extraRate = 0.02 * ((this.difficulty - 1) * 5 + 1);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export class Dungeon {
|
||
|
lv: number;
|
||
|
difficulty?: number;
|
||
|
monsters?: Monster[] = new Array();
|
||
|
needDps?: number;
|
||
|
|
||
|
constructor(lv, difficulty) {
|
||
|
this.lv = lv;
|
||
|
this.setDifficulty(difficulty);
|
||
|
}
|
||
|
setDifficulty(difficulty) {
|
||
|
const lv = this.lv;
|
||
|
this.difficulty = difficulty;
|
||
|
this.monsters = new Array();
|
||
|
for (let i = 0; i < 4; i++) {
|
||
|
this.monsters.push(new Monster(lv, difficulty));
|
||
|
}
|
||
|
this.monsters.push(new BossMonster(lv, difficulty));
|
||
|
this.needDps = lv * lv ** 1.3 * 2 * difficulty;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export const createdDungeons = () => {};
|