Skip to content
Development
Skill

/godot-skill-upgrade

Godot 4技能与升级系统,支持JSON配置技能、解锁条件判断、升级触发逻辑、UI面板设计。

BOOST
From plugin
alphaagent
10419 skills
Install
$ npx -y skills add 925236118/AlphaAgent --skill godot-skill-upgrade --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/godot-skill-upgrade

Context preview

The summary Claude sees to decide when to auto-load this skill.

Godot 4技能与升级系统,支持JSON配置技能、解锁条件判断、升级触发逻辑、UI面板设计。

SKILL.md

godot-skill-upgrade.SKILL.md
name: godot-skill-upgrade
description: Godot 4技能与升级系统,支持JSON配置技能、解锁条件判断、升级触发逻辑、UI面板设计。

Godot 4 技能与升级系统

完整的技能系统和升级机制,支持JSON配置、技能解锁条件、升级树、经验值系统。

何时使用此技能

  • 实现玩家技能树
  • 角色升级系统
  • 技能解锁与前置条件
  • 天赋点/技能点系统

技能配置格式

JSON技能配置

{
    "skills": [
        {
            "id": "fireball",
            "name": "火球术",
            "description": "发射一个火球攻击敌人",
            "icon": "res://icons/fireball.png",
            "type": "attack",
            "cost": {
                "mana": 30,
                "cooldown": 2.0
            },
            "unlock": {
                "level_required": 3,
                "skill_required": null,
                "item_required": null
            },
            "upgrade_levels": [
                {
                    "level": 1,
                    "damage": 50,
                    "range": 10.0
                },
                {
                    "level": 2,
                    "damage": 75,
                    "range": 12.0
                },
                {
                    "level": 3,
                    "damage": 100,
                    "range": 15.0
                }
            ]
        },
        {
            "id": "fire_mastery",
            "name": "火焰精通",
            "description": "火焰技能伤害提升15%",
            "icon": "res://icons/fire_mastery.png",
            "type": "passive",
            "cost": {
                "skill_points": 1
            },
            "unlock": {
                "level_required": 5,
                "skill_required": "fireball",
                "item_required": null
            },
            "upgrade_levels": [
                {
                    "level": 1,
                    "damage_bonus": 0.15
                },
                {
                    "level": 2,
                    "damage_bonus": 0.25
                }
            ]
        }
    ]
}

技能数据结构

# skill_data.gd
class_name SkillData
extends Resource

## 技能唯一标识符
@export var id: StringName

## 技能显示名称
@export var skill_name: String

## 技能描述
@export_multiline var description: String

## 技能图标路径
@export var icon_path: String

## 技能类型
@export_enum("Attack", "Defense", "Support", "Passive", "Ultimate") var skill_type: int = 0

## 消耗
@export var mana_cost: float = 0.0
@export var cooldown: float = 0.0
@export var skill_points_cost: int = 0

## 解锁条件
@export var level_required: int = 1
@export var skill_required: StringName  # 前置技能ID
@export var item_required: StringName   # 所需物品ID

## 升级配置
@export var upgrade_levels: Array[Dictionary] = []

## 最大等级
var max_level: int:
    get: return upgrade_levels.size()

func get_upgrade_data(level: int) -> Dictionary:
    if level <= 0 or level > max_level:
        return {}
    return upgrade_levels[level - 1]

func can_unlock(player_level: int, unlocked_skills: Array, owned_items: Array) -> bool:
    # 检查等级
    if player_level < level_required:
        return false
    
    # 检查前置技能
    if skill_required != null and not skill_required in unlocked_skills:
        return false
    
    return true

解锁条件判断

解锁条件系统

# unlock_condition.gd
class_name UnlockCondition
extends RefCounted

enum ConditionType { LEVEL, SKILL, ITEM, QUEST }

var condition_type: ConditionType
var required_value: Variant

func _init(type: ConditionType, value: Variant) -> void:
    condition_type = type
    required_value = value

static func level_required(level: int) -> UnlockCondition:
    return UnlockCondition.new(ConditionType.LEVEL, level)

static func skill_required(skill_id: StringName) -> UnlockCondition:
    return UnlockCondition.new(ConditionType.SKILL, skill_id)

static func item_required(item_id: StringName) -> UnlockCondition:
    return UnlockCondition.new(ConditionType.ITEM, item_id)

func check(player: Player) -> bool:
    match condition_type:
        ConditionType.LEVEL:
            return player.level >= required_value
        ConditionType.SKILL:
            return player.skills.has(required_value)
        ConditionType.ITEM:
            return player.inventory.has_item(required_value)
    return false

技能解锁管理器

# skill_unlock_manager.gd
class_name SkillUnlockManager
extends Node

## 可用技能列表
var available_skills: Array[SkillData] = []

## 已解锁技能字典
var unlocked_skills: Dictionary = {}

## 信号:技能解锁
signal skill_unlocked(skill_id: StringName)

## 信号:解锁条件变化
signal unlock_conditions_changed

func _ready() -> void:
    pass

func load_skills_from_json(json_path: String) -> void:
    var file := FileAccess.open(json_path, FileAccess.READ)
    if file == null:
        push_error("无法加载技能配置: ", json_path)
        return
    
    var json_str := file.get_as_text()
    file.close()
    
    var json := JSON.parse_string(json_str)
    if json == null or not json.has("skills"):
        return
    
    for skill_json in json.skills:
        var skill := _create_skill_data(skill_json)
        available_skills.append(skill)

func _create_skill_data(data: Dictionary) -> SkillData:
    var skill := SkillData.new()
    skill.id = data.get("id", "")
    skill.skill_name = data.get("name", "")
    skill.description = data.get("description", "")
    skill.icon_path = data.get("icon", "")
    skill.skill_type = data.get("type", "attack")
    skill.mana_cost = data.get("cost", {}).get("mana", 0)
    skill.cooldown = data.get("cost", {}).get("cooldown", 0)
    skill.skill_points_cost = data.get("cost", {}).get("skill_points", 0)
    skill.level_required = data.get("unlock", {}).get("level_required", 1)
    skill.skill_required = data.get("unlock", {}).get("skill_required")
    skill.item_required = data.get("unlock", {}).get("item_required")
    skill.upgrade_levels = data.get("upgrade_levels", [])
    
    return skill

func try_unlock_skill(skill_id: StringName, player: Player) -> bool:
    var skill := _get_skill_by_id(skill_id)
    if skill == null:
        return false
    
    # 检查是否已解锁
    if unlocked_skills.has(skill_id):
        return false
    
    # 检查解锁条件
    if
Read more
Ships withalphaagent

为Godot引擎编辑器开发的Ai Agent插件

Get the whole plugin

Other skills on alphaagent.

godot-tscn-format
Skill

godot-tscn-format

Godot 4.x .tscn 场景文件纯文本格式规范与 AI 操作指南 — 文件结构、资源引用、 Transform 变换、属性值格式、信号连接,以及 AI 直接读写 .tscn 文件的操作方法。