refactor(fight/effect): 统一效果初始化接口,重构效果类型管理并优化参数传递逻辑

This commit is contained in:
1
2025-09-24 16:36:32 +00:00
parent e909200799
commit 266a328159
14 changed files with 146 additions and 204 deletions

View File

@@ -25,16 +25,12 @@ func (this *Effect0) UseSkill(opp *input.Input) bool {
func (e *Effect0) TurnEnd(opp *input.Input) {
e.Input.AttackValue.RemainHp = int32(e.Input.CurrentPet.Info.Hp)
// ret.FAttack.LostHp = uint32(f.First.GetDamageEffect(0).Stack()) //先手方造成血量
//opp.AttackValue.RemainHp = int32(opp.CurrentPet.Info.Hp)
//ret.SAttack.LostHp = uint32(f.Second.GetDamageEffect(0).Stack()) //后手方造成血量
}
// 使用技能时
func (e *Effect0) OnSkill(opp *input.Input, skill *info.SkillEntity) {
e.Input.AttackValue.LostHp = uint32(e.Input.CalculatePower(opp, skill).IntPart())
e.Stack(int(e.Input.CalculatePower(opp, skill).IntPart()))
e.Input.Exec(func(t input.Effect) bool { //计算暴击率加成
@@ -43,8 +39,8 @@ func (e *Effect0) OnSkill(opp *input.Input, skill *info.SkillEntity) {
return e.Input.AttackValue.IsCritical == 0
})
if e.Input.AttackValue.IsCritical == 1 {
e.Input.AttackValue.LostHp = e.Input.AttackValue.LostHp * 2
e.Stack(e.Stack() * 2)
}
//这里注释掉,扣血在对方回合
if uint32(e.Input.AttackValue.LostHp) > opp.CurrentPet.Info.Hp {
@@ -82,6 +78,6 @@ func (this *Effect0) IsCrit(opp *input.Input, skill *info.SkillEntity) {
}
func init() {
input.InitDamageEffect(0, &Effect0{})
input.InitEffect(input.EffectType.Damage, 0, &Effect0{})
}