From 911f814581a126e1247988473e53afac2d06ceed Mon Sep 17 00:00:00 2001 From: hant Date: Thu, 4 Dec 2025 23:11:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=92=E8=89=B2=E9=9D=A2=E6=9D=BF=E5=A2=9E?= =?UTF-8?q?=E5=BC=BA=EF=BC=9A=E6=8A=80=E8=83=BD=E6=A7=BD=E4=BD=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=B3=95=E6=9C=AF=E7=9A=84=E8=AE=A1=E7=AE=97=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E5=92=8C=E5=9F=BA=E7=A1=80=E6=95=B0=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增功能: - ItemDisplay.renderSlot: 增强支持法术物品显示 - 法术显示计算方式描述 - 法术显示品质相关的基础数值 - 法术显示消耗(含强化后的实际消耗) - 装备仍显示属性和词条(无改动) - StatsPanel 导入 SpellDisplay 以支持未来扩展 改进内容: - 角色面板技能栏显示法术的详细信息 - 显示14种计算方式的完整描述 - 显示伤害倍数或治疗系数(根据品质) - 显示强化前后的魔法消耗变化 - 保持与战斗系统显示的一致性 显示格式示例: [技能1] 火球术 Lv.5 +2 计算: 基于魔攻 倍数: 2.0x 消耗: 20 → 16 [技能2] 恢复术 Lv.3 计算: 基于魔攻 治疗: 0.8x + 40 消耗: 15 🧙 Generated with Claude Code Co-Authored-By: Claude --- src/Core/ItemDisplay.php | 74 ++++++++++++++++++++++++++++++++------ src/Modules/StatsPanel.php | 1 + 2 files changed, 65 insertions(+), 10 deletions(-) diff --git a/src/Core/ItemDisplay.php b/src/Core/ItemDisplay.php index 91ffd14..09095c6 100644 --- a/src/Core/ItemDisplay.php +++ b/src/Core/ItemDisplay.php @@ -412,19 +412,73 @@ class ItemDisplay $lines = []; if ($item) { - // 第一行:槽位名 + 装备名 + $type = $item['type'] ?? ''; + + // 第一行:槽位名 + 装备/法术名 $lines[] = $linePrefix . self::$cyan . $slotName . self::$reset . ": " . self::formatName($item); - // 第二行:主属性 - $statsStr = self::formatStatsCompact($item); - if ($statsStr) { - $lines[] = $linePrefix . " " . $statsStr; - } + if ($type === 'spell') { + // 法术显示:计算方式和基础数值 + $calcType = $item['calc_type'] ?? 'matk'; + $spellType = $item['spellType'] ?? $item['type'] ?? 'unknown'; - // 第三行及之后:词条 - $affixes = $item['affixes'] ?? []; - foreach ($affixes as $affix) { - $lines[] = $linePrefix . " " . self::$yellow . "◆" . self::$reset . " " . $affix; + // 计算方式的完整描述 + $calcTypeDescMap = [ + 'matk' => '基于魔攻', + 'patk' => '基于物攻', + 'hybrid' => '混合伤害', + 'hp_percent' => '基于HP%', + 'crit_heal' => '暴击治疗', + 'crit_damage' => '暴击伤害', + 'defense' => '基于防御', + 'low_def_bonus' => '克低防', + 'matk_scaled' => '群体伤害', + 'dispersed_damage' => '分散伤害', + 'crit_aoe' => '暴击范围', + 'smart_heal' => '智能治疗', + 'hp_missing' => '缺血治疗', + 'team_sync' => '队伍同步', + ]; + + $calcDesc = $calcTypeDescMap[$calcType] ?? $calcType; + $lines[] = $linePrefix . " " . self::$white . "计算: " . self::$green . $calcDesc . self::$reset; + + // 显示基础数值 + if ($spellType === 'damage_single' || $spellType === 'damage_aoe') { + $damageRatio = $item['damage_ratio'] ?? [1.2, 1.6, 2.0, 2.6]; + $qualityIndex = self::getQualityIndex($item['quality'] ?? 'common'); + $ratio = $damageRatio[$qualityIndex] ?? 1.0; + $lines[] = $linePrefix . " " . self::$white . "倍数: " . self::$yellow . "{$ratio}x" . self::$reset; + } elseif ($spellType === 'heal_single' || $spellType === 'heal_aoe') { + $healRatio = $item['heal_ratio'] ?? [0.5, 0.8, 1.2, 1.8]; + $healBase = $item['heal_base'] ?? [20, 40, 70, 120]; + $qualityIndex = self::getQualityIndex($item['quality'] ?? 'common'); + $ratio = $healRatio[$qualityIndex] ?? 0.5; + $base = $healBase[$qualityIndex] ?? 20; + $lines[] = $linePrefix . " " . self::$white . "治疗: " . self::$yellow . "{$ratio}x + {$base}" . self::$reset; + } + + // 显示消耗 + $cost = $item['cost'] ?? 0; + $enhanceLevel = $item['enhanceLevel'] ?? 0; + $actualCost = max(1, $cost - ($enhanceLevel * 2)); + if ($enhanceLevel > 0) { + $lines[] = $linePrefix . " " . self::$white . "消耗: " . self::$yellow . "{$cost}" . self::$reset . " → " . self::$green . "{$actualCost}" . self::$reset; + } else { + $lines[] = $linePrefix . " " . self::$white . "消耗: " . self::$green . "{$actualCost}" . self::$reset; + } + } else { + // 装备显示:属性和词条 + $statsStr = self::formatStatsCompact($item); + if ($statsStr) { + $lines[] = $linePrefix . " " . $statsStr; + } + + // 词条 + $affixes = $item['affixes'] ?? []; + foreach ($affixes as $affix) { + $lines[] = $linePrefix . " " . self::$yellow . "◆" . self::$reset . " " . $affix; + } } } else { $lines[] = $linePrefix . self::$cyan . $slotName . self::$reset . ": " . diff --git a/src/Modules/StatsPanel.php b/src/Modules/StatsPanel.php index 016d258..8b705d6 100644 --- a/src/Modules/StatsPanel.php +++ b/src/Modules/StatsPanel.php @@ -6,6 +6,7 @@ use Game\Core\Game; use Game\Core\Screen; use Game\Core\Input; use Game\Core\ItemDisplay; +use Game\Core\SpellDisplay; use Game\Services\EquipmentEnhancer; use Game\Entities\Actor; use Game\Entities\Partner;