体力:修改体力逻辑

This commit is contained in:
luying
2021-06-22 20:33:45 +08:00
parent 43dd3eb400
commit 2baa41ab63
14 changed files with 184 additions and 41 deletions
+3 -1
View File
@@ -32,6 +32,7 @@ export const CONSUME_TYPE = {
FRAME: 12, // 相框
SPINE: 13, // 形象
GIFT_PACKAGE: 14, // 礼包
AP: 15, // 回复体力道具
};
export enum ROLE_TERAPH {
@@ -142,7 +143,8 @@ const itid_array = [
{ id: 50, name: '形象', table: 'role', type: CONSUME_TYPE.HEAD },
{ id: 51, name: '相框', table: 'role', type: CONSUME_TYPE.FRAME },
{ id: 52, name: '玩家形象', table: 'role', type: CONSUME_TYPE.SPINE },
{ id: 55, name: '回复体力道具', table: 'item', type: CONSUME_TYPE.AP },
];
export const ITID = new Map<number, { id: number, name: string, table: string, type?: number, isCurrency?: boolean, equipJewel?: number }>();
@@ -48,3 +48,5 @@ export enum GUILD_SELECT {
export enum FRIEND_SHIP_SELECT {
GET_FRIEND_VALUE = 'friendValue friendLv'
}
export const ENTERY_ROLE_PICK = ['roleId', 'roleName', 'serverId', 'ce', 'topLineupCe', 'coin', 'lv', 'exp', 'vLv', 'gold', 'heros', 'equips', 'consumeGoods', 'title', 'teraphs', 'showLineup', 'heads', 'head', 'frames', 'frame', 'spines', 'spine', 'hasGuild', 'guildCode', 'todayZeroPoint', 'apJson'];
+2 -1
View File
@@ -448,7 +448,8 @@ export const FILENAME = {
DIC_GK_MJSD: 'dic_zyz_gk_activity_mjsd',
DIC_SERVER_NAME: 'dic_zyz_serverName',
DIC_SERVER_GROUP_NAME: 'dic_zyz_serverGropName',
DIC_GK_FES: 'dic_zyz_gk_activity_festival'
DIC_GK_FES: 'dic_zyz_gk_activity_festival',
DIC_AP: 'dic_zyz_ap'
}
export const WAR_RELATE_TABLES = [
+1
View File
@@ -219,6 +219,7 @@ export const STATUS = {
REWARD_CONDITION_NOT_REACH: { code: 30002, simStr: '未满足领取条件' },
REWARD_HAS_RECEIVED: { code: 30003, simStr: '奖励已领取' },
NOT_CONSUME_GOODS: { code: 30004, simStr: '非消耗品' },
AP_IS_FULL: { code: 30005, simStr: '满体力不可使用道具' },
// 武将养成通用 30100 - 30199
+12
View File
@@ -85,6 +85,7 @@ import { loadRMB, dicRMB } from './dictionary/DicRMB';
import { dicActivityType, loadActivityType } from './dictionary/DicActivityType';
import { dicTaskTypeDesc, loadTaskType } from './dictionary/DicTaskType';
import { dicServerName, dicServerGroupName, loadServerName } from "./dictionary/DicServerName";
import { dicAp, loadAp, dicApMaxLevel } from './dictionary/DicAp';
export const gameData = {
blurprtCompose: dicBlueprtCompose,
@@ -208,6 +209,8 @@ export const gameData = {
taskTypeDesc: dicTaskTypeDesc,
serverNames: dicServerName,
serverGroupNames: dicServerGroupName,
ap: dicAp,
apMaxLevel: dicApMaxLevel
};
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
@@ -701,6 +704,14 @@ export function getServerName(id: number) {
return name;
}
export function getDicApByLv(level: number) {
if(level > gameData.apMaxLevel.max) {
return gameData.ap.get(gameData.apMaxLevel.max);
} else {
return gameData.ap.get(level);
}
}
// 初始加载
function initDatas() {
parseDicParam();
@@ -799,6 +810,7 @@ function loadDatas() {
loadActivityType();
loadTaskType();
loadServerName();
loadAp();
}
// 重载dicParam
+36
View File
@@ -0,0 +1,36 @@
import { readFileAndParse } from '../util'
import { FILENAME } from '../../consts'
type KeysEnum<T> = { [P in keyof Required<T>]: true };
const _ = require('lodash');
export interface DicAp {
// 等级
readonly level: number;
// 体力上限
readonly maxAp: number;
// 升到这一级恢复的体力
readonly restoreAp: number;
// 多少秒恢复1点体力
readonly perApRestoreTime: number;
}
const DicApKeys: KeysEnum<DicAp> = {
level: true,
maxAp: true,
restoreAp: true,
perApRestoreTime: true,
};
export const dicApMaxLevel = { max: 0 };
export const dicAp = new Map<number, DicAp>();
export function loadAp() {
let arr = readFileAndParse(FILENAME.DIC_AP);
arr.forEach(o => {
o.maxAp = o.maxAP;
o.restoreAp = o.restoreAP;
o.perApRestoreTime = o.perAPRestoreTime;
dicAp.set(o.level, _.pick(o, Object.keys(DicApKeys)));
if(o.level > dicApMaxLevel.max) dicApMaxLevel.max = o.level;
});
arr = undefined;
}