26 lines
899 B
TypeScript
26 lines
899 B
TypeScript
export const REVIVE_COST_AB_NAME = "revive_cost_ascend";
|
|
export const MAX_REVIVE_COST_STEP = 5;
|
|
|
|
const DEFAULT_REVIVE_COSTS = [500];
|
|
const REVIVE_COSTS_BY_GROUP = {
|
|
B: [500, 700, 900],
|
|
C: [500, 700, 900, 1100, 1300, 1500]
|
|
};
|
|
|
|
export function getABReviveCoinCost(assignment: any, reviveCount: any): number {
|
|
const isTargetExperiment = assignment
|
|
&& String(assignment.layer) === "3"
|
|
&& assignment.name === REVIVE_COST_AB_NAME
|
|
&& assignment.enabled !== false;
|
|
const group = isTargetExperiment
|
|
? String(assignment.group || "Default").toUpperCase()
|
|
: "DEFAULT";
|
|
const costs = group === "B"
|
|
? REVIVE_COSTS_BY_GROUP.B
|
|
: group === "C"
|
|
? REVIVE_COSTS_BY_GROUP.C
|
|
: DEFAULT_REVIVE_COSTS;
|
|
const step = Math.max(0, Math.floor(Number(reviveCount) || 0));
|
|
return costs[Math.min(step, costs.length - 1)];
|
|
}
|