属性:fix

This commit is contained in:
luying
2021-03-04 15:33:25 +08:00
parent 41f65eadd0
commit a0e87a9513
8 changed files with 83 additions and 70 deletions
@@ -81,9 +81,9 @@ export class HeroHandler {
let curHero = await HeroModel.createHero({
roleId, serverId, roleName, hid, hName, star, quality, job, skins:[{id: initialSkin, enable: true}]
});
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.INIT, sid, roleId, curHero, {});
let hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.INIT, sid, roleId, curHero, {});
await calAllHeroCe(HERO_SYSTEM_TYPE.ADD_SKIN, sid, roleId, {}, [initialSkin])
return resResult(STATUS.SUCCESS, {curHero: returnHeroCeRatio(curHero)});
return resResult(STATUS.SUCCESS, {curHero: returnHeroCeRatio(hero)});
}
// 武将升级
@@ -158,7 +158,6 @@ export class RoleHandler {
return resResult(STATUS.ROLE_TERAPH_NOT_QUILITY);
teraph.attr.set(attrId, 0);
console.log('****', attrId, val)
}
teraph.grade ++;
+1 -16
View File
@@ -127,7 +127,7 @@ export async function matchRobots(scale: number, myCe: number, robotCe: number,
const { attribute } = json;
let newAttribute = getRobotAttribute(attribute, myCe, robotCe, scale);
let ce = newAttribute.calCe();
let ce = newAttribute.calCelAndReduce();
enemyObj.enemies.push({...json, attribute: newAttribute, lv});
allCe += ce;
}
@@ -153,21 +153,6 @@ export async function getCEScaleAndRange(roleId: string, curDicExpedition: any)
return {scale, range, lv: role.lv}
}
// 远征表属性解码
export function decodeWarJsonAttribute(attribute: string) {
let arr = decodeStr('attribute', attribute);
// 初始化
let obj = {hp: 0, atk: 0, matk: 0, def: 0, mdef: 0, speed: 0, agi: 0, luk: 0, hit: 0, cri: 0, flee: 0, antCri: 0, damageIncrease: 0, damageDecrease: 0, defIngnore: 0, bloodSuck: 0}
for(let {id, value} of arr) {
let field = getAtrrNameById(id);
if(field) {
obj[field] = value;
}
}
return obj
}
// 远征累计点数获取
export async function getPointRewardStatus(roleId: string, role?: Role) {
if(!role) {
+5 -2
View File
@@ -14,6 +14,7 @@ import { RoleUpdate } from '../db/Role';
//修改并下发战力
export async function calPlayerCeAndSave(type: number, sid: string, roleId: string, originHero: HeroType, update: HeroUpdate, args?: Array<number>) {
let {role, pushHeros, topLineupCe, hero} = await pubCalPlayerCeAndSave(type, roleId, originHero, update, null, args);
console.log(JSON.stringify(pushHeros))
//下发战力
let uids = [{ uid: roleId, sid }];
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(role.ce) , heros: pushHeros, topLineupCe: reduceCe(topLineupCe) }), uids);
@@ -23,7 +24,9 @@ export async function calPlayerCeAndSave(type: number, sid: string, roleId: stri
export async function calAllHeroCe(type:number, sid: string, roleId: string, update: RoleUpdate, args?:Array<number>) {
let {role, ce, pushHeros, topLineupCe } = await reCalAllHeroCe(type, roleId, update, args);
let uids = [{ uid: roleId, sid }];
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(ce), heros: pushHeros, topLineupCe: reduceCe(topLineupCe) }), uids);
if(pushHeros.length > 0) {
let uids = [{ uid: roleId, sid }];
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(ce), heros: pushHeros, topLineupCe: reduceCe(topLineupCe) }), uids);
}
return role;
}
+1
View File
@@ -21,6 +21,7 @@ module.exports = {
"message Hero": {
'required uInt32 hid': 1,
'required uInt32 ce': 2,
'required uInt32 incHeroCe': 3,
},
'required uInt32 ce': 1,
'repeated Hero heros': 2,