fixed # 移除依赖身份模式

This commit is contained in:
2026-10-05 21:45:35 +08:00
parent 036f929862
commit 3a3d547ccd
5 changed files with 101 additions and 55 deletions
+54
View File
@@ -0,0 +1,54 @@
// 阵营是梦三敌我关系的唯一来源;side/identity 仅供核心及界面兼容。
export const battleCamp = player => {
const camp = player?.storage?.mengsanCamp_shuying;
return camp === "ally" || camp === "enemy" ? camp : null;
};
export const campFriend = (from, to) => Boolean(from && to &&
(from === to || (battleCamp(from) !== null && battleCamp(from) === battleCamp(to))));
export const campEnemy = (from, to) => Boolean(from && to && from !== to &&
battleCamp(from) !== null && battleCamp(to) !== null &&
battleCamp(from) !== battleCamp(to));
// get.attitude 会继续处理混乱、技能态度修正;get.effect 等沿用核心收益计算。
export const campAttitude = (from, to) =>
campFriend(from, to) ? 8 : campEnemy(from, to) ? -8 : 0;
export function setBattleCamp(player, camp) {
if (camp !== "ally" && camp !== "enemy") throw new Error("梦三战斗阵营无效:" + camp);
player.storage.mengsanCamp_shuying = camp;
player.side = camp === "enemy";
player.identity = `mengsan_${camp}_shuying`;
player.isZhu = false;
player.setIdentity(player.identity);
player.identityShown = true;
player.ai.shown = 1;
player.classList.add("mengsan-hide-identity-shuying");
}
export function createCampPlayerMethods(game) {
return {
isFriendOf(player) { return campFriend(this, player); },
isEnemyOf(player) { return campEnemy(this, player); },
getEnemies(filter, includeDie) {
return game[includeDie ? "filterPlayer2" : "filterPlayer"](player =>
campEnemy(this, player) && (typeof filter !== "function" || filter(player)));
},
getFriends(filter, includeDie) {
const includeSelf = filter === true;
return game[includeDie ? "filterPlayer2" : "filterPlayer"](player =>
(player !== this || includeSelf) && campFriend(this, player) &&
(typeof filter !== "function" || filter(player)));
},
// 阵营始终公开,不根据行动收益推断隐藏身份或积累暴露值。
logAi() { this.ai.shown = 1; },
addExpose() { return this; },
showIdentity() {
const camp = battleCamp(this);
if (camp) setBattleCamp(this, camp);
},
isZhu2() { return false; },
hasZhuSkill() { return false; },
};
}
+2 -3
View File
@@ -2,11 +2,10 @@ import { applyMengsanDebuff } from "../monsters/artifact-status.js";
import { applyTangled } from "../monsters/vine-tangled.js";
import { attackHitCount, outgoingAttackDamage } from "./intent-damage.js";
import { beginDeathBlow, isDeathBlowIntent } from "./death-blow.js";
import { campEnemy } from "./camps.js";
export const getIntentHostiles = (game, source) =>
game.players.filter(target => target !== source && target.isAlive() &&
target.storage?.mengsanCamp_shuying !==
source.storage?.mengsanCamp_shuying);
game.players.filter(target => target.isAlive() && campEnemy(source, target));
export function createIntentExecutor(game, getActiveBattle) {
const active = source => source.isAlive() &&