@clawtopia/werewolf-evolution 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +14 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -762,17 +762,17 @@ var NO_TARGET_ALTERNATIVE_LANGUAGE = /(?:保留投票权|等待更多信息|暂
762
762
  var EXPLICIT_TARGET_LANGUAGE = /(?:(?:改投|改票(?:到|给)?|归票|票投|投票(?:给|到)?|投(?:给|到)?|查验|验|刀|毒|救|开枪带走|目标(?:改为|是)?)\s*|target(?:\s+seat)?[^0-9]{0,6})([1-9][0-9]*)\s*(?:号|座|\b)/gi;
763
763
  var FINAL_RESULT_LANGUAGE = /(?:最终|终局|全场|对局结果|比赛结果)[^。;,,!!]{0,16}(?:获胜|胜利|胜出|取胜|赢了|输了|落败|失败)|(?:好人(?:阵营)?|村民|平民|狼人(?:阵营)?|狼队)[^。;,,!!]{0,10}(?:获胜|胜利|胜出|取胜|赢了|输了|落败)|(?:险胜|惨胜|翻盘获胜|为(?:最终)?胜利铺路)|赢下(?:本局|这局|对局|比赛)|(?:GOOD|WOLF)(?:_TEAM)?_WIN|(?:the\s+)?(?:(?:good|village|wolf)\s+team|villagers?|village|wolves|wolf|werewolves?)\s+(?:wins?|won|loses?|lost)|(?:won|lost) the game|final (?:victory|defeat)/i;
764
764
  var SEAT_REFERENCE_LANGUAGE = /([1-9][0-9]*)\s*号(?:玩家)?/g;
765
- var BEHAVIOR_TERMS = "\u53D1\u8A00|\u8868\u73B0|\u884C\u4E3A|\u8BF4\u6CD5|\u5185\u5BB9|\u7AD9\u8FB9|\u7968\u578B|\u6295\u7968|\u5F52\u7968|\u7529\u9505|\u8D28\u7591|\u5BF9\u8DF3|\u8D77\u8DF3|\u608D\u8DF3|\u5012\u94A9|\u67E5\u6740|\u4FDD\u4EBA|\u8E29\u4EBA|\u653B\u51FB|\u8FA9\u89E3|\u8DDF\u7968|\u51B2\u7968|\u8868\u6C34";
765
+ var BEHAVIOR_TERMS = "\u53D1\u8A00|\u8868\u73B0|\u884C\u4E3A|\u8BF4\u6CD5|\u5185\u5BB9|\u7AD9\u8FB9|\u7968\u578B|\u6295\u7968|\u5F52\u7968|\u7529\u9505|\u8D28\u7591|\u5BF9\u8DF3|\u8D77\u8DF3|\u608D\u8DF3|\u5012\u94A9|\u67E5\u6740|\u4FDD\u4EBA|\u8E29\u4EBA|\u653B\u51FB|\u8FA9\u89E3|\u8DDF\u7968|\u51B2\u7968|\u8868\u6C34|\u81EA\u79F0|\u58F0\u79F0|\u516C\u5F00\u8EAB\u4EFD|\u516C\u5F00\u9884\u8A00\u5BB6|\u516C\u5F00\u5973\u5DEB|\u516C\u5F00\u730E\u4EBA|\u8DF3\u9884\u8A00\u5BB6|\u8DF3\u5973\u5DEB|\u8DF3\u730E\u4EBA";
766
766
  var FIRST_NIGHT_DAYTIME_INFORMATION = new RegExp(
767
- `(?:\u73A9\u5BB6)?\u53D1\u8A00\u98CE\u683C|(?:\u767D\u5929|\u767D\u663C|\u65E5\u95F4|\u9996\u65E5|\u7B2C\u4E00\u5929|\u5929\u4EAE\u540E|\u6B21\u65E5|\u7B2C\u4E8C\u5929|\u968F\u540E|\u540E\u7EED)[^\u3002\uFF1B\uFF0C,!\uFF01]{0,16}(?:${BEHAVIOR_TERMS})|(?:${BEHAVIOR_TERMS})[^\u3002\uFF1B\uFF0C,!\uFF01]{0,16}(?:\u767D\u5929|\u767D\u663C|\u65E5\u95F4|\u9996\u65E5|\u7B2C\u4E00\u5929|\u5929\u4EAE\u540E|\u6B21\u65E5|\u7B2C\u4E8C\u5929|\u968F\u540E|\u540E\u7EED)`,
767
+ `(?:\u73A9\u5BB6)?\u53D1\u8A00\u98CE\u683C|(?:\u767D\u5929|\u767D\u663C|\u65E5\u95F4|\u9996\u65E5|\u7B2C\u4E00\u5929|\u5929\u4EAE\u540E|\u6B21\u65E5|\u7B2C\u4E8C\u5929|\u7B2C\u4E8C\u591C|\u660E\u5929|\u660E\u65E5|\u4E0B\u4E2A(?:\u56DE\u5408|\u8F6E|\u767D\u5929|\u591C\u665A)|\u4E0B\u4E00(?:\u5929|\u56DE\u5408|\u8F6E|\u591C|\u591C\u665A)|\u968F\u540E|\u540E\u7EED)[^\u3002\uFF1B\uFF0C,!\uFF01]{0,16}(?:${BEHAVIOR_TERMS})|(?:${BEHAVIOR_TERMS})[^\u3002\uFF1B\uFF0C,!\uFF01]{0,16}(?:\u767D\u5929|\u767D\u663C|\u65E5\u95F4|\u9996\u65E5|\u7B2C\u4E00\u5929|\u5929\u4EAE\u540E|\u6B21\u65E5|\u7B2C\u4E8C\u5929|\u7B2C\u4E8C\u591C|\u660E\u5929|\u660E\u65E5|\u4E0B\u4E2A(?:\u56DE\u5408|\u8F6E|\u767D\u5929|\u591C\u665A)|\u4E0B\u4E00(?:\u5929|\u56DE\u5408|\u8F6E|\u591C|\u591C\u665A)|\u968F\u540E|\u540E\u7EED)`,
768
768
  "i"
769
769
  );
770
770
  var DIRECTLY_NEGATED_DAYTIME_INFORMATION = /(?:尚无|暂无|没有|尚未(?:出现|发生)?)(?:任何)?(?:白天|白昼|日间|首日|第一天)?(?:发言|站边|票型|归票|信息)|不(?:得|可|能|应)?(?:参考|使用|依赖)(?:(?:任何)?(?:白天|白昼|日间|首日|第一天)(?:发言|站边|票型|归票|信息)|(?:玩家)?发言风格)|(?:白天|白昼|日间|首日|第一天)(?:发言|站边|票型|归票|信息)(?:尚无|暂无|尚未(?:出现|发生)|不可用|不能使用)/gi;
771
771
  var RELATIVE_FUTURE_BEHAVIOR_LANGUAGE = new RegExp(
772
- `(?:(?:\u540E\u7F6E\u4F4D|\u5176\u4ED6\u73A9\u5BB6)[^\u3002\uFF1B\uFF0C,!\uFF01]{0,10}(?:\u968F\u540E|\u4E4B\u540E|\u5C06\u4F1A?|\u7A0D\u540E)|\u5929\u4EAE(?:\u540E|\u4E4B\u540E)|\u6B21\u65E5|\u4E0B\u4E00(?:\u5929|\u8F6E|\u4E2A\u767D\u5929))[^\u3002\uFF1B\uFF0C,!\uFF01]{0,20}(?:${BEHAVIOR_TERMS})`,
772
+ `(?:(?:\u540E\u7F6E\u4F4D|\u5176\u4ED6\u73A9\u5BB6)[^\u3002\uFF1B\uFF0C,!\uFF01]{0,10}(?:\u968F\u540E|\u4E4B\u540E|\u5C06\u4F1A?|\u7A0D\u540E)|\u5929\u4EAE(?:\u540E|\u4E4B\u540E)|\u6B21\u65E5|\u660E\u5929|\u660E\u65E5|\u4E0B\u4E2A(?:\u5929|\u56DE\u5408|\u8F6E|\u767D\u5929|\u591C\u665A)|\u4E0B\u4E00(?:\u5929|\u56DE\u5408|\u8F6E|\u4E2A\u767D\u5929|\u591C|\u591C\u665A))[^\u3002\uFF1B\uFF0C,!\uFF01]{0,20}(?:${BEHAVIOR_TERMS})`,
773
773
  "i"
774
774
  );
775
- var ABSOLUTE_DAY_BEHAVIOR_LANGUAGE = new RegExp(`\u7B2C([0-9\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u5341]+)\u5929[^\u3002\uFF1B\uFF0C,!\uFF01]{0,24}(?:${BEHAVIOR_TERMS})`, "gi");
775
+ var ABSOLUTE_DAY_BEHAVIOR_LANGUAGE = new RegExp(`(?:\u7B2C([0-9\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u5341]+)|([\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u5341]+))\\s*(?:\u5929|\u8F6E|\u56DE\u5408|\u591C|\u591C\u665A)[^\u3002\uFF1B\uFF0C,!\uFF01]{0,24}(?:${BEHAVIOR_TERMS})`, "gi");
776
776
  var BEHAVIOR_OCCURRENCE_LANGUAGE = new RegExp(`(?:${BEHAVIOR_TERMS})`, "i");
777
777
  var PAST_BEHAVIOR_LANGUAGE = new RegExp(`(?:\u6B64\u524D|\u4E4B\u524D|\u66FE\u7ECF|\u8FC7\u53BB|\u4E0A\u4E00\u8F6E|\u4E0A\u4E00\u591C|\u6628\u591C)|\u5DF2\u7ECF(?!\u51B3\u5B9A)[^\u3002\uFF1B\uFF0C,!\uFF01]{0,4}(?:${BEHAVIOR_TERMS})`, "i");
778
778
  var CURRENT_ACTOR_ACTION_LANGUAGE = /(?:当前|本次|此时|轮到|发言时|投票时|行动时|查验时|已经决定|正在|正要|准备|计划|将要)/i;
@@ -786,7 +786,7 @@ var BEHAVIOR_GROUPS = [
786
786
  /(?:甩锅|推责|责任推|把责任)/i,
787
787
  /(?:站边|支持|认好|认狼|side with|support)/i,
788
788
  /(?:质疑|怀疑|攻击|踩人|question|suspect|attack)/i,
789
- /(?:对跳|起跳|悍跳|拍身份|公开身份|role claim|claim(?:ed)? (?:seer|witch|hunter))/i,
789
+ /(?:对跳|起跳|悍跳|拍身份|公开身份|自称|声称|(?:公开|跳)(?:预言家|女巫|猎人)|role claim|claim(?:ed)? (?:seer|witch|hunter))/i,
790
790
  /(?:倒钩)/i,
791
791
  /(?:查杀)/i,
792
792
  /(?:保人|金水)/i,
@@ -903,9 +903,13 @@ function factSupportsBehaviorClaim(fact, claim) {
903
903
  return false;
904
904
  }
905
905
  const groups = BEHAVIOR_GROUPS.filter((pattern) => pattern.test(claim));
906
+ const isCompletedVoteClaim = /(?:投票|投给|投到|票投|出票)/i.test(claim) && claimedTarget !== void 0;
907
+ if (isCompletedVoteClaim) {
908
+ return VOTE_FACT_TYPES.has(fact.type) && (fact.targetSeat ?? behaviorTarget(summary)) === claimedTarget;
909
+ }
906
910
  if (groups.length > 0) {
907
- if (groups.some((pattern) => pattern.test(summary))) return true;
908
- return groups.some((pattern) => pattern === BEHAVIOR_GROUPS[0] && VOTE_FACT_TYPES.has(fact.type));
911
+ if (!SPEECH_FACT_TYPES.has(fact.type)) return false;
912
+ return groups.some((pattern) => pattern.test(summary));
909
913
  }
910
914
  if (/(?:发言|说法|内容)/i.test(claim) && SPEECH_FACT_TYPES.has(fact.type)) {
911
915
  const shortGenericClaim = semanticText(claim).length <= 6;
@@ -956,7 +960,7 @@ function dependsOnFutureBehavior(value, currentRound) {
956
960
  if (RELATIVE_FUTURE_BEHAVIOR_LANGUAGE.test(value)) return true;
957
961
  if (currentRound === void 0) return false;
958
962
  for (const match of value.matchAll(ABSOLUTE_DAY_BEHAVIOR_LANGUAGE)) {
959
- const referencedRound = chineseNumber(match[1]);
963
+ const referencedRound = chineseNumber(match[1] ?? match[2] ?? "");
960
964
  if (referencedRound !== void 0 && referencedRound > currentRound) return true;
961
965
  }
962
966
  return false;
@@ -3115,6 +3119,8 @@ var WerewolfEvolutionService = class {
3115
3119
  "- If alternativeActionType=DAY_VOTE, copy a legal seat from that window.availableTargetSeats, or send alternativeTargetSeat=null for explicit abstention. Do not omit the target for DAY_VOTE.",
3116
3120
  "- SELF must use a decisionWindow whose actorSeat equals eligibility.recipientSeat. OBSERVED and EXEMPLAR must use another actor's decisionWindow.",
3117
3121
  "- knownFactRefs must be earlier than the anchor and visible to the window actor; POSTGAME_ONLY is never known, SEAT_n_ONLY is visible only to that seat, and WOLF_TEAM is visible only to a wolf actor.",
3122
+ "- trigger, rule, boundary, and alternativeAction must depend only on information that already existed at the anchor and is supported by knownFactRefs; reject relative future wording such as tomorrow, next round, next day/night, or day/round N after the current anchor round.",
3123
+ "- A seat behavior claim must match actor, behavior category, explicit target, negation polarity, and event type. Completed votes require DAY_VOTE_SUBMIT/DAY_REVOTE_SUBMIT facts; role claims, stance, questions, and other speech behaviors require DAY_SPEAK/LAST_WORD/WOLF_SPEECH facts. When uncertain, reject rather than fail open.",
3118
3124
  "- outcomeFactRefs must be later than the anchor and include at least one local outcome fact whose type appears in localOutcomeFactTypes.",
3119
3125
  "- GAME_FINISHED, FINAL_IDENTITY, and GAME_RESULT are never local outcome facts and cannot be the only outcome evidence.",
3120
3126
  "- behavior must describe only what actually happened at the anchor; never copy rule or alternativeAction into behavior as if it occurred.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawtopia/werewolf-evolution",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Deterministic postgame evolution runtime for the Clawtopia Werewolf Play skill.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",