feat: 新增战斗技能效果 524-580
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-17 15:25:08 +08:00
committed by cnb
parent a2e4ec867c
commit 322d5ea64d
10 changed files with 312 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// 524 - {0}回合内若被对手击败则对手疲惫{1}回合
type Effect524 struct {
node.EffectNode
}
func (e *Effect524) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(a[0]) // 持续n回合
}
func (e *Effect524) SwitchOut(in *input.Input) bool {
if e.Input == in {
if !e.Ctx().Our.CurrentPet.Alive() { // 被击败
// 给对手添加疲惫状态
tiredEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Tired))
if tiredEffect != nil {
tiredEffect.Duration(int(e.Args()[1].IntPart()))
e.Ctx().Opp.AddEffect(e.Ctx().Our, tiredEffect)
}
}
e.Alive(false)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 524, &Effect524{})
}

View File

@@ -0,0 +1,27 @@
package effect
import (
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// 533 - 消除双方能力提升、下降状态
type Effect533 struct {
node.EffectNode
}
func (e *Effect533) OnSkill() bool {
// 消除自己
for i := 0; i < len(e.Ctx().Our.Prop); i++ {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0)
}
// 消除对手
for i := 0; i < len(e.Ctx().Opp.Prop); i++ {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 533, &Effect533{})
}

View File

@@ -0,0 +1,36 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// 539 - 对手处于能力提升状态时先制额外+1且威力翻倍
type Effect539 struct {
node.EffectNode
}
func (e *Effect539) ComparePre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool {
if e.Ctx().Opp.HasPropADD() {
// 增加自身技能优先级
if sattack != nil && sattack.PlayerID == e.Ctx().Our.UserID && sattack.SkillEntity != nil {
sattack.SkillEntity.XML.Priority += 1
}
}
return true
}
func (e *Effect539) SkillHit() bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().Opp.HasPropADD() {
e.Ctx().SkillEntity.XML.Power *= 2
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 539, &Effect539{})
}

View File

@@ -0,0 +1,28 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// 546 - 若对手处于{0}状态则对手{1}
type Effect546 struct {
node.EffectNode
}
func (e *Effect546) OnSkill() bool {
triggerStatus := info.EnumPetStatus(e.Args()[0].IntPart())
if e.Ctx().Opp.StatEffect_Exist(triggerStatus) {
targetStatus := int(e.Args()[1].IntPart())
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, targetStatus)
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 546, &Effect546{})
}

View File

@@ -0,0 +1,30 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// 552 - 若对手处于异常状态,则{0}%概率附加{1}点伤害
type Effect552 struct {
node.EffectNode
}
func (e *Effect552) DamageModify(t *info.DamageZone) bool {
if t.Type == info.DamageType.Red && e.Ctx().Opp.StatEffect_Exist_all() {
chance := e.Args()[0].IntPart()
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
extra := alpacadecimal.NewFromInt(e.Args()[1].IntPart())
t.Damage = t.Damage.Add(extra)
}
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 552, &Effect552{})
}

View File

@@ -0,0 +1,26 @@
package effect
import (
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// 567 - 对手为自身天敌时造成的伤害翻倍
type Effect567 struct {
node.EffectNode
}
func (e *Effect567) SkillHit() bool {
if e.Ctx().SkillEntity == nil {
return true
}
// 判断对手是否为自身天敌(即对手属性克制自己)
if e.ISNaturalEnemy() {
e.Ctx().SkillEntity.XML.Power *= 2
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 567, &Effect567{})
}

View File

@@ -0,0 +1,35 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// 570 - 免疫下{0}次受到的攻击
type Effect570 struct {
node.EffectNode
remaining int
}
func (e *Effect570) SetArgs(t *input.Input, a ...int) {
e.EffectNode.Duration(-1)
// 持续次数不是回合用Duration可能不合适但可以用次数。我们通过子效果计数
}
func (e *Effect570) DamageLockEx(t *info.DamageZone) bool {
if e.remaining > 0 && t.Type == info.DamageType.Red {
t.Damage = alpacadecimal.Zero
e.remaining--
if e.remaining <= 0 {
e.Alive(false) // 效果结束
}
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 570, &Effect570{})
}

View File

@@ -0,0 +1,32 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// 572 - 攻击对手时若对手处于{0}状态,则{1}%使对手{2}
type Effect572 struct {
node.EffectNode
}
func (e *Effect572) OnSkill() bool {
triggerStatus := info.EnumPetStatus(e.Args()[0].IntPart())
if e.Ctx().Opp.StatEffect_Exist(triggerStatus) {
chance := e.Args()[1].IntPart()
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
targetStatus := int(e.Args()[2].IntPart())
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, targetStatus)
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
}
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 572, &Effect572{})
}

View File

@@ -0,0 +1,24 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// 575 - 对手处于任意异常状态时造成的伤害将全额恢复体力
type Effect575 struct {
node.EffectNode
}
func (e *Effect575) Skill_Use_ex() bool {
if e.Ctx().Opp.StatEffect_Exist_all() {
damage := e.Ctx().Our.SumDamage
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 575, &Effect575{})
}

View File

@@ -0,0 +1,38 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// 580 - {0}回合内自身受到直接攻击伤害的{1}%反馈给对手
type Effect580 struct {
node.EffectNode
}
func (e *Effect580) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(a[0]) // 持续n回合
}
func (e *Effect580) Skill_Use_ex() bool {
// 自己受到直接攻击伤害时触发
damage := e.Ctx().Opp.SumDamage
reflectDamage := damage.Mul(e.Args()[1]).Div(alpacadecimal.NewFromInt(100))
// 对对手造成固定伤害
damageZone := &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: reflectDamage,
}
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 580, &Effect580{})
}