feat: 新增一批技能效果实现

This commit is contained in:
xinian
2026-03-28 23:59:12 +08:00
committed by cnb
parent 875ad668aa
commit 7376e0e58b
3 changed files with 399 additions and 18 deletions

View File

@@ -40,12 +40,27 @@
- `610` 遇到天敌时先制+`{0}`
- `611` `{0}`回合自身使用攻击技能则附加`{1}`点固定伤害
- `613` `{0}`回合内自身令对手使用的`{1}`系攻击技能无效
- `573` `{0}`回合内若自身能力提升状态被消除或吸取则`{1}`%使对手`{2}``{3}`回合
- `587` `{0}`回合内若被对手击败则对手损失`{1}`点体力造成致命伤害时对手剩余1点体力
- `591` 造成伤害大于`{0}`则下`{1}`回合自己所有直接攻击先制+`{2}`
- `592` `{0}`回合每回合使用攻击技能`{1}`%令对手`{2}`
- `594` 造成的伤害低于`{0}``{1}`%令对手`{2}`
- `596` 技能使用成功时`{0}`%给予对手冻伤中毒烧伤中任意一种异常状态
- `597` `{0}`回合内每回合使用技能吸取对手最大体力的1/`{1}`
- `598` `{0}`%恢复自己所有技能PP值`{1}`
- `401` 若和对手属性相同则技能威力翻倍
- `585` 技能使用成功时`{0}`
- `589` 复制对手`{0}`的能力提升状态
- `590` 使对手`{0}``{6}`%弱化效果翻倍
- `593` 附加`{0}``{1}`值的`{2}`%的百分比伤害
- `595` 技能使用成功时`{0}`%使对手`{1}`若没有触发则对手`{2}`
- 已同步更新
- `logic/service/fight/effect/effect_info_map.go`
### 1.6 本轮新增文件
- `logic/service/fight/effect/400_480_586_599_610_611_613.go`
- `logic/service/fight/effect/573_587_591_592_594_596_597_598.go`
- `logic/service/fight/effect/effect_info_map.go`
### 1.7 本轮验证
@@ -139,20 +154,7 @@ JSON 中存在但代码未注册(示例前 60 项):
### 3.4 当前更可信的下一批候选
这一组是结合本轮人工核对后仍然值得优先继续补的缺失 effect 候选
- `401`
- `573`
- `585`
- `587`
- `589`
- `590`
- `591`
- `592`
- `593`
- `594`
- `595`
- `596`
- `597`
- `598`
- 当前文档 3.4 中这批候选已在本轮补齐
说明
- 这批大多是 58x/59x 段的新效果和当前目录中已有实现重叠较少
@@ -171,9 +173,9 @@ JSON 中存在但代码未注册(示例前 60 项):
本轮更推荐的下一批实现顺序
- 第一组`587 / 591 / 592 / 597 / 598`
- 第二组`573 / 585 / 594 / 595 / 596`
- 第三组`589 / 590 / 593`
- 第一组`529 / 552 / 560 / 576`
- 第二组`10 / 11 / 12 / 14 / 15 / 16`
- 第三组`94 / 99 / 103 / 114`
---
@@ -181,7 +183,7 @@ JSON 中存在但代码未注册(示例前 60 项):
可直接用下面这句发起
`继续处理 effect按 docs/effect-refactor-summary-2026-03-28.md 的 3.4 和 4 执行:先补 587/591/592/597/598再补 573/585/594/595/596每实现一批就更新同一文档和 effect_info_map.go并跑 go test ./service/fight/effect。`
`继续处理 effect按 docs/effect-refactor-summary-2026-03-28.md 的 3.3 和 4 执行:先复核 529/552/560/576再补低风险状态附加类 10/11/12/14/15/16每实现一批就更新同一文档和 effect_info_map.go并跑 go test ./service/fight/effect。`
如果你希望按 JSON 覆盖率推进可用这句
@@ -214,6 +216,7 @@ JSON 中存在但代码未注册(示例前 60 项):
- `public/config/effectInfo.json`
- `logic/service/fight/effect/400_480_586_599_610_611_613.go`
- `logic/service/fight/effect/573_587_591_592_594_596_597_598.go`
- `logic/service/fight/effect/effect_info_map.go`
- `logic/service/fight/effect/sub_effect_helper.go`
- `docs/effect-refactor-summary-2026-03-28.md`

View File

@@ -0,0 +1,364 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
"github.com/gogf/gf/v2/util/grand"
)
// Effect 573: {0}回合内若自身能力提升状态被消除或吸取则{1}%使对手{2}{3}回合
type Effect573 struct {
RoundEffectArg0Base
}
func (e *Effect573) PropBefer(source *input.Input, prop int8, level int8) bool {
if source != e.Ctx().Opp {
return true
}
if prop < 0 || int(prop) >= len(e.Ctx().Our.Prop) {
return true
}
if level != 0 {
return true
}
if e.Ctx().Our.Prop[prop] <= 0 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart()))
if statusEffect == nil {
return true
}
statusEffect.Duration(int(e.Args()[3].IntPart()))
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
return true
}
// Effect 587: {0}回合内若被对手击败则对手损失{1}点体力造成致命伤害时对手剩余1点体力
type Effect587 struct {
RoundEffectArg0Base
}
func (e *Effect587) SwitchOut(in *input.Input) bool {
if e.Input != in {
return true
}
if e.Ctx().Our.CurrentPet.Alive() {
e.Alive(false)
return true
}
oppHP := e.Ctx().Opp.CurrentPet.GetHP()
if oppHP.Cmp(alpacadecimal.NewFromInt(1)) <= 0 {
e.Alive(false)
return true
}
damage := e.Args()[1]
maxDamage := oppHP.Sub(alpacadecimal.NewFromInt(1))
if damage.Cmp(maxDamage) > 0 {
damage = maxDamage
}
if damage.Cmp(alpacadecimal.Zero) <= 0 {
e.Alive(false)
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damage,
})
e.Alive(false)
return true
}
// Effect 591: 造成伤害大于{0},则下{1}回合自己所有直接攻击先制+{2}
type Effect591 struct {
node.EffectNode
}
func (e *Effect591) Skill_Use() bool {
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) <= 0 {
return true
}
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect591Sub{}, -1)
return true
}
type Effect591Sub struct {
RoundEffectArg1Base
}
func (e *Effect591Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
if fattack == nil || fattack.PlayerID == e.Ctx().Our.UserID {
return true
}
if sattack == nil || sattack.SkillEntity == nil {
return true
}
if sattack.SkillEntity.Category() == info.Category.STATUS {
return true
}
sattack.SkillEntity.XML.Priority += int(e.Args()[2].IntPart())
return true
}
// Effect 592: 下{0}回合每回合使用攻击技能{1}%令对手{2}
type Effect592 struct {
node.EffectNode
}
func (e *Effect592) Skill_Use() bool {
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect592Sub{}, -1)
return true
}
type Effect592Sub struct {
RoundEffectArg0Base
}
func (e *Effect592Sub) OnSkill() bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
// Effect 594: 造成的伤害低于{0}时{1}%令对手{2}
type Effect594 struct {
node.EffectNode
}
func (e *Effect594) Skill_Use() bool {
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
// Effect 596: 技能使用成功时,{0}%给予对手冻伤、中毒、烧伤中任意一种异常状态
type Effect596 struct {
node.EffectNode
}
func (e *Effect596) Skill_Use() bool {
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !success {
return true
}
statusTypes := []int{
int(info.PetStatus.Frozen),
int(info.PetStatus.Poisoned),
int(info.PetStatus.Burned),
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, statusTypes[grand.Intn(len(statusTypes))])
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
// Effect 597: {0}回合内每回合使用技能吸取对手最大体力的1/{1}
type Effect597 struct {
RoundEffectArg0Base
}
func (e *Effect597) OnSkill() bool {
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
return true
}
// Effect 598: {0}%恢复自己所有技能PP值{1}点
type Effect598 struct {
node.EffectNode
}
func (e *Effect598) Skill_Use() bool {
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !success {
return true
}
e.Ctx().Our.HealPP(int(e.Args()[1].IntPart()))
return true
}
// Effect 401: 若和对手属性相同,则技能威力翻倍
type Effect401 struct {
Effect400
}
// Effect 585: 技能使用成功时,{0}
type Effect585 struct {
node.EffectNode
}
func (e *Effect585) Skill_Use() bool {
for i, v := range e.SideEffectArgs {
if v == 0 {
continue
}
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(v))
}
return true
}
// Effect 589: 复制对手{0}的能力提升状态
type Effect589 struct {
node.EffectNode
}
func (e *Effect589) Skill_Use() bool {
for i, v := range e.SideEffectArgs {
if v == 0 {
continue
}
oppProp := e.Ctx().Opp.Prop[i]
if oppProp <= 0 {
continue
}
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), oppProp)
}
return true
}
// Effect 590: 使对手{0}{6}%弱化效果翻倍
type Effect590 struct {
node.EffectNode
}
func (e *Effect590) Skill_Use() bool {
double := false
if len(e.SideEffectArgs) > 6 {
success, _, _ := e.Input.Player.Roll(e.SideEffectArgs[6], 100)
double = success
}
for i, v := range e.SideEffectArgs[:min(len(e.SideEffectArgs), 6)] {
if v == 0 {
continue
}
if double {
v *= 2
}
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(v))
}
return true
}
// Effect 593: 附加{0}的{1}值的{2}%的百分比伤害
type Effect593 struct {
node.EffectNode
}
func (e *Effect593) OnSkill() bool {
target := e.Ctx().Our
if int(e.Args()[0].IntPart()) == 1 {
target = e.Ctx().Opp
}
propID := int(e.Args()[1].IntPart())
if propID < 0 || propID >= 6 {
return true
}
base := target.GetProp(propID)
damage := base.Mul(e.Args()[2]).Div(alpacadecimal.NewFromInt(100))
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damage,
})
return true
}
// Effect 595: 技能使用成功时,{0}%使对手{1},若没有触发,则对手{2}
type Effect595 struct {
node.EffectNode
}
func (e *Effect595) Skill_Use() bool {
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
statusID := int(e.Args()[1].IntPart())
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, statusID)
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
for i, v := range e.SideEffectArgs[2:] {
if v == 0 {
continue
}
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(v))
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 401, &Effect401{})
input.InitEffect(input.EffectType.Skill, 573, &Effect573{})
input.InitEffect(input.EffectType.Skill, 585, &Effect585{})
input.InitEffect(input.EffectType.Skill, 589, &Effect589{})
input.InitEffect(input.EffectType.Skill, 590, &Effect590{})
input.InitEffect(input.EffectType.Skill, 587, &Effect587{})
input.InitEffect(input.EffectType.Skill, 591, &Effect591{})
input.InitEffect(input.EffectType.Sub, 591, &Effect591Sub{})
input.InitEffect(input.EffectType.Skill, 592, &Effect592{})
input.InitEffect(input.EffectType.Sub, 592, &Effect592Sub{})
input.InitEffect(input.EffectType.Skill, 593, &Effect593{})
input.InitEffect(input.EffectType.Skill, 594, &Effect594{})
input.InitEffect(input.EffectType.Skill, 595, &Effect595{})
input.InitEffect(input.EffectType.Skill, 596, &Effect596{})
input.InitEffect(input.EffectType.Skill, 597, &Effect597{})
input.InitEffect(input.EffectType.Skill, 598, &Effect598{})
}

View File

@@ -323,8 +323,22 @@ var effectInfoByID = map[int]string{
578: "{0}回合内对手所有属性技能命中率减少{1}%",
579: "若当回合未击败对手则恢复自身最大体力的1/{0}",
580: "{0}回合内自身受到直接攻击伤害的{1}%反馈给对手",
573: "{0}回合内若自身能力提升状态被消除或吸取则{1}%使对手{2}{3}回合",
587: "{0}回合内若被对手击败则对手损失{1}点体力造成致命伤害时对手剩余1点体力",
588: "先出手时,{0}%概率使自己{1}+{2}",
591: "造成伤害大于{0},则下{1}回合自己所有直接攻击先制+{2}",
592: "下{0}回合每回合使用攻击技能{1}%令对手{2}",
594: "造成的伤害低于{0}时{1}%令对手{2}",
595: "技能使用成功时,{0}%使对手{1},若没有触发,则对手{2}",
596: "技能使用成功时,{0}%给予对手冻伤、中毒、烧伤中任意一种异常状态",
597: "{0}回合内每回合使用技能吸取对手最大体力的1/{1}",
598: "{0}%恢复自己所有技能PP值{1}点",
400: "若和对手属性相同,则技能威力翻倍",
401: "若和对手属性相同,则技能威力翻倍",
585: "技能使用成功时,{0}",
589: "复制对手{0}的能力提升状态",
590: "使对手{0}{6}%弱化效果翻倍",
593: "附加{0}的{1}值的{2}%的百分比伤害",
480: "{0}回合内自身所有攻击威力为两倍",
586: "{0}回合内自己的属性攻击必中",
599: "{0}回合内受到{1}伤害减少{2}%",