refactor: 重构战斗技能使用节点
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-08 19:42:47 +08:00
committed by cnb
parent ca7eb04f6e
commit 09da1dc253
10 changed files with 45 additions and 38 deletions

View File

@@ -10,7 +10,7 @@ type NewSel54 struct {
NewSel0
}
func (e *NewSel54) Action_end() bool {
func (e *NewSel54) Skill_Use_ex() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true

View File

@@ -10,7 +10,7 @@ type NewSel71 struct {
NewSel0
}
func (e *NewSel71) Action_end() bool {
func (e *NewSel71) Skill_Use_ex() bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}

View File

@@ -11,7 +11,7 @@ type Effect150 struct {
node.EffectNode
}
func (e *Effect150) Action_end() bool {
func (e *Effect150) Skill_Use() bool {
e.Ctx().Opp.SetProp(e.Ctx().Opp, 1, int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB)
e.Ctx().Opp.SetProp(e.Ctx().Opp, 3, int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB)

View File

@@ -11,7 +11,7 @@ type Effect424 struct {
node.EffectNode
}
func (e *Effect424) Action_end() bool {
func (e *Effect424) Skill_Use() bool {
e.Ctx().Opp.SetProp(e.Ctx().Our, 4, int8(e.Args()[1].IntPart()), info.AbilityOpType.SUB)
return true
}

View File

@@ -15,7 +15,7 @@ func (e *Effect409) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(a[0]) // 持续n回合
}
func (e *Effect409) Action_end() bool {
func (e *Effect409) Skill_Use() bool {
e.Ctx().Opp.SetProp(e.Ctx().Our, 4, int8(int(e.Args()[1].IntPart())), info.AbilityOpType.SUB)
return true

View File

@@ -13,7 +13,7 @@ type Effect419 struct {
node.EffectNode
}
func (e *Effect419) Action_end() bool {
func (e *Effect419) Skill_Use() bool {
for _, V := range e.Ctx().Opp.Prop[:] {
if V > 0 {
fixedDamage := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart())) // k点固定伤害

View File

@@ -26,7 +26,7 @@ func (e *Effect439) SetArgs(t *input.Input, a ...int) {
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
}
func (e *Effect439) Action_end() bool {
func (e *Effect439) Skill_Use() bool {
var isprop bool
for _, v := range e.Ctx().Our.Prop {
if v < 0 {
@@ -35,11 +35,10 @@ func (e *Effect439) Action_end() bool {
}
if e.Ctx().Our.StatEffect_Exist_all() || isprop {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[1],
})
Type: info.DamageType.Fixed,
Damage: e.Args()[1],
})
}
return true
}

View File

@@ -248,26 +248,14 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
}
}
// if defender.CurrentPet.Info.Hp > 0 {
// //技能使用后
// defender.Exec(func(effect input.Effect) bool {
// effect.Ctx().SkillEntity = currentSkill
// effect.Skill_Use_ex()
// return true
// })
// }
// //技能使用后
// attacker.Exec(func(effect input.Effect) bool { //技能使用后的我方效果
// effect.Ctx().SkillEntity = currentSkill
// effect.SkillUseed()
// return true
// })
// defender.Exec(func(effect input.Effect) bool {
// effect.Ctx().SkillEntity = currentSkill
// effect.Action_end_ex()
// return true
// })
if defender.CurrentPet.Info.Hp > 0 {
//技能使用后
defender.Exec(func(effect input.Effect) bool {
effect.Ctx().SkillEntity = currentSkill
effect.Skill_Use_ex()
return true
})
}
if defender.CurrentPet.Info.Hp <= 0 && attacker.CurrentPet.Info.Hp <= 0 { //先手方死亡,触发反同归于尽
attacker.CurrentPet.Info.Hp = 1
@@ -280,9 +268,10 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
//技能使用后
attacker.Exec(func(effect input.Effect) bool { //技能使用后的我方效果
effect.Ctx().SkillEntity = currentSkill
effect.Action_end()
effect.Skill_Use()
return true
})
}
if defender.CurrentPet.Info.Hp <= 0 {
@@ -294,11 +283,22 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
//技能使用后
defender.Exec(func(effect input.Effect) bool { //技能使用后的我方效果
effect.Ctx().SkillEntity = currentSkill
effect.Action_end_ex()
effect.Skill_Use_ex()
return true
})
}
//技能使用后
attacker.Exec(func(effect input.Effect) bool { //技能使用后的我方效果
effect.Ctx().SkillEntity = currentSkill
effect.Action_end()
return true
})
//技能使用后
defender.Exec(func(effect input.Effect) bool { //技能使用后的我方效果
effect.Ctx().SkillEntity = currentSkill
effect.Action_end_ex()
return true
})
}
f.Broadcast(func(ff *input.Input) {

View File

@@ -33,10 +33,9 @@ type Effect interface {
DamageLock(*info.DamageZone) bool //锁定伤害
DamageLockEx(*info.DamageZone) bool //被动方锁定伤害
Damage_Shield(*info.DamageZone) bool // 护盾值变化时触发
//Damage_Use() bool // 伤害作用
//Skill_Use_ex() bool //技能PP减少节点
//Action_end() bool //技能PP减少节点
//Action_end_ex() bool
Skill_Use() bool //技能使用节点
Skill_Use_ex() bool //技能PP减少节点
Action_end() bool
Action_end_ex() bool
//OnDefeat(opp *Input) bool // 精灵被击败时触发

View File

@@ -30,3 +30,12 @@ func (e *EffectNode) HookAction() bool {
// panic("not implemented") // TODO: Implement
return true
}
func (e *EffectNode) Skill_Use_ex() bool {
// panic("not implemented") // TODO: Implement
return true
}
func (e *EffectNode) Skill_Use() bool {
// panic("not implemented") // TODO: Implement
return true
}