add history action

This commit is contained in:
bridge
2025-09-02 21:19:58 +08:00
parent 1f5c4032f5
commit 0f9f5f35f7
4 changed files with 18 additions and 5 deletions

View File

@@ -70,7 +70,7 @@ class RuleAI(AI):
else:
return "Cultivate", {}
else:
return "MoveToRegion", {"region": best_region}
return "MoveToRegion", {"region": best_region.name}
def get_best_region(self, regions: list[Region]) -> Region:
"""

View File

@@ -182,6 +182,12 @@ class Avatar:
def is_in_region(self, region: Region) -> bool:
return self.tile.region == region
def get_history_action_pairs_str(self) -> str:
"""
获取历史动作对的字符串
"""
return "\n".join([f"{action.__class__.__name__}: {action_params}" for action, action_params in self.history_action_pairs])
def get_new_avatar_from_ordinary(world: World, current_month_stamp: MonthStamp, name: str, age: Age):
"""
从凡人中来的新修士

View File

@@ -124,6 +124,7 @@ class Front:
elif event.key == pygame.K_SPACE:
self._step_once()
# 自动步进
if self._auto_step and self._last_step_ms >= self.step_interval_ms:
self._step_once()
@@ -423,10 +424,7 @@ class Front:
# 添加历史动作信息
lines.append("") # 空行分隔
lines.append("历史动作:")
for i, (action, params) in enumerate(avatar.history_action_pairs):
action_name = action.__class__.__name__
lines.append(f" {i+1}. {action_name}")
lines.extend(avatar.get_history_action_pairs_str().split("\n"))
self._draw_tooltip(lines, *self.pygame.mouse.get_pos(), self.tooltip_font)
def _draw_tooltip_for_region(self, region, mouse_x: int, mouse_y: int):

9
台本/vol1.txt Normal file
View File

@@ -0,0 +1,9 @@
标题党致歉
总得有人来做
目前的进度
鬼谷八荒
战斗——火焰纹章like
战棋类其实很适合表现花样很多的仙侠技能
更丰富,像矮人地牢
代码更灵活配表更好入门——怎么做trade off?
可以github点赞