You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.9 KiB
2.9 KiB
需求:宝石装备与合成
状态:局外 UI / 存档 / 合成已实现;局内属性与技能已接入战斗。
背景
老项目武器功能改造为宝石:Weapon 表每行一颗宝石;部分宝石带 act_skill。宝石在局外宝石页镶嵌到金木水火土五行,装备后局内对应属性数字获得属性与技能。
配表
| 表 | 用途 |
|---|---|
Weapon |
宝石定义:type 1 通用 / 2~6 金木水火土;quality 0~5 与等级对应;itemid 道具;synthesisnumber 合成消耗本宝石数量;synthesisitem 合成目标 id 列表;attritubes / act_skill |
Item |
type=3 宝石道具;para 指向 Weapon.id |
镶嵌规则
- 每五行 4 槽(g1~g4)。
- 通用(
type=1)可装任意五行。 - 属性专属(
type=2~6)须type === elementType + 1(elementType 1~5 = 金木水火土),且每五行最多 1 颗专属。 - 目标槽有宝石:先卸再装(或交换)。
- 仓库拖到槽 = 装备;槽拖到仓库区 = 卸下。
拥有量
- 库存:
Item数量(Weapon.itemid)。 - 可用数 = 库存 − 已镶嵌数;仓库与合成只使用可用数。
存档
OtherDataType.ElementGem- 格式:
element|s0,s1,s2,s3#...(element=1~5,槽位宝石 id,0=空)
一键合成
- 每轮对当前可用数做快照,仅用快照计算可合成次数;本轮产出不参与本轮材料。
- 消耗
synthesisnumber个本宝石,产出 1 个目标:synthesisitem仅 1 个则取之,多个则随机取 1。 - 多轮直到无可合成。
- 弹窗展示:各宝石「合成后可用数 − 合成前可用数」中
delta > 0的条目。
UI 注意
- 仓库按页签展示,无「全部」、无滚动:
btn0~btn5→Weapon.type1~6(通用/金木水火土),默认通用。 - 仓库格分帧实例化进
ui_content(Layout 排布);交互为直接拖拽镶嵌/卸下。 - 仓库全量重建仅:打开页 / 切页签 / 一键合成。镶嵌成功只局部改数量与槽位;失败不刷列表。
- 仓库项
bg用宝石框大{quality};镶嵌位g1~g4仍用宝石框小。
局内(已接入)
五行数字上阵时(TowerLoadoutService.setupCombat):
- 本机玩家:
gg.gem.getElementSlots(Hero.herotype)读该五行最多 4 槽宝石。 - 每颗
attritubes写入该数字属性(多槽累加);刷新上阵前清除旧gem_modifier。 - 有
act_skill的宝石接到原有武器技能槽(主动 / 被动 / atk_buff);同五行多颗技能宝石时取品质更高者(配表异常时 warn)。 - AI 对手不读本机镶嵌。
attritubes 类型
| type | 含义 | 战斗写入 |
|---|---|---|
| 1 | 攻击万分比 | Attack Mul |
| 2 | 暴击万分比 | CritRate Add |
| 3 | 暴击伤害万分比 | CritDamage Add |
| 4 | 攻速万分比 | aspd_add |
| 5 | 伤害加成万分比 | dmg_mul |
实现:assets/script/battle/combat/GemBattleEffect.ts。