pet_data/README.md

140 lines
2.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 虛擬寵物系統 - Nuxt 版本
基於 PRD v2.1 的資料驅動虛擬寵物系統支援事件觸發、Buff 管理、神明系統等核心功能。
## 🚀 快速開始
### 安裝依賴
```bash
npm install
```
### 啟動開發伺服器
```bash
npm run dev
```
### 使用 Console 互動版
1. 訪問:`http://localhost:3000/console-demo.html`
2. 打開瀏覽器開發者工具F12
3. 在 Console 中輸入命令,例如:
- `help()` - 查看所有命令
- `showStatus()` - 顯示寵物狀態
- `start()` - 啟動遊戲循環
- `feed(20)` - 餵食
- `play(15)` - 玩耍
- `pray()` - 祈福
詳細使用說明請參考 [docs/USAGE.md](./docs/USAGE.md)
## 📁 專案結構
- `data/` - 資料配置(寵物種族、神明、事件、道具、籤詩)
- `core/` - 核心系統API 服務、寵物系統、事件系統、神明系統)
- `console-demo.js` - Console 互動介面
- `public/console-demo.html` - 瀏覽器版本
- `docs/` - 文檔API 結構、使用說明)
## 🔌 API 整合
系統支援 Mock 和真實 API 切換:
- **Mock 模式**(預設):資料儲存在 localStorage
- **真實 API**:修改 `console-demo.js` 中的 `useMock: false`
API 端點結構詳見 [docs/API_STRUCTURE.md](./docs/API_STRUCTURE.md)
## 📚 文檔
- [使用說明](./docs/USAGE.md) - 完整的使用指南和命令列表
- [API 結構](./docs/API_STRUCTURE.md) - API 端點設計文檔
## 🎮 核心功能
- ✅ 寵物狀態管理(飢餓、快樂、健康等)
- ✅ Tick 循環系統(每 3 秒)
- ✅ 事件系統資料驅動10% 機率觸發)
- ✅ Buff 系統flat + percent 加成)
- ✅ 神明系統5 位神明,祈福、抽籤)
- ✅ API 服務層(支援 mock/real 切換)
- ✅ Console 互動介面
## 🛠️ 開發
Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
## Setup
Make sure to install dependencies:
```bash
# npm
npm install
# pnpm
pnpm install
# yarn
yarn install
# bun
bun install
```
## Development Server
Start the development server on `http://localhost:3000`:
```bash
# npm
npm run dev
# pnpm
pnpm dev
# yarn
yarn dev
# bun
bun run dev
```
## Production
Build the application for production:
```bash
# npm
npm run build
# pnpm
pnpm build
# yarn
yarn build
# bun
bun run build
```
Locally preview production build:
```bash
# npm
npm run preview
# pnpm
pnpm preview
# yarn
yarn preview
# bun
bun run preview
```
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.