在挑战Boss逻辑中,新增对Boss怪物NewSeIdxs字段的解析,将其分割并转换为EffectInfo添加到宠物信息中。同时增加对PetList为空时的错误处理,返回精灵不存在错误码。 refactor(effect): 调整技能属性判断方式及方法命名 将部分战斗效果和技能实体中的Type()方法重命名为GetType(),统一接口调用方式,并修改属性类型比较逻辑,直接通过整型值进行判断,提升代码一致性与可维护性。 fix(xml): 补充地图Boss配置项Id字段 更新地图配置文件中Boss节点缺失的Id属性,确保Boss数据结构完整性和唯一标识正确加载。 chore(input): 增加技能实体非空检查防止panic 在输入处理模块中加入对SelectSkillAction.SkillEntity的空指针检查,避免因未初始化技能导致运行时异常。
47 lines
1.4 KiB
Go
47 lines
1.4 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/logic/service/fight/info"
|
||
"blazing/logic/service/fight/input"
|
||
)
|
||
|
||
// 6. 受到`普通属性'(128)伤害时以n%的概率使对方进入`异常状态'(仅一个异常状态)(a1: 异常状态类型, a2: 百分比)
|
||
// TODO: 实现受到`普通属性'(128)伤害时以n%的概率使对方进入`异常状态'(仅一个异常状态)(a1: 异常状态类型, a2: 百分比)的核心逻辑
|
||
type NewSel6 struct {
|
||
NewSel0
|
||
}
|
||
|
||
func (e *NewSel6) Damage_Lock_ex(t *info.DamageZone) bool {
|
||
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
|
||
if e.EffectIDCombiner.CatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
|
||
// 3. 概率判定(Args()[1]为触发概率)
|
||
success, _, _ := e.Input.Player.Roll(e.Args()[1], 100)
|
||
if !success {
|
||
return true
|
||
}
|
||
|
||
duration := int(e.Input.FightC.GetRand().Int31n(2)) // 默认随机 2~3 回合
|
||
duration++
|
||
// 5. 获取状态效果实例并设置参数
|
||
statusEffect := input.Geteffect(input.EffectType.Status, int(e.Args()[0]))
|
||
if statusEffect == nil {
|
||
return true
|
||
}
|
||
statusEffect.Duration(duration)
|
||
statusEffect.SetArgs(e.Ctx().Our) // 目标为对手
|
||
|
||
// 6. 给对手添加状态
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||
|
||
return true
|
||
}
|
||
func init() {
|
||
input.InitEffect(input.EffectType.NewSel, 6, &NewSel6{})
|
||
}
|