Browse Source

抽取创建装备公共方法

2.0
许孟阳 2 months ago
parent
commit
9a0bc3a5bc
  1. 180
      src/config/equips/armor.ts
  2. 65
      src/config/equips/base.ts
  3. 16
      src/config/equips/bean.ts
  4. 158
      src/config/equips/bracers.ts
  5. 219
      src/config/equips/jewelry.ts
  6. 138
      src/config/equips/neck.ts
  7. 138
      src/config/equips/pants.ts
  8. 134
      src/config/equips/ring.ts
  9. 138
      src/config/equips/shoes.ts
  10. 215
      src/config/equips/weapon.ts

180
src/config/equips/armor.ts

@ -1,128 +1,81 @@
import { Entry, Quality, EquipBase, Equip } from './bean'; import { getCategory, createExtraEntry, createBase, createSamples } from './base';
import { Entry, Quality, EquipBase, Equip, Categorys } from './bean';
import { qualitys, entry_initor, extra_entry_num } from './constant'; import { qualitys, entry_initor, extra_entry_num } from './constant';
const extraEntrys = ['atk', 'hp', 'def', 'defPercent', 'hpPercent', 'dmgReduc', 'critAvoid', 'critDmgReduc']; const extraEntrys = ['atk', 'hp', 'def', 'defPercent', 'hpPercent', 'dmgReduc', 'critAvoid', 'critDmgReduc'];
const coefficient = { shabby: 0.7, ordinary: 1, artifact: 1.5, epic: 1.8, unique: 2, colorful: 2 }; const coefficient = { shabby: 0.7, ordinary: 1, artifact: 1.5, epic: 1.8, unique: 2, colorful: 2 };
export const armorColorfulCategorys = [ export const armorColorfulCategorys: Categorys[] = [
{ new Categorys(
name: 'baihua', 'baihua',
icon: 'armor/百花内甲.png', 'armor/百花内甲.png',
entry: [ [
{ type: 'def', valCoefficient: 1.0 }, { type: 'def', valCoefficient: 1.0 },
{ type: 'hp', valCoefficient: 1.4 }, { type: 'hp', valCoefficient: 1.4 },
{ type: 'atk', valCoefficient: 1.4 }, { type: 'atk', valCoefficient: 1.4 },
], ],
skill: 'BHXDJC', 'BHXDJC'
}, ),
]; ];
export const armorUniqueCategorys = [ export const armorUniqueCategorys: Categorys[] = [
{ new Categorys('dispute', 'U_Armor01.png', [
name: 'dispute',
icon: 'U_Armor01.png',
entry: [
{ type: 'def', valCoefficient: 1.0 }, { type: 'def', valCoefficient: 1.0 },
{ type: 'hp', valCoefficient: 1.4 }, { type: 'hp', valCoefficient: 1.4 },
{ type: 'atk', valCoefficient: 1.4 }, { type: 'atk', valCoefficient: 1.4 },
], ]),
}, new Categorys('jianHao', 'U_Armor02.png', [
{
name: 'jianHao',
icon: 'U_Armor02.png',
entry: [
{ type: 'def', valCoefficient: 2.1 }, { type: 'def', valCoefficient: 2.1 },
{ type: 'hp', valCoefficient: 2.6 }, { type: 'hp', valCoefficient: 2.6 },
], ]),
}, new Categorys('samurai', 'U_Armor03.png', [
{
name: 'samurai',
icon: 'U_Armor03.png',
entry: [
{ type: 'def', valCoefficient: 1.3 }, { type: 'def', valCoefficient: 1.3 },
{ type: 'hp', valCoefficient: 1.7 }, { type: 'hp', valCoefficient: 1.7 },
{ type: 'atk', valCoefficient: 0.9 }, { type: 'atk', valCoefficient: 0.9 },
], ]),
}, new Categorys('trackers', 'U_Armor04.png', [
{
name: 'trackers',
icon: 'U_Armor04.png',
entry: [
{ type: 'def', valCoefficient: 0.9 }, { type: 'def', valCoefficient: 0.9 },
{ type: 'critDmg', valCoefficient: 1.7 }, { type: 'critDmg', valCoefficient: 1.7 },
{ type: 'atk', valCoefficient: 1.7 }, { type: 'atk', valCoefficient: 1.7 },
], ]),
}, new Categorys('rongYi', 'U_Armor05.png', [
{
name: 'rongYi',
icon: 'U_Armor05.png',
entry: [
{ type: 'hp', valCoefficient: 1.6 }, { type: 'hp', valCoefficient: 1.6 },
{ type: 'atk', valCoefficient: 2.4 }, { type: 'atk', valCoefficient: 2.4 },
{ type: 'bloc', valCoefficient: 1.2 }, { type: 'bloc', valCoefficient: 1.2 },
], ]),
}, new Categorys('nightwear', 'U_Armor06.png', [
{
name: 'nightwear',
icon: 'U_Armor06.png',
entry: [
{ type: 'def', valCoefficient: 1.2 }, { type: 'def', valCoefficient: 1.2 },
{ type: 'hp', valCoefficient: 1.5 }, { type: 'hp', valCoefficient: 1.5 },
{ type: 'atk', valCoefficient: 1.2 }, { type: 'atk', valCoefficient: 1.2 },
], ]),
}, new Categorys('wildDragon', 'U_Armor07.png', [
{
name: 'wildDragon',
icon: 'U_Armor07.png',
entry: [
{ type: 'def', valCoefficient: 1.5 }, { type: 'def', valCoefficient: 1.5 },
{ type: 'bloc', valCoefficient: 1.2 }, { type: 'bloc', valCoefficient: 1.2 },
{ type: 'hp', valCoefficient: 1.4 }, { type: 'hp', valCoefficient: 1.4 },
], ]),
},
]; ];
export const armorCategorys = [ export const armorCategorys: Categorys[] = [
{ new Categorys('guard', 'A_A2.png', [
name: 'guard',
icon: 'A_A2.png',
entry: [
{ type: 'def', valCoefficient: 2 }, { type: 'def', valCoefficient: 2 },
{ type: 'hp', valCoefficient: 0.6 }, { type: 'hp', valCoefficient: 0.6 },
], ]),
}, new Categorys('redWillow', 'A_A3.png', [
{
name: 'redWillow',
icon: 'A_A3.png',
entry: [
{ type: 'def', valCoefficient: 0.9 }, { type: 'def', valCoefficient: 0.9 },
{ type: 'hp', valCoefficient: 1.2 }, { type: 'hp', valCoefficient: 1.2 },
], ]),
}, new Categorys('warrior', 'A_A5.png', [
{
name: 'warrior',
icon: 'A_A5.png',
entry: [
{ type: 'def', valCoefficient: 1.1 }, { type: 'def', valCoefficient: 1.1 },
{ type: 'hp', valCoefficient: 0.8 }, { type: 'hp', valCoefficient: 0.8 },
], ]),
}, new Categorys('lightArmor', 'A_A7.png', [
{
name: 'lightArmor',
icon: 'A_A7.png',
entry: [
{ type: 'def', valCoefficient: 0.7 }, { type: 'def', valCoefficient: 0.7 },
{ type: 'hp', valCoefficient: 0.5 }, { type: 'hp', valCoefficient: 0.5 },
{ type: 'atk', valCoefficient: 0.5 }, { type: 'atk', valCoefficient: 0.5 },
], ]),
}, new Categorys('furryArmor', 'A_A9.png', [
{
name: 'furryArmor',
icon: 'A_A9.png',
entry: [
{ type: 'def', valCoefficient: 0.8 }, { type: 'def', valCoefficient: 0.8 },
{ type: 'hp', valCoefficient: 0.8 }, { type: 'hp', valCoefficient: 0.8 },
{ type: 'atk', valCoefficient: 0.4 }, { type: 'atk', valCoefficient: 0.4 },
], ]),
},
]; ];
export const initialArmor = () => { export const initialArmor = () => {
@ -136,69 +89,14 @@ export const initialArmor = () => {
export const createArmor = (quality, lv) => { export const createArmor = (quality, lv) => {
const type = 'armor'; const type = 'armor';
const qualityBean = new Quality(quality, coefficient[quality]); const qualityBean = new Quality(quality, coefficient[quality]);
const category = getCategory(quality); const category = getCategory(quality, armorCategorys, armorUniqueCategorys, armorColorfulCategorys);
const base = createBase(quality, lv, category); const base = createBase(quality, lv, category, coefficient);
const extraEntry = new Array(); const extraEntry = new Array();
const extraEntryNum = extra_entry_num[quality]; const extraEntryNum = extra_entry_num[quality];
for (let i = 0; i < extraEntryNum; i++) { for (let i = 0; i < extraEntryNum; i++) {
extraEntry.push(armorExtraEntry(quality, lv)); extraEntry.push(createExtraEntry(quality, lv, extraEntrys, coefficient));
} }
return new Equip(type, lv, qualityBean, base, extraEntry); return new Equip(type, lv, qualityBean, base, extraEntry);
}; };
export const armorExtraEntry = (quality, lv) => { export const armorSamples = createSamples(armorCategorys, armorUniqueCategorys, armorColorfulCategorys, 'armor', coefficient);
const type = extraEntrys[Math.floor(Math.random() * extraEntrys.length)];
const initor = entry_initor[type];
const qualityCoefficient = coefficient[quality];
const entry = initor(lv, qualityCoefficient);
return entry;
};
const createBase = (quality, lv, category) => {
const entry = new Array();
category.entry.forEach((item) => {
const initor = entry_initor[item.type];
const qualityCoefficient = coefficient[quality];
entry.push(initor(lv, qualityCoefficient, item.valCoefficient));
});
return new EquipBase(category.name, category.icon, entry, category.skill);
};
const getCategory = (quality) => {
let categorys = armorCategorys;
switch (quality) {
case qualitys[4]:
categorys = armorUniqueCategorys;
break;
case qualitys[5]:
categorys = armorColorfulCategorys;
break;
}
return categorys[Math.floor(Math.random() * categorys.length)];
};
const armorSample = (quality, category): Equip => {
const type = 'armor';
const lv = 100;
const qualityBean = new Quality(quality, coefficient[quality]);
const base = createBase(quality, lv, category);
const extraEntry = new Array();
return new Equip(type, lv, qualityBean, base, extraEntry);
};
const armorSamples = {
colorful: new Array(),
unique: new Array(),
epic: new Array(),
artifact: new Array(),
};
armorColorfulCategorys.forEach((item) => {
armorSamples.colorful.push(armorSample('colorful', item));
});
armorUniqueCategorys.forEach((item) => {
armorSamples.unique.push(armorSample('unique', item));
});
armorCategorys.forEach((item) => {
armorSamples.epic.push(armorSample('epic', item));
armorSamples.artifact.push(armorSample('artifact', item));
});
export { armorSamples };

65
src/config/equips/base.ts

@ -0,0 +1,65 @@
import { Categorys, Equip, EquipBase, Quality } from './bean';
import { entry_initor, qualitys } from './constant';
export const getCategory = (quality, categorys: Categorys[], uniqueCategorys: Categorys[], colorfulCategorys: Categorys[]) => {
switch (quality) {
case qualitys[4]:
categorys = uniqueCategorys;
break;
case qualitys[5]:
categorys = colorfulCategorys;
break;
}
while (true) {
const category = categorys[Math.floor(Math.random() * categorys.length)];
if (category.reRoll > 0 && Math.random() < category.reRoll) {
continue;
}
return category;
}
};
export const createBase = (quality, lv, category, coefficient) => {
const entry = new Array();
category.entry.forEach((item) => {
const initor = entry_initor[item.type];
const qualityCoefficient = coefficient[quality];
entry.push(initor(lv, qualityCoefficient, item.valCoefficient));
});
return new EquipBase(category.name, category.icon, entry, category.skill);
};
export const createExtraEntry = (quality, lv, extraEntrys, coefficient) => {
const type = extraEntrys[Math.floor(Math.random() * extraEntrys.length)];
const initor = entry_initor[type];
const qualityCoefficient = coefficient[quality];
const entry = initor(lv, qualityCoefficient);
return entry;
};
export const createSamples = (categorys: Categorys[], uniqueCategorys: Categorys[], colorfulCategorys: Categorys[], type, coefficient) => {
const samples = {
colorful: new Array(),
unique: new Array(),
epic: new Array(),
artifact: new Array(),
};
colorfulCategorys.forEach((item) => {
samples.colorful.push(createSample('colorful', item, type, coefficient));
});
uniqueCategorys.forEach((item) => {
samples.unique.push(createSample('unique', item, type, coefficient));
});
categorys.forEach((item) => {
samples.epic.push(createSample('epic', item, type, coefficient));
samples.artifact.push(createSample('artifact', item, type, coefficient));
});
return samples;
};
const createSample = (quality, category, type, coefficient): Equip => {
const lv = 100;
const qualityBean = new Quality(quality, coefficient[quality]);
const base = createBase(quality, lv, category, coefficient);
const extraEntry = new Array();
return new Equip(type, lv, qualityBean, base, extraEntry);
};

16
src/config/equips/bean.ts

@ -61,3 +61,19 @@ export class Equip {
this.extraEntry = extraEntry; this.extraEntry = extraEntry;
} }
} }
export class Categorys {
name: string;
icon: string;
entry: any[];
skill?: string;
reRoll: number;
constructor(name: string, icon: string, entry: any[], skill?: string, reRoll?: number) {
this.name = name;
this.icon = icon;
this.entry = entry;
this.skill = skill;
this.reRoll = reRoll || 0;
}
}

158
src/config/equips/bracers.ts

@ -1,105 +1,70 @@
import { Entry, Quality, EquipBase, Equip } from './bean'; import { getCategory, createExtraEntry, createBase, createSamples } from './base';
import { qualitys, entry_initor, extra_entry_num } from './constant'; import { Entry, Quality, EquipBase, Equip, Categorys } from './bean';
import { qualitys, extra_entry_num } from './constant';
const extraEntrys = ['atk', 'crit', 'critDmg', 'hp', 'def', 'atkPercent', 'defPercent', 'hpPercent']; const extraEntrys = ['atk', 'crit', 'critDmg', 'hp', 'def', 'atkPercent', 'defPercent', 'hpPercent'];
const coefficient = { shabby: 0.6, ordinary: 0.9, artifact: 1.3, epic: 1.6, unique: 1.8, colorful: 1.8 }; const coefficient = { shabby: 0.6, ordinary: 0.9, artifact: 1.3, epic: 1.6, unique: 1.8, colorful: 1.8 };
export const bracersColorfulCategorys = [ export const bracersColorfulCategorys: Categorys[] = [
{ new Categorys(
name: 'xianglong', 'xianglong',
icon: 'bracers/降龙.png', 'bracers/降龙.png',
entry: [ [
{ type: 'critDmg', valCoefficient: 1.2 }, { type: 'critDmg', valCoefficient: 1.2 },
{ type: 'atkPercent', valCoefficient: 0.7 }, { type: 'atkPercent', valCoefficient: 0.7 },
{ type: 'atk', valCoefficient: 1 }, { type: 'atk', valCoefficient: 1 },
], ],
skill: 'Xianglong', 'Xianglong'
}, ),
]; ];
export const bracersUniqueCategorys = [ export const bracersUniqueCategorys: Categorys[] = [
{ new Categorys('duoqing', 'bracers/多情腕.png', [
name: 'duoqing',
icon: 'bracers/多情腕.png',
entry: [
{ type: 'atk', valCoefficient: 1 }, { type: 'atk', valCoefficient: 1 },
{ type: 'hp', valCoefficient: 0.8 }, { type: 'hp', valCoefficient: 0.8 },
{ type: 'def', valCoefficient: 0.9 }, { type: 'def', valCoefficient: 0.9 },
], ]),
}, new Categorys('wano', 'bracers/玩藕.png', [
{
name: 'wano',
icon: 'bracers/玩藕.png',
entry: [
{ type: 'critDmg', valCoefficient: 1.5 }, { type: 'critDmg', valCoefficient: 1.5 },
{ type: 'crit', valCoefficient: 0.5 }, { type: 'crit', valCoefficient: 0.5 },
{ type: 'atk', valCoefficient: 0.8 }, { type: 'atk', valCoefficient: 0.8 },
], ]),
}, new Categorys('rsggu', 'bracers/人参果裹布.png', [
{
name: 'rsggu',
icon: 'bracers/人参果裹布.png',
entry: [
{ type: 'critDmg', valCoefficient: 1.2 }, { type: 'critDmg', valCoefficient: 1.2 },
{ type: 'atkPercent', valCoefficient: 1.0 }, { type: 'atkPercent', valCoefficient: 1.0 },
{ type: 'atk', valCoefficient: 0.7 }, { type: 'atk', valCoefficient: 0.7 },
], ]),
}, new Categorys('yingwu', 'bracers/鹦鹉杯.png', [
{
name: 'yingwu',
icon: 'bracers/鹦鹉杯.png',
entry: [
{ type: 'critDmg', valCoefficient: 1.6 }, { type: 'critDmg', valCoefficient: 1.6 },
{ type: 'atk', valCoefficient: 1.6 }, { type: 'atk', valCoefficient: 1.6 },
], ]),
}, new Categorys('meipusa', 'bracers/美菩萨.png', [
{
name: 'meipusa',
icon: 'bracers/美菩萨.png',
entry: [
{ type: 'atkPercent', valCoefficient: 1.2 }, { type: 'atkPercent', valCoefficient: 1.2 },
{ type: 'def', valCoefficient: 0.9 }, { type: 'def', valCoefficient: 0.9 },
{ type: 'hp', valCoefficient: 1.2 }, { type: 'hp', valCoefficient: 1.2 },
], ]),
},
]; ];
export const bracersCategorys = [ export const bracersCategorys: Categorys[] = [
{ new Categorys('guoshi', 'bracers/裹尸布.png', [
name: 'guoshi',
icon: 'bracers/裹尸布.png',
entry: [
{ type: 'def', valCoefficient: 0.9 }, { type: 'def', valCoefficient: 0.9 },
{ type: 'hp', valCoefficient: 0.6 }, { type: 'hp', valCoefficient: 0.6 },
{ type: 'atk', valCoefficient: 0.5 }, { type: 'atk', valCoefficient: 0.5 },
], ]),
}, new Categorys('xiuyugu', 'bracers/绣与骨.png', [
{
name: 'xiuyugu',
icon: 'bracers/绣与骨.png',
entry: [
{ type: 'crit', valCoefficient: 1.1 }, { type: 'crit', valCoefficient: 1.1 },
{ type: 'hp', valCoefficient: 0.5 }, { type: 'hp', valCoefficient: 0.5 },
{ type: 'atk', valCoefficient: 0.6 }, { type: 'atk', valCoefficient: 0.6 },
], ]),
}, new Categorys('huoshen', 'bracers/火神腕.png', [
{
name: 'huoshen',
icon: 'bracers/火神腕.png',
entry: [
{ type: 'crit', valCoefficient: 1.1 }, { type: 'crit', valCoefficient: 1.1 },
{ type: 'hp', valCoefficient: 0.6 }, { type: 'hp', valCoefficient: 0.6 },
{ type: 'atk', valCoefficient: 0.5 }, { type: 'atk', valCoefficient: 0.5 },
], ]),
}, new Categorys('heishou', 'bracers/黑手.png', [
{
name: 'heishou',
icon: 'bracers/黑手.png',
entry: [
{ type: 'crit', valCoefficient: 0.75 }, { type: 'crit', valCoefficient: 0.75 },
{ type: 'critDmg', valCoefficient: 0.5 }, { type: 'critDmg', valCoefficient: 0.5 },
{ type: 'hp', valCoefficient: 0.5 }, { type: 'hp', valCoefficient: 0.5 },
], ]),
},
]; ];
export const initialbracers = () => { export const initialbracers = () => {
@ -113,69 +78,14 @@ export const initialbracers = () => {
export const createbracers = (quality, lv): Equip => { export const createbracers = (quality, lv): Equip => {
const type = 'bracers'; const type = 'bracers';
const qualityBean = new Quality(quality, coefficient[quality]); const qualityBean = new Quality(quality, coefficient[quality]);
const category = getCategory(quality); const category = getCategory(quality, bracersCategorys, bracersUniqueCategorys, bracersColorfulCategorys);
const base = createBase(quality, lv, category); const base = createBase(quality, lv, category, coefficient);
const extraEntry = new Array(); const extraEntry = new Array();
const extraEntryNum = extra_entry_num[quality]; const extraEntryNum = extra_entry_num[quality];
for (let i = 0; i < extraEntryNum; i++) { for (let i = 0; i < extraEntryNum; i++) {
extraEntry.push(bracersExtraEntry(quality, lv)); extraEntry.push(createExtraEntry(quality, lv, extraEntrys, coefficient));
}
return new Equip(type, lv, qualityBean, base, extraEntry);
};
export const bracersExtraEntry = (quality, lv) => {
const type = extraEntrys[Math.floor(Math.random() * extraEntrys.length)];
const initor = entry_initor[type];
const qualityCoefficient = coefficient[quality];
const entry = initor(lv, qualityCoefficient);
return entry;
};
const createBase = (quality, lv, category) => {
const entry = new Array();
category.entry.forEach((item) => {
const initor = entry_initor[item.type];
const qualityCoefficient = coefficient[quality];
entry.push(initor(lv, qualityCoefficient, item.valCoefficient));
});
return new EquipBase(category.name, category.icon, entry, category.skill);
};
const getCategory = (quality) => {
let categorys = bracersCategorys;
switch (quality) {
case qualitys[4]:
categorys = bracersUniqueCategorys;
break;
case qualitys[5]:
categorys = bracersColorfulCategorys;
break;
} }
return categorys[Math.floor(Math.random() * categorys.length)];
};
const bracersSample = (quality, category): Equip => {
const type = 'bracers';
const lv = 100;
const qualityBean = new Quality(quality, coefficient[quality]);
const base = createBase(quality, lv, category);
const extraEntry = new Array();
return new Equip(type, lv, qualityBean, base, extraEntry); return new Equip(type, lv, qualityBean, base, extraEntry);
}; };
const bracersSamples = { export const bracersSamples = createSamples(bracersCategorys, bracersUniqueCategorys, bracersColorfulCategorys, 'bracers', coefficient);
colorful: new Array(),
unique: new Array(),
epic: new Array(),
artifact: new Array(),
};
bracersColorfulCategorys.forEach((item) => {
bracersSamples.colorful.push(bracersSample('colorful', item));
});
bracersUniqueCategorys.forEach((item) => {
bracersSamples.unique.push(bracersSample('unique', item));
});
bracersCategorys.forEach((item) => {
bracersSamples.epic.push(bracersSample('epic', item));
bracersSamples.artifact.push(bracersSample('artifact', item));
});
export { bracersSamples };

219
src/config/equips/jewelry.ts

@ -1,153 +1,118 @@
import { Entry, Quality, EquipBase, Equip } from './bean'; import { getCategory, createExtraEntry, createBase, createSamples } from './base';
import { qualitys, entry_initor, extra_entry_num } from './constant'; import { Entry, Quality, EquipBase, Equip, Categorys } from './bean';
import { qualitys, extra_entry_num } from './constant';
const extraEntrys = ['atk', 'crit', 'critDmg', 'hp', 'def', 'dmgPercent']; const extraEntrys = ['atk', 'crit', 'critDmg', 'hp', 'def', 'dmgPercent'];
const coefficient = { shabby: 0.6, ordinary: 0.9, artifact: 1.3, epic: 1.6, unique: 1.8, colorful: 1.8 }; const coefficient = { shabby: 0.6, ordinary: 0.9, artifact: 1.3, epic: 1.6, unique: 1.8, colorful: 1.8 };
export const jewelryColorfulCategorys = [ export const jewelryColorfulCategorys: Categorys[] = [
{ new Categorys(
name: 'shuzhuang', 'shuzhuang',
icon: 'jewelry/梳妆镜.png', 'jewelry/梳妆镜.png',
entry: [ [
{ type: 'atk', valCoefficient: 1 }, { type: 'atk', valCoefficient: 1 },
{ type: 'hp', valCoefficient: 0.7 }, { type: 'hp', valCoefficient: 0.7 },
{ type: 'def', valCoefficient: 0.4 }, { type: 'def', valCoefficient: 0.4 },
], ],
skill: 'JHSY', 'JHSY'
}, ),
{ new Categorys(
name: 'liulipan', 'liulipan',
icon: 'jewelry/琉璃盘.png', 'jewelry/琉璃盘.png',
entry: [ [
{ type: 'atk', valCoefficient: 0.6 }, { type: 'atk', valCoefficient: 0.6 },
{ type: 'hp', valCoefficient: 1.5 }, { type: 'hp', valCoefficient: 1.5 },
], ],
skill: 'Liulipan', 'Liulipan'
}, ),
{ new Categorys(
name: 'ghdp', 'ghdp',
icon: 'jewelry/勾魂夺魂.png', 'jewelry/勾魂夺魂.png',
entry: [ [
{ type: 'critDmg', valCoefficient: 1 }, { type: 'critDmg', valCoefficient: 1 },
{ type: 'crit', valCoefficient: 0.4 }, { type: 'crit', valCoefficient: 0.4 },
{ type: 'atk', valCoefficient: 0.5 }, { type: 'atk', valCoefficient: 0.5 },
], ],
skill: 'CritFear', 'CritFear'
}, ),
{ new Categorys(
name: 'youerhuan', 'youerhuan',
icon: 'jewelry/白骨夫人的右耳环.png', 'jewelry/白骨夫人的右耳环.png',
entry: [ [
{ type: 'critDmg', valCoefficient: 1.5 }, { type: 'critDmg', valCoefficient: 1.5 },
{ type: 'atk', valCoefficient: 0.8 }, { type: 'atk', valCoefficient: 0.8 },
], ],
skill: 'Vampire1', 'Vampire1'
}, ),
{ new Categorys(
name: 'jingboyu', 'jingboyu',
icon: 'jewelry/金钵盂.png', 'jewelry/金钵盂.png',
entry: [ [
{ type: 'atk', valCoefficient: 0.8 }, { type: 'atk', valCoefficient: 0.8 },
{ type: 'hp', valCoefficient: 0.6 }, { type: 'hp', valCoefficient: 0.6 },
{ type: 'def', valCoefficient: 0.6 }, { type: 'def', valCoefficient: 0.6 },
], ],
skill: 'Prototype', 'Prototype'
}, ),
{ new Categorys(
name: 'zijingboyu', 'zijingboyu',
icon: 'jewelry/紫金钵盂.png', 'jewelry/紫金钵盂.png',
entry: [ [
{ type: 'atk', valCoefficient: 0.8 }, { type: 'atk', valCoefficient: 0.8 },
{ type: 'hp', valCoefficient: 0.6 }, { type: 'hp', valCoefficient: 0.6 },
{ type: 'def', valCoefficient: 0.6 }, { type: 'def', valCoefficient: 0.6 },
], ],
skill: 'Fate', 'Fate'
}, ),
]; ];
export const jewelryUniqueCategorys = [ export const jewelryUniqueCategorys: Categorys[] = [
{ new Categorys('hanjing', 'jewelry/寒晶佩.png', [
name: 'hanjing',
icon: 'jewelry/寒晶佩.png',
entry: [
{ type: 'atk', valCoefficient: 1 }, { type: 'atk', valCoefficient: 1 },
{ type: 'hp', valCoefficient: 0.8 }, { type: 'hp', valCoefficient: 0.8 },
{ type: 'def', valCoefficient: 0.9 }, { type: 'def', valCoefficient: 0.9 },
], ]),
}, new Categorys('ylhm', 'jewelry/月灵幻梦.png', [
{
name: 'ylhm',
icon: 'jewelry/月灵幻梦.png',
entry: [
{ type: 'critDmg', valCoefficient: 1.5 }, { type: 'critDmg', valCoefficient: 1.5 },
{ type: 'crit', valCoefficient: 0.5 }, { type: 'crit', valCoefficient: 0.5 },
{ type: 'atk', valCoefficient: 0.8 }, { type: 'atk', valCoefficient: 0.8 },
], ]),
}, new Categorys('liangren', 'jewelry/月灵良人幻梦.png', [
{
name: 'liangren',
icon: 'jewelry/良人.png',
entry: [
{ type: 'critDmg', valCoefficient: 1.2 }, { type: 'critDmg', valCoefficient: 1.2 },
{ type: 'dmgPercent', valCoefficient: 0.4 }, { type: 'dmgPercent', valCoefficient: 0.4 },
{ type: 'atk', valCoefficient: 0.7 }, { type: 'atk', valCoefficient: 0.7 },
], ]),
}, new Categorys('duzhan', 'jewelry/督战.png', [
{
name: 'duzhan',
icon: 'jewelry/督战.png',
entry: [
{ type: 'critDmg', valCoefficient: 1.6 }, { type: 'critDmg', valCoefficient: 1.6 },
{ type: 'atk', valCoefficient: 1.6 }, { type: 'atk', valCoefficient: 1.6 },
], ]),
}, new Categorys('cltx', 'jewelry/赤羚天禧.png', [
{
name: 'cltx',
icon: 'jewelry/赤羚天禧.png',
entry: [
{ type: 'dmgPercent', valCoefficient: 0.5 }, { type: 'dmgPercent', valCoefficient: 0.5 },
{ type: 'def', valCoefficient: 0.9 }, { type: 'def', valCoefficient: 0.9 },
{ type: 'hp', valCoefficient: 1.2 }, { type: 'hp', valCoefficient: 1.2 },
], ]),
},
]; ];
export const jewelryCategorys = [ export const jewelryCategorys: Categorys[] = [
{ new Categorys('weihun', 'jewelry/未婚.png', [
name: 'weihun',
icon: 'jewelry/未婚.png',
entry: [
{ type: 'def', valCoefficient: 0.9 }, { type: 'def', valCoefficient: 0.9 },
{ type: 'hp', valCoefficient: 0.6 }, { type: 'hp', valCoefficient: 0.6 },
{ type: 'atk', valCoefficient: 0.5 }, { type: 'atk', valCoefficient: 0.5 },
], ]),
}, new Categorys('huangyan', 'jewelry/谎言.png', [
{
name: 'huangyan',
icon: 'jewelry/谎言.png',
entry: [
{ type: 'crit', valCoefficient: 1.1 }, { type: 'crit', valCoefficient: 1.1 },
{ type: 'hp', valCoefficient: 0.5 }, { type: 'hp', valCoefficient: 0.5 },
{ type: 'atk', valCoefficient: 0.6 }, { type: 'atk', valCoefficient: 0.6 },
], ]),
}, new Categorys('zhenjing', 'jewelry/真经.png', [
{
name: 'zhenjing',
icon: 'jewelry/真经.png',
entry: [
{ type: 'crit', valCoefficient: 1.1 }, { type: 'crit', valCoefficient: 1.1 },
{ type: 'hp', valCoefficient: 0.6 }, { type: 'hp', valCoefficient: 0.6 },
{ type: 'atk', valCoefficient: 0.5 }, { type: 'atk', valCoefficient: 0.5 },
], ]),
}, new Categorys('maming', 'jewelry/马鸣玉佩.png', [
{
name: 'maming',
icon: 'jewelry/马鸣玉佩.png',
entry: [
{ type: 'crit', valCoefficient: 0.75 }, { type: 'crit', valCoefficient: 0.75 },
{ type: 'critDmg', valCoefficient: 0.5 }, { type: 'critDmg', valCoefficient: 0.5 },
{ type: 'hp', valCoefficient: 0.5 }, { type: 'hp', valCoefficient: 0.5 },
], ]),
},
]; ];
export const initialJewelry = () => { export const initialJewelry = () => {
@ -161,69 +126,13 @@ export const initialJewelry = () => {
export const createJewelry = (quality, lv): Equip => { export const createJewelry = (quality, lv): Equip => {
const type = 'jewelry'; const type = 'jewelry';
const qualityBean = new Quality(quality, coefficient[quality]); const qualityBean = new Quality(quality, coefficient[quality]);
const category = getCategory(quality); const category = getCategory(quality, jewelryCategorys, jewelryUniqueCategorys, jewelryColorfulCategorys);
const base = createBase(quality, lv, category); const base = createBase(quality, lv, category, coefficient);
const extraEntry = new Array(); const extraEntry = new Array();
const extraEntryNum = extra_entry_num[quality]; const extraEntryNum = extra_entry_num[quality];
for (let i = 0; i < extraEntryNum; i++) { for (let i = 0; i < extraEntryNum; i++) {
extraEntry.push(jewelryExtraEntry(quality, lv)); extraEntry.push(createExtraEntry(quality, lv, extraEntrys, coefficient));
} }
return new Equip(type, lv, qualityBean, base, extraEntry); return new Equip(type, lv, qualityBean, base, extraEntry);
}; };
export const jewelrySamples = createSamples(jewelryCategorys, jewelryUniqueCategorys, jewelryColorfulCategorys, 'jewelry', coefficient);
export const jewelryExtraEntry = (quality, lv) => {
const type = extraEntrys[Math.floor(Math.random() * extraEntrys.length)];
const initor = entry_initor[type];
const qualityCoefficient = coefficient[quality];
const entry = initor(lv, qualityCoefficient);
return entry;
};
const createBase = (quality, lv, category) => {
const entry = new Array();
category.entry.forEach((item) => {
const initor = entry_initor[item.type];
const qualityCoefficient = coefficient[quality];
entry.push(initor(lv, qualityCoefficient, item.valCoefficient));
});
return new EquipBase(category.name, category.icon, entry, category.skill);
};
const getCategory = (quality) => {
let categorys = jewelryCategorys;
switch (quality) {
case qualitys[4]:
categorys = jewelryUniqueCategorys;
break;
case qualitys[5]:
categorys = jewelryColorfulCategorys;
break;
}
return categorys[Math.floor(Math.random() * categorys.length)];
};
const jewelrySample = (quality, category): Equip => {
const type = 'jewelry';
const lv = 100;
const qualityBean = new Quality(quality, coefficient[quality]);
const base = createBase(quality, lv, category);
const extraEntry = new Array();
return new Equip(type, lv, qualityBean, base, extraEntry);
};
const jewelrySamples = {
colorful: new Array(),
unique: new Array(),
epic: new Array(),
artifact: new Array(),
};
jewelryColorfulCategorys.forEach((item) => {
jewelrySamples.colorful.push(jewelrySample('colorful', item));
});
jewelryUniqueCategorys.forEach((item) => {
jewelrySamples.unique.push(jewelrySample('unique', item));
});
jewelryCategorys.forEach((item) => {
jewelrySamples.epic.push(jewelrySample('epic', item));
jewelrySamples.artifact.push(jewelrySample('artifact', item));
});
export { jewelrySamples };

138
src/config/equips/neck.ts

@ -1,86 +1,55 @@
import { Entry, Quality, EquipBase, Equip } from './bean'; import { getCategory, createExtraEntry, createBase, createSamples } from './base';
import { qualitys, entry_initor, extra_entry_num } from './constant'; import { Entry, Quality, EquipBase, Equip, Categorys } from './bean';
import { qualitys, extra_entry_num } from './constant';
const extraEntrys = ['atk', 'crit', 'critDmg', 'hp', 'def', 'bloc']; const extraEntrys = ['atk', 'crit', 'critDmg', 'hp', 'def', 'bloc'];
const coefficient = { shabby: 0.6, ordinary: 0.9, artifact: 1.3, epic: 1.6, unique: 1.8, colorful: 1.8 }; const coefficient = { shabby: 0.6, ordinary: 0.9, artifact: 1.3, epic: 1.6, unique: 1.8, colorful: 1.8 };
export const neckColorfulCategorys = []; export const neckColorfulCategorys: Categorys[] = [];
export const neckUniqueCategorys = [ export const neckUniqueCategorys: Categorys[] = [
{ new Categorys('demonSlayer', 'U_neck01.png', [
name: 'demonSlayer',
icon: 'U_neck01.png',
entry: [
{ type: 'atk', valCoefficient: 1.0 }, { type: 'atk', valCoefficient: 1.0 },
{ type: 'hp', valCoefficient: 0.8 }, { type: 'hp', valCoefficient: 0.8 },
{ type: 'def', valCoefficient: 0.9 }, { type: 'def', valCoefficient: 0.9 },
], ]),
}, new Categorys('darkDragon', 'U_neck02.png', [
{
name: 'darkDragon',
icon: 'U_neck02.png',
entry: [
{ type: 'critDmg', valCoefficient: 1.5 }, { type: 'critDmg', valCoefficient: 1.5 },
{ type: 'crit', valCoefficient: 0.5 }, { type: 'crit', valCoefficient: 0.5 },
{ type: 'hp', valCoefficient: 0.8 }, { type: 'hp', valCoefficient: 0.8 },
], ]),
}, new Categorys('single', 'U_neck03.png', [
{
name: 'single',
icon: 'U_neck03.png',
entry: [
{ type: 'critDmg', valCoefficient: 1.5 }, { type: 'critDmg', valCoefficient: 1.5 },
{ type: 'bloc', valCoefficient: 0.7 }, { type: 'bloc', valCoefficient: 0.7 },
{ type: 'hp', valCoefficient: 0.7 }, { type: 'hp', valCoefficient: 0.7 },
], ]),
}, new Categorys('demons', 'U_neck04.png', [
{
name: 'demons',
icon: 'U_neck04.png',
entry: [
{ type: 'critDmg', valCoefficient: 1.6 }, { type: 'critDmg', valCoefficient: 1.6 },
{ type: 'atk', valCoefficient: 1.6 }, { type: 'atk', valCoefficient: 1.6 },
], ]),
}, new Categorys('ipaya', 'U_neck05.png', [
{
name: 'ipaya',
icon: 'U_neck05.png',
entry: [
{ type: 'bloc', valCoefficient: 0.9 }, { type: 'bloc', valCoefficient: 0.9 },
{ type: 'def', valCoefficient: 0.9 }, { type: 'def', valCoefficient: 0.9 },
{ type: 'hp', valCoefficient: 1.3 }, { type: 'hp', valCoefficient: 1.3 },
], ]),
},
]; ];
export const neckCategorys = [ export const neckCategorys: Categorys[] = [
{ new Categorys('crusade', 'Ac_1.png', [
name: 'crusade',
icon: 'Ac_1.png',
entry: [
{ type: 'def', valCoefficient: 0.9 }, { type: 'def', valCoefficient: 0.9 },
{ type: 'hp', valCoefficient: 0.5 }, { type: 'hp', valCoefficient: 0.5 },
{ type: 'bloc', valCoefficient: 0.6 }, { type: 'bloc', valCoefficient: 0.6 },
], ]),
}, new Categorys('gintamaEyes', 'Ac_5.png', [
{
name: 'gintamaEyes',
icon: 'Ac_5.png',
entry: [
{ type: 'crit', valCoefficient: 1.1 }, { type: 'crit', valCoefficient: 1.1 },
{ type: 'hp', valCoefficient: 0.5 }, { type: 'hp', valCoefficient: 0.5 },
{ type: 'atk', valCoefficient: 0.6 }, { type: 'atk', valCoefficient: 0.6 },
], ]),
}, new Categorys('iceDragon', 'Ac_7.png', [
{
name: 'iceDragon',
icon: 'Ac_7.png',
entry: [
{ type: 'crit', valCoefficient: 0.75 }, { type: 'crit', valCoefficient: 0.75 },
{ type: 'critDmg', valCoefficient: 0.5 }, { type: 'critDmg', valCoefficient: 0.5 },
{ type: 'hp', valCoefficient: 0.5 }, { type: 'hp', valCoefficient: 0.5 },
], ]),
},
]; ];
export const initialNeck = () => { export const initialNeck = () => {
@ -94,69 +63,14 @@ export const initialNeck = () => {
export const createNeck = (quality, lv) => { export const createNeck = (quality, lv) => {
const type = 'neck'; const type = 'neck';
const qualityBean = new Quality(quality, coefficient[quality]); const qualityBean = new Quality(quality, coefficient[quality]);
const category = getCategory(quality); const category = getCategory(quality, neckCategorys, neckUniqueCategorys, neckColorfulCategorys);
const base = createBase(quality, lv, category); const base = createBase(quality, lv, category, coefficient);
const extraEntry = new Array(); const extraEntry = new Array();
const extraEntryNum = extra_entry_num[quality]; const extraEntryNum = extra_entry_num[quality];
for (let i = 0; i < extraEntryNum; i++) { for (let i = 0; i < extraEntryNum; i++) {
extraEntry.push(neckExtraEntry(quality, lv)); extraEntry.push(createExtraEntry(quality, lv, extraEntrys, coefficient));
} }
return new Equip(type, lv, qualityBean, base, extraEntry); return new Equip(type, lv, qualityBean, base, extraEntry);
}; };
export const neckExtraEntry = (quality, lv) => { export const neckSamples = createSamples(neckCategorys, neckUniqueCategorys, neckColorfulCategorys, 'neck', coefficient);
const type = extraEntrys[Math.floor(Math.random() * extraEntrys.length)];
const initor = entry_initor[type];
const qualityCoefficient = coefficient[quality];
const entry = initor(lv, qualityCoefficient);
return entry;
};
const createBase = (quality, lv, category) => {
const entry = new Array();
category.entry.forEach((item) => {
const initor = entry_initor[item.type];
const qualityCoefficient = coefficient[quality];
entry.push(initor(lv, qualityCoefficient, item.valCoefficient));
});
return new EquipBase(category.name, category.icon, entry);
};
const getCategory = (quality) => {
let categorys = neckCategorys;
switch (quality) {
case qualitys[4]:
categorys = neckUniqueCategorys;
break;
case qualitys[5]:
categorys = neckColorfulCategorys;
break;
}
return categorys[Math.floor(Math.random() * categorys.length)];
};
const neckSample = (quality, category): Equip => {
const type = 'neck';
const lv = 100;
const qualityBean = new Quality(quality, coefficient[quality]);
const base = createBase(quality, lv, category);
const extraEntry = new Array();
return new Equip(type, lv, qualityBean, base, extraEntry);
};
const neckSamples = {
colorful: new Array(),
unique: new Array(),
epic: new Array(),
artifact: new Array(),
};
neckColorfulCategorys.forEach((item) => {
neckSamples.colorful.push(neckSample('colorful', item));
});
neckUniqueCategorys.forEach((item) => {
neckSamples.unique.push(neckSample('unique', item));
});
neckCategorys.forEach((item) => {
neckSamples.epic.push(neckSample('epic', item));
neckSamples.artifact.push(neckSample('artifact', item));
});
export { neckSamples };

138
src/config/equips/pants.ts

@ -1,82 +1,51 @@
import { Entry, Quality, EquipBase, Equip } from './bean'; import { getCategory, createExtraEntry, createBase, createSamples } from './base';
import { qualitys, entry_initor, extra_entry_num } from './constant'; import { Entry, Quality, EquipBase, Equip, Categorys } from './bean';
import { qualitys, extra_entry_num } from './constant';
const extraEntrys = ['atk', 'hp', 'def', 'defPercent', 'hpPercent', 'dmgReduc', 'critAvoid', 'critDmgReduc']; const extraEntrys = ['atk', 'hp', 'def', 'defPercent', 'hpPercent', 'dmgReduc', 'critAvoid', 'critDmgReduc'];
const coefficient = { shabby: 0.7, ordinary: 1, artifact: 1.5, epic: 1.8, unique: 2, colorful: 2 }; const coefficient = { shabby: 0.7, ordinary: 1, artifact: 1.5, epic: 1.8, unique: 2, colorful: 2 };
export const pantsColorfulCategorys = []; export const pantsColorfulCategorys: Categorys[] = [];
export const pantsUniqueCategorys = [ export const pantsUniqueCategorys: Categorys[] = [
{ new Categorys('mhlg', 'pants/梦回龙宫.png', [
name: 'mhlg',
icon: 'pants/梦回龙宫.png',
entry: [
{ type: 'def', valCoefficient: 2 }, { type: 'def', valCoefficient: 2 },
{ type: 'hp', valCoefficient: 2.8 }, { type: 'hp', valCoefficient: 2.8 },
], ]),
}, new Categorys('longlin', 'pants/龙鳞胫甲.png', [
{
name: 'longlin',
icon: 'pants/龙鳞胫甲.png',
entry: [
{ type: 'def', valCoefficient: 0.9 }, { type: 'def', valCoefficient: 0.9 },
{ type: 'critDmg', valCoefficient: 1.7 }, { type: 'critDmg', valCoefficient: 1.7 },
{ type: 'atk', valCoefficient: 1.7 }, { type: 'atk', valCoefficient: 1.7 },
], ]),
}, new Categorys('qiutu', 'pants/囚徒.png', [
{
name: 'qiutu',
icon: 'pants/囚徒.png',
entry: [
{ type: 'hp', valCoefficient: 2 }, { type: 'hp', valCoefficient: 2 },
{ type: 'atk', valCoefficient: 2 }, { type: 'atk', valCoefficient: 2 },
{ type: 'bloc', valCoefficient: 1.2 }, { type: 'bloc', valCoefficient: 1.2 },
], ]),
}, new Categorys('wuwei', 'pants/五味.png', [
{
name: 'wuwei',
icon: 'pants/五味.png',
entry: [
{ type: 'def', valCoefficient: 1.2 }, { type: 'def', valCoefficient: 1.2 },
{ type: 'hp', valCoefficient: 1.7 }, { type: 'hp', valCoefficient: 1.7 },
{ type: 'atk', valCoefficient: 1.0 }, { type: 'atk', valCoefficient: 1.0 },
], ]),
}, new Categorys('cangjing', 'pants/藏经甲.png', [
{
name: 'cangjing',
icon: 'pants/藏经甲.png',
entry: [
{ type: 'def', valCoefficient: 1.5 }, { type: 'def', valCoefficient: 1.5 },
{ type: 'bloc', valCoefficient: 1.2 }, { type: 'bloc', valCoefficient: 1.2 },
{ type: 'hp', valCoefficient: 1.4 }, { type: 'hp', valCoefficient: 1.4 },
], ]),
},
]; ];
export const pantsCategorys = [ export const pantsCategorys: Categorys[] = [
{ new Categorys('qijia', 'pants/泣甲.png', [
name: 'qijia',
icon: 'pants/泣甲.png',
entry: [
{ type: 'def', valCoefficient: 2 }, { type: 'def', valCoefficient: 2 },
{ type: 'hp', valCoefficient: 0.6 }, { type: 'hp', valCoefficient: 0.6 },
], ]),
}, new Categorys('guanjia', 'pants/管家服.png', [
{
name: 'guanjia',
icon: 'pants/管家服.png',
entry: [
{ type: 'def', valCoefficient: 0.8 }, { type: 'def', valCoefficient: 0.8 },
{ type: 'hp', valCoefficient: 1.8 }, { type: 'hp', valCoefficient: 1.8 },
], ]),
}, new Categorys('egui', 'pants/饿鬼.png', [
{
name: 'egui',
icon: 'pants/饿鬼.png',
entry: [
{ type: 'def', valCoefficient: 0.8 }, { type: 'def', valCoefficient: 0.8 },
{ type: 'hp', valCoefficient: 0.8 }, { type: 'hp', valCoefficient: 0.8 },
{ type: 'atk', valCoefficient: 0.8 }, { type: 'atk', valCoefficient: 0.8 },
], ]),
},
]; ];
export const initialpants = () => { export const initialpants = () => {
@ -90,69 +59,14 @@ export const initialpants = () => {
export const createpants = (quality, lv) => { export const createpants = (quality, lv) => {
const type = 'pants'; const type = 'pants';
const qualityBean = new Quality(quality, coefficient[quality]); const qualityBean = new Quality(quality, coefficient[quality]);
const category = getCategory(quality); const category = getCategory(quality, pantsCategorys, pantsUniqueCategorys, pantsColorfulCategorys);
const base = createBase(quality, lv, category); const base = createBase(quality, lv, category, coefficient);
const extraEntry = new Array(); const extraEntry = new Array();
const extraEntryNum = extra_entry_num[quality]; const extraEntryNum = extra_entry_num[quality];
for (let i = 0; i < extraEntryNum; i++) { for (let i = 0; i < extraEntryNum; i++) {
extraEntry.push(pantsExtraEntry(quality, lv)); extraEntry.push(createExtraEntry(quality, lv, extraEntrys, coefficient));
} }
return new Equip(type, lv, qualityBean, base, extraEntry); return new Equip(type, lv, qualityBean, base, extraEntry);
}; };
export const pantsExtraEntry = (quality, lv) => { export const pantsSamples = createSamples(pantsCategorys, pantsUniqueCategorys, pantsColorfulCategorys, 'pants', coefficient);
const type = extraEntrys[Math.floor(Math.random() * extraEntrys.length)];
const initor = entry_initor[type];
const qualityCoefficient = coefficient[quality];
const entry = initor(lv, qualityCoefficient);
return entry;
};
const createBase = (quality, lv, category) => {
const entry = new Array();
category.entry.forEach((item) => {
const initor = entry_initor[item.type];
const qualityCoefficient = coefficient[quality];
entry.push(initor(lv, qualityCoefficient, item.valCoefficient));
});
return new EquipBase(category.name, category.icon, entry);
};
const getCategory = (quality) => {
let categorys = pantsCategorys;
switch (quality) {
case qualitys[4]:
categorys = pantsUniqueCategorys;
break;
case qualitys[5]:
categorys = pantsColorfulCategorys;
break;
}
return categorys[Math.floor(Math.random() * categorys.length)];
};
const pantsSample = (quality, category): Equip => {
const type = 'pants';
const lv = 100;
const qualityBean = new Quality(quality, coefficient[quality]);
const base = createBase(quality, lv, category);
const extraEntry = new Array();
return new Equip(type, lv, qualityBean, base, extraEntry);
};
const pantsSamples = {
colorful: new Array(),
unique: new Array(),
epic: new Array(),
artifact: new Array(),
};
pantsColorfulCategorys.forEach((item) => {
pantsSamples.colorful.push(pantsSample('colorful', item));
});
pantsUniqueCategorys.forEach((item) => {
pantsSamples.unique.push(pantsSample('unique', item));
});
pantsCategorys.forEach((item) => {
pantsSamples.epic.push(pantsSample('epic', item));
pantsSamples.artifact.push(pantsSample('artifact', item));
});
export { pantsSamples };

134
src/config/equips/ring.ts

@ -1,80 +1,49 @@
import { Entry, Quality, EquipBase, Equip } from './bean'; import { getCategory, createExtraEntry, createBase, createSamples } from './base';
import { qualitys, entry_initor, extra_entry_num } from './constant'; import { Entry, Quality, EquipBase, Equip, Categorys } from './bean';
import { qualitys, extra_entry_num } from './constant';
const extraEntrys = ['atk', 'crit', 'critDmg', 'hp', 'def']; const extraEntrys = ['atk', 'crit', 'critDmg', 'hp', 'def'];
const coefficient = { shabby: 0.6, ordinary: 0.9, artifact: 1.3, epic: 1.6, unique: 1.8, colorful: 2 }; const coefficient = { shabby: 0.6, ordinary: 0.9, artifact: 1.3, epic: 1.6, unique: 1.8, colorful: 2 };
export const ringColorfulCategorys = []; export const ringColorfulCategorys: Categorys[] = [];
export const ringUniqueCategorys = [ export const ringUniqueCategorys: Categorys[] = [
{ new Categorys('death', 'U_ring01.png', [
name: 'death',
icon: 'U_ring01.png',
entry: [
{ type: 'crit', valCoefficient: 1 }, { type: 'crit', valCoefficient: 1 },
{ type: 'critDmg', valCoefficient: 0.5 }, { type: 'critDmg', valCoefficient: 0.5 },
{ type: 'hp', valCoefficient: 0.8 }, { type: 'hp', valCoefficient: 0.8 },
], ]),
}, new Categorys('realFurryRing', 'U_ring02.png', [
{
name: 'realFurryRing',
icon: 'U_ring02.png',
entry: [
{ type: 'critDmg', valCoefficient: 1.2 }, { type: 'critDmg', valCoefficient: 1.2 },
{ type: 'crit', valCoefficient: 0.5 }, { type: 'crit', valCoefficient: 0.5 },
{ type: 'atk', valCoefficient: 0.7 }, { type: 'atk', valCoefficient: 0.7 },
], ]),
}, new Categorys('pioneer', 'U_ring03.png', [
{
name: 'pioneer',
icon: 'U_ring03.png',
entry: [
{ type: 'critDmg', valCoefficient: 1 }, { type: 'critDmg', valCoefficient: 1 },
{ type: 'crit', valCoefficient: 0.5 }, { type: 'crit', valCoefficient: 0.5 },
{ type: 'hp', valCoefficient: 0.7 }, { type: 'hp', valCoefficient: 0.7 },
], ]),
}, new Categorys('susan', 'U_ring04.png', [
{
name: 'susan',
icon: 'U_ring04.png',
entry: [
{ type: 'critDmg', valCoefficient: 1.6 }, { type: 'critDmg', valCoefficient: 1.6 },
{ type: 'atk', valCoefficient: 1.1 }, { type: 'atk', valCoefficient: 1.1 },
], ]),
}, new Categorys('moonlight', 'U_ring05.png', [
{
name: 'moonlight',
icon: 'U_ring05.png',
entry: [
{ type: 'critDmg', valCoefficient: 1.5 }, { type: 'critDmg', valCoefficient: 1.5 },
{ type: 'hp', valCoefficient: 1.2 }, { type: 'hp', valCoefficient: 1.2 },
], ]),
},
]; ];
export const ringCategorys = [ export const ringCategorys = [
{ new Categorys('life', 'Ac_9.png', [{ type: 'hp', valCoefficient: 1.5 }]),
name: 'life', new Categorys('imperialSoul', 'Ac_10.png', [
icon: 'Ac_9.png',
entry: [{ type: 'hp', valCoefficient: 1.5 }],
},
{
name: 'imperialSoul',
icon: 'Ac_10.png',
entry: [
{ type: 'hp', valCoefficient: 1 }, { type: 'hp', valCoefficient: 1 },
{ type: 'atk', valCoefficient: 0.5 }, { type: 'atk', valCoefficient: 0.5 },
], ]),
}, new Categorys('furryRing', 'Ac_11.png', [
{
name: 'furryRing',
icon: 'Ac_11.png',
entry: [
{ type: 'hp', valCoefficient: 0.9 }, { type: 'hp', valCoefficient: 0.9 },
{ type: 'atk', valCoefficient: 0.3 }, { type: 'atk', valCoefficient: 0.3 },
{ type: 'crit', valCoefficient: 0.8 }, { type: 'crit', valCoefficient: 0.8 },
], ]),
},
]; ];
export const initialRing = () => { export const initialRing = () => {
@ -88,69 +57,14 @@ export const initialRing = () => {
export const createRing = (quality, lv) => { export const createRing = (quality, lv) => {
const type = 'ring'; const type = 'ring';
const qualityBean = new Quality(quality, coefficient[quality]); const qualityBean = new Quality(quality, coefficient[quality]);
const category = getCategory(quality); const category = getCategory(quality, ringCategorys, ringUniqueCategorys, ringColorfulCategorys);
const base = createBase(quality, lv, category); const base = createBase(quality, lv, category, coefficient);
const extraEntry = new Array(); const extraEntry = new Array();
const extraEntryNum = extra_entry_num[quality]; const extraEntryNum = extra_entry_num[quality];
for (let i = 0; i < extraEntryNum; i++) { for (let i = 0; i < extraEntryNum; i++) {
extraEntry.push(ringExtraEntry(quality, lv)); extraEntry.push(createExtraEntry(quality, lv, extraEntrys, coefficient));
} }
return new Equip(type, lv, qualityBean, base, extraEntry); return new Equip(type, lv, qualityBean, base, extraEntry);
}; };
export const ringExtraEntry = (quality, lv) => { export const ringSamples = createSamples(ringCategorys, ringUniqueCategorys, ringColorfulCategorys, 'ring', coefficient);
const type = extraEntrys[Math.floor(Math.random() * extraEntrys.length)];
const initor = entry_initor[type];
const qualityCoefficient = coefficient[quality];
const entry = initor(lv, qualityCoefficient);
return entry;
};
const createBase = (quality, lv, category) => {
const entry = new Array();
category.entry.forEach((item) => {
const initor = entry_initor[item.type];
const qualityCoefficient = coefficient[quality];
entry.push(initor(lv, qualityCoefficient, item.valCoefficient));
});
return new EquipBase(category.name, category.icon, entry);
};
const getCategory = (quality) => {
let categorys = ringCategorys;
switch (quality) {
case qualitys[4]:
categorys = ringUniqueCategorys;
break;
case qualitys[5]:
categorys = ringColorfulCategorys;
break;
}
return categorys[Math.floor(Math.random() * categorys.length)];
};
const ringSample = (quality, category): Equip => {
const type = 'ring';
const lv = 100;
const qualityBean = new Quality(quality, coefficient[quality]);
const base = createBase(quality, lv, category);
const extraEntry = new Array();
return new Equip(type, lv, qualityBean, base, extraEntry);
};
const ringSamples = {
colorful: new Array(),
unique: new Array(),
epic: new Array(),
artifact: new Array(),
};
ringColorfulCategorys.forEach((item) => {
ringSamples.colorful.push(ringSample('colorful', item));
});
ringUniqueCategorys.forEach((item) => {
ringSamples.unique.push(ringSample('unique', item));
});
ringCategorys.forEach((item) => {
ringSamples.epic.push(ringSample('epic', item));
ringSamples.artifact.push(ringSample('artifact', item));
});
export { ringSamples };

138
src/config/equips/shoes.ts

@ -1,82 +1,51 @@
import { Entry, Quality, EquipBase, Equip } from './bean'; import { getCategory, createExtraEntry, createBase, createSamples } from './base';
import { qualitys, entry_initor, extra_entry_num } from './constant'; import { Entry, Quality, EquipBase, Equip, Categorys } from './bean';
import { qualitys, extra_entry_num } from './constant';
const extraEntrys = ['atk', 'hp', 'def', 'moveSpeed', 'dmgReduc']; const extraEntrys = ['atk', 'hp', 'def', 'moveSpeed', 'dmgReduc'];
const coefficient = { shabby: 0.7, ordinary: 1, artifact: 1.3, epic: 1.5, unique: 1.8, colorful: 1.8 }; const coefficient = { shabby: 0.7, ordinary: 1, artifact: 1.3, epic: 1.5, unique: 1.8, colorful: 1.8 };
export const shoesColorfulCategorys = []; export const shoesColorfulCategorys: Categorys[] = [];
export const shoesUniqueCategorys = [ export const shoesUniqueCategorys: Categorys[] = [
{ new Categorys('qxzl', 'shoes/浅夏紫灵.png', [
name: 'qxzl',
icon: 'shoes/浅夏紫灵.png',
entry: [
{ type: 'moveSpeed', valCoefficient: 1.5 }, { type: 'moveSpeed', valCoefficient: 1.5 },
{ type: 'atk', valCoefficient: 1.2 }, { type: 'atk', valCoefficient: 1.2 },
{ type: 'hp', valCoefficient: 1.4 }, { type: 'hp', valCoefficient: 1.4 },
], ]),
}, new Categorys('xuedun', 'shoes/血遁靴.png', [
{
name: 'xuedun',
icon: 'shoes/血遁靴.png',
entry: [
{ type: 'moveSpeed', valCoefficient: 2.8 }, { type: 'moveSpeed', valCoefficient: 2.8 },
{ type: 'hp', valCoefficient: 1.2 }, { type: 'hp', valCoefficient: 1.2 },
], ]),
}, new Categorys('talang', 'shoes/踏浪.png', [
{
name: 'talang',
icon: 'shoes/踏浪.jpg',
entry: [
{ type: 'moveSpeed', valCoefficient: 1.8 }, { type: 'moveSpeed', valCoefficient: 1.8 },
{ type: 'hp', valCoefficient: 1 }, { type: 'hp', valCoefficient: 1 },
{ type: 'atk', valCoefficient: 1.2 }, { type: 'atk', valCoefficient: 1.2 },
], ]),
}, new Categorys('jiuwanli', 'shoes/九万里.png', [
{
name: 'jiuwanli',
icon: 'shoes/九万里.png',
entry: [
{ type: 'moveSpeed', valCoefficient: 1.9 }, { type: 'moveSpeed', valCoefficient: 1.9 },
{ type: 'def', valCoefficient: 1 }, { type: 'def', valCoefficient: 1 },
{ type: 'hp', valCoefficient: 1.2 }, { type: 'hp', valCoefficient: 1.2 },
], ]),
}, new Categorys('hongchen', 'shoes/红尘.png', [
{
name: 'hongchen',
icon: 'shoes/红尘.png',
entry: [
{ type: 'moveSpeed', valCoefficient: 1.2 }, { type: 'moveSpeed', valCoefficient: 1.2 },
{ type: 'def', valCoefficient: 1.5 }, { type: 'def', valCoefficient: 1.5 },
{ type: 'hp', valCoefficient: 1.4 }, { type: 'hp', valCoefficient: 1.4 },
], ]),
},
]; ];
export const shoesCategorys = [ export const shoesCategorys: Categorys[] = [
{ new Categorys('lingguan', 'shoes/灵官靴.png', [
name: 'lingguan',
icon: 'shoes/灵官靴.png',
entry: [
{ type: 'moveSpeed', valCoefficient: 0.8 }, { type: 'moveSpeed', valCoefficient: 0.8 },
{ type: 'def', valCoefficient: 1.8 }, { type: 'def', valCoefficient: 1.8 },
], ]),
}, new Categorys('quanchi', 'shoes/犬齿鞋.png', [
{
name: 'quanchi',
icon: 'shoes/犬齿鞋.png',
entry: [
{ type: 'moveSpeed', valCoefficient: 0.8 }, { type: 'moveSpeed', valCoefficient: 0.8 },
{ type: 'hp', valCoefficient: 1.8 }, { type: 'hp', valCoefficient: 1.8 },
], ]),
}, new Categorys('kunlun', 'shoes/昆仑履.png', [
{
name: 'kunlun',
icon: 'shoes/昆仑履.png',
entry: [
{ type: 'moveSpeed', valCoefficient: 0.8 }, { type: 'moveSpeed', valCoefficient: 0.8 },
{ type: 'def', valCoefficient: 0.8 }, { type: 'def', valCoefficient: 0.8 },
{ type: 'hp', valCoefficient: 0.8 }, { type: 'hp', valCoefficient: 0.8 },
], ]),
},
]; ];
export const initialshoes = () => { export const initialshoes = () => {
@ -90,69 +59,14 @@ export const initialshoes = () => {
export const createshoes = (quality, lv) => { export const createshoes = (quality, lv) => {
const type = 'shoes'; const type = 'shoes';
const qualityBean = new Quality(quality, coefficient[quality]); const qualityBean = new Quality(quality, coefficient[quality]);
const category = getCategory(quality); const category = getCategory(quality, shoesCategorys, shoesUniqueCategorys, shoesColorfulCategorys);
const base = createBase(quality, lv, category); const base = createBase(quality, lv, category, coefficient);
const extraEntry = new Array(); const extraEntry = new Array();
const extraEntryNum = extra_entry_num[quality]; const extraEntryNum = extra_entry_num[quality];
for (let i = 0; i < extraEntryNum; i++) { for (let i = 0; i < extraEntryNum; i++) {
extraEntry.push(shoesExtraEntry(quality, lv)); extraEntry.push(createExtraEntry(quality, lv, extraEntrys, coefficient));
} }
return new Equip(type, lv, qualityBean, base, extraEntry); return new Equip(type, lv, qualityBean, base, extraEntry);
}; };
export const shoesExtraEntry = (quality, lv) => { export const shoesSamples = createSamples(shoesCategorys, shoesUniqueCategorys, shoesColorfulCategorys, 'shoes', coefficient);
const type = extraEntrys[Math.floor(Math.random() * extraEntrys.length)];
const initor = entry_initor[type];
const qualityCoefficient = coefficient[quality];
const entry = initor(lv, qualityCoefficient);
return entry;
};
const createBase = (quality, lv, category) => {
const entry = new Array();
category.entry.forEach((item) => {
const initor = entry_initor[item.type];
const qualityCoefficient = coefficient[quality];
entry.push(initor(lv, qualityCoefficient, item.valCoefficient));
});
return new EquipBase(category.name, category.icon, entry);
};
const getCategory = (quality) => {
let categorys = shoesCategorys;
switch (quality) {
case qualitys[4]:
categorys = shoesUniqueCategorys;
break;
case qualitys[5]:
categorys = shoesColorfulCategorys;
break;
}
return categorys[Math.floor(Math.random() * categorys.length)];
};
const shoesSample = (quality, category): Equip => {
const type = 'shoes';
const lv = 100;
const qualityBean = new Quality(quality, coefficient[quality]);
const base = createBase(quality, lv, category);
const extraEntry = new Array();
return new Equip(type, lv, qualityBean, base, extraEntry);
};
const shoesSamples = {
colorful: new Array(),
unique: new Array(),
epic: new Array(),
artifact: new Array(),
};
shoesColorfulCategorys.forEach((item) => {
shoesSamples.colorful.push(shoesSample('colorful', item));
});
shoesUniqueCategorys.forEach((item) => {
shoesSamples.unique.push(shoesSample('unique', item));
});
shoesCategorys.forEach((item) => {
shoesSamples.epic.push(shoesSample('epic', item));
shoesSamples.artifact.push(shoesSample('artifact', item));
});
export { shoesSamples };

215
src/config/equips/weapon.ts

@ -1,157 +1,90 @@
import { Entry, Quality, EquipBase, Equip } from './bean'; import { getCategory, createExtraEntry, createBase, createSamples } from './base';
import { qualitys, entry_initor, extra_entry_num } from './constant'; import { Entry, Quality, EquipBase, Equip, Categorys } from './bean';
import { qualitys, extra_entry_num } from './constant';
const extraEntrys = ['atk', 'crit', 'critDmg', 'hp', 'def', 'atkPercent', 'defPercent', 'hpPercent', 'dmgPercent']; const extraEntrys = ['atk', 'crit', 'critDmg', 'hp', 'def', 'atkPercent', 'defPercent', 'hpPercent', 'dmgPercent'];
const coefficient = { shabby: 0.7, ordinary: 1, artifact: 1.5, epic: 1.8, unique: 2, colorful: 2 }; const coefficient = { shabby: 0.7, ordinary: 1, artifact: 1.5, epic: 1.8, unique: 2, colorful: 2 };
export const weaponColorfulCategorys = [ export const weaponColorfulCategorys: Categorys[] = [
{ new Categorys(
name: 'qiuai', 'qiuai',
icon: 'weapon/求爱.png', 'weapon/求爱.png',
entry: [ [
{ type: 'atk', valCoefficient: 1.8 }, { type: 'atk', valCoefficient: 1.8 },
{ type: 'crit', valCoefficient: 1.5 }, { type: 'crit', valCoefficient: 1.5 },
{ type: 'critDmg', valCoefficient: 1.3 }, { type: 'critDmg', valCoefficient: 1.3 },
], ],
skill: 'IceBlade,SeeRed', 'IceBlade,SeeRed'
}, ),
]; ];
export const weaponUniqueCategorys = [ export const weaponUniqueCategorys: Categorys[] = [
{ new Categorys('creation', 'U_Sword01.png', [
name: 'creation',
icon: 'U_Sword01.png',
entry: [
{ type: 'atk', valCoefficient: 1.8 }, { type: 'atk', valCoefficient: 1.8 },
{ type: 'crit', valCoefficient: 1.5 }, { type: 'crit', valCoefficient: 1.5 },
{ type: 'critDmg', valCoefficient: 1.3 }, { type: 'critDmg', valCoefficient: 1.3 },
], ]),
}, new Categorys('nameless', 'U_Sword02.png', [
{
name: 'nameless',
icon: 'U_Sword02.png',
entry: [
{ type: 'atk', valCoefficient: 2.7 }, { type: 'atk', valCoefficient: 2.7 },
{ type: 'crit', valCoefficient: 2.5 }, { type: 'crit', valCoefficient: 2.5 },
], ]),
}, new Categorys('scarlet', 'U_Sword03.png', [
{
name: 'scarlet',
icon: 'U_Sword03.png',
entry: [
{ type: 'atk', valCoefficient: 1.8 }, { type: 'atk', valCoefficient: 1.8 },
{ type: 'crit', valCoefficient: 1.5 }, { type: 'crit', valCoefficient: 1.5 },
{ type: 'critDmg', valCoefficient: 1.3 }, { type: 'critDmg', valCoefficient: 1.3 },
], ]),
}, new Categorys('death', 'U_Sword04.png', [
{
name: 'death',
icon: 'U_Sword04.png',
entry: [
{ type: 'atk', valCoefficient: 1.8 }, { type: 'atk', valCoefficient: 1.8 },
{ type: 'crit', valCoefficient: 1.5 }, { type: 'crit', valCoefficient: 1.5 },
{ type: 'critDmg', valCoefficient: 1.3 }, { type: 'critDmg', valCoefficient: 1.3 },
], ]),
}, new Categorys('frostDragon', 'U_Sword05.png', [
{
name: 'frostDragon',
icon: 'U_Sword05.png',
entry: [
{ type: 'atk', valCoefficient: 1.8 }, { type: 'atk', valCoefficient: 1.8 },
{ type: 'crit', valCoefficient: 1.5 }, { type: 'crit', valCoefficient: 1.5 },
{ type: 'critDmg', valCoefficient: 1.3 }, { type: 'critDmg', valCoefficient: 1.3 },
], ]),
}, new Categorys('dragon', 'U_Sword06.png', [
{
name: 'dragon',
icon: 'U_Sword06.png',
entry: [
{ type: 'atk', valCoefficient: 2.8 }, { type: 'atk', valCoefficient: 2.8 },
{ type: 'critDmg', valCoefficient: 2.2 }, { type: 'critDmg', valCoefficient: 2.2 },
], ]),
}, new Categorys('adventurer', 'U_Sword07.png', [
{
name: 'adventurer',
icon: 'U_Sword07.png',
entry: [
{ type: 'atk', valCoefficient: 2.4 }, { type: 'atk', valCoefficient: 2.4 },
{ type: 'hp', valCoefficient: 1.8 }, { type: 'hp', valCoefficient: 1.8 },
], ]),
}, new Categorys('seraphim', 'U_Sword08.png', [
{
name: 'seraphim',
icon: 'U_Sword08.png',
entry: [
{ type: 'atk', valCoefficient: 2.6 }, { type: 'atk', valCoefficient: 2.6 },
{ type: 'def', valCoefficient: 1.8 }, { type: 'def', valCoefficient: 1.8 },
], ]),
}, new Categorys('shuzhuwan', 'U_Sword09.png', [{ type: 'atk', valCoefficient: 3.9 }]),
{ new Categorys('leibse', 'U_Sword10.png', [
name: 'shuzhuwan',
icon: 'U_Sword09.png',
entry: [{ type: 'atk', valCoefficient: 3.9 }],
},
{
name: 'leibse',
icon: 'U_Sword10.png',
entry: [
{ type: 'atk', valCoefficient: 1.9 }, { type: 'atk', valCoefficient: 1.9 },
{ type: 'def', valCoefficient: 1.2 }, { type: 'def', valCoefficient: 1.2 },
{ type: 'bloc', valCoefficient: 0.4 }, { type: 'bloc', valCoefficient: 0.4 },
], ]),
},
]; ];
export const weaponCategorys = [ export const weaponCategorys: Categorys[] = [
{ new Categorys('hellrock', 'W_Sword016.png', [
name: 'hellrock',
icon: 'W_Sword016.png',
entry: [
{ type: 'atk', valCoefficient: 1.2 }, { type: 'atk', valCoefficient: 1.2 },
{ type: 'crit', valCoefficient: 1.3 }, { type: 'crit', valCoefficient: 1.3 },
], ]),
}, new Categorys('warrior', 'W_Sword007.png', [
{
name: 'warrior',
icon: 'W_Sword007.png',
entry: [
{ type: 'atk', valCoefficient: 1.2 }, { type: 'atk', valCoefficient: 1.2 },
{ type: 'def', valCoefficient: 0.5 }, { type: 'def', valCoefficient: 0.5 },
], ]),
}, new Categorys('redWillow', 'W_Sword019.png', [
{
name: 'redWillow',
icon: 'W_Sword019.png',
entry: [
{ type: 'atk', valCoefficient: 1.3 }, { type: 'atk', valCoefficient: 1.3 },
{ type: 'hp', valCoefficient: 1.1 }, { type: 'hp', valCoefficient: 1.1 },
], ]),
}, new Categorys('sword', 'W_Sword001.png', [{ type: 'atk', valCoefficient: 1.7 }]),
{ new Categorys('waveBlade', 'W_Sword021.png', [{ type: 'atk', valCoefficient: 1.7 }]),
name: 'sword', new Categorys('furryPaw', 'W_Fist003.png', [
icon: 'W_Sword001.png',
entry: [{ type: 'atk', valCoefficient: 1.7 }],
},
{
name: 'waveBlade',
icon: 'W_Sword021.png',
entry: [{ type: 'atk', valCoefficient: 1.7 }],
},
{
name: 'furryPaw',
icon: 'W_Fist003.png',
entry: [
{ type: 'atk', valCoefficient: 2 }, { type: 'atk', valCoefficient: 2 },
{ type: 'crit', valCoefficient: 0.7 }, { type: 'crit', valCoefficient: 0.7 },
], ]),
}, new Categorys('iceCrystals', 'W_Sword018.png', [
{
name: 'iceCrystals',
icon: 'W_Sword018.png',
entry: [
{ type: 'atk', valCoefficient: 1.4 }, { type: 'atk', valCoefficient: 1.4 },
{ type: 'critDmg', valCoefficient: 1.3 }, { type: 'critDmg', valCoefficient: 1.3 },
], ]),
},
]; ];
export const initialWeapon = () => { export const initialWeapon = () => {
@ -165,68 +98,14 @@ export const initialWeapon = () => {
export const createWeapon = (quality, lv) => { export const createWeapon = (quality, lv) => {
const type = 'weapon'; const type = 'weapon';
const qualityBean = new Quality(quality, coefficient[quality]); const qualityBean = new Quality(quality, coefficient[quality]);
const category = getCategory(quality); const category = getCategory(quality, weaponCategorys, weaponUniqueCategorys, weaponColorfulCategorys);
const base = createBase(quality, lv, category); const base = createBase(quality, lv, category, coefficient);
const extraEntry = new Array(); const extraEntry = new Array();
const extraEntryNum = extra_entry_num[quality]; const extraEntryNum = extra_entry_num[quality];
for (let i = 0; i < extraEntryNum; i++) { for (let i = 0; i < extraEntryNum; i++) {
extraEntry.push(weaponExtraEntry(quality, lv)); extraEntry.push(createExtraEntry(quality, lv, extraEntrys, coefficient));
} }
return new Equip(type, lv, qualityBean, base, extraEntry); return new Equip(type, lv, qualityBean, base, extraEntry);
}; };
export const weaponExtraEntry = (quality, lv) => { export const weaponSamples = createSamples(weaponCategorys, weaponUniqueCategorys, weaponColorfulCategorys, 'weapon', coefficient);
const type = extraEntrys[Math.floor(Math.random() * extraEntrys.length)];
const initor = entry_initor[type];
const qualityCoefficient = coefficient[quality];
const entry = initor(lv, qualityCoefficient);
return entry;
};
const createBase = (quality, lv, category) => {
const entry = new Array();
category.entry.forEach((item) => {
const initor = entry_initor[item.type];
const qualityCoefficient = coefficient[quality];
entry.push(initor(lv, qualityCoefficient, item.valCoefficient));
});
return new EquipBase(category.name, category.icon, entry, category.skill);
};
const getCategory = (quality) => {
let categorys = weaponCategorys;
switch (quality) {
case qualitys[4]:
categorys = weaponUniqueCategorys;
break;
case qualitys[5]:
categorys = weaponColorfulCategorys;
break;
}
return categorys[Math.floor(Math.random() * categorys.length)];
};
const weaponSample = (quality, category): Equip => {
const type = 'weapon';
const lv = 100;
const qualityBean = new Quality(quality, coefficient[quality]);
const base = createBase(quality, lv, category);
const extraEntry = new Array();
return new Equip(type, lv, qualityBean, base, extraEntry);
};
const weaponSamples = {
colorful: new Array(),
unique: new Array(),
epic: new Array(),
artifact: new Array(),
};
weaponColorfulCategorys.forEach((item) => {
weaponSamples.colorful.push(weaponSample('colorful', item));
});
weaponUniqueCategorys.forEach((item) => {
weaponSamples.unique.push(weaponSample('unique', item));
});
weaponCategorys.forEach((item) => {
weaponSamples.epic.push(weaponSample('epic', item));
weaponSamples.artifact.push(weaponSample('artifact', item));
});
export { weaponSamples };

Loading…
Cancel
Save