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.
159 lines
4.5 KiB
159 lines
4.5 KiB
3 weeks ago
|
import { Entry, Quality, EquipBase, Equip } from './bean';
|
||
|
import { qualitys, entry_initor, extra_entry_num } from './constant';
|
||
|
|
||
|
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 };
|
||
|
export const shoesColorfulCategorys = [];
|
||
|
|
||
|
export const shoesUniqueCategorys = [
|
||
|
{
|
||
|
name: 'qxzl',
|
||
|
icon: 'shoes/浅夏紫灵.png',
|
||
|
entry: [
|
||
|
{ type: 'moveSpeed', valCoefficient: 1.5 },
|
||
|
{ type: 'atk', valCoefficient: 1.2 },
|
||
|
{ type: 'hp', valCoefficient: 1.4 },
|
||
|
],
|
||
|
},
|
||
|
{
|
||
|
name: 'xuedun',
|
||
|
icon: 'shoes/血遁靴.png',
|
||
|
entry: [
|
||
|
{ type: 'moveSpeed', valCoefficient: 2.8 },
|
||
|
{ type: 'hp', valCoefficient: 1.2 },
|
||
|
],
|
||
|
},
|
||
|
{
|
||
|
name: 'talang',
|
||
|
icon: 'shoes/踏浪.jpg',
|
||
|
entry: [
|
||
|
{ type: 'moveSpeed', valCoefficient: 1.8 },
|
||
|
{ type: 'hp', valCoefficient: 1 },
|
||
|
{ type: 'atk', valCoefficient: 1.2 },
|
||
|
],
|
||
|
},
|
||
|
{
|
||
|
name: 'jiuwanli',
|
||
|
icon: 'shoes/九万里.png',
|
||
|
entry: [
|
||
|
{ type: 'moveSpeed', valCoefficient: 1.9 },
|
||
|
{ type: 'def', valCoefficient: 1 },
|
||
|
{ type: 'hp', valCoefficient: 1.2 },
|
||
|
],
|
||
|
},
|
||
|
{
|
||
|
name: 'hongchen',
|
||
|
icon: 'shoes/红尘.png',
|
||
|
entry: [
|
||
|
{ type: 'moveSpeed', valCoefficient: 1.2 },
|
||
|
{ type: 'def', valCoefficient: 1.5 },
|
||
|
{ type: 'hp', valCoefficient: 1.4 },
|
||
|
],
|
||
|
},
|
||
|
];
|
||
|
export const shoesCategorys = [
|
||
|
{
|
||
|
name: 'lingguan',
|
||
|
icon: 'shoes/灵官靴.png',
|
||
|
entry: [
|
||
|
{ type: 'moveSpeed', valCoefficient: 0.8 },
|
||
|
{ type: 'def', valCoefficient: 1.8 },
|
||
|
],
|
||
|
},
|
||
|
{
|
||
|
name: 'quanchi',
|
||
|
icon: 'shoes/犬齿鞋.png',
|
||
|
entry: [
|
||
|
{ type: 'moveSpeed', valCoefficient: 0.8 },
|
||
|
{ type: 'hp', valCoefficient: 1.8 },
|
||
|
],
|
||
|
},
|
||
|
{
|
||
|
name: 'kunlun',
|
||
|
icon: 'shoes/昆仑履.png',
|
||
|
entry: [
|
||
|
{ type: 'moveSpeed', valCoefficient: 0.8 },
|
||
|
{ type: 'def', valCoefficient: 0.8 },
|
||
|
{ type: 'hp', valCoefficient: 0.8 },
|
||
|
],
|
||
|
},
|
||
|
];
|
||
|
|
||
|
export const initialshoes = () => {
|
||
|
const type = 'shoes';
|
||
|
const qualityBean = new Quality(qualitys[0], coefficient[qualitys[0]]);
|
||
|
const base = new EquipBase('initial', 'shoes/新手.png', [new Entry('moveSpeed', 10, '+10%', 10, 10)]);
|
||
|
const extraEntry = [new Entry('hp', 10, '+10', 10, 10)];
|
||
|
return new Equip(type, 1, qualityBean, base, extraEntry);
|
||
|
};
|
||
|
|
||
|
export const createshoes = (quality, lv) => {
|
||
|
const type = 'shoes';
|
||
|
const qualityBean = new Quality(quality, coefficient[quality]);
|
||
|
const category = getCategory(quality);
|
||
|
const base = createBase(quality, lv, category);
|
||
|
const extraEntry = new Array();
|
||
|
const extraEntryNum = extra_entry_num[quality];
|
||
|
for (let i = 0; i < extraEntryNum; i++) {
|
||
|
extraEntry.push(shoesExtraEntry(quality, lv));
|
||
|
}
|
||
|
return new Equip(type, lv, qualityBean, base, extraEntry);
|
||
|
};
|
||
|
|
||
|
export const shoesExtraEntry = (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);
|
||
|
};
|
||
|
|
||
|
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 };
|