feat: 实现战斗技能效果
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
xinian
2026-03-29 16:38:34 +08:00
committed by cnb
parent 7439c45768
commit c40430aaa4
15 changed files with 851 additions and 210 deletions

View File

@@ -1,36 +0,0 @@
# Task 001: Effects 17-600
## 目标
- 补齐以下 5 或最后一组不足 5 当前判定未实现的 skill effect
- 实现位置优先放在 `logic/service/fight/effect/`
- effect 需要展示说明同步更新 `logic/service/fight/effect/effect_info_map.go`
- 完成后至少执行`cd /workspace/logic && go test ./service/fight/effect`
## Effect 列表
### Effect 17
- `argsNum`: `0`
- `info`: `1回合等待次回合攻击`
### Effect 139
- `argsNum`: `0`
- `info`: `50%威力301-350、30%威力101-300,20%威力5-100`
### Effect 201
- `argsNum`: `2`
- `info`: `对选中对象或本方全体恢复1/{1}的体力`
### Effect 445
- `argsNum`: `0`
- `info`: `使用后在战斗结束时可以获得500赛尔豆每日上限5000`
### Effect 600
- `argsNum`: `4`
- `info`: `若对手是{0}则造成伤害提升{1}%,若对手不是{0},则有{2}%概率使对手{3}`
- `param`: `5,0,0|1,3,3`
## 备注
- 该清单按当前仓库静态注册结果生成如果某个 effect 实际通过其他模块或运行时路径实现需要先复核后再落代码
- `201``445` 这类占位 effect优先补核心逻辑或补充明确的不可实现说明

View File

@@ -1,39 +0,0 @@
# Task 002: Effects 601-605
## 目标
- 补齐以下 5 或最后一组不足 5 当前判定未实现的 skill effect
- 实现位置优先放在 `logic/service/fight/effect/`
- effect 需要展示说明同步更新 `logic/service/fight/effect/effect_info_map.go`
- 完成后至少执行`cd /workspace/logic && go test ./service/fight/effect`
## Effect 列表
### Effect 601
- `argsNum`: `6`
- `info`: `若本回合击败对手,下回合对方出场精灵{0}`
- `param`: `24,0,0`
### Effect 602
- `argsNum`: `9`
- `info`: `{0}回合内若{1}使用攻击技能则{2}的{3}`
- `param`: `9,1,1|9,2,2|0,3,3`
### Effect 603
- `argsNum`: `3`
- `info`: `{0}%概率使对手陷入{1}状态{2}回合`
- `param`: `1,1,1`
### Effect 604
- `argsNum`: `4`
- `info`: `威力随机,随机范围{0}-{1},连续使用每次威力提升{2},最高提升至{3}`
### Effect 605
- `argsNum`: `3`
- `info`: `自身体力{0}对手时附加{1}值{2}%的百分比伤害`
- `param`: `7,0,0|8,1,1`
## 备注
- 该清单按当前仓库静态注册结果生成如果某个 effect 实际通过其他模块或运行时路径实现需要先复核后再落代码
- `201``445` 这类占位 effect优先补核心逻辑或补充明确的不可实现说明

View File

@@ -1,38 +0,0 @@
# Task 003: Effects 606-614
## 目标
- 补齐以下 5 或最后一组不足 5 当前判定未实现的 skill effect
- 实现位置优先放在 `logic/service/fight/effect/`
- effect 需要展示说明同步更新 `logic/service/fight/effect/effect_info_map.go`
- 完成后至少执行`cd /workspace/logic && go test ./service/fight/effect`
## Effect 列表
### Effect 606
- `argsNum`: `1`
- `info`: `若体力{0}对手,技能威力翻倍`
- `param`: `7,0,0`
### Effect 607
- `argsNum`: `9`
- `info`: `{0}回合内若{1}使用属性技能则{2}的{3}`
- `param`: `9,1,1|9,2,2|0,3,3`
### Effect 608
- `argsNum`: `3`
- `info`: `若对手体力低于1/2该技能先制额外+1`
### Effect 612
- `argsNum`: `2`
- `info`: `{0}%概率攻击{1}次`
### Effect 614
- `argsNum`: `2`
- `info`: `{0}回合内若对手使用攻击技能则对手{1}`
- `param`: `1,1,1`
## 备注
- 该清单按当前仓库静态注册结果生成如果某个 effect 实际通过其他模块或运行时路径实现需要先复核后再落代码
- `201``445` 这类占位 effect优先补核心逻辑或补充明确的不可实现说明

View File

@@ -1,36 +0,0 @@
# Task 020: Effects 709-713
## 目标
- 补齐以下 5 或最后一组不足 5 当前判定未实现的 skill effect
- 实现位置优先放在 `logic/service/fight/effect/`
- effect 需要展示说明同步更新 `logic/service/fight/effect/effect_info_map.go`
- 完成后至少执行`cd /workspace/logic && go test ./service/fight/effect`
## Effect 列表
### Effect 709
- `argsNum`: `0`
- `info`: `击败对手时若自身处于能力提升状态,则将所处的能力提升状态翻倍`
### Effect 710
- `argsNum`: `1`
- `info`: `解除自身能力下降状态,若解除成功则{0}回合内免疫能力下降状态`
### Effect 711
- `argsNum`: `1`
- `info`: `{0}回合若自身能力提升状态被消除则必定致命一击`
### Effect 712
- `argsNum`: `7`
- `info`: `{0}回合内将对手的{1}能力降为0点`
- `param`: `16,1,1`
### Effect 713
- `argsNum`: `1`
- `info`: `附加自身能力提升等级总和X{0}的固定伤害`
## 备注
- 该清单按当前仓库静态注册结果生成如果某个 effect 实际通过其他模块或运行时路径实现需要先复核后再落代码
- `201``445` 这类占位 effect优先补核心逻辑或补充明确的不可实现说明

View File

@@ -1,35 +0,0 @@
# Task 023: Effects 724-728
## 目标
- 补齐以下 5 或最后一组不足 5 当前判定未实现的 skill effect
- 实现位置优先放在 `logic/service/fight/effect/`
- effect 需要展示说明同步更新 `logic/service/fight/effect/effect_info_map.go`
- 完成后至少执行`cd /workspace/logic && go test ./service/fight/effect`
## Effect 列表
### Effect 724
- `argsNum`: `3`
- `info`: `{0}回合内受到攻击{1}%恢复1/{2}体力`
### Effect 725
- `argsNum`: `3`
- `info`: `{0}回合内每回合有{1}%的概率降低对手最大体力的1/{2}`
### Effect 726
- `argsNum`: `1`
- `info`: `{0}回合若对手先出手,则令对手当回合使用的攻击技能无效`
### Effect 727
- `argsNum`: `0`
- `info`: `后出手时将自身能力等级返回至上一回合结束时`
### Effect 728
- `argsNum`: `1`
- `info`: `自身处于能力提升状态时回合结束时直接减少对手1/{0}最大体力`
## 备注
- 该清单按当前仓库静态注册结果生成如果某个 effect 实际通过其他模块或运行时路径实现需要先复核后再落代码
- `201``445` 这类占位 effect优先补核心逻辑或补充明确的不可实现说明

View File

@@ -0,0 +1,161 @@
---
name: fight-effect-impl
description: Implement or repair Go fight effects in the Blazing battle system. Use when working in logic/service/fight/effect or nearby boss hooks, especially for missing effect tasks, effect registration, hook selection, delayed/round effects, status application, effect_info_map updates, and package-level validation.
---
# Fight Effect Impl
Implement effect work in the existing battle framework instead of inventing a parallel pattern.
## Workflow
1. Read the task source first.
If the request comes from `docs/effect-unimplemented-tasks/`, open the task file and extract effect IDs, arg counts, and description text.
2. Confirm whether each effect is actually missing.
Search for both type names and registrations. Do not rely only on direct `InitEffect(...)` grep results.
Also inspect shared registration files such as:
- `logic/service/fight/effect/sterStatusEffects.go`
- `logic/service/fight/effect/effect_power_doblue.go`
- `logic/service/fight/effect/EffectAttackMiss.go`
- `logic/service/fight/effect/EffectPhysicalAttackAddStatus.go`
- `logic/service/fight/effect/EffectDefeatTrigger.go`
- `logic/service/fight/effect/effect_attr.go`
3. Reuse the nearest local pattern.
Open effects with similar timing or semantics before writing code. Prefer matching existing hooks, helper bases, registration style, and comments over building a generic abstraction.
4. Choose the hook from battle flow, not from description text alone.
Read `logic/service/fight/input/interface.go`, `logic/service/fight/fightc.go`, and `logic/service/fight/loop.go` when timing is unclear.
## Effect Hooks
Use this section when effect timing is unclear.
### Core call order
The main references are:
- `logic/service/fight/input/interface.go`
- `logic/service/fight/fightc.go`
- `logic/service/fight/loop.go`
Typical attack flow inside `processSkillAttack` and `enterturn` is:
1. defender `SkillHit_ex()`
2. attacker `SkillHit()`
3. attacker `CalculatePre()`
4. attacker `OnSkill()`
5. defender `Damage(...)` settles red/fixed/true damage
6. defender `Skill_Use_ex()`
7. attacker `Skill_Use()`
8. defender `Action_end_ex()`
9. attacker `Action_end()`
10. both sides `TurnEnd()` at round end
11. all live effects `OnBattleEnd()` at fight end
### Hook selection cheatsheet
- `SkillHit_ex()`
Use for defender-side pre-hit interception, miss forcing, and hit-rate disruption.
- `SkillHit()`
Use for attacker-side power, crit, or skill-property changes before damage is computed.
- `CalculatePre()`
Use for temporary state rewrites that must exist during power calculation and then be restored.
- `OnSkill()`
Use for on-hit side effects, extra fixed damage setup, healing, status attach, or delayed-effect spawning.
- `ActionStartEx()`
Use for defender-side pre-action gates.
- `ActionStart()`
Use for attacker-side action gating, forced no-action behavior, and same-turn priority-sensitive logic.
- `Skill_Use_ex()`
Use for defender-side after-being-targeted behavior.
- `Skill_Use()`
Use for attacker-side after-using-skill behavior.
- `ComparePre()`
Use for priority changes before turn order is finalized.
- `TurnStart()`
Use for per-round setup or replacing the current round's selected action before execution.
- `TurnEnd()`
Use for countdown or expiry. The default node decrements positive durations and clears zero-duration effects.
- `OnBattleEnd()`
Use only when the effect truly settles at battle end. Confirm any reward path can be persisted from this hook.
### Repo-specific cautions
- `EffectCache` matters.
Parsed skill effects are stored in `EffectCache` before execution. If a first-turn charge effect must suppress the rest of the skill's side effects, explicitly disable sibling cached effects for that turn.
- `addSubEffect(...)` is lightweight.
Read `logic/service/fight/effect/sub_effect_helper.go` before assuming helper behavior. The current helper forwards IDs and args, but does not automatically apply the `duration` argument to the sub-effect instance.
- Team-wide healing is limited by current model.
There is no generic battle-target abstraction for friendly bench targets. If the effect heals all owned pets, iterate `AllPet` and mutate non-active pets carefully.
- Static task scans can be false positives.
Task documents may flag effects as missing even when they already exist in grouped files or shared registration files. Verify before editing.
## Implementation Rules
- Prefer existing base structs in `logic/service/fight/effect/sub_effect_helper.go` when they already match duration behavior.
- Verify helper semantics before using them. In this repo, some helpers are thinner than their names suggest.
- For status effects, create them through `InitEffect(input.EffectType.Status, ...)` and add them through `AddEffect(...)` on the target input.
- For healing, use `Input.Heal(...)` for the active battler and mutate non-active owned pets only when the current model already stores them in `AllPet`.
- For battle-end rewards or delayed settlement, confirm the hook is actually executed in `loop.go` before coding against it.
- Keep comments short and effect-focused.
## Common Tasks
### Random power or conditional power effects
Use `SkillHit()` when the effect changes `SkillEntity.XML.Power` before damage is calculated.
Examples in repo: `139.go`, `effect_power_doblue.go`, `600_605.go`.
### Hit-time status or side effects
Use `OnSkill()` when the effect should fire after hit/damage calculation setup and before final damage application is settled.
For direct status application, initialize the status effect from the source input and add it to the opponent.
### Round or delayed effects
For multi-turn logic, confirm whether the effect should:
- modify this turn only,
- start next turn,
- trigger when attacked,
- or replace the next selected skill.
For next-turn logic, inspect nearby effects such as `62`, `407`, `440`, `499`, `551`, `560`, and any adjacent ID patterns.
### Two-turn charge effects
Preserve the repo's existing battle loop assumptions.
A practical pattern is:
- cache the release skill on the first turn,
- suppress first-turn damage/effect output,
- inject the cached skill into the next turn's selected action in `TurnStart`,
- avoid double PP consumption in `HookPP`.
### Reward-on-battle-end effects
Check `OnBattleEnd()` execution in `logic/service/fight/loop.go`.
If a reward has a daily cap, prefer the shared counter utilities under `common/data/share/` over inventing new state.
## Validation
Run, at minimum:
- `cd /workspace/logic && go test ./service/fight/effect`
- `cd /workspace/logic && go build ./...`
If the task came from `docs/effect-unimplemented-tasks/`, remove the completed task file when the user asked for it.
## Output
When finishing a task, report:
- which effect IDs were truly implemented,
- which IDs already existed and were left untouched,
- validation commands actually run,
- any remaining model limitations or behavior assumptions.