武将战力更新,更新表json

This commit is contained in:
mamengke01
2020-12-12 17:40:03 +08:00
parent 4158799327
commit 9bf50e2d14
12 changed files with 1888 additions and 51 deletions

View File

@@ -346,7 +346,7 @@ export class HeroHandler {
continue;
let member = await HeroModel.findByHidAndRole(hid, roleId, false);
if (!member)
return resResult(STATUS.HERO_NOT_FIND);
return resResult(STATUS.ROLE_SHORT_HERO_CONECTION);
if (member.star < friendShip.level)
return resResult(STATUS.NOT_REACH_UNLOCK_LEVEL);
}

View File

@@ -5,7 +5,8 @@ import { PvpDefenseModel } from '../db/PvpDefense';
import { getWarJsons, getGamedata, getExpeditionById } from '../pubUtils/gamedata';
import { decodeStr, resResult, setLocalHours, shouldRefresh } from '../pubUtils/util';
import { WAR_JSON_ATTRIBUTE_TYPE, EXPEDITION_CONST } from '../consts/consts';
import { EXPEDITION_CONST } from '../consts/consts';
import { getAtrrNameById} from '../consts/abilityConst';
import Actor from '../pubUtils/actor';
import { ExpeditionWarRecordModel } from '../db/ExpeditionWarRecord';
@@ -143,7 +144,7 @@ export function decodeWarJsonAttribute(attribute: string) {
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 = WAR_JSON_ATTRIBUTE_TYPE[id];
let field = getAtrrNameById(id);
if(field) {
obj[field] = value;
}

View File

@@ -2,22 +2,22 @@
* 体力系统
*/
import { HERO_SYSTEM_TYPE, WAR_JSON_ATTRIBUTE_TYPE } from '../consts/consts';
import { HERO_SYSTEM_TYPE } from '../consts/consts';
import { pinus } from 'pinus';
import { STATUS } from '../consts/statusCode';
import { resResult } from '../pubUtils/util';
import Hero from '../db/Hero';
import { RoleModel } from '../db/Role';
import { getJobInfoById, getJobByGradeAndClass, getHeroInfoById, getHeroStar, getHeroWake } from '../pubUtils/gamedata';
import { HEROTARIN, CE_RATIO, ABI_TYPE_TO_STAGE, ABI_STAGE} from '../consts/abilityConst';
import { CeAttrData, CeAttr } from '../db/BaseModel';
import { getJobInfoById, getJobByGradeAndClass, getHeroInfoById, getHeroStar, getHeroWake, getFiendShipLevel, getFriendShipById } from '../pubUtils/gamedata';
import { getAttrNameByJobStage, getAttrCeRatio, getAtrrNameById, ABI_TYPE_TO_STAGE, ABI_STAGE} from '../consts/abilityConst';
const HERO_CE_RATIO = 100;
//战力计算TODO
export function calPlayerCe(hero: any, type: number, args: Array<number>) {
let incCe = 0;
let incArr = {};
let reIncAttr; // {"hp": {"base": number, "fixUp": number, "ratioUp": number}}
let reIncAttr = {}; // {"hp": {"base": number, "fixUp": number, "ratioUp": number}}
let addSeidList = new Array<number>();
let removeSeidList = new Array<number>();
@@ -40,7 +40,7 @@ export function calPlayerCe(hero: any, type: number, args: Array<number>) {
hero.ceAttr[attrName][attrKey] = parseInt(reIncAttr[attrName][attrKey]);
}
incArr[attrName] = reIncAttr[attrName].fixUp * HERO_CE_RATIO + reIncAttr[attrName].base *(HERO_CE_RATIO + reIncAttr[attrName].ratioUp) - oldCe; //计算属性
incCe += incArr[attrName] * CE_RATIO[attrName];
incCe += incArr[attrName] * getAttrCeRatio[attrName];
}
hero.ce += incCe;
return incCe;
@@ -106,8 +106,8 @@ export function calHeroStarIncAttr (hero: Hero, addSeidList: Array<number>, remo
let starUp = dicStar.ceAttr.get(stage);
let newBase = heroAttr + hero.lv * (heroUpAttr + starUp);
let field = WAR_JSON_ATTRIBUTE_TYPE[targetAttrId];
let ceAttrData: CeAttrData = ceAttr[field]||new CeAttrData(); // 存表中的属性下的basefixupratioup
let field = getAtrrNameById(targetAttrId);
let ceAttrData: CeAttrData = ceAttr[field]; // 存表中的属性下的basefixupratioup
let {ratioUp = 0, fixUp = 0} = ceAttrData;
res[field] = { base: newBase, ratioUp, fixUp}; // base变动增量为△base * ratio + 0
}
@@ -117,8 +117,8 @@ export function calHeroStarIncAttr (hero: Hero, addSeidList: Array<number>, remo
export function calHeroTrainIncAttr(hero: any) {
let res = {};
let attrName: string = HEROTARIN[hero.jobStage];
res[attrName] ={fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp};
let attrName: string = getAttrNameByJobStage[hero.jobStage];
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp};
let currentJob = getJobInfoById(hero.job);
if (currentJob.grade > 1) {
let jobGradeAndClass = getJobByGradeAndClass(currentJob.job_class, currentJob.grade - 1);
@@ -130,6 +130,28 @@ export function calHeroTrainIncAttr(hero: any) {
return res;
}
export function calHeroJobStageUpIncAttr(hero: any) {
let res = {};
return res;
}
export function calWaerHeroSkinIncAttr(hero: any) {
let res = {};
let friendShipLevel = getFiendShipLevel(hero.favourLv);
hero.conections.forEach(element => {
let reFriendShip = getFriendShipById(element.shipId, element.level);
if (reFriendShip)
getAtrrNameById(reFriendShip);
});
if (hero.favourLv > 1) {
} else {
}
return res;
}
// 根据存在升星表等的stage字段的id对应17维id
function getFieldByStage(stage: number, jobid: number) {
let targetAttrId = ABI_TYPE_TO_STAGE.get(stage);

View File

@@ -66,19 +66,21 @@ export enum ABI_STAGE {
END = 6
}
export const ATTR = {}
//武将训练等级
export const HEROTARIN = {
"1": "hp",
"2": "atk",
"3": "def",
"4": "mdef",
"5": "agi",
"6": "luk"
1: "hp",
2: "atk",
3: "def",
4: "mdef",
5: "agi",
6: "luk"
};
//战力系数
export const CE_RATIO = {
"hp" : 1,
"atk" : 2,
"matk" :2,
"matk": 2,
"def": 2,
"mdef": 2,
"agi": 2,
@@ -93,11 +95,43 @@ export const CE_RATIO = {
"bloodSuck": 0,
};
export const ABI_TYPE_TO_STAGE = new Map<number, number | ((jobType: number) => number)>([
export const HERO_ATTR = {
1: "hp", // 生命
2: "atk", // 物攻
3: "matk", // 策攻
4: "def", // 物防
5: "mdef", // 测防
6: "agi", // 敏捷
7: "luk", // 幸运
8: "speed", // 移动
9: "hit", // 命中等级
10: "cri", // 暴击等级
11: "flee", // 格挡等级
12: "antCri", // 抗暴等级
13: "damageIncrease", // 伤害加深等级
14: "damageDecrease", // 伤害减免等级
15: "defIngnore", // 忽视防御等级
16: "bloodSuck", // 吸血等级
17: "ap" // 怒气
};
export const ABI_TYPE_TO_STAGE = new Map<number, number | ((jobType: number) => number)>([
[ABI_STAGE.HP, ABI_TYPE.ABI_HP],
[ABI_STAGE.ATK, (jobType:number) => { return jobType == JOB_TYPE.PHYSIC?ABI_TYPE.ABI_ATK: ABI_TYPE.ABI_MATK}],
[ABI_STAGE.DEF, ABI_TYPE.ABI_DEF],
[ABI_STAGE.MDEF, ABI_TYPE.ABI_MDEF],
[ABI_STAGE.AGI, ABI_TYPE.ABI_AGI],
[ABI_STAGE.LUK, ABI_TYPE.ABI_LUK]
]);
]);
export function getAtrrNameById(attrId: number) {
return HERO_ATTR[attrId];
};
export function getAttrCeRatio(attr: string) {
return CE_RATIO[attr];
};
export function getAttrNameByJobStage(jobStage: number) {
return HEROTARIN[jobStage];
};

View File

@@ -226,26 +226,6 @@ export const EXPEDITION_CONST = {
RESET_CNT: 1 // 可以免费重置的次数
}
export const WAR_JSON_ATTRIBUTE_TYPE = {
"1": "hp", // 生命
"2": "atk", // 物攻
"3": "matk", // 策攻
"4": "def", // 物防
"5": "mdef", // 测防
"6": "agi", // 敏捷
"7": "luk", // 幸运
"8": "speed", // 移动
"9": "hit", // 命中等级
"10": "cri", // 暴击等级
"11": "flee", // 格挡等级
"12": "antCri", // 抗暴等级
"13": "damageIncrease", // 伤害加深等级
"14": "damageDecrease", // 伤害减免等级
"15": "defIngnore", // 忽视防御等级
"16": "bloodSuck", // 吸血等级
"17": "ap" // 怒气
};
export const EVENT_QUIZ_NUM = 3;
export const DEFAULT_HEROES = [ 12, 14, 11, 9, 15];

View File

@@ -138,9 +138,10 @@ export const STATUS = {
NOT_REACH_UNLOCK_LEVEL: {code: 30302, simStr: '未达到解锁等级'},
HERO_SKIN_NOT_FIND: {code: 30303, simStr: '时装不存在'},
HERO_SKIN_IS_EXIST: {code: 30304, simStr: '时装已存在'},
HERO_CONECTION_IS_MAX_LEVEL: {code: 30305, simStr: '羁绊已达到最大等级'},
HERO_CONECTION_IS_NOT_EXIT: {code: 30305, simStr: '羁绊不存在'},
HERO_FAVOUR_LEVEL_REACH_MAXT:{code: 30304, simStr: '武将好感等级以达到最大'},
HERO_CONECTION_IS_MAX_LEVEL: {code: 30306, simStr: '羁绊已达到最大等级'},
HERO_CONECTION_IS_NOT_EXIT: {code: 30307, simStr: '羁绊不存在'},
ROLE_SHORT_HERO_CONECTION:{code: 30308, simStr: '未拥有羁绊武将'},
HERO_FAVOUR_LEVEL_REACH_MAXT:{code: 30308, simStr: '武将好感等级以达到最大'},
// 社交相关状态 40000 - 49999
// 运营模块相关状态 50000 - 59999
// GM后台相关状态 60000 - 69999

View File

@@ -1,6 +1,6 @@
import { getHeroInfoById, getStarRatio, getHeroSkillById, getSeidById, getOlySeidByType, getGoodById } from "./gamedata";
import { ABI_TYPE, SEID_TYPE } from "../consts/abilityConst";
import { WAR_JSON_ATTRIBUTE_TYPE, EXPRESSION } from '../consts/consts';
import { getAtrrNameById, ABI_TYPE, SEID_TYPE } from "../consts/abilityConst";
import { EXPRESSION } from '../consts/consts';
export default class Actor {
private hid: number = 0;
@@ -260,7 +260,7 @@ export default class Actor {
let json = {hp: 0, atk: 0, matk: 0, def: 0, mdef: 0, agi: 0, speed: 0, luk: 0, hit: 0, cri: 0, flee: 0, antCri: 0, damageIncrease: 0, damageDecrease: 0, defIngnore: 0, bloodSuck: 0};
for(let i = ABI_TYPE.ABI_HP;i < ABI_TYPE.ABI_MAX;i++){
let field = WAR_JSON_ATTRIBUTE_TYPE[i];
let field = getAtrrNameById(i);
json[field] = this.getRealAbility(i);
}
return json

View File

@@ -30,7 +30,7 @@ const blueprtCompose = new Map<number, any>();
const fiendShips = new Map<string, any>();
const fashions = new Map<number, any>();
const fiendShipHidAandIds = new Map<number, {actorId: number, level:number}>();
const fiendShipLevelMaps = new Map<number, any>();
interface dicStar {
id: number;
@@ -277,7 +277,7 @@ function parseFiendShips() {
const data = gamedata['jsons'][file] || [];
data.forEach(elem => {
if (elem && elem.id) {
let hids = elem.memberId.split('|');
let hids = elem.memberId.split('&');
elem.hids = hids;
delete elem.memberId;
fiendShips.set(elem.shipId + '_' + elem.level, elem);
@@ -293,8 +293,19 @@ function parseFiendShipLevels() {
const data = gamedata['jsons'][file] || [];
data.sort(function(a, b) {
return a.level - b.level;
})
});
}
function parseFiendShipLevelMaps() {
const file = 'dic_zyz_friend_ship_level';
const data = gamedata['jsons'][file] || [];
data.forEach(elem => {
if (elem && elem.id) {
fiendShipLevelMaps.set(elem.level, elem);
}
});
}
function initData (folder: string) {
if(!gamedata.hasOwnProperty(folder)) {
gamedata[folder] = {};
@@ -375,6 +386,7 @@ function parseData() {
parseFashions();
parseFiendShips();
parseFiendShipLevels();
parseFiendShipLevelMaps();
parseHeroStar();
parseHeroWake();
}
@@ -578,4 +590,8 @@ export function getHeroStar(quality: number, star: number) {
export function getHeroWake(quality: number, star: number) {
return heroWakeList.get(`${quality}_${star}`);
}
export function getFiendShipLevel(level: number) {
return fiendShipLevelMaps.get(level);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
[
{
"type": 1,
"name": "商店",
"icon": 2,
"description": "去商店买呀"
},
{
"type": 2,
"name": "关卡",
"icon": 3,
"description": "去关卡扫荡"
},
{
"type": 3,
"name": "招募",
"icon": 4,
"description": "招募获得"
},
{
"type": 4,
"name": "活动",
"icon": 5,
"description": "去活动页面"
}
]

View File

@@ -0,0 +1,338 @@
[
{
"id ": 1,
"actorId": 1,
"name": "曹操",
"weight": 1
},
{
"id ": 2,
"actorId": 2,
"name": "夏侯惇",
"weight": 1
},
{
"id ": 3,
"actorId": 3,
"name": "张辽",
"weight": 1
},
{
"id ": 4,
"actorId": 4,
"name": "夏侯渊",
"weight": 1
},
{
"id ": 5,
"actorId": 5,
"name": "郭嘉",
"weight": 1
},
{
"id ": 6,
"actorId": 6,
"name": "司马懿",
"weight": 1
},
{
"id ": 7,
"actorId": 7,
"name": "典韦",
"weight": 1
},
{
"id ": 8,
"actorId": 8,
"name": "庞德",
"weight": 1
},
{
"id ": 9,
"actorId": 9,
"name": "邓艾",
"weight": 1
},
{
"id ": 10,
"actorId": 10,
"name": "徐晃",
"weight": 1
},
{
"id ": 11,
"actorId": 11,
"name": "曹仁",
"weight": 1
},
{
"id ": 12,
"actorId": 12,
"name": "李典",
"weight": 1
},
{
"id ": 13,
"actorId": 13,
"name": "蔡琰",
"weight": 1
},
{
"id ": 14,
"actorId": 14,
"name": "贾诩",
"weight": 1
},
{
"id ": 15,
"actorId": 15,
"name": "许褚",
"weight": 1
},
{
"id ": 16,
"actorId": 16,
"name": "乐进",
"weight": 1
},
{
"id ": 17,
"actorId": 17,
"name": "张飞",
"weight": 1
},
{
"id ": 18,
"actorId": 18,
"name": "关羽",
"weight": 1
},
{
"id ": 19,
"actorId": 19,
"name": "赵云",
"weight": 1
},
{
"id ": 20,
"actorId": 20,
"name": "刘备",
"weight": 1
},
{
"id ": 21,
"actorId": 21,
"name": "黄忠",
"weight": 1
},
{
"id ": 22,
"actorId": 22,
"name": "诸葛亮",
"weight": 1
},
{
"id ": 23,
"actorId": 23,
"name": "庞统",
"weight": 1
},
{
"id ": 24,
"actorId": 24,
"name": "魏延",
"weight": 1
},
{
"id ": 25,
"actorId": 25,
"name": "陈到",
"weight": 1
},
{
"id ": 26,
"actorId": 26,
"name": "关银屏",
"weight": 1
},
{
"id ": 27,
"actorId": 27,
"name": "马云禄",
"weight": 1
},
{
"id ": 28,
"actorId": 28,
"name": "马良",
"weight": 1
},
{
"id ": 29,
"actorId": 29,
"name": "黄月英",
"weight": 1
},
{
"id ": 30,
"actorId": 30,
"name": "王平",
"weight": 1
},
{
"id ": 31,
"actorId": 31,
"name": "孙乾",
"weight": 1
},
{
"id ": 32,
"actorId": 32,
"name": "周泰",
"weight": 1
},
{
"id ": 33,
"actorId": 33,
"name": "孙策",
"weight": 1
},
{
"id ": 34,
"actorId": 34,
"name": "周瑜",
"weight": 1
},
{
"id ": 35,
"actorId": 35,
"name": "太史慈",
"weight": 1
},
{
"id ": 36,
"actorId": 36,
"name": "孙权",
"weight": 1
},
{
"id ": 37,
"actorId": 37,
"name": "甘宁",
"weight": 1
},
{
"id ": 38,
"actorId": 38,
"name": "孙尚香",
"weight": 1
},
{
"id ": 39,
"actorId": 39,
"name": "陆逊",
"weight": 1
},
{
"id ": 40,
"actorId": 40,
"name": "小乔",
"weight": 1
},
{
"id ": 41,
"actorId": 41,
"name": "大乔",
"weight": 1
},
{
"id ": 42,
"actorId": 42,
"name": "步练师",
"weight": 1
},
{
"id ": 43,
"actorId": 43,
"name": "左慈",
"weight": 1
},
{
"id ": 44,
"actorId": 44,
"name": "吕布",
"weight": 1
},
{
"id ": 45,
"actorId": 45,
"name": "张任",
"weight": 1
},
{
"id ": 46,
"actorId": 46,
"name": "华佗",
"weight": 1
},
{
"id ": 47,
"actorId": 47,
"name": "张角",
"weight": 1
},
{
"id ": 48,
"actorId": 48,
"name": "南华",
"weight": 1
},
{
"id ": 49,
"actorId": 49,
"name": "高顺",
"weight": 1
},
{
"id ": 50,
"actorId": 50,
"name": "麹义",
"weight": 1
},
{
"id ": 51,
"actorId": 51,
"name": "李儒",
"weight": 1
},
{
"id ": 52,
"actorId": 52,
"name": "庞舞",
"weight": 1
},
{
"id ": 53,
"actorId": 53,
"name": "夏侯轻衣",
"weight": 1
},
{
"id ": 54,
"actorId": 54,
"name": "文丑",
"weight": 1
},
{
"id ": 55,
"actorId": 55,
"name": "颜良",
"weight": 1
},
{
"id ": 56,
"actorId": 56,
"name": "貂蝉",
"weight": 1
}
]

View File

@@ -0,0 +1,17 @@
[
{
"id": 1,
"string": "挑战规则\r\n玩家可以不断向上挑战关卡挑战不需要消耗资源。\r\n在镇念塔中挂机获得资源。\r\n\r\n收集\r\n当通过第一关后开启收集功能。\r\n每隔一定时间便可自动获得相关资源收益。\r\n通过层数越高收集单位时间内获得的收益越高。\r\n收集收益最多存储1个小时。\r\n\r\n任务探索\r\n探索任务每日5点刷新每次会刷新多个任务。\r\n可派遣武将完成任务任务完成后可获得奖励。\r\n每个任务会存在特殊加成条件当武将满足加成条件时可获得额外的加成奖励。\r\n\r\n奖励规则\r\n成功挑战关卡后会获得关卡奖励。\r\n每通过5个关卡可获得一份通关奖励。\r\n探索每隔一定时间可获得奖励。\r\n完成派遣任务可获得奖励\r\n\r\n",
"tip": "镇念塔说明"
},
{
"id": 2,
"string": "挑战规则\r\n玩家可以不断向上挑战首领关卡挑战不需要消耗资源。\r\n",
"tip": "秘境说明"
},
{
"id": 3,
"string": "这里写上远征玩法说明",
"tip": "远征说明"
}
]