装备:淬火
This commit is contained in:
+40
-1
@@ -88,6 +88,9 @@ import { dicServerName, dicServerGroupName, loadServerName } from "./dictionary/
|
||||
import { dicAp, loadAp, dicApMaxLevel } from './dictionary/DicAp';
|
||||
import { dicApBuy, dicApMaxBuyTimes, loadApBuy } from "./dictionary/DicApBuy";
|
||||
import { dicTaskExp, loadTskExp} from './dictionary/DicTaskExp';
|
||||
import { dicQuench, loadQuench } from './dictionary/DicQuench';
|
||||
import { dicQuenchByQuality, dicQuenchByQualityAndGrade, loadQuenchQuality } from './dictionary/DicQuenchQuality';
|
||||
import { dicQuenchConsume, loadQuenchConsume } from './dictionary/DicQuenchConsume';
|
||||
|
||||
export const gameData = {
|
||||
blurprtCompose: dicBlueprtCompose,
|
||||
@@ -216,7 +219,11 @@ export const gameData = {
|
||||
apMaxLevel: dicApMaxLevel,
|
||||
apBuy: dicApBuy,
|
||||
apMaxBuyTimes: dicApMaxBuyTimes,
|
||||
taskExp: dicTaskExp
|
||||
taskExp: dicTaskExp,
|
||||
quench: dicQuench,
|
||||
quenchByQuality: dicQuenchByQuality,
|
||||
quenchByQualityAndGrade: dicQuenchByQualityAndGrade,
|
||||
quenchConsume: dicQuenchConsume
|
||||
};
|
||||
|
||||
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
||||
@@ -723,6 +730,34 @@ export function getDicSuitByTypeAndLv(suitType: number, starLevel: number) {
|
||||
return gameData.suitByTypeAndLv.get(`${suitType}_${starLevel}`);
|
||||
}
|
||||
|
||||
export function getQuenchGradeByValue(value: number) {
|
||||
let grade = 0;
|
||||
for(let [_grade, { singleRatioMin, singleRatioMax }] of gameData.quench) {
|
||||
if(value >= singleRatioMin && value < singleRatioMax ) {
|
||||
grade = _grade;
|
||||
}
|
||||
}
|
||||
return grade;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根绝品质和品相获得上下限,当grade为0,获取该品质下全阶的上下限
|
||||
* @param quality 品质
|
||||
* @param grade 品相
|
||||
* @returns {{ min: number, max: number }}
|
||||
*/
|
||||
export function getQuenchByQualityAndGrade(quality: number, grade: number) {
|
||||
if(grade == 0) { // 这个品质的上下限
|
||||
return gameData.quenchByQuality.get(quality);
|
||||
} else { // 该品质该品相的上下限
|
||||
return gameData.quenchByQualityAndGrade.get(`${quality}_${grade}`);
|
||||
}
|
||||
}
|
||||
|
||||
export function getQuenchConsume(lvLimited: number, quality: number) {
|
||||
return gameData.quenchConsume.get(`${lvLimited}_${quality}`);
|
||||
}
|
||||
|
||||
// 初始加载
|
||||
function initDatas() {
|
||||
parseDicParam();
|
||||
@@ -824,6 +859,10 @@ function loadDatas() {
|
||||
loadAp();
|
||||
loadApBuy();
|
||||
loadTskExp();
|
||||
loadQuench();
|
||||
loadQuenchQuality();
|
||||
loadQuenchConsume();
|
||||
|
||||
}
|
||||
|
||||
// 重载dicParam
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicQuench {
|
||||
// id
|
||||
readonly id: number;
|
||||
// 品相
|
||||
readonly grade: number;
|
||||
// 品相名
|
||||
readonly name: string;
|
||||
// 单属性最小值
|
||||
readonly singleRatioMin: number;
|
||||
// 单属性最大值
|
||||
readonly singleRatioMax: number;
|
||||
// 暴击效果,倍率
|
||||
readonly critEffect: number;
|
||||
// 暴击概率
|
||||
readonly critProbability: number;
|
||||
}
|
||||
|
||||
export const dicQuench = new Map<number, DicQuench>(); // id => dic
|
||||
export function loadQuench() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_QUENCH);
|
||||
|
||||
arr.forEach(o => {
|
||||
dicQuench.set(o.grade, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
export interface DicQuenchConsume {
|
||||
// id
|
||||
readonly id: number;
|
||||
// 等级
|
||||
readonly equipLvl: number;
|
||||
// 品质
|
||||
readonly quality: number;
|
||||
// 淬火一次的消耗
|
||||
readonly unitConsume: RewardInter[];
|
||||
}
|
||||
|
||||
export const dicQuenchConsume = new Map<string, RewardInter[]>(); // equipLvl&quality => dic
|
||||
export function loadQuenchConsume() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_QUENCH_CONSUME);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.unitConsume = parseGoodStr(o.unitconsume);
|
||||
dicQuenchConsume.set(`${o.equipLvl}_${o.quality}`, o.unitConsume);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicQuenchQuality {
|
||||
// id
|
||||
readonly id: number;
|
||||
// 装备品质
|
||||
readonly quality: number;
|
||||
// 品相
|
||||
readonly grade: number;
|
||||
// 单属性最小值
|
||||
readonly singleRatioMin: number;
|
||||
// 单属性最大值
|
||||
readonly singleRatioMax: number;
|
||||
// 初始是否可以随机出
|
||||
readonly initialAvailable: number;
|
||||
}
|
||||
|
||||
export const dicQuenchByQualityAndGrade = new Map<string, { min: number, max: number }>();
|
||||
export const dicQuenchByQuality = new Map<number, { min: number, max: number }>(); // quality => {}
|
||||
export function loadQuenchQuality() {
|
||||
dicQuenchByQuality.clear();
|
||||
dicQuenchByQualityAndGrade.clear();
|
||||
let arr = readFileAndParse(FILENAME.DIC_QUENCH_QUALITY);
|
||||
|
||||
arr.forEach(o => {
|
||||
if(o.initialAvailable == 1) {
|
||||
if(!dicQuenchByQuality.has(o.quality)) {
|
||||
dicQuenchByQuality.set(o.quality, { min: o.singleRatioMin, max: o.singleRatioMax });
|
||||
} else {
|
||||
if(o.singleRatioMin < dicQuenchByQuality.get(o.quality).min) {
|
||||
dicQuenchByQuality.get(o.quality).min = o.singleRatioMin;
|
||||
}
|
||||
if(o.singleRatioMax > dicQuenchByQuality.get(o.quality).max) {
|
||||
dicQuenchByQuality.get(o.quality).max = o.singleRatioMax;
|
||||
}
|
||||
}
|
||||
dicQuenchByQualityAndGrade.set(`${o.quality}_${o.grade}`, { min: o.singleRatioMin, max: o.singleRatioMax });
|
||||
}
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -9,12 +9,6 @@ export interface RewardInter {
|
||||
|
||||
export interface EquipInter {
|
||||
id: number;
|
||||
name: string;
|
||||
quality: number;
|
||||
suitId: number;
|
||||
hole: number;
|
||||
randomEffect: Array<number>;
|
||||
itid: number;
|
||||
hid?: number;
|
||||
times?: number;
|
||||
};
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
import { HeroModel, HeroType } from '../db/Hero';
|
||||
import { ItemModel } from '../db/Item';
|
||||
import { EquipModel, RandSe, Holes } from './../db/Equip';
|
||||
import { EquipModel, RandSe, Holes, RandMain } from './../db/Equip';
|
||||
import { BagInter, EquipInter } from './interface';
|
||||
import { gameData } from './data';
|
||||
import { gameData, getQuenchByQualityAndGrade, getQuenchGradeByValue } from './data';
|
||||
import { RANDOM_SE_COUNT, FIX_ATTRIBUTES_RAN, ITID, CURRENCY_BY_TYPE, CURRENCY_TYPE, ROLE_SELECT, FIGURE_UNLOCK_CONDITION, CONSUME_TYPE, HERO_SYSTEM_TYPE, TASK_TYPE } from '../consts';
|
||||
import { getRandValueByMinMax, getRandEelm } from './util';
|
||||
|
||||
@@ -55,9 +55,11 @@ export async function addBags(roleId: string, roleName: string, data: BagInter)
|
||||
}
|
||||
|
||||
export async function addEquips(roleId: string, roleName: string, weapon: EquipInter) {
|
||||
let { id, name, quality, suitId, hole, randomEffect, itid, hid } = weapon;
|
||||
let { id, hid = 0 } = weapon;
|
||||
let { name, quality, suitId, hole, randomEffect, itid, goodsAbility } = gameData.goods.get(id);
|
||||
let { type } = ITID.get(itid);
|
||||
|
||||
// 随机属性
|
||||
let randomNum = RANDOM_SE_COUNT.get(quality);
|
||||
let randomResult: number[] = getRandEelm(randomEffect, randomNum);
|
||||
|
||||
@@ -73,14 +75,30 @@ export async function addEquips(roleId: string, roleName: string, weapon: EquipI
|
||||
};
|
||||
});
|
||||
|
||||
let randRange = getRandValueByMinMax(0 - FIX_ATTRIBUTES_RAN, FIX_ATTRIBUTES_RAN, 0);
|
||||
let randRange = 0;
|
||||
|
||||
// 淬火品相
|
||||
let randMain: RandMain[] = [];
|
||||
let grade = 0;
|
||||
for(let [ attrId, attrValue ] of goodsAbility) {
|
||||
if(attrValue > 0) {
|
||||
let { min, max } = getQuenchByQualityAndGrade(quality, grade);
|
||||
let rand = getRandValueByMinMax(min, max, 0);
|
||||
grade = getQuenchGradeByValue(rand);
|
||||
randMain.push({
|
||||
id: attrId,
|
||||
rand
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let holes = new Array<Holes>();
|
||||
for (let i = 0; i < hole; i++) {
|
||||
holes.push({ id: i + 1, isOpen: false, jewel: 0 })
|
||||
holes.push({ id: i + 1, isOpen: false, jewel: 0 });
|
||||
}
|
||||
|
||||
const equip = await EquipModel.createEquip({ roleId, roleName, id, name, quality, suitId, randRange, ePlaceId: type, randSe, holes, hid });
|
||||
const equip = await EquipModel.createEquip({ roleId, roleName, id, name, quality, suitId, randRange, ePlaceId: type, randSe, holes, hid, grade, randMain });
|
||||
|
||||
// 任务
|
||||
let pushMessage = await checkTaskWithEquip(roleId, TASK_TYPE.EQUIP_SUIT, equip);
|
||||
|
||||
@@ -695,11 +695,8 @@ export function calEquipSeids(hero: HeroType) {
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('################')
|
||||
console.log('#####1', JSON.stringify([...suits]));
|
||||
|
||||
for(let [ _suitType, map ] of suits) {
|
||||
console.log('#####2', _suitType, JSON.stringify([...map]));
|
||||
let effectSeid = new Map<number, { starLevel: number, seid: number }>(); // count => { starLevel, seid }
|
||||
for(let [ starLevel, { dic: { effect }, count } ] of map) {
|
||||
for(let { count: effectCount, seid} of effect) {
|
||||
@@ -713,7 +710,6 @@ export function calEquipSeids(hero: HeroType) {
|
||||
for(let [_count, { seid }] of effectSeid) {
|
||||
seids.push(seid, 0);
|
||||
}
|
||||
console.log('#####3', _suitType, JSON.stringify([...effectSeid]));
|
||||
}
|
||||
return seids;
|
||||
}
|
||||
@@ -750,6 +746,10 @@ export function calHeroEquipIncAttr(hero: HeroType) {
|
||||
}
|
||||
}
|
||||
|
||||
let randMainMap = new Map<number, number>();
|
||||
for(let {id, rand} of (e.randMain||[])) {
|
||||
randMainMap.set(id, rand);
|
||||
}
|
||||
for (let i = ABI_TYPE.ABI_HP; i < ABI_TYPE.ABI_MAX; i++) {
|
||||
// console.log('***', i);
|
||||
let value1 = goodsAbility.get(i) || 0 * (HERO_CE_RATIO + e.randRange);
|
||||
@@ -757,17 +757,19 @@ export function calHeroEquipIncAttr(hero: HeroType) {
|
||||
let valueup = goodsAbilityUp.get(i) || 0;
|
||||
// console.log('成长', lv, valueup);
|
||||
let valueRefine = dicRefine ? dicRefine.upPercent : 0;
|
||||
// console.log('refine', dicRefine?dicRefine.upPercent:0 );
|
||||
// console.log('精炼', dicRefine?dicRefine.upPercent:0 );
|
||||
let valueJewel = jewel.get(i) || 0;
|
||||
// console.log('jewel', valueJewel);
|
||||
let attr = (value1 + lv * valueup) * (HERO_CE_RATIO + valueRefine) + valueJewel * HERO_CE_RATIO;
|
||||
// console.log('宝石', valueJewel);
|
||||
let valueGrade = randMainMap.get(i)||0;
|
||||
// console.log('品相', valueGrade)
|
||||
let attr = (value1 + lv * valueup) * valueGrade * (HERO_CE_RATIO + valueRefine) + valueJewel * HERO_CE_RATIO * HERO_CE_RATIO;
|
||||
|
||||
if(attr >= 0) {
|
||||
// console.log('装备战力:', i, attr);
|
||||
if(setMap.has(i)) {
|
||||
setMap.set(i, setMap.get(i) + attr);
|
||||
setMap.set(i, setMap.get(i) + Math.floor(attr / HERO_CE_RATIO));
|
||||
} else {
|
||||
setMap.set(i, attr);
|
||||
setMap.set(i, Math.floor(attr / HERO_CE_RATIO));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user