add occupy action
This commit is contained in:
@@ -82,7 +82,7 @@ class MoveToDirection(DefineAction, ActualActionMixin):
|
||||
self.start_monthstamp = self.world.month_stamp
|
||||
self.direction = direction
|
||||
direction_cn = Direction.get_cn_name(direction)
|
||||
return Event(self.world.month_stamp, f"{self.avatar.name} 开始向{direction_cn}方探索未知区域", related_avatars=[self.avatar.id])
|
||||
return Event(self.world.month_stamp, f"{self.avatar.name} 开始向{direction_cn}方移动", related_avatars=[self.avatar.id])
|
||||
|
||||
def step(self, direction: str) -> ActionResult:
|
||||
# 确保方向已设置
|
||||
@@ -108,7 +108,7 @@ class MoveToDirection(DefineAction, ActualActionMixin):
|
||||
|
||||
async def finish(self, direction: str) -> list[Event]:
|
||||
direction_cn = Direction.get_cn_name(direction)
|
||||
return [Event(self.world.month_stamp, f"{self.avatar.name} 结束了向{direction_cn}方的探索", related_avatars=[self.avatar.id])]
|
||||
return [Event(self.world.month_stamp, f"{self.avatar.name} 结束了向{direction_cn}方的移动", related_avatars=[self.avatar.id])]
|
||||
|
||||
def _execute(self, *args, **kwargs):
|
||||
pass
|
||||
@@ -101,7 +101,7 @@ class Region(ABC):
|
||||
}
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(eq=False)
|
||||
class NormalRegion(Region):
|
||||
"""普通区域"""
|
||||
animal_ids: list[int] = field(default_factory=list)
|
||||
@@ -171,7 +171,7 @@ class NormalRegion(Region):
|
||||
return info
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(eq=False)
|
||||
class CultivateRegion(Region):
|
||||
"""修炼区域"""
|
||||
essence_type: EssenceType = EssenceType.GOLD # 默认值避免 dataclass 继承错误
|
||||
@@ -225,7 +225,7 @@ class CultivateRegion(Region):
|
||||
return info
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(eq=False)
|
||||
class CityRegion(Region):
|
||||
"""城市区域"""
|
||||
def get_region_type(self) -> str:
|
||||
|
||||
@@ -4,7 +4,7 @@ from pathlib import Path
|
||||
from src.classes.region import Region
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(eq=False)
|
||||
class SectRegion(Region):
|
||||
"""
|
||||
宗门总部区域:仅用于显示宗门总部的名称与描述。
|
||||
|
||||
@@ -87,7 +87,7 @@ class Simulator:
|
||||
# 记录事件
|
||||
event = Event(
|
||||
self.world.month_stamp,
|
||||
f"路过 {region.name},发现无主,将其占据。",
|
||||
f"{avatar.name} 路过 {region.name},发现无主,将其占据。",
|
||||
related_avatars=[avatar.id]
|
||||
)
|
||||
avatar.add_event(event)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { ref } from 'vue';
|
||||
import type { RegionDetail, EffectEntity } from '@/types/core';
|
||||
import EntityRow from './components/EntityRow.vue';
|
||||
import RelationRow from './components/RelationRow.vue';
|
||||
import SecondaryPopup from './components/SecondaryPopup.vue';
|
||||
import { useUiStore } from '@/stores/ui';
|
||||
|
||||
@@ -21,6 +22,10 @@ function showDetail(item: EffectEntity | undefined) {
|
||||
function jumpToSect(id: number) {
|
||||
uiStore.select('sect', id.toString());
|
||||
}
|
||||
|
||||
function jumpToAvatar(id: string) {
|
||||
uiStore.select('avatar', id);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -49,6 +54,18 @@ function jumpToSect(id: number) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Host (洞府主人) -->
|
||||
<div class="section" v-if="data.type === 'cultivate'">
|
||||
<div class="section-title">洞府主人</div>
|
||||
<RelationRow
|
||||
v-if="data.host"
|
||||
:name="data.host.name"
|
||||
meta="主人"
|
||||
@click="jumpToAvatar(data.host.id)"
|
||||
/>
|
||||
<div v-else class="empty-hint">无主(可占据)</div>
|
||||
</div>
|
||||
|
||||
<!-- Animals -->
|
||||
<div class="section" v-if="data.animals?.length">
|
||||
<div class="section-title">动物分布</div>
|
||||
@@ -115,6 +132,12 @@ function jumpToSect(id: number) {
|
||||
color: #88fdc4;
|
||||
}
|
||||
|
||||
.empty-hint {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -143,6 +143,12 @@ export interface RegionDetail extends EntityBase {
|
||||
density: number;
|
||||
};
|
||||
|
||||
// 洞府主人(修炼区域特有)
|
||||
host?: {
|
||||
id: string;
|
||||
name: string;
|
||||
} | null;
|
||||
|
||||
animals: EffectEntity[];
|
||||
plants: EffectEntity[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user