Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix

This commit is contained in:
ciniao 2023-12-18 18:02:15 +08:00
commit af0225005a

View File

@ -1,10 +1,10 @@
import { ResGetList } from '../protocols/hero/PtlGetList';
import { player } from '../protocols/user/type';
import { EquipShared } from './equip';
import { PeijianShared } from './peijian';
import { PlayerShared } from './player';
import { PublicShared } from './public';
import { ShiwuShared } from './shiwu';
import {ResGetList} from '../protocols/hero/PtlGetList';
import {player} from '../protocols/user/type';
import {EquipShared} from './equip';
import {PeijianShared} from './peijian';
import {PlayerShared} from './player';
import {PublicShared} from './public';
import {ShiwuShared} from './shiwu';
export type otherBuff = Partial<player & {
allBuff: k_v<number>;
@ -23,6 +23,7 @@ export class HeroShared {
return allBuff;
}
/**
*
* @param hero
@ -30,7 +31,7 @@ export class HeroShared {
*/
static getHeroBasicAttr(hero: heroDataType, otherBuff: otherBuff = G.otherBuff, pos = 0) {
let jiban = 0;
let buff: k_v<any> = { skillArr: [] };
let buff: k_v<any> = {skillArr: []};
let heroConf = G.gc.hero[hero.heroId];
let heroLv = G.gc.herolv[heroConf.lvup];
let heroGrow = G.gc.herogrow[heroConf.jjup]?.[hero.jieji];
@ -39,7 +40,7 @@ export class HeroShared {
for (let k in heroLv.buff) {
let val = heroLv.buff[k];
if (typeof val == 'number') buff[k] = val;
else buff[k] = PublicShared.eval(val, { lv: hero.lv });
else buff[k] = PublicShared.eval(val, {lv: hero.lv});
// else buff[k] = Math.floor(new Function(`let lv=${hero.lv}; return ${val}`)());
}
@ -126,7 +127,7 @@ export class HeroShared {
PublicShared.mergeProperty(buff, PeijianShared.getAttr(p));
let conf = G.gc.peijian[p.peijianId];
if (conf.suit) {
if (!suitObj[conf.suit]) suitObj[conf.suit] = { num: 0, minLv: 0 };
if (!suitObj[conf.suit]) suitObj[conf.suit] = {num: 0, minLv: 0};
suitObj[conf.suit].num++;
if (!suitObj[conf.suit].minLv || p.lv < suitObj[conf.suit].minLv) suitObj[conf.suit].minLv = p.lv;
}
@ -172,7 +173,7 @@ export class HeroShared {
if (hero.qiannneg) {
for (let type in hero.qiannneg) {
// console.log(PublicShared.mergeProperty(buff, G.gc.hero_qianneng[type]?.[hero.qiannneg[type]].buff))
for(let i = 1; i <= hero.qiannneg[type]; i++) {
for (let i = 1; i <= hero.qiannneg[type]; i++) {
G.gc.hero_qianneng[type]?.[i] && PublicShared.mergeProperty(buff, G.gc.hero_qianneng[type]?.[i].buff);
}
}
@ -260,7 +261,7 @@ export class HeroShared {
if (otherBuff?.skills) {
for (let [id, lv] of Object.entries(otherBuff.skills)) {
if (lv && G.gc.xunlianjihua[id].use == 0) {
PublicShared.mergeProperty(buff, Object.fromEntries([G.gc.xunlianjihua[id].skill].map(k => [k, PublicShared.eval(G.gc.xunlianjihua[id].v[0], { slv: lv })])));
PublicShared.mergeProperty(buff, Object.fromEntries([G.gc.xunlianjihua[id].skill].map(k => [k, PublicShared.eval(G.gc.xunlianjihua[id].v[0], {slv: lv})])));
}
}
}
@ -286,6 +287,7 @@ export class HeroShared {
return buff;
};
/**修正属性 数值取整*/
static amendAttr(buff: k_v<number>) {
for (let k in buff) {
@ -294,6 +296,7 @@ export class HeroShared {
buff[k] = Math.floor(buff[k]);
}
}
/**
*
* @param hero
@ -303,6 +306,7 @@ export class HeroShared {
let buff = this.getHeroBasicAttr(hero, otherBuff, pos);
return this.computeHeroZhanLi(buff);
}
/**
*
*/
@ -313,6 +317,7 @@ export class HeroShared {
let def = buff.def || 0;
let hp = buff.hp || 0;
let speed = buff.speed || 0;
let speedpro = buff.speedpro || 0;
let hppro = buff.hppro || 0;
let dpspro = buff.dpspro || 0;
let undpspro = buff.undpspro || 0;
@ -329,11 +334,11 @@ export class HeroShared {
(maxdps * .75) +
(def * 1.03) +
(hp * 1) +
(speed * 21.28) +
(hp * hppro * .5) +
(speed * (speedpro + 1) * 21.28) +
((mindps + maxdps) / 2 * dpspro * .75) +
(hp * undpspro * .6) +
((mindps + maxdps) / 2 * xixuepro * 1) +
((mindps + maxdps) / 2 * xixuepro) +
((mindps + maxdps) / 2 * baoshangpro * .75) +
((mindps + maxdps) / 2 * shanbipro * .5) +
((mindps + maxdps) / 2 * mingzhongpro * .5) +
@ -341,6 +346,7 @@ export class HeroShared {
(hp * pvpdpsdrop * .5)
);
}
/**
*
* @param id id
@ -349,10 +355,11 @@ export class HeroShared {
static getHeroLvUpNeed(id: string | number, lv = 1): atn[] {
return [
{ a: 'item', t: '1', n: G.gc.herolvup[lv].expneed },
{ a: 'attr', t: 'jinbi', n: G.gc.herolvup[lv].jinbineed }
{a: 'item', t: '1', n: G.gc.herolvup[lv].expneed},
{a: 'attr', t: 'jinbi', n: G.gc.herolvup[lv].jinbineed}
];
}
/**
*
* @param id id