feat(稷下学宫): 修改带出英灵奖励数量, 修改特性卡随机权重(流派、品质、等级相关)

This commit is contained in:
zhangxk
2023-09-08 14:07:52 +08:00
parent 98b4b56143
commit e5bbd112b7
10 changed files with 8077 additions and 7656 deletions

View File

@@ -218,7 +218,7 @@ export class RougeHandler {
const { takeoutReward = [], score = 0, tech = 0, spiritPlan } = clone(layerReward);
addScore += score, addTech += tech;
for (const { id, count } of takeoutReward) takeoutRewardMap.set(id, takeoutRewardMap.get(id) || 0 + count);
spiritIds.push(...getRandomSpirit(spiritPlan));
for (const { id, count } of spiritPlan) { spiritIds.push(...getRandomSpirit(id, count)); }
}
let spiritMap = new Map<number, RewardInter>();
spiritIds.forEach((spiritId) => {
@@ -506,10 +506,12 @@ export class RougeHandler {
let costResult = await RougelikeRecordModel.costCoin(gameCode, costCoin);
if (!costResult) return resResult(STATUS.COIN_NOT_ENOUGH);
let replaceReward = await getLayerNodeReward(roleId, gameCode, dbRecord.authorType, dbDetail.nodeId, layerPlanData.rewardPlan, dbDetail.layer);
let replaceReward = await getLayerNodeReward(roleId, gameCode, dbRecord.authorType, dbDetail.nodeId, layerPlanData.rewardPlan, dbDetail.layer, dbDetail.questType);
let { rewards } = dbDetail;
let newRewards = [...rewards.filter(reward => reward.rewardType != rewardType), ...replaceReward.rewards.filter(reward => reward.rewardType == rewardType)].map(reward => ({ ...reward, reRandRewardCnt: 1 })).sort((a, b) => a.groupIndex - b.groupIndex);
dbDetail = await RougelikeRecordDetailModel.updateByCode(gameCode, detailCode, { $set: { rewards: newRewards } });
if (replaceReward && replaceReward.rewards.length > 0) {
let newRewards = [...rewards.filter(reward => reward.rewardType != rewardType), ...replaceReward.rewards.filter(reward => reward.rewardType == rewardType)].map(reward => ({ ...reward, reRandRewardCnt: 1 })).sort((a, b) => a.groupIndex - b.groupIndex);
dbDetail = await RougelikeRecordDetailModel.updateByCode(gameCode, detailCode, { $set: { rewards: newRewards } });
}
return resResult(STATUS.SUCCESS, { rewards: dbDetail.rewards });
}

View File

@@ -595,7 +595,7 @@ export async function getPassiveCardPlan(passiveCardPlan: number, passiveCardRan
let cardsMap = await getCardCount(gameCode, ROUGE_LIKE_CARD_TYPE.PASSIVE);
const { chooseCardsMap, noChooseCardsMap } = await getIsChooseCard(gameCode);
for (let obj of cards) {
let weightRecord: { originalWight?: number, passiveRedWight?: number, passiveLableNum?: number, authorAddWeight?: number, passiveLableNumAddWeight?: number, finalWeight?: number } = {};
let weightRecord: { originalWight?: number, passiveRedWight?: number, holyAddWeight?: number, passiveLableNum?: number, authorAddWeight?: number, passiveLableNumAddWeight?: number, finalWeight?: number } = {};
if (!obj) continue;
let { cardId, weight } = obj;
if (!cardId || !weight) continue;
@@ -617,11 +617,17 @@ export async function getPassiveCardPlan(passiveCardPlan: number, passiveCardRan
}
const holyAddWeight = await getAddPassiveWeight(roleId, gameCode, type);
weight += holyAddWeight;
weightRecord.holyAddWeight = holyAddWeight;
weight += await getAddPassiveWeight(roleId, gameCode, type);
if ((passiveCardData?.authorType || 0) == type) {
weight += ROUGELIKE.AUTHOR_ADD_RANDOM;
weightRecord.authorAddWeight = ROUGELIKE.AUTHOR_ADD_RANDOM;
const { authorType = 0, quality = 0, lv = 0 } = passiveCardData;
if (authorType == type) {
const passiveWeightData = gameData.rougePassiveWeight.get(authorType + '_' + quality + '_' + lv);
if (passiveWeightData && passiveWeightData.authorTypeWeightAdd) {
weight += passiveWeightData.authorTypeWeightAdd;
weightRecord.authorAddWeight = passiveWeightData.authorTypeWeightAdd;
}
}
@@ -632,13 +638,6 @@ export async function getPassiveCardPlan(passiveCardPlan: number, passiveCardRan
weightRecord.passiveLableNumAddWeight = ROUGELIKE.PASSIVE_LABLE_ADD_RANDOM * (Math.ceil(labelNum / ROUGELIKE.PASSIVE_LABLE_NUM));
}
// if (!passiveCardData.passiveLabel || passiveCardData.passiveLabel.length == 0) continue;
// for (let val of passiveCardData.passiveLabel) {
// let labelNum = lableMap.get(val) || 0;
// if (labelNum < ROUGELIKE.PASSIVE_LABLE_NUM || ROUGELIKE.PASSIVE_LABLE_NUM == 0) continue;
// weight += ROUGELIKE.PASSIVE_LABLE_ADD_RANDOM * (Math.ceil(labelNum / ROUGELIKE.PASSIVE_LABLE_NUM));
// }
weightRecord.finalWeight = weight;
newCards.push({ ...obj, weight, weightRecord });
@@ -861,7 +860,7 @@ export async function updateChalleng(dbRecord: RougelikeRecordType, roleId: stri
}
export function getLayerRewardOneData(type: number, grade: number, layer: number, nodeType: number) {
let result: { takeoutReward?: RewardInter[], coin?: number, score?: number, tech?: number, spiritPlan?: number } = {};
let result: { takeoutReward?: RewardInter[], coin?: number, score?: number, tech?: number, spiritPlan?: RewardInter[] } = {};
const typeGradeData = gameData.rougeTypeGrade.get(type + '_' + grade);
if (!typeGradeData) return result;
const layerPlanData = gameData.rougeLayerPlan.get(typeGradeData.layerPlan + '_' + layer);
@@ -871,15 +870,15 @@ export function getLayerRewardOneData(type: number, grade: number, layer: number
const layerRewardData = gameData.rougeLayerRewardPlan.get(layerPlanData.rewardPlan + '_' + nodeType);
if (!layerRewardData) return result;
result = { ...layerRewardData, ...result };
return result;
}
export function getRandomSpirit(spiritPlan: number) {
export function getRandomSpirit(spiritPlan: number, randomNum: number) {
let spiritId: number[] = [];
const spiritPlanData = gameData.spiritPlan.get(spiritPlan);
if (ROUGELIKE.SPIRIT_RANDOM_NUM == 0 || !spiritPlanData || spiritPlanData.length == 0) return spiritId;
let random = getRandEelmWithWeightAndNum(spiritPlanData, ROUGELIKE.SPIRIT_RANDOM_NUM);
if (randomNum == 0 || !spiritPlanData || spiritPlanData.length == 0) return spiritId;
let random = getRandEelmWithWeightAndNum(spiritPlanData, randomNum);
spiritId = random.map(cur => { return cur.dic.spiritId });
return spiritId;

View File

@@ -676,6 +676,7 @@ export const FILENAME = {
DIC_ROUGE_CHARA_CARD_PLAN: "dic_rougeChara_cardPlan",
DIC_ROUGE_PASSIVE_CARD_PLAN: "dic_rougePassive_cardPlan",
DIC_ROUGE_HOLY_CARD_PLAN: "dic_rougeHoly_cardPlan",
DIC_ROUGE_PASSIVE_WEIGHT: "dic_rougePassive_weight",
DIC_ROUGE_CHALLANGE: "dic_rougeChallenge",
DIC_ROUGE_CHALLANGE_PLAN: "dic_rougeChallengePlan",
DIC_ROUGE_QUESTION_MARK_PLAN: "dic_rougeQuestionMarkPlan",
@@ -686,7 +687,6 @@ export const FILENAME = {
DIC_ROUGE_SCORE_REWARD: "dic_rougeScoreReward",
DIC_ROUGE_EFFECT: "dic_rougeEffect",
DIC_ROUGE_EFFECT_TYPE: "dic_rougeEffectType",
DIC_ROUGE_TECH: "dic_rougeTech",
DIC_ROUGE_TECH_CIRCLE: "dic_rougeTechCircle",
DIC_ROUGE_TECH_LEVEL: "dic_rougeTechLevel",
@@ -962,7 +962,7 @@ export enum GACHA_TYPE {
ASSIGN = 3, // 指定卡池
GUIDE = 4, // 限时
ACTIVITY = 5, // 新武将活动
TAUTOR=6, // 百家争鸣祈灵
TAUTOR = 6, // 百家争鸣祈灵
}
export enum GACHA_PLAN_TYPE {

View File

@@ -116,6 +116,8 @@ export class WeightRecord {
holyLableNumAddWeight?: number;
@prop({ required: false, default: 0 })
finalWeight?: number;
@prop({ required: false, default: 0 })
holyAddWeight?: number;
}
export class RandomRec {
@prop({ required: false, default: 0 })

View File

@@ -172,6 +172,7 @@ import { dicRougeScoreNum, dicRougeScoreReward, loadRougeScoreReward } from "./d
import { dicRougeEffect, loadRougeEffect } from "./dictionary/DicRougeEffect";
import { dicRougeEffectType, loadRougeEffectType } from "./dictionary/DicRougeEffectType";
import { dicSpiritPlan, loadSpiritPlan } from "./dictionary/DicSpiritPlan";
import { dicRougePassiveWeight, loadRougePassiveWeight } from "./dictionary/DicRougePassiveWeight";
export const gameData = {
daily: dicDaily,
@@ -414,7 +415,7 @@ export const gameData = {
rougeCharaCardPlan: dicRougeCharaCardPlan,
rougePassiveCardPlan: dicRougePassiveCardPlan,
rougeHolyCardPlan: dicRougeHolyCardPlan,
rougePassiveWeight: dicRougePassiveWeight,
rougeChallenge: dicRougeChallenge,
rougeChallengePlan: dicRougeChallengePlan,
rougeQuestionMarkPlan: dicRougeQuestionMarkPlan,
@@ -1776,6 +1777,7 @@ function loadDatas(type?: string) {
if (type == undefined || type == 'loadRougeCharaCardPlan') loadRougeCharaCardPlan();
if (type == undefined || type == 'loadRougePassiveCardPlan') loadRougePassiveCardPlan();
if (type == undefined || type == 'loadRougeHolyCardPlan') loadRougeHolyCardPlan();
if (type == undefined || type == 'loadRougePassiveWeight') loadRougePassiveWeight();
if (type == undefined || type === 'loadRougeChallenge') loadRougeChallenge();
if (type == undefined || type == 'loadRougeChallengePlan') loadRougeChallengePlan();
if (type == undefined || type == 'loadRougeQuestionMarkPlan') loadRougeQuestionMarkPlan();

View File

@@ -15,7 +15,7 @@ export interface DicRougeLayerPlan {
readonly rewardPlan: number; // 每层可以赠送的奖励
readonly shopPlan: number; // 该层可以随机到的商店方案
readonly takeoutReward: RewardInter[]; //额外奖励
readonly spiritPlan: number; //英灵随机奖励
readonly spiritPlan: RewardInter[]; //英灵随机奖励
}
export const dicRougeLayerPlan = new Map<string, DicRougeLayerPlan>();
export const dicRougeLayerPlanByPlanId = new Map<number, DicRougeLayerPlan[]>();
@@ -29,6 +29,8 @@ export function loadRougeLayerPlan() {
arr.forEach(o => {
o.takeoutReward = parseGoodStr(o.takeoutReward);
o.spiritPlan = parseGoodStr(o.spiritPlan);
dicRougeLayerPlan.set(o.planId + '_' + o.layerIndex, o);
if (!dicRougeLayerPlanByPlanId.get(o.planId)) dicRougeLayerPlanByPlanId.set(o.planId, []);

View File

@@ -0,0 +1,28 @@
/**
* 流派增加权重
*/
import { readFileAndParse } from '../util'
import { FILENAME } from '../../consts'
export interface DicRougePassiveWeight {
readonly id: number;
readonly authorType: number; // 流派类型
readonly quality: number; // 品质
readonly level: number; // 等级
readonly authorTypeWeightAdd: number; // 流派增加权重
}
export const dicRougePassiveWeight = new Map<string, DicRougePassiveWeight>();
export function loadRougePassiveWeight() {
dicRougePassiveWeight.clear();
let arr = readFileAndParse(FILENAME.DIC_ROUGE_PASSIVE_WEIGHT);
arr.forEach(o => {
dicRougePassiveWeight.set(o.authorType + '_' + o.quality + '_' + o.level, o);
});
arr = undefined;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,386 @@
[
{
"id": 1,
"authorType": 1,
"quality": 1,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 2,
"authorType": 1,
"quality": 1,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 3,
"authorType": 1,
"quality": 2,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 4,
"authorType": 1,
"quality": 2,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 5,
"authorType": 1,
"quality": 3,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 6,
"authorType": 1,
"quality": 3,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 7,
"authorType": 2,
"quality": 1,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 8,
"authorType": 2,
"quality": 1,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 9,
"authorType": 2,
"quality": 2,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 10,
"authorType": 2,
"quality": 2,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 11,
"authorType": 2,
"quality": 3,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 12,
"authorType": 2,
"quality": 3,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 13,
"authorType": 3,
"quality": 1,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 14,
"authorType": 3,
"quality": 1,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 15,
"authorType": 3,
"quality": 2,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 16,
"authorType": 3,
"quality": 2,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 17,
"authorType": 3,
"quality": 3,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 18,
"authorType": 3,
"quality": 3,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 19,
"authorType": 4,
"quality": 1,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 20,
"authorType": 4,
"quality": 1,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 21,
"authorType": 4,
"quality": 2,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 22,
"authorType": 4,
"quality": 2,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 23,
"authorType": 4,
"quality": 3,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 24,
"authorType": 4,
"quality": 3,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 25,
"authorType": 5,
"quality": 1,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 26,
"authorType": 5,
"quality": 1,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 27,
"authorType": 5,
"quality": 2,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 28,
"authorType": 5,
"quality": 2,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 29,
"authorType": 5,
"quality": 3,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 30,
"authorType": 5,
"quality": 3,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 31,
"authorType": 6,
"quality": 1,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 32,
"authorType": 6,
"quality": 1,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 33,
"authorType": 6,
"quality": 2,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 34,
"authorType": 6,
"quality": 2,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 35,
"authorType": 6,
"quality": 3,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 36,
"authorType": 6,
"quality": 3,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 37,
"authorType": 7,
"quality": 1,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 38,
"authorType": 7,
"quality": 1,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 39,
"authorType": 7,
"quality": 2,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 40,
"authorType": 7,
"quality": 2,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 41,
"authorType": 7,
"quality": 3,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 42,
"authorType": 7,
"quality": 3,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 43,
"authorType": 8,
"quality": 1,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 44,
"authorType": 8,
"quality": 1,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 45,
"authorType": 8,
"quality": 2,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 46,
"authorType": 8,
"quality": 2,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 47,
"authorType": 8,
"quality": 3,
"level": 1,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
},
{
"id": 48,
"authorType": 8,
"quality": 3,
"level": 2,
"authorTypeWeightAdd": 800,
"getHolyWeightAdd": 500
}
]