refactor(fight): 统一战斗系统方法命名规范并优化逻辑 - 将所有下划线命名的方法统一为驼峰命名,如 Turn_Start 改为 TurnStart, Action_end_ex 改为 ActionEndEx,Turn_End 改为 TurnEnd - 新增 IsOwner() 方法用于判断当前精灵是否为场上的当前宠物 - 将硬编码的 CatchTime 比较逻辑替换为 IsOwner() 方法调用 - 在 NewSel408 中实现消除对手能力强化效果的具体逻辑 - 修复 effect_74 中衰弱状态的数值引用,使用枚举类型代替硬编码 - 优化 input/fight.go 中的技能选择逻辑,使用伤害值比较代替权重比较 - 移除 shiny.go 中未使用的 utils 导入和相关逻辑 - 修正 NewSel77 从 Turn_End 重命名为 TurnStart 的方法 - 在 input/fight.go 中添加 Damage 方法的注释说明 ```
42 lines
1.0 KiB
Go
42 lines
1.0 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/logic/service/fight/input"
|
||
)
|
||
|
||
// 409. 致命一击时,n%几率令对手进入某一种异常状态(a1: n, a2: 异常状态类型)
|
||
// TODO: 需要了解如何判断致命一击
|
||
type NewSel409 struct {
|
||
NewSel0
|
||
}
|
||
|
||
func (e *NewSel409) ActionEndEx() bool {
|
||
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
|
||
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
|
||
return true
|
||
}
|
||
|
||
// TODO: 检查是否是致命一击
|
||
// 目前没有找到相应的API,可能需要在Ctx或其他地方添加isCrit标记
|
||
|
||
// n%几率触发
|
||
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
||
if !success {
|
||
return true
|
||
}
|
||
|
||
// 获取状态效果实例并设置参数
|
||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
|
||
if statusEffect == nil {
|
||
return true
|
||
}
|
||
|
||
// 给对手添加状态
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Opp, statusEffect)
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.NewSel, 409, &NewSel409{})
|
||
}
|