角色面板增强:技能槽位显示法术的计算方式和基础数值

新增功能:
- 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 <noreply@anthropic.com>
This commit is contained in:
hant 2025-12-04 23:11:49 +08:00
parent ab90eb8435
commit 911f814581
2 changed files with 65 additions and 10 deletions

View File

@ -412,20 +412,74 @@ class ItemDisplay
$lines = [];
if ($item) {
// 第一行:槽位名 + 装备名
$type = $item['type'] ?? '';
// 第一行:槽位名 + 装备/法术名
$lines[] = $linePrefix . self::$cyan . $slotName . self::$reset . ": " . self::formatName($item);
// 第二行:主属性
if ($type === 'spell') {
// 法术显示:计算方式和基础数值
$calcType = $item['calc_type'] ?? 'matk';
$spellType = $item['spellType'] ?? $item['type'] ?? 'unknown';
// 计算方式的完整描述
$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 . ": " .
self::$gray . "(空)" . self::$reset;

View File

@ -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;