refactor relation add and cancel

This commit is contained in:
bridge
2025-12-20 20:30:30 +08:00
parent 3d117c2fb2
commit 8fb81c3473
12 changed files with 288 additions and 53 deletions

View File

@@ -4,6 +4,7 @@ Avatar 核心类
精简后的 Avatar 类,通过 Mixin 组合完整功能。
"""
import random
from collections import defaultdict
from dataclasses import dataclass, field
from enum import Enum
from typing import Optional, List, TYPE_CHECKING
@@ -119,6 +120,9 @@ class Avatar(
known_regions: set[int] = field(default_factory=set)
# 关系交互计数器: key=target_id, value={"count": 0, "checked_times": 0}
relation_interaction_states: dict[str, dict[str, int]] = field(default_factory=lambda: defaultdict(lambda: {"count": 0, "checked_times": 0}))
# ========== 宗门相关 ==========
def join_sect(self, sect: Sect, rank: "SectRank") -> None: