属性: 修改好感度添加方法

This commit is contained in:
luying
2021-02-24 11:36:28 +08:00
parent dd995e67eb
commit b14f751d92
9 changed files with 9754 additions and 111 deletions
@@ -4,7 +4,7 @@ import { HeroModel } from '../../../db/Hero';
import { resResult, decodeIdCntArrayStr, parseGoodStr, reduceCe } from '../../../pubUtils/util';
import {Application, BackendSession} from 'pinus';
import { handleCost } from '../../../services/rewardService';
import { getTitle, getTeraph, gameData, getScollByStar } from '../../../pubUtils/data';
import { getTitle, getTeraph, gameData, getScollByStar, getFriendLvByExp } from '../../../pubUtils/data';
import { SCHOOL, SCROLL } from '../../../pubUtils/dicParam';
import { getTeraphAttr, getAtrrNameById } from '../../../consts/constModules/abilityConst'
import { findIndex } from 'underscore';
@@ -119,6 +119,7 @@ export class RoleHandler {
}
if (!attrs.length)
return resResult(STATUS.ROLE_TERAPH_NOT_STRENGTHEN);
// 随机神像中的一条属性并检查道具是否足够
let {attr, consumes} = checkMaterialEnough(count, attrs, teraphInfo, teraph);
for (let key in attr) {
teraph[key] += attr[key];
@@ -311,19 +312,11 @@ export class RoleHandler {
update.scrollColorStar = 0;
// 获取一定好感度
let friendShipLevels = gameData.friendShipLevel;
if (friendShipLevels[friendShipLevels.length - 1].level > favourLv) {
let maxLv = gameData.maxFriendShipLv;
if (maxLv > favourLv) {
update.favour += SCROLL.SCROLL_ACTIVE_FAVOUR;
for (let friendShipLevel of friendShipLevels) {
if (friendShipLevel.level < update.favourLv)
continue;
if (friendShipLevel.exp > update.favour)
break;
update.favour -= friendShipLevel.exp;
update.favourLv++;
}
update.favourLv = getFriendLvByExp(update.favour);
}
} else {
if (star > scrollStar) { // 可以升星