本文へ移動
cccskills
無料GitHub で公開

godot-rpg-stats

Expert blueprint for RPG stat systems (attributes, leveling, modifiers, damage formulas) using Resource-based stats, stackable modifiers, and derived stat calculations. Use when implementing character progression OR equipment/buff systems. Keywords stats, attributes, leveling, modifiers, CharacterStats, derived stats, damage calculation, XP.

インストール方法を見る

含まれるファイル(18)

  • SKILL.md12.1 KB
  • references/elite-stat-patterns.md2.8 KB
  • references/migration-notes.md2.5 KB
  • scripts/base_stats_resource.gd1.5 KB
  • scripts/damage_formula_handler.gd1.3 KB
  • scripts/derived_stat_resource.gd555 B
  • scripts/dynamic_stat_label_sync.gd1.3 KB
  • scripts/equipment_tooltip_helper.gd780 B
  • scripts/exp_progression_resource.gd1.1 KB
  • scripts/level_up_system.gd1.4 KB
  • scripts/modifier_stack_stats.gd2.6 KB
  • scripts/persistent_character_stats.gd1.3 KB
  • scripts/resource_stat_inheritance.gd1.2 KB
  • scripts/rpg_stat_resource.gd376 B
  • scripts/stat_modifier_stacking.gd1.2 KB
  • scripts/stat_resource.gd2.9 KB
  • scripts/stats_component_reactive.gd2.0 KB
  • scripts/status_effect_data.gd1.4 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Available Scripts

MANDATORY by scenario — read before implementing:

base_stats_resource.gd

Core data container for base attributes (Str, Dex, Int) and derived scaling rules.

status_effect_data.gd

Serialized buff/debuff definition using StatusEffectData.Type { ADDITIVE, MULTIPLICATIVE, OVERRIDE }.

stats_component_reactive.gd

Orchestrator for JIT (Just-In-Time) stat calculation with active modifier stacking.

exp_progression_resource.gd

Data-driven level-up curve definition using growth factors and base XP.

dynamic_stat_label_sync.gd

Reactive UI hook for syncing Labels to stat changes without polling.

damage_formula_handler.gd

Centralized RefCounted utility for complex combat math and damage calculations.

stat_modifier_stacking.gd

Logic for handling unique vs. stackable buffs and refreshing durations.

resource_stat_inheritance.gd

Pattern for extending base stats with specialized attributes (Elemental Resists).

persistent_character_stats.gd

Managing the serialization of character progression to .tres files.

level_up_system.gd

Logic for awarding experience and triggering level-up benefits.

rpg_stat_resource.gd

Capped base stat Resource with setter clamps + stat_changed signal.

derived_stat_resource.gd

Derived stat that recalculates when base stat dependencies change.

equipment_tooltip_helper.gd

BBCode equipment comparison tooltips (_make_custom_tooltip).

NEVER Do in RPG Stats

  • NEVER use integers for percentages — Always use float (0.0–1.0 or 0.0–100.0) to avoid truncation.
  • NEVER modify current_health without emitting signals — UI desyncs without broadcasts.
  • NEVER rely solely on additive modifiers — Use multiplicative or hybrid scaling for long progressions.
  • NEVER add modifiers without a unique ID or Key — Required to remove specific effects.
  • NEVER use exponential XP formulas without a growth cap — Uncapped pow() overflows or soft-locks levels.
  • NEVER forget to clamp derived values — Negative vitality must not yield negative max HP (maxi(val, 1)).
  • NEVER perform heavy stat recalculations in _process() — Recalc only on modifier/base change (reactive).
  • NEVER hardcode stat names in logic — Use StringNames or enums.
  • NEVER store temporary runtime buffs in a permanent Save Resource — Strip short-duration modifiers before serialize.
  • NEVER calculate damage directly in the Character script — Centralize in damage_formula_handler.gd.
  • NEVER invent Dictionary-only modifier APIs in examples — Align with StatusEffectData.Type and the stacking scripts.

Decision Tree

LayerResponsibilityScript
Resource templateDesigner-authored base attributes, curves, inheritancebase_stats_resource.gd, exp_progression_resource.gd, resource_stat_inheritance.gd
Runtime StatsComponentDuplicate/instance template, apply/remove modifiers, emit signals, JIT derived statsMANDATORY stats_component_reactive.gd + stat_modifier_stacking.gd
StatusEffectDataTyped buff rows (ADDITIVE / MULTIPLICATIVE / OVERRIDE)status_effect_data.gd
DamageFormula (RefCounted)Pure combat math shared by Player/NPCMANDATORY damage_formula_handler.gd
PersistenceSave progression; strip runtime buffs firstpersistent_character_stats.gd
UI syncLabels listen to signals — no pollingdynamic_stat_label_sync.gd

Do not paste beginner class_name Stats / Dictionary equipment tutorials — route to the scripts above.


API alignment (StatusEffectData)

# Author buffs as Resources — not ad-hoc Dictionary modifiers
var haste := StatusEffectData.new()
haste.name = "Haste"
haste.type = StatusEffectData.Type.MULTIPLICATIVE
haste.attribute = "speed"
haste.value = 1.25
haste.duration = 8.0

var flat_str := StatusEffectData.new()
flat_str.type = StatusEffectData.Type.ADDITIVE
flat_str.attribute = "strength"
flat_str.value = 5.0

var break_def := StatusEffectData.new()
break_def.type = StatusEffectData.Type.OVERRIDE
break_def.attribute = "defense"
break_def.value = 0.0

Stacking / refresh / unique-vs-stackable behavior: MANDATORY stat_modifier_stacking.gd. Apply through stats_component_reactive.gd so derived stats recalc once per change.


Elite reminders (script-backed)

  1. Caps — rpg_stat_resource.gd; clamp on setters; never allow overflow attributes.
  2. Dependency graphs — derived_stat_resource.gd; derived stats recalc from signals when bases change — never _process.
  3. Equipment — Register/remove modifier IDs on equip/unequip via stacking API; tooltips via equipment_tooltip_helper.gd.

Deep dive (load on demand)

Equipment hooks, damage formula, skill gates, elite cap/derived/tooltip patterns — references/elite-stat-patterns.md.

Reference

Progressive disclosure: open Official Documentation links only when researching a specific API; load Related Skills when routing to a peer domain — do not preload the whole lattice.

Official Documentation

  • Resources — why base stats, curves, and status effects belong on Resource templates you duplicate or instance per character.
  • Resource — duplicate(), resource_local_to_scene, and shared-vs-unique semantics that prevent every enemy sharing one HP Resource.
  • GDScript exported properties — @export / @export_group so designers tune attributes and scaling in the Inspector without code edits.
  • Using signals — stat_changed / stats_recalculated so UI and derived stats react without _process polling.
  • Saving games — serialize progression Resources and strip runtime-only buffs before write.
  • File paths in Godot projects — user:// vs res:// for persistent character .tres saves.
  • ResourceSaver — write character stats Resources to disk after level-ups.
  • ResourceLoader — exists / load paths when restoring progression on boot.
  • RefCounted — keep damage formulas and pure combat math off the scene tree.
  • Random number generation — seeded crit / variance rolls that stay reproducible in balance tests.
  • Label — bind text to signal-driven attribute refresh for HUD sync.
  • SceneTree — create_timer for timed buff expiry without a per-effect Node.

Related Skills

Prerequisites

Complements

Downstream / consumers

Master

  • godot-master — library router and mirrored module entry for cross-skill discovery.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Bevy ECS skill for 2D sprite animation. Keywords: Bevy, sprite, animation, AnimationPlayer, AnimationClip, 2D.

日本語の概要は準備中です。原文の説明を表示しています。

thedivergentai/Game-Design-Agentic-Skills8452026年10月13日 更新

Bevy ECS skill for 3D lights. Keywords: Bevy, lighting, directional, point, spot, bevy_light, PBR.

日本語の概要は準備中です。原文の説明を表示しています。

thedivergentai/Game-Design-Agentic-Skills8452026年10月13日 更新

Bevy ECS skill for PBR materials. Keywords: Bevy, StandardMaterial, PBR, material, ExtendedMaterial.

日本語の概要は準備中です。原文の説明を表示しています。

thedivergentai/Game-Design-Agentic-Skills8452026年10月13日 更新

Bevy ECS skill for 3D level assembly. Keywords: Bevy, level, scene, mesh, world, ECS.

日本語の概要は準備中です。原文の説明を表示しています。

thedivergentai/Game-Design-Agentic-Skills8452026年10月13日 更新

Bevy ECS skill for abilities. Keywords: Bevy, ability, cooldown, ECS, gameplay.

日本語の概要は準備中です。原文の説明を表示しています。

thedivergentai/Game-Design-Agentic-Skills8452026年10月13日 更新

Bevy ECS skill for moving a Bevy game from 2D to 3D. Keywords: Bevy, 2D, 3D, adapt, camera, sprite.

日本語の概要は準備中です。原文の説明を表示しています。

thedivergentai/Game-Design-Agentic-Skills8452026年10月13日 更新

thedivergentai のスキルをすべて見る

このスキルの問題を報告する