|
@@ -66,16 +66,18 @@ const OATHS = [
|
|
|
const rnd = (r, n) => Math.floor(r() * n);
|
|
const rnd = (r, n) => Math.floor(r() * n);
|
|
|
const pick = (r, arr) => arr[rnd(r, arr.length)];
|
|
const pick = (r, arr) => arr[rnd(r, arr.length)];
|
|
|
|
|
|
|
|
-export function atkOf(s) { return 10 + 1.5 * (s.attrs.knowledge + bonusOf(s, 'knowledge')) + 2 * (s.attrs.judge + bonusOf(s, 'judge')) + ((s.oathObj && s.oathObj.atkBonus) || 0); }
|
|
|
|
|
|
|
+/** 开局(轮)的攻击力:用来给里世界敌方标定基准值 */
|
|
|
|
|
+export function baseAtkOf(s) { return 10 + 1.5 * 2 + 2 * 2; }
|
|
|
|
|
+/** 攻击力:知识 +1.5/点、裁决 +2/点,再乘本局“锋芒”成长(临时攻击 ×3/10,上限 ×3) */
|
|
|
|
|
+export function atkOf(s) { const g = s.growth || 1; return (10 + 1.5 * (s.attrs.knowledge + bonusOf(s, 'knowledge')) + 2 * (s.attrs.judge + bonusOf(s, 'judge')) + ((s.oathObj && s.oathObj.atkBonus) || 0)) * Math.min(3, g); }
|
|
|
export function hpMaxOf(s) { return Math.round((40 + 4 * (s.attrs.oath + bonusOf(s, 'oath')) + 1.5 * (s.attrs.belief + bonusOf(s, 'belief'))) * (1 + (s.oathObj?.hp || 0))); }
|
|
export function hpMaxOf(s) { return Math.round((40 + 4 * (s.attrs.oath + bonusOf(s, 'oath')) + 1.5 * (s.attrs.belief + bonusOf(s, 'belief'))) * (1 + (s.oathObj?.hp || 0))); }
|
|
|
/** 敌人威胁 pK:随步数与位面递增,与玩家属性无关(属性只放大你的攻击/生命) */
|
|
/** 敌人威胁 pK:随步数与位面递增,与玩家属性无关(属性只放大你的攻击/生命) */
|
|
|
export function threatOf(s, step, kind) {
|
|
export function threatOf(s, step, kind) {
|
|
|
- const a = s.attrs;
|
|
|
|
|
- const sum = a.knowledge + a.oath + a.belief + a.judge;
|
|
|
|
|
- const p = s.plane || 0, i = step ?? s.step ?? 0;
|
|
|
|
|
- // 敌方威胁 = 你的规则总和 ×(1+10%×步)×1.15^位面——敌人始终比你“多带一点规则”,位面越深越硬(与你的预算密度同序)
|
|
|
|
|
- const base = sum * (1 + 0.1 * i) * Math.pow(1.15, p);
|
|
|
|
|
- return Math.max(1, Math.round(base * (kind === 'boss' ? 1.1 : kind === 'elite' ? 1.05 : 1)));
|
|
|
|
|
|
|
+ const i = step ?? s.step ?? 0;
|
|
|
|
|
+ // 敌方威胁 pK = 开局攻击力(四类基础槽标定)×(1+16%×步 + 6%×阶) ×(1+3%×峰值锋芒),局内自己分配的点不参与标定
|
|
|
|
|
+ const atk0 = 10 + 1.5 * 2 + 2 * 2;
|
|
|
|
|
+ const base = atk0 * (1 + 0.16 * i + 0.09 * (s.plane || 0)) * (1 + 0.03 * Math.max(0, (s.growth || 1) - 1));
|
|
|
|
|
+ return Math.max(1, Math.round(base * (kind === 'boss' ? 1.25 : kind === 'elite' ? 1.08 : 1)));
|
|
|
}
|
|
}
|
|
|
export function clampAttr(v, k) { return clamp(+v.toFixed(2), 0, CAP[k]); }
|
|
export function clampAttr(v, k) { return clamp(+v.toFixed(2), 0, CAP[k]); }
|
|
|
|
|
|
|
@@ -116,6 +118,7 @@ export function buildDone(s, oathIdx) {
|
|
|
s.oathObj = o;
|
|
s.oathObj = o;
|
|
|
s.hp = hpMaxOf(s);
|
|
s.hp = hpMaxOf(s);
|
|
|
s.state = 'run';
|
|
s.state = 'run';
|
|
|
|
|
+ s.peak = atkOf(s); // 本局峰值战力(锋芒 +30% 以此为准)
|
|
|
riftPrepare(s, 0);
|
|
riftPrepare(s, 0);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
@@ -124,13 +127,24 @@ function constDone(s) { return !!s.oathObj; }
|
|
|
|
|
|
|
|
export function encounterKind(i) {
|
|
export function encounterKind(i) {
|
|
|
if (i === ENCOUNTERS - 1) return 'boss';
|
|
if (i === ENCOUNTERS - 1) return 'boss';
|
|
|
- return ['normal', 'event', 'elite', 'normal', 'event'][i] || 'normal';
|
|
|
|
|
|
|
+ // 幕结构:战斗 / 奇遇 / 精英 / 战斗 / 本源潮起 / 终局
|
|
|
|
|
+ return ['normal', 'event', 'elite', 'normal', 'tide'][i] || 'normal';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export function riftPrepare(s, i) {
|
|
export function riftPrepare(s, i) {
|
|
|
s.step = i;
|
|
s.step = i;
|
|
|
const r = mulberry32((s.seed + i * 7919) >>> 0);
|
|
const r = mulberry32((s.seed + i * 7919) >>> 0);
|
|
|
const kind = encounterKind(i);
|
|
const kind = encounterKind(i);
|
|
|
|
|
+ if (kind === 'tide') {
|
|
|
|
|
+ // 本源潮起:不战斗,直接获得本局一次性的战力/生命补给(高决策点:留着最后冲刺 vs 立刻用掉)
|
|
|
|
|
+ s.state = 'event';
|
|
|
|
|
+ s.mouth = { type: 'event', title: '本源潮起', text: '规则的本源在此汇聚成潮。你可以取走一份,但它只够支撑一段路程。', opts: [
|
|
|
|
|
+ { label: '淬炼锋芒', hint: '本局攻击 ×1.35(锋芒)', j: 0 },
|
|
|
|
|
+ { label: '固化誓约', hint: '最大生命 +30 并回满', j: 1 },
|
|
|
|
|
+ { label: '窥见终局', hint: '终局敌人威胁 −15%', j: 2 },
|
|
|
|
|
+ ], ev: { id: 'tide', apply0: true } };
|
|
|
|
|
+ return s;
|
|
|
|
|
+ }
|
|
|
if (kind === 'event') {
|
|
if (kind === 'event') {
|
|
|
const ev = pick(r, EVENTS);
|
|
const ev = pick(r, EVENTS);
|
|
|
s.state = 'event';
|
|
s.state = 'event';
|
|
@@ -144,12 +158,12 @@ export function riftPrepare(s, i) {
|
|
|
// 敌人血量/攻击 ∝ 你的攻击力(按全局强度计算,不吃本局临时加点):数值不脱钩,打起来始终“几到十几剑”
|
|
// 敌人血量/攻击 ∝ 你的攻击力(按全局强度计算,不吃本局临时加点):数值不脱钩,打起来始终“几到十几剑”
|
|
|
const basis = (s.baseAtk || 10 + 1.5 * 1 + 2 * 1) * Math.pow(s.density || planeDensity(s.plane), 2.2);
|
|
const basis = (s.baseAtk || 10 + 1.5 * 1 + 2 * 1) * Math.pow(s.density || planeDensity(s.plane), 2.2);
|
|
|
const gAtk = basis;
|
|
const gAtk = basis;
|
|
|
- const kHp = (kind === 'elite' ? 1.5 : 1.0) * Math.pow(1.06, i + s.plane);
|
|
|
|
|
|
|
+ const kHp = (kind === 'elite' ? 1.5 : 1.0) * Math.pow(1.06, i + s.plane) * Math.pow(1.28, s.plane); // 阶越高,敌人越“厚”
|
|
|
let hp = gAtk * kHp * 2.6;
|
|
let hp = gAtk * kHp * 2.6;
|
|
|
let dmg = gAtk * 0.04 * (kind === 'boss' ? 1.15 : 1);
|
|
let dmg = gAtk * 0.04 * (kind === 'boss' ? 1.15 : 1);
|
|
|
let name = pick(r, MONSTERS);
|
|
let name = pick(r, MONSTERS);
|
|
|
if (kind === 'elite') name = pick(r, ELITES);
|
|
if (kind === 'elite') name = pick(r, ELITES);
|
|
|
- if (kind === 'boss') { hp = Math.max(hp, threatOf(s, i, 'boss') * 4.0); name = pick(r, BOSSES); }
|
|
|
|
|
|
|
+ if (kind === 'boss') { hp = Math.max(hp, threatOf(s, i, 'boss') * 4.0 * (1 + 0.25 * s.plane)); name = pick(r, BOSSES); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -162,7 +176,7 @@ export function riftPrepare(s, i) {
|
|
|
return s;
|
|
return s;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export function kindName(k) { return { normal: '战斗', elite: '精英', boss: '终局', event: '奇遇' }[k] || k; }
|
|
|
|
|
|
|
+export function kindName(k) { return { normal: '战斗', elite: '精英', boss: '终局', event: '奇遇', tide: '潮起' }[k] || k; }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 挥剑:结果 = 攻击 + 骰面(0..5);pK = 敌人威胁。
|
|
* 挥剑:结果 = 攻击 + 骰面(0..5);pK = 敌人威胁。
|
|
@@ -184,7 +198,7 @@ export function slash(s, rollVal) {
|
|
|
if (value > threat) {
|
|
if (value > threat) {
|
|
|
const need = threat * 1.75;
|
|
const need = threat * 1.75;
|
|
|
if (value >= need) { res = 'crit'; dmg = Math.floor(value * 1.75); back = 1; }
|
|
if (value >= need) { res = 'crit'; dmg = Math.floor(value * 1.75); back = 1; }
|
|
|
- else { res = 'win'; dmg = value; back = 3; }
|
|
|
|
|
|
|
+ else { res = 'win'; dmg = value; back = 3; s.growth = Math.min(3, (s.growth || 1) * 1.3); s.peak = Math.max(s.peak || 0, atkOf(s)); } // 锋芒成长
|
|
|
// 裁决(攻击属性):拼招/超杀时额外削减 = 裁决 × 1
|
|
// 裁决(攻击属性):拼招/超杀时额外削减 = 裁决 × 1
|
|
|
if (maxK === 'judge' || maxK === 'knowledge') dmg += Math.floor((maxK === 'judge' ? a.judge + bonusOf(s, 'judge') : a.knowledge + bonusOf(s, 'knowledge')) * 1);
|
|
if (maxK === 'judge' || maxK === 'knowledge') dmg += Math.floor((maxK === 'judge' ? a.judge + bonusOf(s, 'judge') : a.knowledge + bonusOf(s, 'knowledge')) * 1);
|
|
|
} else {
|
|
} else {
|
|
@@ -218,6 +232,18 @@ export function afterSlash(s, r) {
|
|
|
export function applyOption(s, j) {
|
|
export function applyOption(s, j) {
|
|
|
const m = s.mouth;
|
|
const m = s.mouth;
|
|
|
if (s.state !== 'event' || !m || !m.ev) return null;
|
|
if (s.state !== 'event' || !m || !m.ev) return null;
|
|
|
|
|
+ if (m.ev.id === 'tide') {
|
|
|
|
|
+ let msg = '';
|
|
|
|
|
+ const hpmax = hpMaxOf(s);
|
|
|
|
|
+ if (j === 0) { s.growth = Math.min(3, (s.growth || 1) * 1.35); s.peak = Math.max(s.peak || 0, atkOf(s)); msg = '锋芒:本局攻击提升'; }
|
|
|
|
|
+ else if (j === 1) { s.bonus = s.bonus || {}; s.bonus.oath = (s.bonus.oath || 0) + 7.5; s.hp = hpMaxOf(s); msg = '誓约固化:最大生命 +30,并回满'; }
|
|
|
|
|
+ else { s._bossWeak = 0.15; msg = '窥见终局:终局敌人威胁 −15%'; }
|
|
|
|
|
+ s.score += 20;
|
|
|
|
|
+ if (s.step + 1 >= ENCOUNTERS) { s.state = 'result'; s.cleared = true; return { cleared: true, msg }; }
|
|
|
|
|
+ riftPrepare(s, s.step + 1);
|
|
|
|
|
+ if (m.type === 'event' && s.mouth && s.mouth.type === 'fight' && s._bossWeak) s.mouth.threat = Math.round(s.mouth.threat * (1 - s._bossWeak));
|
|
|
|
|
+ return { next: true, msg };
|
|
|
|
|
+ }
|
|
|
const opt = m.ev.opts[j];
|
|
const opt = m.ev.opts[j];
|
|
|
if (!opt) return null;
|
|
if (!opt) return null;
|
|
|
const r = mulberry32((s.seed + s.step * 53 + j) >>> 0);
|
|
const r = mulberry32((s.seed + s.step * 53 + j) >>> 0);
|
|
@@ -251,7 +277,7 @@ export function applyOption(s, j) {
|
|
|
export function riftResult(s, prodPerSec, alreadyAnchored) {
|
|
export function riftResult(s, prodPerSec, alreadyAnchored) {
|
|
|
const steps = s.step + (s.cleared ? 1 : 0) + 1;
|
|
const steps = s.step + (s.cleared ? 1 : 0) + 1;
|
|
|
// 失败也有价值:探索碎片至少 25% 的固定产出
|
|
// 失败也有价值:探索碎片至少 25% 的固定产出
|
|
|
- const delta = Math.max(3, C.riftExploreDelta(steps, s.score, s.cleared));
|
|
|
|
|
|
|
+ const delta = Math.max(3, C.riftExploreDelta(steps, s.score, s.cleared, s.plane || 0));
|
|
|
const essence = Math.max(prodPerSec * 8, 10) * Math.max(1, delta / 16);
|
|
const essence = Math.max(prodPerSec * 8, 10) * Math.max(1, delta / 16);
|
|
|
const shard = alreadyAnchored ? 0 : (s.cleared ? 1 : s.score >= 100 ? 1 : 0);
|
|
const shard = alreadyAnchored ? 0 : (s.cleared ? 1 : s.score >= 100 ? 1 : 0);
|
|
|
return { explore: delta, essence, score: s.score, shard, cleared: s.cleared, steps };
|
|
return { explore: delta, essence, score: s.score, shard, cleared: s.cleared, steps };
|