返回顶部
m

mud-adventure泥巴冒险助手

文字冒险型 MUD 游戏创作助手。用于快速搭建文字冒险游戏的世界观、地图、NPC、物品、任务与对话树。当用户说"做 MUD"、"写文字冒险"、"创建mud游戏"、"搭建mud世界"时触发。

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
106
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

mud-adventure

MUD 冒险技能

文字冒险型 MUD 游戏创作技能包。帮你从零构建可运行的单文件 Python MUD 游戏。

快速开始

游戏核心只需一个 Python 文件(game.py),运行方式:

bash
python game.py

首次使用,按以下流程构建游戏:

世界观设计 → 地图建模 → 人物/物品 → 对话/任务 → 合并到 game.py

详细设计指南见 references/world-design.md(世界观、故事结构)
详细系统指南见 references/game-systems.md(战斗、物品、任务)
示例代码见 references/examples.md

默认游戏模板

以下模板可直接复制到 game.py 运行,内含 3 个房间、1 个 NPC、1 个战斗场景:

python
import random

============ 世界设定 ============

TITLE = 迷雾森林 AUTHOR = 石头龙虾二号

============ 房间定义 ============

rooms = { 入口: { name: 森林入口, desc: 你站在一棵巨大的古橡树下,晨雾弥漫,四周静得只能听见自己的呼吸。, exits: {北: 大厅, 东: 小屋}, items: [], npcs: [], }, 大厅: { name: 迷雾大厅, desc: 雾气中隐约可见一座石制大厅,墙壁上刻着模糊的文字。, exits: {南: 入口, 北: 宝藏室}, items: [古老的钥匙], npcs: [守卫], }, 小屋: { name: 林间小屋, desc: 一间破旧的小木屋,窗户透出微弱的烛光。, exits: {西: 入口}, items: [治疗药水], npcs: [隐士], }, 宝藏室: { name: 隐藏宝藏室, desc: 你推开门,金光闪闪的宝物堆满了整个房间!, exits: {南: 大厅}, items: [黄金剑], npcs: [], locked: True, }, }

============ NPC 定义 ============

npcs = { 守卫: { name: 石甲守卫, desc: 一个身披石甲的沉默战士,目光警惕地盯着你。, hp: 30, attack: 8, dialogue: { 你好: 守卫冷哼一声:想过去?先证明你的实力!, 挑战: 守卫举起巨剑:那就来吧!, 离开: 守卫退回阴影中,不再说话。, }, hostile: True, }, 隐士: { name: 森林隐士, desc: 一位白发苍苍的老人,正对着烛火沉思。, hp: 20, attack: 0, dialogue: { 你好: 隐士微微一笑:旅人,这片森林藏着许多秘密。, 帮助: 隐士点点头:在大厅的墙壁上,有打开宝藏室的提示。, 离开: 隐士挥挥手:愿森林保佑你。, }, hostile: False, }, }

============ 物品定义 ============

items = { 古老的钥匙: {name: 古老的钥匙, desc: 一把生锈但依然坚固的钥匙。, effect: None}, 治疗药水: {name: 治疗药水, desc: 散发淡蓝色光芒的恢复药剂。, effect: heal}, 黄金剑: {name: 黄金剑, desc: 传说中的宝剑,剑身流淌着金色的光芒。, effect: power}, }

============ 玩家状态 ============

player = { hp: 100, max_hp: 100, attack: 10, inventory: [], location: 入口, flags: {大厅_交谈过: False, 击败守卫: False}, }

============ 核心函数 ============

def print_intro(): print(f\n{=*50}) print(f 🎮 {TITLE}) print(f 作者:{AUTHOR}) print(f{=*50}\n) print(输入 help 查看所有命令。\n)

def show_room():
room = rooms[player[location]]
locked_msg = [门被锁住了] if room.get(locked) and not player[flags].get(有钥匙) else
print(f\n📍 【{room[name]}】{locked_msg})
print(f {room[desc]})
exits = 、.join(room[exits].keys())
print(f 出口:{exits})
if room.get(items):
print(f 物品:{, .join(room[items])})
if room.get(npcs):
print(f NPC:{, .join(room[npcs])})

def show_help():
print(
help - 显示此帮助
look - 环顾四周
go <方向> - 向指定方向移动(北/南/东/西/前/后)
look <物品>- 查看物品
take <物品> - 拾取物品
inventory - 查看背包
use <物品> - 使用物品
talk - 与NPC交谈
attack - 攻击敌人
status - 查看角色状态
quit - 退出游戏
)

def move(direction):
room = rooms[player[location]]
if direction not in room[exits]:
print( 你无法往那个方向走。)
return
target = room[exits][direction]
if rooms[target].get(locked) and not player[flags].get(有钥匙):
print(f {rooms[target][name]}的门是锁着的。你需要找到钥匙。)
return
player[location] = target
show_room()

def takeitem(itemname):
room = rooms[player[location]]
for i, item in enumerate(room.get(items, [])):
if itemname in item or item in itemname:
player[inventory].append(item)
room[items].pop(i)
if item == 古老的钥匙:
player[flags][有钥匙] = True
print(f 你拾取了「{item}」。)
return
print( 这里没有这个东西。)

def useitem(itemname):
for i, item in enumerate(player[inventory]):
if itemname in item or item in itemname:
if items[item][effect] == heal:
heal = min(30, player[max_hp] - player[hp])
player[hp] += heal
player[inventory].pop(i)
print(f 你喝下了「{item}」,恢复了 {heal} 点生命!)
elif items[item][effect] == power:
player[attack] += 5
player[inventory].pop(i)
print(f 你装备了「{item}」,攻击力提升!)
else:
print(f 你使用了「{item}」。)
return
print( 你的背包里没有这个东西。)

def talk_to(target):
room = rooms[player[location]]
if target not in room.get(npcs, []):
print( 这里没有这个人。)
return
npc = npcs[target]
print(f\n 👤 {npc[name]}:{npc[desc]})
print(\n 你想说什么?(输入选项前的关键词))
for key in npc[dialogue]:
print(f - {key})
choice = input(\n > ).strip()
if choice in npc[dialogue]:
print(f\n {npc[dialogue][choice]})
if choice == 帮助 and target == 隐士:
player[flags][大厅_交谈过] = True
else:
print( 对方没有回应……)

def combat(enemy_id):
if enemy_id not in npcs:
print( 这里没有这个敌人。)
return
enemy = npcs[enemy_id]
print(f\n ⚔️ 你向 {enemy[name]} 发起了战斗!)
while enemy[hp] > 0 and player[hp] > 0:
dmgtoenemy = random.randint(max(1, player[attack]-3), player[attack]+3)
enemy[hp] -= dmgtoenemy
print(f 你造成了 {

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 mud-adventure-1776027682 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 mud-adventure-1776027682 技能

通过命令行安装

skillhub install mud-adventure-1776027682

下载

⬇ 下载 mud-adventure v1.0.0(免费)

文件大小: 11.21 KB | 发布时间: 2026-4-13 11:07

v1.0.0 最新 2026-4-13 11:07
Initial release: Gu Long style wuxia MUD game builder with world design guide, game systems reference, and playable template.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部