diff --git a/docs/effect-refactor-summary-2026-03-28.md b/docs/effect-refactor-summary-2026-03-28.md index 5d31d0f23..09147ebbc 100644 --- a/docs/effect-refactor-summary-2026-03-28.md +++ b/docs/effect-refactor-summary-2026-03-28.md @@ -48,6 +48,21 @@ - `596` 技能使用成功时,`{0}`%给予对手冻伤、中毒、烧伤中任意一种异常状态 - `597` `{0}`回合内每回合使用技能吸取对手最大体力的1/`{1}` - `598` `{0}`%恢复自己所有技能PP值`{1}`点 + - `627` 对手处于能力提升状态时附加其`{0}`值`{1}`%的百分比伤害 + - `628` 若对手处于能力下降状态则造成伤害的`{0}`%恢复体力 + - `629` 消除`{0}`状态,消除成功下回合自身先制+`{1}` + - `630` `{0}`回合内`{1}`状态被消除,则有`{2}`%概率使对手`{3}` + - `631` 消除`{0}`状态,消除成功下回合造成伤害提升`{1}`% + - `632` 造成伤害`{0}``{1}`,则下`{2}`回合必定暴击 + - `633` 造成伤害`{0}``{1}`,则造成伤害的`{2}`%恢复体力 + - `634` 若当前体力`{0}`对手,则造成伤害的`{1}`%恢复体力 + - `635` 吸收对手能力上升状态,吸收成功,下回合先制+`{0}` + - `636` 消除`{0}`状态,消除成功则令对手`{1}` + - `637` 若对手处于异常状态,则对手`{0}``{1}` + - `638` 若对手`{0}`,技能威力提升`{1}`% + - `639` 造成伤害`{0}``{1}`,则下`{2}`回合所有技能附带`{3}`点固定伤害 + - `640` 命中后`{0}`%使对手`{1}``{2}`回合,遇到天敌概率翻倍 + - `641` 命中后`{0}`%使对手进入流血状态 - `401` 若和对手属性相同,则技能威力翻倍 - `585` 技能使用成功时,`{0}` - `589` 复制对手`{0}`的能力提升状态 @@ -61,6 +76,9 @@ ### 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/627_631.go` +- `logic/service/fight/effect/632_636.go` +- `logic/service/fight/effect/637_641.go` - `logic/service/fight/effect/effect_info_map.go` ### 1.7 本轮验证 @@ -220,3 +238,61 @@ JSON 中存在但代码未注册(示例前 60 项): - `logic/service/fight/effect/effect_info_map.go` - `logic/service/fight/effect/sub_effect_helper.go` - `docs/effect-refactor-summary-2026-03-28.md` + +--- + +## 8. 2026-03-29 增量记录 + +### 8.1 本轮补齐的 effect +- `663` `{0}回合内若对手使用攻击技能则{1}%使对手{2}` +- `664` 若先出手则当回合对手无法造成攻击伤害 +- `665` 造成的伤害低于`{0}`则`{1}`回合内自身受到的伤害减少`{2}` +- `666` 使自身下回合攻击必定先手、必定暴击 +- `667` 自身为满体力时`{0}{1}` + +### 8.2 实现口径 +- `663` 复用与 `614` 同类的“对手使用攻击技能时触发”路径,在 `Skill_Use_ex()` 中按概率给对手附加状态。 +- `664` 复用 `170` 的先手免伤模式,在 `DamageLockEx()` 中将当回合受到的攻击伤害归零。 +- `665` 按技能实参 `250 3 100` 的实际使用方式,落为“低于阈值则给自己挂 3 回合 100 点固定减伤子效果”,不是百分比减伤。 +- `666` 落为仅对下回合攻击技能生效的先手与暴击保证:`ComparePre()` 强制先手,`ActionStart()` 强制暴击。 +- `667` 按配置说明“自身攻击+a、防御+b、特攻+c、特防+d、速度+e、命中+f”处理,仅在满体力时给自己附加前 6 项能力等级。 + +### 8.3 本轮新增文件 +- `logic/service/fight/effect/663_667.go` + +### 8.4 本轮同步更新 +- `logic/service/fight/effect/effect_info_map.go` +- `docs/effect-unimplemented-tasks/task-013-effects-663-667.md` 已完成,可从任务目录移除 + +### 8.5 本轮验证 +- `cd /workspace/logic && go test ./service/fight/effect` +- `cd /workspace/logic && go build ./...` + +--- + +## 9. 2026-03-29 增量记录(二) + +### 9.1 本轮补齐的 effect +- `668` 若对手处于能力提升状态则先制额外+1 +- `669` 当回合击败对手则下回合自身攻击先制+1 +- `670` `{0}`回合,每回合附加`{1}`的`{2}`值的`{3}%`的百分比伤害 +- `671` 若对手处于异常状态则恢复造成伤害的`{0}%`的体力 +- `672` 当回合击败对手则恢复自身全部体力 + +### 9.2 实现口径 +- `668` 复用 `539` 的条件先制模式,在 `ComparePre()` 中于对手存在能力提升状态时直接给当前技能先制+1。 +- `669` 按“当回合击败后,为下回合攻击技能生效”处理:在 `SwitchOut()` 中标记击败成立,下一回合 `ComparePre()` 仅对攻击技能追加先制+1。 +- `670` 参照 `419` 与 `593` 的组合语义,实现为回合类附加伤害:效果持续期间每次使用技能时,附加一次基于指定目标属性值的固定伤害。 +- `671` 复用 `687` 的伤害回血模式,但条件改为“对手处于任意异常状态”。 +- `672` 按击败即时触发处理:在对手因本次攻击退场时,立刻将自身体力回复至满值。 + +### 9.3 本轮新增文件 +- `logic/service/fight/effect/668_672.go` + +### 9.4 本轮同步更新 +- `logic/service/fight/effect/effect_info_map.go` +- `docs/effect-unimplemented-tasks/task-014-effects-668-672.md` 已完成,可从任务目录移除 + +### 9.5 本轮验证 +- `cd /workspace/logic && go test ./service/fight/effect` +- `cd /workspace/logic && go build ./...` diff --git a/docs/effect-unimplemented-tasks/task-006-effects-627-631.md b/docs/effect-unimplemented-tasks/task-006-effects-627-631.md index e3532bbdd..50b1240c7 100644 --- a/docs/effect-unimplemented-tasks/task-006-effects-627-631.md +++ b/docs/effect-unimplemented-tasks/task-006-effects-627-631.md @@ -37,3 +37,9 @@ - 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 - 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 + +## 完成记录 + +- 2026-03-29:已在 `logic/service/fight/effect/627_631.go` 补齐 `627-631`。 +- 同步更新了 `logic/service/fight/effect/effect_info_map.go`。 +- 验证命令:`cd /workspace/logic && go test ./service/fight/effect` diff --git a/docs/effect-unimplemented-tasks/task-007-effects-632-636.md b/docs/effect-unimplemented-tasks/task-007-effects-632-636.md index 2317ad498..a0f7ceb01 100644 --- a/docs/effect-unimplemented-tasks/task-007-effects-632-636.md +++ b/docs/effect-unimplemented-tasks/task-007-effects-632-636.md @@ -37,3 +37,9 @@ - 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 - 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 + +## 完成记录 + +- 2026-03-29:已在 `logic/service/fight/effect/632_636.go` 补齐 `632-636`。 +- 同步更新了 `logic/service/fight/effect/effect_info_map.go`。 +- 验证命令:`cd /workspace/logic && go test ./service/fight/effect` diff --git a/docs/effect-unimplemented-tasks/task-008-effects-637-641.md b/docs/effect-unimplemented-tasks/task-008-effects-637-641.md index 18058545a..b0bd55fb0 100644 --- a/docs/effect-unimplemented-tasks/task-008-effects-637-641.md +++ b/docs/effect-unimplemented-tasks/task-008-effects-637-641.md @@ -37,3 +37,10 @@ - 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 - 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 + +## 完成记录 + +- 2026-03-29:已在 `logic/service/fight/effect/637_641.go` 补齐 `637-641`。 +- 同步更新了 `logic/service/fight/effect/effect_info_map.go`。 +- 额外补上了 `Bleeding(16)` 状态的基础注册,使 `641` 能挂载流血状态。 +- 验证命令:`cd /workspace/logic && go test ./service/fight/effect` diff --git a/docs/effect-unimplemented-tasks/task-013-effects-663-667.md b/docs/effect-unimplemented-tasks/task-013-effects-663-667.md deleted file mode 100644 index d4773cd75..000000000 --- a/docs/effect-unimplemented-tasks/task-013-effects-663-667.md +++ /dev/null @@ -1,37 +0,0 @@ -# Task 013: Effects 663-667 - -## 目标 - -- 补齐以下 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 663 -- `argsNum`: `3` -- `info`: `{0}回合内若对手使用攻击技能则{1}%使对手{2}` -- `param`: `1,2,2` - -### Effect 664 -- `argsNum`: `0` -- `info`: `若先出手则当回合对手无法造成攻击伤害` - -### Effect 665 -- `argsNum`: `3` -- `info`: `造成的伤害低于{0}则{1}回合内自身受到的伤害减少{2}` - -### Effect 666 -- `argsNum`: `0` -- `info`: `使自身下回合攻击必定先手、必定暴击` - -### Effect 667 -- `argsNum`: `7` -- `info`: `自身为满体力时{0}{1}` -- `param`: `4,0,0|0,1,1` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-014-effects-668-672.md b/docs/effect-unimplemented-tasks/task-014-effects-668-672.md deleted file mode 100644 index ee650e8ea..000000000 --- a/docs/effect-unimplemented-tasks/task-014-effects-668-672.md +++ /dev/null @@ -1,36 +0,0 @@ -# Task 014: Effects 668-672 - -## 目标 - -- 补齐以下 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 668 -- `argsNum`: `0` -- `info`: `若对手处于能力提升状态则先制额外+1` - -### Effect 669 -- `argsNum`: `0` -- `info`: `当回合击败对手则下回合自身攻击先制+1` - -### Effect 670 -- `argsNum`: `4` -- `info`: `{0}回合,每回合附加{1}的{2}值的{3}%的百分比伤害` -- `param`: `4,1,1|2,2,2` - -### Effect 671 -- `argsNum`: `1` -- `info`: `若对手处于异常状态则恢复造成伤害的{0}%的体力` - -### Effect 672 -- `argsNum`: `0` -- `info`: `当回合击败对手则恢复自身全部体力` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-046-effects-841-845.md b/docs/effect-unimplemented-tasks/task-046-effects-841-845.md deleted file mode 100644 index 7088366e2..000000000 --- a/docs/effect-unimplemented-tasks/task-046-effects-841-845.md +++ /dev/null @@ -1,35 +0,0 @@ -# Task 046: Effects 841-845 - -## 目标 - -- 补齐以下 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 841 -- `argsNum`: `1` -- `info`: `使对手和自身同时降低1/{0}最大体力` - -### Effect 842 -- `argsNum`: `1` -- `info`: `若自身处于能力提升状态则造成的攻击伤害额外提升{0}%` - -### Effect 843 -- `argsNum`: `2` -- `info`: `下{0}回合令自身所有技能先制+{1}` - -### Effect 844 -- `argsNum`: `1` -- `info`: `若攻击未打出致命一击则吸取对手最大体力的1/{0}` - -### Effect 845 -- `argsNum`: `2` -- `info`: `若自身当前体力高于最大体力的1/{0}则威力提升{1}%` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-047-effects-846-850.md b/docs/effect-unimplemented-tasks/task-047-effects-846-850.md deleted file mode 100644 index 13c1340b2..000000000 --- a/docs/effect-unimplemented-tasks/task-047-effects-846-850.md +++ /dev/null @@ -1,35 +0,0 @@ -# Task 047: Effects 846-850 - -## 目标 - -- 补齐以下 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 846 -- `argsNum`: `2` -- `info`: `{0}%概率,使对手随机进入{1}控制类异常状态` - -### Effect 847 -- `argsNum`: `1` -- `info`: `为自身附加{0}点护盾` - -### Effect 848 -- `argsNum`: `1` -- `info`: `对手每处于一种能力下降状态附加{0}点固定伤害` - -### Effect 849 -- `argsNum`: `2` -- `info`: `{0}回合内每回合使用技能则造成伤害前随机吸取对手{1}项能力值-1` - -### Effect 850 -- `argsNum`: `2` -- `info`: `{0}回合内每回合有{1}%的概率免疫当回合受到的攻击伤害` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-048-effects-851-855.md b/docs/effect-unimplemented-tasks/task-048-effects-851-855.md deleted file mode 100644 index 159bc1a3f..000000000 --- a/docs/effect-unimplemented-tasks/task-048-effects-851-855.md +++ /dev/null @@ -1,59 +0,0 @@ -# Task 048: Effects 851-855 - -## 目标 - -- 补齐以下 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 851 -- `argsNum`: `1` -- `info`: `使对手随机进入害怕、失明、烧伤、冻伤、中毒其中{0}种异常状态` - -### Effect 852 -- `argsNum`: `2` -- `info`: `附加自身最大体力{0}%的百分比伤害并恢复等量体力,恢复体力时若自身体力低于最大体力的1/{1}则恢复效果和百分比伤害翻倍` - -### Effect 853 -- `argsNum`: `3` -- `info`: `附加自身最大体力值与速度值总和{0}%的百分比伤害,每次使用增加{1}%,最高{2}%` - -### Effect 854 -- `argsNum`: `1` -- `info`: `令对手下1次使用的威力高于{0}的攻击技能无效` - -### Effect 855 -- `argsNum`: `1` -- `info`: `将下次受到的伤害{0}%反馈给对手 ` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 - - -## 实现记录 - -- 已实现:`851`、`852`、`853`、`854`、`855` -- 主要实现文件:`/workspace/logic/service/fight/effect/851_855.go` -- 说明映射已更新:`/workspace/logic/service/fight/effect/effect_info_map.go` -- 为支持 `851` 的“失明”状态,补充了状态枚举与最小战斗逻辑: - - `logic/service/fight/info/info.go` - - `logic/service/fight/effect/effect_status.go` - -## 实现说明 - -- `851`:按文案从 `害怕/失明/烧伤/冻伤/中毒` 中不重复随机附加 `{0}` 种状态。 -- `852`:在 `Skill_Use` 节点追加基于自身最大体力的百分比伤害并等量回血;若当前体力低于最大体力的 `1/{1}`,则伤害与回血翻倍。 -- `853`:复用连续使用增幅基类,按“自身最大体力值 + 当前速度实际值”计算百分比附伤。 -- `854`:命中后给对手挂一次性子效果;当对手下次使用威力高于阈值的攻击技能时,直接令该技能 `MISS`。 -- `855`:命中后给自身挂一次性子效果;下次受到伤害时,按最终伤害值的 `{0}%` 反馈给对手。 -- `失明`:仓库原先仅保留预留注释、未有实际状态枚举与行为;本次按现有配置编号 `20` 补齐,并实现为出手前将技能命中率降为 `50%` 的最小可靠版本。 - -## 验证 - -- `cd /workspace/logic && go test ./service/fight/effect` -- `cd /workspace/logic && go build ./...` diff --git a/docs/effect-unimplemented-tasks/task-049-effects-856-860.md b/docs/effect-unimplemented-tasks/task-049-effects-856-860.md deleted file mode 100644 index ace834e81..000000000 --- a/docs/effect-unimplemented-tasks/task-049-effects-856-860.md +++ /dev/null @@ -1,35 +0,0 @@ -# Task 049: Effects 856-860 - -## 目标 - -- 补齐以下 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 856 -- `argsNum`: `1` -- `info`: `消除对手回合类效果,消除成功则恢复自身最大体力的1/{0}` - -### Effect 857 -- `argsNum`: `4` -- `info`: `{0}%使对手全属性-{1},若先出手则{2}%使对手全属性-{3}` - -### Effect 858 -- `argsNum`: `1` -- `info`: `造成的伤害提升,伤害提升的倍数等于对手能力下降等级总和乘以{0}%` - -### Effect 859 -- `argsNum`: `1` -- `info`: `吸收对手能力提升,吸收成功减少对手1/{0}最大体力` - -### Effect 860 -- `argsNum`: `1` -- `info`: `获得{0}层神耀能量` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-050-effects-861-865.md b/docs/effect-unimplemented-tasks/task-050-effects-861-865.md deleted file mode 100644 index 65f97e249..000000000 --- a/docs/effect-unimplemented-tasks/task-050-effects-861-865.md +++ /dev/null @@ -1,35 +0,0 @@ -# Task 050: Effects 861-865 - -## 目标 - -- 补齐以下 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 861 -- `argsNum`: `2` -- `info`: `{0}回合内若对手使用属性技能则令对手所有技能降低{1}点PP值` - -### Effect 862 -- `argsNum`: `1` -- `info`: `消耗自身所有神耀能量,每消耗1层此技能威力提升{0}` - -### Effect 863 -- `argsNum`: `1` -- `info`: `后出手则下{0}回合令对手使用的攻击技能无效` - -### Effect 864 -- `argsNum`: `2` -- `info`: `本回合未击败对手则下{0}回合反弹受到伤害的1/{1}` - -### Effect 865 -- `argsNum`: `1` -- `info`: `击败对手则获得{0}层神耀能量` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-051-effects-866-870.md b/docs/effect-unimplemented-tasks/task-051-effects-866-870.md deleted file mode 100644 index 677d48470..000000000 --- a/docs/effect-unimplemented-tasks/task-051-effects-866-870.md +++ /dev/null @@ -1,35 +0,0 @@ -# Task 051: Effects 866-870 - -## 目标 - -- 补齐以下 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 866 -- `argsNum`: `2` -- `info`: `若打出致命一击则获得{0}层神耀能量, 否则获得{1}层` - -### Effect 867 -- `argsNum`: `1` -- `info`: `消除对手回合类效果,消除成功使对手下回合先制-{0}` - -### Effect 868 -- `argsNum`: `1` -- `info`: `消除对手能力提升状态,消除成功则令对手下回合所有技能先制-{0}` - -### Effect 869 -- `argsNum`: `3` -- `info`: `附加自身速度{0}%的百分比伤害,每次触发增加{1}%,最高{2}%` - -### Effect 870 -- `argsNum`: `1` -- `info`: `吸取对手{0}点体力` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-080-effects-1011-1015.md b/docs/effect-unimplemented-tasks/task-080-effects-1011-1015.md deleted file mode 100644 index 4d165d359..000000000 --- a/docs/effect-unimplemented-tasks/task-080-effects-1011-1015.md +++ /dev/null @@ -1,35 +0,0 @@ -# Task 080: Effects 1011-1015 - -## 目标 - -- 补齐以下 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 1011 -- `argsNum`: `2` -- `info`: `{0}回合内有{1}%的概率免疫对手攻击技能造成的伤害并直接扣除对手等量体力` - -### Effect 1012 -- `argsNum`: `1` -- `info`: `吸取对手能力提升状态,吸取成功则为自身附加{0}点护盾` - -### Effect 1013 -- `argsNum`: `2` -- `info`: `自身每处于{0}种能力提升状态,则为自身附加{1}点护盾` - -### Effect 1014 -- `argsNum`: `2` -- `info`: `全属性+{0},自身当前体力高于最大体力的1/{1}时强化效果翻倍` - -### Effect 1015 -- `argsNum`: `1` -- `info`: `自身体力低于对手时恢复自身最大体力的1/{0}` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-081-effects-1016-1020.md b/docs/effect-unimplemented-tasks/task-081-effects-1016-1020.md deleted file mode 100644 index 59053688b..000000000 --- a/docs/effect-unimplemented-tasks/task-081-effects-1016-1020.md +++ /dev/null @@ -1,35 +0,0 @@ -# Task 081: Effects 1016-1020 - -## 目标 - -- 补齐以下 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 1016 -- `argsNum`: `3` -- `info`: `造成的伤害不足{0}则下{1}次攻击造成的伤害提高{2}%` - -### Effect 1017 -- `argsNum`: `0` -- `info`: `消耗自身所有护盾值,造成等量固定伤害` - -### Effect 1018 -- `argsNum`: `2` -- `info`: `{0}回合内若受到的伤害低于{1}则免疫伤害并造成等同于伤害量的固定伤害` - -### Effect 1019 -- `argsNum`: `2` -- `info`: `造成的攻击伤害若高于{0}则令对手{1}回合内使用的属性技能无效` - -### Effect 1020 -- `argsNum`: `1` -- `info`: `全属性+{0},对手不处于能力提升状态时强化效果翻倍` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-082-effects-1021-1025.md b/docs/effect-unimplemented-tasks/task-082-effects-1021-1025.md deleted file mode 100644 index f78fa1c62..000000000 --- a/docs/effect-unimplemented-tasks/task-082-effects-1021-1025.md +++ /dev/null @@ -1,35 +0,0 @@ -# Task 082: Effects 1021-1025 - -## 目标 - -- 补齐以下 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 1021 -- `argsNum`: `1` -- `info`: `对手不处于能力提升状态时造成的伤害提高{0}%` - -### Effect 1022 -- `argsNum`: `1` -- `info`: `吸取对手能力提升状态,吸取成功则吸取对手{0}点体力` - -### Effect 1023 -- `argsNum`: `3` -- `info`: `{0}回合内{1}%闪避对手攻击,若对手MISS则恢复自身最大体力的1/{2}` - -### Effect 1024 -- `argsNum`: `3` -- `info`: `{0}回合内{1}%的概率免疫对手攻击伤害,未触发则回合结束时附加{2}%伤害量的百分比伤害` - -### Effect 1025 -- `argsNum`: `1` -- `info`: `吸取对手能力提升状态,吸取成功则恢复自身最大体力的1/{0}` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-083-effects-1026-1030.md b/docs/effect-unimplemented-tasks/task-083-effects-1026-1030.md deleted file mode 100644 index 31ef55670..000000000 --- a/docs/effect-unimplemented-tasks/task-083-effects-1026-1030.md +++ /dev/null @@ -1,37 +0,0 @@ -# Task 083: Effects 1026-1030 - -## 目标 - -- 补齐以下 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 1026 -- `argsNum`: `2` -- `info`: `下{0}回合,每回合都使对手的先制-{1}` - -### Effect 1027 -- `argsNum`: `2` -- `info`: `{0}回合内若自身不处于能力提升状态则附加{1}点固定伤害` - -### Effect 1028 -- `argsNum`: `8` -- `info`: `命中后{0}回合内每回合使对手{1},若未触发则减少对手最大体力的1/{7}` -- `param`: `0,1,1` - -### Effect 1029 -- `argsNum`: `3` -- `info`: `造成的伤害低于{0}则下{1}回合自身先制+{2}` - -### Effect 1030 -- `argsNum`: `1` -- `info`: `将自身能力下降状态反馈给对手,反馈成功则对手{0}` -- `param`: `1,0,0` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-097-effects-1097-1101.md b/docs/effect-unimplemented-tasks/task-097-effects-1097-1101.md deleted file mode 100644 index 17b34e399..000000000 --- a/docs/effect-unimplemented-tasks/task-097-effects-1097-1101.md +++ /dev/null @@ -1,35 +0,0 @@ -# Task 097: Effects 1097-1101 - -## 目标 - -- 补齐以下 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 1097 -- `argsNum`: `0` -- `info`: `造成的攻击伤害若低于280则令对手疲惫;未击败对手则令对手下1回合使用的攻击技能无效;技能结束后对手体力值高于0,则50%进行一次额外行动以触发星皇之怒(星皇之怒:50%令对手失明,未触发则2回合内令对手使用的属性技能无效)` - -### Effect 1098 -- `argsNum`: `0` -- `info`: `致命一击率提升20%,每次使用增加20%,最高100%;打出致命一击后令自身下2次技能触发的星皇之怒威力不再减少;技能结束后对手体力值高于0,则50%进行一次额外行动以触发星皇之怒(星皇之怒:下2次自身使用的攻击技能先制+2)` - -### Effect 1099 -- `argsNum`: `1` -- `info`: `消除对手能力提升状态,消除成功则自身免疫下{0}次受到的异常状态` - -### Effect 1100 -- `argsNum`: `3` -- `info`: `{0}回合内若对手使用属性技能则随机进入烧伤、冻伤、中毒、麻痹、害怕、睡眠中的一种异常状态,未触发则下{1}回合造成的伤害提高{2}%` - -### Effect 1101 -- `argsNum`: `3` -- `info`: `命中后{0}%秒杀对方,若MISS则自身死亡,使对手随机{1}个技能的PP值归零且全属性-{2}` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-098-effects-1102-1106.md b/docs/effect-unimplemented-tasks/task-098-effects-1102-1106.md deleted file mode 100644 index 355fc9fce..000000000 --- a/docs/effect-unimplemented-tasks/task-098-effects-1102-1106.md +++ /dev/null @@ -1,37 +0,0 @@ -# Task 098: Effects 1102-1106 - -## 目标 - -- 补齐以下 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 1102 -- `argsNum`: `3` -- `info`: `{0}回合内若对手使用属性技能则{1},未触发则减少对手1/{2}最大体力` -- `param`: `1,1,1` - -### Effect 1103 -- `argsNum`: `1` -- `info`: `若对手处于能力提升状态则造成的攻击伤害额外提升{0}%` - -### Effect 1104 -- `argsNum`: `2` -- `info`: `造成的伤害低于{0}则吸取对手1/{1}最大体力` - -### Effect 1105 -- `argsNum`: `2` -- `info`: `{0}回合内每回合攻击附加自身攻击和特攻中最高一项{1}%的百分比伤害` - -### Effect 1106 -- `argsNum`: `3` -- `info`: `当回合造成的攻击伤害若高于{0}则{1}%令对手{2}` -- `param`: `1,2,2` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-099-effects-1107-1111.md b/docs/effect-unimplemented-tasks/task-099-effects-1107-1111.md deleted file mode 100644 index 54a470eee..000000000 --- a/docs/effect-unimplemented-tasks/task-099-effects-1107-1111.md +++ /dev/null @@ -1,36 +0,0 @@ -# Task 099: Effects 1107-1111 - -## 目标 - -- 补齐以下 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 1107 -- `argsNum`: `4` -- `info`: `未击败对手则{0}%自身全属性+{1},{2}%对手全属性-{3}` - -### Effect 1108 -- `argsNum`: `2` -- `info`: `自身每处于一种能力提升状态则技能连击数+{0},对手每处于一种弱化状态则技能连击数+{1}` - -### Effect 1109 -- `argsNum`: `2` -- `info`: `{0}回合内若自身能力提升状态被消除则吸取对手最大体力的1/{1}` - -### Effect 1110 -- `argsNum`: `1` -- `info`: `反转对手能力提升状态,反转成功则令对手下{0}次属性技能失效,反转失败则消除对手能力提升状态` - -### Effect 1111 -- `argsNum`: `4` -- `info`: `{0}%令对手{1},未触发则{2}回合内自身造成的攻击伤害额外提升{3}%` -- `param`: `1,1,1` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/logic/service/fight/effect/1011_1015.go b/logic/service/fight/effect/1011_1015.go new file mode 100644 index 000000000..1aa18681b --- /dev/null +++ b/logic/service/fight/effect/1011_1015.go @@ -0,0 +1,130 @@ +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" +) + +// Effect 1011: {0}回合内有{1}%的概率免疫对手攻击技能造成的伤害并直接扣除对手等量体力 +type Effect1011 struct { + RoundEffectArg0Base +} + +func (e *Effect1011) DamageLockEx(t *info.DamageZone) bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + if t.Type != info.DamageType.Red || t.Damage.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100) + if !success { + return true + } + + damage := t.Damage + t.Damage = alpacadecimal.Zero + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: damage, + }) + return true +} + +// Effect 1012: 吸取对手能力提升状态,吸取成功则为自身附加{0}点护盾 +type Effect1012 struct { + node.EffectNode +} + +func (e *Effect1012) OnSkill() bool { + canSteal := false + for i, v := range e.Ctx().Opp.Prop[:] { + if v <= 0 { + continue + } + if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) { + canSteal = true + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v) + } + } + if canSteal { + e.Ctx().Our.AddShield(e.Args()[0]) + } + return true +} + +// Effect 1013: 自身每处于{0}种能力提升状态,则为自身附加{1}点护盾 +type Effect1013 struct { + node.EffectNode +} + +func (e *Effect1013) OnSkill() bool { + step := int(e.Args()[0].IntPart()) + if step <= 0 { + return true + } + + boostCount := 0 + for _, v := range e.Ctx().Our.Prop[:] { + if v > 0 { + boostCount++ + } + } + + shieldTimes := boostCount / step + if shieldTimes <= 0 { + return true + } + + e.Ctx().Our.AddShield(e.Args()[1].Mul(alpacadecimal.NewFromInt(int64(shieldTimes)))) + return true +} + +// Effect 1014: 全属性+{0},自身当前体力高于最大体力的1/{1}时强化效果翻倍 +type Effect1014 struct { + node.EffectNode +} + +func (e *Effect1014) OnSkill() bool { + boostValue := int8(e.Args()[0].IntPart()) + threshold := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[1]) + if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) > 0 { + boostValue *= 2 + } + + for i := 0; i < 6; i++ { + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boostValue) + } + return true +} + +// Effect 1015: 自身体力低于对手时恢复自身最大体力的1/{0} +type Effect1015 struct { + node.EffectNode +} + +func (e *Effect1015) OnSkill() bool { + if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) >= 0 { + return true + } + + e.Ctx().Our.Heal( + e.Ctx().Our, + &action.SelectSkillAction{}, + e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0]), + ) + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 1011, &Effect1011{}) + input.InitEffect(input.EffectType.Skill, 1012, &Effect1012{}) + input.InitEffect(input.EffectType.Skill, 1013, &Effect1013{}) + input.InitEffect(input.EffectType.Skill, 1014, &Effect1014{}) + input.InitEffect(input.EffectType.Skill, 1015, &Effect1015{}) +} diff --git a/logic/service/fight/effect/1016_1020.go b/logic/service/fight/effect/1016_1020.go new file mode 100644 index 000000000..d61cd503b --- /dev/null +++ b/logic/service/fight/effect/1016_1020.go @@ -0,0 +1,170 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// Effect 1016: 造成的伤害不足{0}则下{1}次攻击造成的伤害提高{2}% +type Effect1016 struct { + node.EffectNode +} + +func (e *Effect1016) Skill_Use() bool { + if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 { + return true + } + + effect := e.Ctx().Our.InitEffect( + input.EffectType.Sub, + 1016, + int(e.Args()[1].IntPart()), + int(e.Args()[2].IntPart()), + ) + if effect != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + } + return true +} + +type Effect1016Sub struct { + node.EffectNode + remaining int + percent alpacadecimal.Decimal +} + +func (e *Effect1016Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.Duration(-1) + if len(a) > 0 { + e.remaining = a[0] + } + if len(a) > 1 { + e.percent = alpacadecimal.NewFromInt(int64(a[1])) + } +} + +func (e *Effect1016Sub) Damage_Mul(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 { + return true + } + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + + bonus := zone.Damage.Mul(e.percent).Div(alpacadecimal.NewFromInt(100)) + zone.Damage = zone.Damage.Add(bonus) + e.remaining-- + if e.remaining <= 0 { + e.Alive(false) + } + return true +} + +// Effect 1017: 消耗自身所有护盾值,造成等量固定伤害 +type Effect1017 struct { + node.EffectNode +} + +func (e *Effect1017) Skill_Use() bool { + shield := e.Ctx().Our.ConsumeAllShield() + if shield.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: shield, + }) + return true +} + +// Effect 1018: {0}回合内若受到的伤害低于{1}则免疫伤害并造成等同于伤害量的固定伤害 +type Effect1018 struct { + RoundEffectArg0Base +} + +func (e *Effect1018) DamageLockEx(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red { + return true + } + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 || zone.Damage.Cmp(e.Args()[1]) >= 0 { + return true + } + + damage := zone.Damage + zone.Damage = alpacadecimal.Zero + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: damage, + }) + return true +} + +// Effect 1019: 造成的攻击伤害若高于{0}则令对手{1}回合内使用的属性技能无效 +type Effect1019 struct { + node.EffectNode +} + +func (e *Effect1019) Skill_Use() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) <= 0 { + return true + } + + effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1019, int(e.Args()[1].IntPart())) + if effect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, effect) + } + return true +} + +type Effect1019Sub struct { + RoundEffectArg0Base +} + +func (e *Effect1019Sub) SkillHit_ex() bool { + if e.Ctx().SkillEntity == nil { + return true + } + if e.Ctx().SkillEntity.Category() != info.Category.STATUS { + return true + } + e.Ctx().SkillEntity.SetMiss() + return true +} + +// Effect 1020: 全属性+{0},对手不处于能力提升状态时强化效果翻倍 +type Effect1020 struct { + node.EffectNode +} + +func (e *Effect1020) OnSkill() bool { + boostValue := int8(e.Args()[0].IntPart()) + if !e.Ctx().Opp.HasPropADD() { + boostValue *= 2 + } + + for i := 0; i < 6; i++ { + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boostValue) + } + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 1016, &Effect1016{}) + input.InitEffect(input.EffectType.Sub, 1016, &Effect1016Sub{}) + input.InitEffect(input.EffectType.Skill, 1017, &Effect1017{}) + input.InitEffect(input.EffectType.Skill, 1018, &Effect1018{}) + input.InitEffect(input.EffectType.Skill, 1019, &Effect1019{}) + input.InitEffect(input.EffectType.Sub, 1019, &Effect1019Sub{}) + input.InitEffect(input.EffectType.Skill, 1020, &Effect1020{}) +} diff --git a/logic/service/fight/effect/1021_1025.go b/logic/service/fight/effect/1021_1025.go new file mode 100644 index 000000000..b306a5257 --- /dev/null +++ b/logic/service/fight/effect/1021_1025.go @@ -0,0 +1,166 @@ +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" +) + +// Effect 1021: 对手不处于能力提升状态时造成的伤害提高{0}% +type Effect1021 struct { + node.EffectNode +} + +func (e *Effect1021) SkillHit() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + if e.Ctx().Opp.HasPropADD() { + return true + } + + addSkillPowerPercent(e.Ctx().SkillEntity, e.Args()[0]) + return true +} + +// Effect 1022: 吸取对手能力提升状态,吸取成功则吸取对手{0}点体力 +type Effect1022 struct { + node.EffectNode +} + +func (e *Effect1022) OnSkill() bool { + canSteal := false + for i, v := range e.Ctx().Opp.Prop[:] { + if v <= 0 { + continue + } + if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) { + canSteal = true + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v) + } + } + if !canSteal { + return true + } + + drain := e.Args()[0] + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: drain, + }) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain) + return true +} + +// Effect 1023: {0}回合内{1}%闪避对手攻击,若对手MISS则恢复自身最大体力的1/{2} +type Effect1023 struct { + RoundEffectArg0Base +} + +func (e *Effect1023) SkillHit_ex() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + if e.Ctx().SkillEntity.AttackTime == 2 { + return true + } + + success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100) + if !success { + return true + } + if !e.Ctx().SkillEntity.SetMiss() { + return true + } + + e.Ctx().Our.Heal( + e.Ctx().Our, + &action.SelectSkillAction{}, + e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[2]), + ) + return true +} + +// Effect 1024: {0}回合内{1}%的概率免疫对手攻击伤害,未触发则回合结束时附加{2}%伤害量的百分比伤害 +type Effect1024 struct { + RoundEffectArg0Base + pendingDamage alpacadecimal.Decimal + immuneTriggeredRound bool +} + +func (e *Effect1024) DamageLockEx(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red { + return true + } + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100) + if success { + zone.Damage = alpacadecimal.Zero + e.immuneTriggeredRound = true + return true + } + + e.pendingDamage = e.pendingDamage.Add(zone.Damage) + return true +} + +func (e *Effect1024) TurnEnd() { + if !e.immuneTriggeredRound && e.pendingDamage.Cmp(alpacadecimal.Zero) > 0 { + damage := e.pendingDamage.Mul(e.Args()[2]).Div(alpacadecimal.NewFromInt(100)) + if damage.Cmp(alpacadecimal.Zero) > 0 { + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: damage, + }) + } + } + + e.pendingDamage = alpacadecimal.Zero + e.immuneTriggeredRound = false + e.EffectNode.TurnEnd() +} + +// Effect 1025: 吸取对手能力提升状态,吸取成功则恢复自身最大体力的1/{0} +type Effect1025 struct { + node.EffectNode +} + +func (e *Effect1025) OnSkill() bool { + canSteal := false + for i, v := range e.Ctx().Opp.Prop[:] { + if v <= 0 { + continue + } + if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) { + canSteal = true + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v) + } + } + if !canSteal { + return true + } + + e.Ctx().Our.Heal( + e.Ctx().Our, + &action.SelectSkillAction{}, + e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0]), + ) + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 1021, &Effect1021{}) + input.InitEffect(input.EffectType.Skill, 1022, &Effect1022{}) + input.InitEffect(input.EffectType.Skill, 1023, &Effect1023{}) + input.InitEffect(input.EffectType.Skill, 1024, &Effect1024{}) + input.InitEffect(input.EffectType.Skill, 1025, &Effect1025{}) +} diff --git a/logic/service/fight/effect/1026_1030.go b/logic/service/fight/effect/1026_1030.go new file mode 100644 index 000000000..37cd6770f --- /dev/null +++ b/logic/service/fight/effect/1026_1030.go @@ -0,0 +1,184 @@ +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" +) + +// Effect 1026: 下{0}回合,每回合都使对手的先制-{1} +type Effect1026 struct { + node.EffectNode +} + +func (e *Effect1026) Skill_Use() bool { + effect := e.Ctx().Our.InitEffect( + input.EffectType.Sub, + 1026, + int(e.Args()[0].IntPart()), + int(e.Args()[1].IntPart()), + ) + if effect != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + } + return true +} + +type Effect1026Sub struct { + RoundEffectArg0Base +} + +func (e *Effect1026Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + priorityDown := int(e.Args()[1].IntPart()) + + if fattack != nil && fattack.PlayerID == e.Ctx().Opp.UserID && fattack.SkillEntity != nil { + fattack.SkillEntity.XML.Priority -= priorityDown + } + if sattack != nil && sattack.PlayerID == e.Ctx().Opp.UserID && sattack.SkillEntity != nil { + sattack.SkillEntity.XML.Priority -= priorityDown + } + return true +} + +// Effect 1027: {0}回合内若自身不处于能力提升状态则附加{1}点固定伤害 +type Effect1027 struct { + RoundEffectArg0Base +} + +func (e *Effect1027) OnSkill() bool { + if e.Ctx().Our.HasPropADD() { + return true + } + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: e.Args()[1], + }) + return true +} + +// Effect 1028: 命中后{0}回合内每回合使对手{1},若未触发则减少对手最大体力的1/{7} +type Effect1028 struct { + node.EffectNode +} + +func (e *Effect1028) Skill_Use() bool { + effect := e.Ctx().Our.InitEffect( + input.EffectType.Sub, + 1028, + e.SideEffectArgs..., + ) + if effect != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + } + return true +} + +type Effect1028Sub struct { + RoundEffectArg0Base +} + +func (e *Effect1028Sub) TurnEnd() { + triggered := false + for i, v := range e.SideEffectArgs[1:7] { + if v == 0 { + continue + } + if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(v)) { + triggered = true + } + } + + if !triggered && len(e.SideEffectArgs) > 7 { + divisor := alpacadecimal.NewFromInt(int64(e.SideEffectArgs[7])) + if divisor.Cmp(alpacadecimal.Zero) > 0 { + damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(divisor) + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: damage, + }) + } + } + + e.EffectNode.TurnEnd() +} + +// Effect 1029: 造成的伤害低于{0}则下{1}回合自身先制+{2} +type Effect1029 struct { + node.EffectNode +} + +func (e *Effect1029) Skill_Use() bool { + if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 { + return true + } + + effect := e.Ctx().Our.InitEffect( + input.EffectType.Sub, + 1029, + int(e.Args()[1].IntPart()), + int(e.Args()[2].IntPart()), + ) + if effect != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + } + return true +} + +type Effect1029Sub struct { + RoundEffectArg0Base +} + +func (e *Effect1029Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + if sattack != nil && sattack.PlayerID == e.Ctx().Our.UserID && sattack.SkillEntity != nil { + sattack.SkillEntity.XML.Priority += int(e.Args()[1].IntPart()) + } + if fattack != nil && fattack.PlayerID == e.Ctx().Our.UserID && fattack.SkillEntity != nil { + fattack.SkillEntity.XML.Priority += int(e.Args()[1].IntPart()) + } + return true +} + +// Effect 1030: 将自身能力下降状态反馈给对手,反馈成功则对手{0} +type Effect1030 struct { + node.EffectNode +} + +func (e *Effect1030) OnSkill() bool { + reflected := false + for i, v := range e.Ctx().Our.Prop[:] { + if v >= 0 { + continue + } + if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), v) { + reflected = true + } + } + + if !reflected { + return true + } + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[0].IntPart())) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 1026, &Effect1026{}) + input.InitEffect(input.EffectType.Sub, 1026, &Effect1026Sub{}) + input.InitEffect(input.EffectType.Skill, 1027, &Effect1027{}) + input.InitEffect(input.EffectType.Skill, 1028, &Effect1028{}) + input.InitEffect(input.EffectType.Sub, 1028, &Effect1028Sub{}) + input.InitEffect(input.EffectType.Skill, 1029, &Effect1029{}) + input.InitEffect(input.EffectType.Sub, 1029, &Effect1029Sub{}) + input.InitEffect(input.EffectType.Skill, 1030, &Effect1030{}) +} diff --git a/logic/service/fight/effect/1097_1101.go b/logic/service/fight/effect/1097_1101.go new file mode 100644 index 000000000..d155a2010 --- /dev/null +++ b/logic/service/fight/effect/1097_1101.go @@ -0,0 +1,552 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + "blazing/modules/player/model" + + "github.com/alpacahq/alpacadecimal" + "github.com/gogf/gf/v2/util/grand" +) + +var hundred = alpacadecimal.NewFromInt(100) + +// Effect 1097: 造成的攻击伤害若低于280则令对手疲惫;未击败对手则令对手下1回合使用的攻击技能无效; +// 技能结束后对手体力值高于0,则50%进行一次额外行动以触发星皇之怒 +type Effect1097 struct { + node.EffectNode + starFuryActive bool +} + +func (e *Effect1097) Skill_Use() bool { + skill := e.Ctx().SkillEntity + if skill == nil || skill.Category() == info.Category.STATUS { + return true + } + + if skill.AttackTime != 0 && e.Ctx().Our.SumDamage.Cmp(alpacadecimal.NewFromInt(280)) < 0 { + tiredEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Tired)) + if tiredEffect != nil { + tiredEffect.Duration(1) + e.Ctx().Opp.AddEffect(e.Ctx().Our, tiredEffect) + } + } + + if e.Ctx().Opp.CurrentPet.Info.Hp > 0 { + disableAttack := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1097, 1, 0) + if disableAttack != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, disableAttack) + } + } + + if e.starFuryActive { + if e.Ctx().Opp.CurrentPet.Info.Hp <= 0 { + return true + } + + success, _, _ := e.Input.Player.Roll(50, 100) + if success { + blindEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Blind)) + if blindEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, blindEffect) + } + return true + } + + disableStatus := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1097, 2, 1) + if disableStatus != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, disableStatus) + } + return true + } + + if e.Ctx().Opp.CurrentPet.Info.Hp <= 0 { + return true + } + + success, _, _ := e.Input.Player.Roll(50, 100) + if !success { + return true + } + + furySkill := cloneSkillEntity(skill) + if furySkill == nil { + return true + } + if furySkill.Category() != info.Category.STATUS { + furySkill.XML.Power = halvePower(furySkill.XML.Power) + } + + e.starFuryActive = true + executeExtraSkill(e.Ctx().Our, e.Ctx().Opp, furySkill) + e.starFuryActive = false + return true +} + +// Effect 1097 sub: 令对手攻击技能或属性技能失效 +type Effect1097Sub struct { + node.EffectNode + armed bool + mode int +} + +func (e *Effect1097Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + if len(a) > 0 { + e.Duration(a[0]) + } + if len(a) > 1 { + e.mode = a[1] + } +} + +func (e *Effect1097Sub) ActionStart(a, b *action.SelectSkillAction) bool { + if e.Ctx().SkillEntity == nil { + return true + } + + switch e.mode { + case 0: + if !e.armed || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + e.Ctx().SkillEntity.SetMiss() + case 1: + if e.Ctx().SkillEntity.Category() != info.Category.STATUS { + return true + } + e.Ctx().SkillEntity.SetNoSide() + } + + return true +} + +func (e *Effect1097Sub) TurnEnd() { + if e.mode == 0 && !e.armed { + e.armed = true + } + e.EffectNode.TurnEnd() +} + +// Effect 1098: 致命一击率提升20%,每次使用增加20%,最高100%;打出致命一击后令自身下2次技能触发的星皇之怒威力不再减少; +// 技能结束后对手体力值高于0,则50%进行一次额外行动以触发星皇之怒 +type Effect1098 struct { + node.EffectNode + critChance int + fullPowerFuryCount int + starFuryActive bool +} + +func (e *Effect1098) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + if old := t.GetEffect(input.EffectType.Skill, 1098); old != nil { + if prev, ok := old.(*Effect1098); ok { + e.critChance = prev.critChance + e.fullPowerFuryCount = prev.fullPowerFuryCount + } + } + if e.critChance <= 0 { + e.critChance = 20 + } +} + +func (e *Effect1098) SkillHit() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + + success, _, _ := e.Input.Player.Roll(e.critChance, 100) + if success { + e.Ctx().SkillEntity.XML.CritRate = 16 + } + return true +} + +func (e *Effect1098) Skill_Use() bool { + skill := e.Ctx().SkillEntity + if skill == nil { + return true + } + + if skill.Category() != info.Category.STATUS && skill.Crit != 0 { + e.fullPowerFuryCount = 2 + } + if e.critChance < 100 { + e.critChance += 20 + if e.critChance > 100 { + e.critChance = 100 + } + } + + if e.starFuryActive { + priorityEffect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1098, 2) + if priorityEffect != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, priorityEffect) + } + return true + } + + if e.Ctx().Opp.CurrentPet.Info.Hp <= 0 { + return true + } + + success, _, _ := e.Input.Player.Roll(50, 100) + if !success { + return true + } + + furySkill := cloneSkillEntity(skill) + if furySkill == nil { + return true + } + if furySkill.Category() != info.Category.STATUS { + if e.fullPowerFuryCount > 0 { + e.fullPowerFuryCount-- + } else { + furySkill.XML.Power = halvePower(furySkill.XML.Power) + } + } + + e.starFuryActive = true + executeExtraSkill(e.Ctx().Our, e.Ctx().Opp, furySkill) + e.starFuryActive = false + return true +} + +// Effect 1098 sub: 下2次自身使用的攻击技能先制+2 +type Effect1098Sub struct { + node.EffectNode + remaining int +} + +func (e *Effect1098Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.Duration(-1) + if len(a) > 0 { + e.remaining = a[0] + } +} + +func (e *Effect1098Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + if e.remaining <= 0 { + e.Alive(false) + return true + } + + current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() == info.Category.STATUS { + return true + } + + current.SkillEntity.XML.Priority += 2 + e.remaining-- + if e.remaining <= 0 { + e.Alive(false) + } + return true +} + +// Effect 1099: 消除对手能力提升状态,消除成功则自身免疫下{0}次受到的异常状态 +type Effect1099 struct { + node.EffectNode +} + +func (e *Effect1099) Skill_Use() bool { + cleared := false + for i, level := range e.Ctx().Opp.Prop[:] { + if level <= 0 { + continue + } + if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) { + cleared = true + } + } + if !cleared { + return true + } + + immuneEffect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1099, int(e.Args()[0].IntPart())) + if immuneEffect != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, immuneEffect) + } + return true +} + +// Effect 1099 sub: 免疫下N次异常状态 +type Effect1099Sub struct { + node.EffectNode + remaining int +} + +func (e *Effect1099Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.Duration(-1) + if len(a) > 0 { + e.remaining = a[0] + } +} + +func (e *Effect1099Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool { + if e.remaining <= 0 { + e.Alive(false) + return true + } + if in != e.Ctx().Opp || !input.IS_Stat(effEffect) { + return true + } + + e.remaining-- + if e.remaining <= 0 { + e.Alive(false) + } + return false +} + +// Effect 1100: {0}回合内若对手使用属性技能则随机进入烧伤、冻伤、中毒、麻痹、害怕、睡眠中的一种异常状态,未触发则下{1}回合造成的伤害提高{2}% +type Effect1100 struct { + RoundEffectArg0Base + triggered bool +} + +func (e *Effect1100) Skill_Use_ex() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS { + return true + } + + e.triggered = true + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, randomStatus1100()) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + return true +} + +func (e *Effect1100) TurnEnd() { + if !e.triggered && e.Duration() == 1 { + boostEffect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1100, int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart())) + if boostEffect != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, boostEffect) + } + } + e.EffectNode.TurnEnd() +} + +// Effect 1100 sub: 下M回合造成的伤害提高K% +type Effect1100Sub struct { + node.EffectNode + percent alpacadecimal.Decimal +} + +func (e *Effect1100Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + if len(a) > 0 { + e.Duration(a[0]) + } + if len(a) > 1 { + e.percent = alpacadecimal.NewFromInt(int64(a[1])) + } +} + +func (e *Effect1100Sub) Damage_Mul(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red { + return true + } + + zone.Damage = zone.Damage.Mul(hundred.Add(e.percent)).Div(hundred) + return true +} + +// Effect 1101: 命中后{0}%秒杀对方,若MISS则自身死亡,使对手随机{1}个技能的PP值归零且全属性-{2} +type Effect1101 struct { + node.EffectNode +} + +func (e *Effect1101) DamageFloor(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red { + return true + } + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.AttackTime == 0 { + return true + } + + success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100) + if !success { + return true + } + + zone.Damage = e.Ctx().Opp.CurrentPet.GetMaxHP() + return true +} + +func (e *Effect1101) Skill_Use() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.AttackTime == 0 { + e.Ctx().Our.CurrentPet.Info.Hp = 0 + } + + zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[1].IntPart())) + applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[2].IntPart())) + return true +} + +func executeExtraSkill(attacker, defender *input.Input, skill *info.SkillEntity) { + if attacker == nil || defender == nil || skill == nil || attacker.CurrentPet.Info.Hp == 0 { + return + } + + skill.XML.MustHit = 1 + skill.AttackTimeC(attacker.Prop[5]) + + defender.Exec(func(effect input.Effect) bool { + effect.Ctx().SkillEntity = skill + effect.SkillHit_ex() + return true + }) + + attacker.Exec(func(effect input.Effect) bool { + effect.Ctx().SkillEntity = skill + effect.SkillHit() + return true + }) + + var originalProps [2][6]int8 + var originalPetInfo [2]model.PetInfo + originalProps[0], originalProps[1] = attacker.Prop, defender.Prop + originalPetInfo[0], originalPetInfo[1] = attacker.CurrentPet.Info, defender.CurrentPet.Info + + attacker.Exec(func(effect input.Effect) bool { + effect.Ctx().SkillEntity = skill + effect.CalculatePre() + return true + }) + + var sumDamage alpacadecimal.Decimal + if skill.AttackTime != 0 { + sumDamage = attacker.CalculatePower(defender, skill) + attacker.CalculateCrit(defender, skill) + attacker.IsCritical = skill.Crit + } + + attacker.Prop, defender.Prop = originalProps[0], originalProps[1] + attacker.CurrentPet.Info, defender.CurrentPet.Info = originalPetInfo[0], originalPetInfo[1] + + if attacker.IsCritical == 1 { + if skill.Category() == info.Category.PHYSICAL && defender.Prop[1] > 0 { + defender.Prop[1] = 0 + } else if skill.Category() == info.Category.SPECIAL && defender.Prop[3] > 0 { + defender.Prop[3] = 0 + } + sumDamage = sumDamage.Mul(alpacadecimal.NewFromInt(2)) + } + + attacker.Exec(func(effect input.Effect) bool { + effect.Ctx().SkillEntity = skill + effect.OnSkill() + return true + }) + + defender.Damage(attacker, &info.DamageZone{ + Type: info.DamageType.Red, + Damage: sumDamage, + }) + + if defender.CurrentPet.Info.Hp > 0 { + defender.Exec(func(effect input.Effect) bool { + effect.Ctx().SkillEntity = skill + effect.Skill_Use_ex() + return true + }) + } + + if attacker.CurrentPet.Info.Hp > 0 { + attacker.Exec(func(effect input.Effect) bool { + effect.Ctx().SkillEntity = skill + effect.Skill_Use() + return true + }) + } + + defender.Exec(func(effect input.Effect) bool { + effect.Ctx().SkillEntity = skill + effect.Action_end_ex() + return true + }) + attacker.Exec(func(effect input.Effect) bool { + effect.Ctx().SkillEntity = skill + effect.Action_end() + return true + }) +} + +func halvePower(power int) int { + if power <= 1 { + return 1 + } + power /= 2 + if power <= 0 { + return 1 + } + return power +} + +func actionByPlayer(fattack, sattack *action.SelectSkillAction, playerID uint32) *action.SelectSkillAction { + if fattack != nil && fattack.PlayerID == playerID { + return fattack + } + if sattack != nil && sattack.PlayerID == playerID { + return sattack + } + return nil +} + +func randomStatus1100() int { + statusTypes := []int{ + int(info.PetStatus.Burned), + int(info.PetStatus.Frozen), + int(info.PetStatus.Poisoned), + int(info.PetStatus.Paralysis), + int(info.PetStatus.Fear), + int(info.PetStatus.Sleep), + } + return statusTypes[grand.Intn(len(statusTypes))] +} + +func zeroRandomSkillPP(target *input.Input, count int) { + if target == nil || count <= 0 { + return + } + skills := target.CurrentPet.Info.SkillList + if len(skills) == 0 { + return + } + if count > len(skills) { + count = len(skills) + } + + indexes := grand.Perm(len(skills)) + for _, idx := range indexes[:count] { + target.CurrentPet.Info.SkillList[idx].PP = 0 + } +} + +func applyAllPropDown(owner, target *input.Input, level int8) { + if owner == nil || target == nil || level <= 0 { + return + } + for i := range target.Prop { + target.SetProp(owner, int8(i), -level) + } +} + +func init() { + input.InitEffect(input.EffectType.Skill, 1097, &Effect1097{}) + input.InitEffect(input.EffectType.Sub, 1097, &Effect1097Sub{}) + input.InitEffect(input.EffectType.Skill, 1098, &Effect1098{}) + input.InitEffect(input.EffectType.Sub, 1098, &Effect1098Sub{}) + input.InitEffect(input.EffectType.Skill, 1099, &Effect1099{}) + input.InitEffect(input.EffectType.Sub, 1099, &Effect1099Sub{}) + input.InitEffect(input.EffectType.Skill, 1100, &Effect1100{}) + input.InitEffect(input.EffectType.Sub, 1100, &Effect1100Sub{}) + input.InitEffect(input.EffectType.Skill, 1101, &Effect1101{}) +} diff --git a/logic/service/fight/effect/1102_1106.go b/logic/service/fight/effect/1102_1106.go new file mode 100644 index 000000000..0b36f6b94 --- /dev/null +++ b/logic/service/fight/effect/1102_1106.go @@ -0,0 +1,136 @@ +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" +) + +// Effect 1102: {0}回合内若对手使用属性技能则{1},未触发则减少对手1/{2}最大体力 +type Effect1102 struct { + RoundEffectArg0Base + triggered bool +} + +func (e *Effect1102) Skill_Use_ex() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS { + return true + } + + e.triggered = true + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart())) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + return true +} + +func (e *Effect1102) TurnEnd() { + if !e.triggered && e.Duration() == 1 && e.Args()[2].Cmp(alpacadecimal.Zero) > 0 { + damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[2]) + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: damage, + }) + } + e.EffectNode.TurnEnd() +} + +// Effect 1103: 若对手处于能力提升状态则造成的攻击伤害额外提升{0}% +type Effect1103 struct { + node.EffectNode +} + +func (e *Effect1103) SkillHit() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + if !e.Ctx().Opp.HasPropADD() { + return true + } + + addSkillPowerPercent(e.Ctx().SkillEntity, e.Args()[0]) + return true +} + +// Effect 1104: 造成的伤害低于{0}则吸取对手1/{1}最大体力 +type Effect1104 struct { + node.EffectNode +} + +func (e *Effect1104) Skill_Use() bool { + skill := e.Ctx().SkillEntity + if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 { + return true + } + if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1]) + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: damage, + }) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage) + return true +} + +// Effect 1105: {0}回合内每回合攻击附加自身攻击和特攻中最高一项{1}%的固定伤害 +type Effect1105 struct { + RoundEffectArg0Base +} + +func (e *Effect1105) OnSkill() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + + baseProp := alpacadecimal.Max(e.Ctx().Our.GetProp(0), e.Ctx().Our.GetProp(2)) + damage := baseProp.Mul(e.Args()[1]).Div(hundred) + 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 1106: 当回合造成的攻击伤害若高于{0}则{1}%令对手{2} +type Effect1106 struct { + node.EffectNode +} + +func (e *Effect1106) Skill_Use() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + 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 +} + +func init() { + input.InitEffect(input.EffectType.Skill, 1102, &Effect1102{}) + input.InitEffect(input.EffectType.Skill, 1103, &Effect1103{}) + input.InitEffect(input.EffectType.Skill, 1104, &Effect1104{}) + input.InitEffect(input.EffectType.Skill, 1105, &Effect1105{}) + input.InitEffect(input.EffectType.Skill, 1106, &Effect1106{}) +} diff --git a/logic/service/fight/effect/1107_1111.go b/logic/service/fight/effect/1107_1111.go new file mode 100644 index 000000000..0ad1e8f93 --- /dev/null +++ b/logic/service/fight/effect/1107_1111.go @@ -0,0 +1,232 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// Effect 1107: 未击败对手则{0}%自身全属性+{1},{2}%对手全属性-{3} +type Effect1107 struct { + node.EffectNode +} + +func (e *Effect1107) Skill_Use() bool { + if e.Ctx().Opp.CurrentPet.Info.Hp <= 0 { + return true + } + + selfChance := int(e.Args()[0].IntPart()) + if ok, _, _ := e.Input.Player.Roll(selfChance, 100); ok { + boost := int8(e.Args()[1].IntPart()) + for i := 0; i < 6; i++ { + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boost) + } + } + + oppChance := int(e.Args()[2].IntPart()) + if ok, _, _ := e.Input.Player.Roll(oppChance, 100); ok { + reduce := int8(e.Args()[3].IntPart()) + for i := 0; i < 6; i++ { + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -reduce) + } + } + + return true +} + +// Effect 1108: 自身每处于一种能力提升状态则技能连击数+{0},对手每处于一种弱化状态则技能连击数+{1} +// 当前战斗模型未逐段执行多段攻击,这里按仓库现有连击效果统一折算为红伤倍率提升。 +type Effect1108 struct { + node.EffectNode +} + +func (e *Effect1108) Damage_Mul(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red { + return true + } + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + + baseHits := e.Ctx().SkillEntity.XML.AtkNum + if baseHits <= 0 { + baseHits = 1 + } + + extraHits := countPositivePropKinds(e.Ctx().Our)*int(e.Args()[0].IntPart()) + + countNegativePropKinds(e.Ctx().Opp)*int(e.Args()[1].IntPart()) + totalHits := baseHits + extraHits + if totalHits <= 1 { + return true + } + + zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(int64(totalHits))) + return true +} + +// Effect 1109: {0}回合内若自身能力提升状态被消除则吸取对手最大体力的1/{1} +type Effect1109 struct { + RoundEffectArg0Base +} + +func (e *Effect1109) 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 || e.Ctx().Our.Prop[prop] <= 0 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1]) + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: damage, + }) + e.Ctx().Our.Heal(e.Ctx().Our, nil, damage) + return true +} + +// Effect 1110: 反转对手能力提升状态,反转成功则令对手下{0}次属性技能失效,反转失败则消除对手能力提升状态 +type Effect1110 struct { + node.EffectNode +} + +func (e *Effect1110) Skill_Use() bool { + reversed := false + for i, v := range e.Ctx().Opp.Prop[:] { + if v <= 0 { + continue + } + if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v) { + reversed = true + } + } + + if reversed { + effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1110, int(e.Args()[0].IntPart())) + if effect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, effect) + } + return true + } + + for i, v := range e.Ctx().Opp.Prop[:] { + if v > 0 { + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) + } + } + return true +} + +type Effect1110Sub struct { + node.EffectNode + remaining int +} + +func (e *Effect1110Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.Duration(-1) + if len(a) > 0 { + e.remaining = a[0] + } +} + +func (e *Effect1110Sub) SkillHit_ex() bool { + if e.remaining <= 0 { + e.Alive(false) + return true + } + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS { + return true + } + + e.Ctx().SkillEntity.SetNoSide() + e.Ctx().SkillEntity.AttackTime = 0 + e.remaining-- + if e.remaining <= 0 { + e.Alive(false) + } + return true +} + +// Effect 1111: {0}%令对手{1},未触发则{2}回合内自身造成的攻击伤害额外提升{3}% +type Effect1111 struct { + node.EffectNode +} + +func (e *Effect1111) Skill_Use() bool { + success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100) + if success { + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart())) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + return true + } + + effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1111, int(e.Args()[2].IntPart()), int(e.Args()[3].IntPart())) + if effect != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + } + return true +} + +type Effect1111Sub struct { + node.EffectNode + percent alpacadecimal.Decimal +} + +func (e *Effect1111Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + if len(a) > 0 { + e.Duration(a[0]) + } + if len(a) > 1 { + e.percent = alpacadecimal.NewFromInt(int64(a[1])) + } +} + +func (e *Effect1111Sub) Damage_Mul(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red { + return true + } + + zone.Damage = zone.Damage.Mul(hundred.Add(e.percent)).Div(hundred) + return true +} + +func countPositivePropKinds(target *input.Input) int { + count := 0 + for _, v := range target.Prop[:] { + if v > 0 { + count++ + } + } + return count +} + +func countNegativePropKinds(target *input.Input) int { + count := 0 + for _, v := range target.Prop[:] { + if v < 0 { + count++ + } + } + return count +} + +func init() { + input.InitEffect(input.EffectType.Skill, 1107, &Effect1107{}) + input.InitEffect(input.EffectType.Skill, 1108, &Effect1108{}) + input.InitEffect(input.EffectType.Skill, 1109, &Effect1109{}) + input.InitEffect(input.EffectType.Skill, 1110, &Effect1110{}) + input.InitEffect(input.EffectType.Sub, 1110, &Effect1110Sub{}) + input.InitEffect(input.EffectType.Skill, 1111, &Effect1111{}) + input.InitEffect(input.EffectType.Sub, 1111, &Effect1111Sub{}) +} diff --git a/logic/service/fight/effect/627_631.go b/logic/service/fight/effect/627_631.go new file mode 100644 index 000000000..08121265e --- /dev/null +++ b/logic/service/fight/effect/627_631.go @@ -0,0 +1,221 @@ +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" +) + +func clearStatusEffects(target *input.Input, statusID int) bool { + cleared := false + for _, eff := range target.Effects { + if eff == nil || !eff.Alive() { + continue + } + effID := eff.ID() + if effID.GetEffectType() != input.EffectType.Status || int(effID.Suffix()) != statusID { + continue + } + eff.Alive(false) + cleared = true + } + return cleared +} + +func shouldAdjustNextAttackPriority(e input.Effect, fattack, sattack *action.SelectSkillAction) bool { + if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { + return false + } + if fattack == nil || fattack.PlayerID == e.Ctx().Our.UserID { + return false + } + if sattack == nil || sattack.SkillEntity == nil { + return false + } + return true +} + +// Effect 627: 对手处于能力提升状态时附加其{0}值{1}%的百分比伤害 +type Effect627 struct { + node.EffectNode +} + +func (e *Effect627) OnSkill() bool { + if !e.Ctx().Opp.HasPropADD() { + return true + } + + propID := int(e.Args()[0].IntPart()) + if propID < 0 || propID >= 6 { + return true + } + + damage := e.Ctx().Opp.GetProp(propID).Mul(e.Args()[1]).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 628: 若对手处于能力下降状态则造成伤害的{0}%恢复体力 +type Effect628 struct { + node.EffectNode +} + +func (e *Effect628) Skill_Use() bool { + if !e.Ctx().Opp.HasPropSub() { + return true + } + if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + heal := e.Ctx().Our.SumDamage.Mul(e.Args()[0]).Div(alpacadecimal.NewFromInt(100)) + if heal.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal) + return true +} + +// Effect 629: 消除{0}状态,消除成功下回合自身先制+{1} +type Effect629 struct { + node.EffectNode +} + +func (e *Effect629) Skill_Use() bool { + if !clearStatusEffects(e.Ctx().Our, int(e.Args()[0].IntPart())) { + return true + } + + addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect629Sub{}, -1) + return true +} + +type Effect629Sub struct { + FixedDuration1Base +} + +func (e *Effect629Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + if !shouldAdjustNextAttackPriority(e, fattack, sattack) { + return true + } + + sattack.SkillEntity.XML.Priority += int(e.Args()[1].IntPart()) + return true +} + +// Effect 630: {0}回合内{1}状态被消除,则有{2}%概率使对手{3} +type Effect630 struct { + RoundEffectArg0Base + initialized bool + lastExists bool + triggered bool +} + +func (e *Effect630) observeStatusRemoval() { + if e.triggered { + return + } + + statusID := int(e.Args()[1].IntPart()) + exists := e.Ctx().Our.StatEffect_Exist(info.EnumPetStatus(statusID)) + if !e.initialized { + e.initialized = true + e.lastExists = exists + return + } + + if e.lastExists && !exists { + e.triggered = true + success, _, _ := e.Input.Player.Roll(int(e.Args()[2].IntPart()), 100) + if success { + applyEffectPropChanges(e.Ctx().Opp, e.Ctx().Our, e.SideEffectArgs[3:], false) + } + e.Alive(false) + return + } + + e.lastExists = exists +} + +func (e *Effect630) TurnStart(fattack, sattack *action.SelectSkillAction) { + e.observeStatusRemoval() +} + +func (e *Effect630) ActionStart(fattack, sattack *action.SelectSkillAction) bool { + e.observeStatusRemoval() + return true +} + +func (e *Effect630) OnSkill() bool { + e.observeStatusRemoval() + return true +} + +func (e *Effect630) Skill_Use() bool { + e.observeStatusRemoval() + return true +} + +func (e *Effect630) Skill_Use_ex() bool { + e.observeStatusRemoval() + return true +} + +func (e *Effect630) Action_end() bool { + e.observeStatusRemoval() + return true +} + +func (e *Effect630) Action_end_ex() bool { + e.observeStatusRemoval() + return true +} + +// Effect 631: 消除{0}状态,消除成功下回合造成伤害提升{1}% +type Effect631 struct { + node.EffectNode +} + +func (e *Effect631) Skill_Use() bool { + if !clearStatusEffects(e.Ctx().Our, int(e.Args()[0].IntPart())) { + return true + } + + addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect631Sub{}, -1) + return true +} + +type Effect631Sub struct { + FixedDuration1Base +} + +func (e *Effect631Sub) Damage_Mul(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red { + return true + } + + bonus := zone.Damage.Mul(e.Args()[1]).Div(alpacadecimal.NewFromInt(100)) + zone.Damage = zone.Damage.Add(bonus) + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 627, &Effect627{}) + input.InitEffect(input.EffectType.Skill, 628, &Effect628{}) + input.InitEffect(input.EffectType.Skill, 629, &Effect629{}) + input.InitEffect(input.EffectType.Sub, 629, &Effect629Sub{}) + input.InitEffect(input.EffectType.Skill, 630, &Effect630{}) + input.InitEffect(input.EffectType.Skill, 631, &Effect631{}) + input.InitEffect(input.EffectType.Sub, 631, &Effect631Sub{}) +} diff --git a/logic/service/fight/effect/632_636.go b/logic/service/fight/effect/632_636.go new file mode 100644 index 000000000..6e74373c7 --- /dev/null +++ b/logic/service/fight/effect/632_636.go @@ -0,0 +1,176 @@ +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" +) + +func effectCompareByMode(mode int, left, right alpacadecimal.Decimal) bool { + switch mode { + case 0: + return left.Cmp(right) < 0 + case 1: + return left.Cmp(right) > 0 + default: + return false + } +} + +// Effect 632: 造成伤害{0}{1},则下{2}回合必定暴击 +type Effect632 struct { + node.EffectNode +} + +func (e *Effect632) Skill_Use() bool { + if !effectCompareByMode(int(e.Args()[0].IntPart()), e.Ctx().Our.SumDamage, e.Args()[1]) { + return true + } + + effect := e.Ctx().Our.InitEffect( + input.EffectType.Sub, + 632, + int(e.Args()[0].IntPart()), + int(e.Args()[1].IntPart()), + int(e.Args()[2].IntPart()), + ) + if effect != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + } + return true +} + +type Effect632Sub struct { + node.EffectNode +} + +func (e *Effect632Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + if len(a) > 2 { + e.Duration(a[2]) + } +} + +func (e *Effect632Sub) ActionStart(a, b *action.SelectSkillAction) bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + + e.Ctx().SkillEntity.XML.CritRate = 16 + return true +} + +// Effect 633: 造成伤害{0}{1},则造成伤害的{2}%恢复体力 +type Effect633 struct { + node.EffectNode +} + +func (e *Effect633) Skill_Use() bool { + if !effectCompareByMode(int(e.Args()[0].IntPart()), e.Ctx().Our.SumDamage, e.Args()[1]) { + return true + } + if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + heal := e.Ctx().Our.SumDamage.Mul(e.Args()[2]).Div(alpacadecimal.NewFromInt(100)) + if heal.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal) + return true +} + +// Effect 634: 若当前体力{0}对手,则造成伤害的{1}%恢复体力 +type Effect634 struct { + node.EffectNode +} + +func (e *Effect634) Skill_Use() bool { + if !effectCompareByMode(int(e.Args()[0].IntPart()), e.Ctx().Our.CurrentPet.GetHP(), e.Ctx().Opp.CurrentPet.GetHP()) { + return true + } + if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + heal := e.Ctx().Our.SumDamage.Mul(e.Args()[1]).Div(alpacadecimal.NewFromInt(100)) + if heal.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal) + return true +} + +// Effect 635: 吸收对手能力上升状态,吸收成功,下回合先制+{0} +type Effect635 struct { + node.EffectNode +} + +func (e *Effect635) Skill_Use() bool { + absorbed := false + for i, v := range e.Ctx().Opp.Prop[:] { + if v <= 0 { + continue + } + if !e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) { + continue + } + absorbed = true + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v) + } + if !absorbed { + return true + } + + effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 635, int(e.Args()[0].IntPart())) + if effect != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + } + return true +} + +type Effect635Sub struct { + FixedDuration1Base +} + +func (e *Effect635Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + if !shouldAdjustNextAttackPriority(e, fattack, sattack) { + return true + } + + sattack.SkillEntity.XML.Priority += int(e.Args()[0].IntPart()) + return true +} + +// Effect 636: 消除{0}状态,消除成功则令对手{1} +type Effect636 struct { + node.EffectNode +} + +func (e *Effect636) Skill_Use() bool { + if !clearStatusEffects(e.Ctx().Our, int(e.Args()[0].IntPart())) { + return true + } + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart())) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 632, &Effect632{}) + input.InitEffect(input.EffectType.Sub, 632, &Effect632Sub{}) + input.InitEffect(input.EffectType.Skill, 633, &Effect633{}) + input.InitEffect(input.EffectType.Skill, 634, &Effect634{}) + input.InitEffect(input.EffectType.Skill, 635, &Effect635{}) + input.InitEffect(input.EffectType.Sub, 635, &Effect635Sub{}) + input.InitEffect(input.EffectType.Skill, 636, &Effect636{}) +} diff --git a/logic/service/fight/effect/637_641.go b/logic/service/fight/effect/637_641.go new file mode 100644 index 000000000..2a079eaa8 --- /dev/null +++ b/logic/service/fight/effect/637_641.go @@ -0,0 +1,149 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// Effect 637: 若对手处于异常状态,则对手{0}{1} +type Effect637 struct { + node.EffectNode +} + +func (e *Effect637) OnSkill() bool { + if !e.Ctx().Opp.StatEffect_Exist_all() { + return true + } + + propID := int(e.Args()[0].IntPart()) + if propID < 0 || propID >= 6 { + return true + } + + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propID), int8(e.Args()[1].IntPart())) + return true +} + +// Effect 638: 若对手{0},技能威力提升{1}% +type Effect638 struct { + node.EffectNode +} + +func (e *Effect638) SkillHit() bool { + if e.Ctx().SkillEntity == nil { + return true + } + if !e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) { + return true + } + + bonus := alpacadecimal.NewFromInt(int64(e.Ctx().SkillEntity.XML.Power)). + Mul(e.Args()[1]). + Div(alpacadecimal.NewFromInt(100)) + e.Ctx().SkillEntity.XML.Power += int(bonus.IntPart()) + return true +} + +// Effect 639: 造成伤害{0}{1},则下{2}回合所有技能附带{3}点固定伤害 +type Effect639 struct { + node.EffectNode +} + +func (e *Effect639) Skill_Use() bool { + if !effectCompareByMode(int(e.Args()[0].IntPart()), e.Ctx().Our.SumDamage, e.Args()[1]) { + return true + } + + effect := e.Ctx().Our.InitEffect( + input.EffectType.Sub, + 639, + int(e.Args()[0].IntPart()), + int(e.Args()[1].IntPart()), + int(e.Args()[2].IntPart()), + int(e.Args()[3].IntPart()), + ) + if effect != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + } + return true +} + +type Effect639Sub struct { + node.EffectNode +} + +func (e *Effect639Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + if len(a) > 2 { + e.Duration(a[2]) + } +} + +func (e *Effect639Sub) OnSkill() bool { + if len(e.Args()) < 4 { + return true + } + + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: e.Args()[3], + }) + return true +} + +// Effect 640: 命中后{0}%使对手{1}{2}回合,遇到天敌概率翻倍 +type Effect640 struct { + node.EffectNode +} + +func (e *Effect640) Skill_Use() bool { + chance := int(e.Args()[0].IntPart()) + if e.ISNaturalEnemy() { + chance *= 2 + if chance > 100 { + chance = 100 + } + } + + success, _, _ := e.Input.Player.Roll(chance, 100) + if !success { + return true + } + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart())) + if statusEffect != nil { + statusEffect.Duration(int(e.Args()[2].IntPart())) + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + return true +} + +// Effect 641: 命中后{0}%使对手进入流血状态 +type Effect641 struct { + node.EffectNode +} + +func (e *Effect641) Skill_Use() bool { + success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100) + if !success { + return true + } + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Bleeding)) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 637, &Effect637{}) + input.InitEffect(input.EffectType.Skill, 638, &Effect638{}) + input.InitEffect(input.EffectType.Skill, 639, &Effect639{}) + input.InitEffect(input.EffectType.Sub, 639, &Effect639Sub{}) + input.InitEffect(input.EffectType.Skill, 640, &Effect640{}) + input.InitEffect(input.EffectType.Skill, 641, &Effect641{}) +} diff --git a/logic/service/fight/effect/663_667.go b/logic/service/fight/effect/663_667.go new file mode 100644 index 000000000..ea5c16753 --- /dev/null +++ b/logic/service/fight/effect/663_667.go @@ -0,0 +1,159 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + "math" + + "github.com/alpacahq/alpacadecimal" +) + +// Effect 663: {0}回合内若对手使用攻击技能则{1}%使对手{2} +type Effect663 struct { + RoundEffectArg0Base +} + +func (e *Effect663) Skill_Use_ex() bool { + if e.Ctx().SkillEntity == nil || 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 664: 若先出手则当回合对手无法造成攻击伤害 +type Effect664 struct { + node.EffectNode +} + +func (e *Effect664) DamageLockEx(zone *info.DamageZone) bool { + if !e.IsFirst() || zone == nil || zone.Type != info.DamageType.Red { + return true + } + + zone.Damage = alpacadecimal.Zero + return true +} + +// Effect 665: 造成的伤害低于{0}则{1}回合内自身受到的伤害减少{2} +type Effect665 struct { + node.EffectNode +} + +func (e *Effect665) Skill_Use() bool { + if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 { + return true + } + + reductionEffect := e.Ctx().Our.InitEffect( + input.EffectType.Sub, + 665, + int(e.Args()[1].IntPart()), + int(e.Args()[2].IntPart()), + ) + if reductionEffect != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, reductionEffect) + } + return true +} + +type Effect665Sub struct { + node.EffectNode +} + +func (e *Effect665Sub) SetArgs(t *input.Input, a ...int) { + setArgsWithDuration0(&e.EffectNode, t, a...) +} + +func (e *Effect665Sub) DamageSubEx(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 { + return true + } + + if zone.Damage.Cmp(e.Args()[1]) > 0 { + zone.Damage = zone.Damage.Sub(e.Args()[1]) + } else { + zone.Damage = alpacadecimal.Zero + } + return true +} + +// Effect 666: 使自身下回合攻击必定先手、必定暴击 +type Effect666 struct { + FixedDuration1Base + active bool +} + +func (e *Effect666) Skill_Use() bool { + e.active = true + return true +} + +func (e *Effect666) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + if !e.active { + return true + } + if sattack == nil || sattack.PlayerID != e.Ctx().Our.UserID || sattack.SkillEntity == nil { + return true + } + if sattack.SkillEntity.Category() == info.Category.STATUS { + return true + } + if fattack == nil || fattack.PlayerID == e.Ctx().Our.UserID { + return true + } + + sattack.SkillEntity.XML.Priority = math.MaxInt + return true +} + +func (e *Effect666) ActionStart(a, b *action.SelectSkillAction) bool { + if !e.active || e.Ctx().SkillEntity == nil { + return true + } + if e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + + e.Ctx().SkillEntity.XML.CritRate = 16 + return true +} + +// Effect 667: 自身为满体力时{0}{1} +type Effect667 struct { + node.EffectNode +} + +func (e *Effect667) Skill_Use() bool { + if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Our.CurrentPet.GetMaxHP()) != 0 { + return true + } + + for i := 0; i < len(e.SideEffectArgs) && i < 6; i++ { + if e.SideEffectArgs[i] == 0 { + continue + } + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(e.SideEffectArgs[i])) + } + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 663, &Effect663{}) + input.InitEffect(input.EffectType.Skill, 664, &Effect664{}) + input.InitEffect(input.EffectType.Skill, 665, &Effect665{}) + input.InitEffect(input.EffectType.Sub, 665, &Effect665Sub{}) + input.InitEffect(input.EffectType.Skill, 666, &Effect666{}) + input.InitEffect(input.EffectType.Skill, 667, &Effect667{}) +} diff --git a/logic/service/fight/effect/668_672.go b/logic/service/fight/effect/668_672.go new file mode 100644 index 000000000..79f8ac90c --- /dev/null +++ b/logic/service/fight/effect/668_672.go @@ -0,0 +1,144 @@ +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" +) + +// Effect 668: 若对手处于能力提升状态则先制额外+1 +type Effect668 struct { + node.EffectNode +} + +func (e *Effect668) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + if !e.Ctx().Opp.HasPropADD() { + return true + } + if sattack == nil || sattack.PlayerID != e.Ctx().Our.UserID || sattack.SkillEntity == nil { + return true + } + + sattack.SkillEntity.XML.Priority += 1 + return true +} + +// Effect 669: 当回合击败对手则下回合自身攻击先制+1 +type Effect669 struct { + FixedDuration1Base + triggered bool +} + +func (e *Effect669) SwitchOut(in *input.Input) bool { + if in == e.Ctx().Our { + e.Alive(false) + return true + } + if in != e.Ctx().Opp { + return true + } + if e.Ctx().Opp.CurrentPet.Alive() { + e.Alive(false) + return true + } + + e.triggered = true + return true +} + +func (e *Effect669) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + if !e.triggered || !shouldAdjustNextAttackPriority(e, fattack, sattack) { + return true + } + if sattack.SkillEntity.Category() == info.Category.STATUS { + return true + } + + sattack.SkillEntity.XML.Priority += 1 + return true +} + +// Effect 670: {0}回合,每回合附加{1}的{2}值的{3}%的百分比伤害 +type Effect670 struct { + RoundEffectArg0Base +} + +func (e *Effect670) Skill_Use() bool { + target := e.Ctx().Our + if int(e.Args()[1].IntPart()) == 1 { + target = e.Ctx().Opp + } + + propID := int(e.Args()[2].IntPart()) + if propID < 0 || propID >= 6 { + return true + } + + damage := target.GetProp(propID).Mul(e.Args()[3]).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 671: 若对手处于异常状态则恢复造成伤害的{0}%的体力 +type Effect671 struct { + node.EffectNode +} + +func (e *Effect671) Skill_Use() bool { + if !e.Ctx().Opp.StatEffect_Exist_all() { + return true + } + if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + heal := e.Ctx().Our.SumDamage.Mul(e.Args()[0]).Div(alpacadecimal.NewFromInt(100)) + if heal.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal) + return true +} + +// Effect 672: 当回合击败对手则恢复自身全部体力 +type Effect672 struct { + FixedDuration1Base +} + +func (e *Effect672) SwitchOut(in *input.Input) bool { + if in == e.Ctx().Our { + e.Alive(false) + return true + } + if in != e.Ctx().Opp { + return true + } + if e.Ctx().Opp.CurrentPet.Alive() { + e.Alive(false) + return true + } + + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp) + e.Alive(false) + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 668, &Effect668{}) + input.InitEffect(input.EffectType.Skill, 669, &Effect669{}) + input.InitEffect(input.EffectType.Skill, 670, &Effect670{}) + input.InitEffect(input.EffectType.Skill, 671, &Effect671{}) + input.InitEffect(input.EffectType.Skill, 672, &Effect672{}) +} diff --git a/logic/service/fight/effect/841_845.go b/logic/service/fight/effect/841_845.go new file mode 100644 index 000000000..aaeffe93f --- /dev/null +++ b/logic/service/fight/effect/841_845.go @@ -0,0 +1,139 @@ +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" +) + +func addSkillPowerPercent(skill *info.SkillEntity, percent alpacadecimal.Decimal) { + if skill == nil || percent.Cmp(alpacadecimal.Zero) <= 0 { + return + } + + bonus := alpacadecimal.NewFromInt(int64(skill.XML.Power)).Mul(percent).Div(alpacadecimal.NewFromInt(100)) + skill.XML.Power += int(bonus.IntPart()) +} + +// Effect 841: 使对手和自身同时降低1/{0}最大体力 +type Effect841 struct { + node.EffectNode +} + +func (e *Effect841) Skill_Use() bool { + if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0]) + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: damage, + }) + + selfDamage := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0]) + e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: selfDamage, + }) + return true +} + +// Effect 842: 若自身处于能力提升状态则造成的攻击伤害额外提升{0}% +type Effect842 struct { + node.EffectNode +} + +func (e *Effect842) SkillHit() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + if len(e.Args()) == 0 { + return true + } + if !e.Ctx().Our.HasPropADD() { + return true + } + + addSkillPowerPercent(e.Ctx().SkillEntity, e.Args()[0]) + return true +} + +// Effect 843: 下{0}回合令自身所有技能先制+{1} +type Effect843 struct { + node.EffectNode +} + +func (e *Effect843) Skill_Use() bool { + addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect843Sub{}, -1) + return true +} + +type Effect843Sub struct { + RoundEffectArg0Base +} + +func (e *Effect843Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + if sattack == nil || sattack.PlayerID != e.Ctx().Our.UserID || sattack.SkillEntity == nil { + return true + } + + sattack.SkillEntity.XML.Priority += int(e.Args()[1].IntPart()) + return true +} + +// Effect 844: 若攻击未打出致命一击则吸取对手最大体力的1/{0} +type Effect844 struct { + node.EffectNode +} + +func (e *Effect844) Skill_Use() bool { + skill := e.Ctx().SkillEntity + if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || skill.Crit != 0 { + return true + } + if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0]) + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: damage, + }) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage) + return true +} + +// Effect 845: 若自身当前体力高于最大体力的1/{0}则威力提升{1}% +type Effect845 struct { + node.EffectNode +} + +func (e *Effect845) SkillHit() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + threshold := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0]) + if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) <= 0 { + return true + } + + addSkillPowerPercent(e.Ctx().SkillEntity, e.Args()[1]) + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 841, &Effect841{}) + input.InitEffect(input.EffectType.Skill, 842, &Effect842{}) + input.InitEffect(input.EffectType.Skill, 843, &Effect843{}) + input.InitEffect(input.EffectType.Skill, 844, &Effect844{}) + input.InitEffect(input.EffectType.Skill, 845, &Effect845{}) +} diff --git a/logic/service/fight/effect/846_850.go b/logic/service/fight/effect/846_850.go new file mode 100644 index 000000000..8fb432181 --- /dev/null +++ b/logic/service/fight/effect/846_850.go @@ -0,0 +1,146 @@ +package effect + +import ( + "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 846: {0}%概率,使对手随机进入{1}控制类异常状态 +type Effect846 struct { + node.EffectNode +} + +func (e *Effect846) OnSkill() bool { + if len(e.Args()) < 2 { + return true + } + + success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100) + if !success { + return true + } + + controlStatuses := []int{ + int(info.PetStatus.Paralysis), + int(info.PetStatus.Tired), + int(info.PetStatus.Fear), + int(info.PetStatus.Petrified), + int(info.PetStatus.Sleep), + } + count := int(e.Args()[1].IntPart()) + if count <= 0 { + return true + } + if count > len(controlStatuses) { + count = len(controlStatuses) + } + + indices := grand.Perm(len(controlStatuses)) + for _, idx := range indices[:count] { + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, controlStatuses[idx]) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + + return true +} + +// Effect 847: 为自身附加{0}点护盾 +type Effect847 struct { + node.EffectNode +} + +func (e *Effect847) Skill_Use() bool { + if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + e.Ctx().Our.AddShield(e.Args()[0]) + return true +} + +// Effect 848: 对手每处于一种能力下降状态附加{0}点固定伤害 +type Effect848 struct { + node.EffectNode +} + +func (e *Effect848) Skill_Use() bool { + if len(e.Args()) == 0 { + return true + } + + count := int64(0) + for _, v := range e.Ctx().Opp.Prop[:] { + if v < 0 { + count++ + } + } + if count == 0 { + return true + } + + damage := e.Args()[0].Mul(alpacadecimal.NewFromInt(count)) + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: damage, + }) + return true +} + +// Effect 849: {0}回合内每回合使用技能则造成伤害前随机吸取对手{1}项能力值-1 +type Effect849 struct { + RoundEffectArg0Base +} + +func (e *Effect849) SkillHit() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + if len(e.Args()) < 2 { + return true + } + + count := int(e.Args()[1].IntPart()) + if count <= 0 { + return true + } + + for i := 0; i < count; i++ { + propIdx := int8(grand.Intn(6)) + if !e.Ctx().Opp.SetProp(e.Ctx().Our, propIdx, -1) { + continue + } + e.Ctx().Our.SetProp(e.Ctx().Our, propIdx, 1) + } + return true +} + +// Effect 850: {0}回合内每回合有{1}%的概率免疫当回合受到的攻击伤害 +type Effect850 struct { + RoundEffectArg0Base +} + +func (e *Effect850) DamageLockEx(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red { + return true + } + + success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100) + if success { + zone.Damage = alpacadecimal.Zero + } + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 846, &Effect846{}) + input.InitEffect(input.EffectType.Skill, 847, &Effect847{}) + input.InitEffect(input.EffectType.Skill, 848, &Effect848{}) + input.InitEffect(input.EffectType.Skill, 849, &Effect849{}) + input.InitEffect(input.EffectType.Skill, 850, &Effect850{}) +} diff --git a/logic/service/fight/effect/856_860.go b/logic/service/fight/effect/856_860.go new file mode 100644 index 000000000..d25ac473b --- /dev/null +++ b/logic/service/fight/effect/856_860.go @@ -0,0 +1,163 @@ +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" +) + +func activeTurnEffectCount(in *input.Input) int { + if in == nil { + return 0 + } + + count := 0 + for _, effect := range in.Effects { + if effect == nil || !effect.Alive() { + continue + } + if effect.Duration() > 0 { + count++ + } + } + return count +} + +func totalOppPropDownLevels(in *input.Input) int64 { + if in == nil { + return 0 + } + + total := int64(0) + for _, v := range in.Prop[:] { + if v < 0 { + total += int64(-v) + } + } + return total +} + +// Effect 856: 消除对手回合类效果,消除成功则恢复自身最大体力的1/{0} +type Effect856 struct { + node.EffectNode +} + +func (e *Effect856) Skill_Use() bool { + if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + before := activeTurnEffectCount(e.Ctx().Opp) + e.Ctx().Opp.CancelTurn(e.Ctx().Our) + if before <= 0 { + return true + } + + e.Ctx().Our.Heal( + e.Ctx().Our, + &action.SelectSkillAction{}, + e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0]), + ) + return true +} + +// Effect 857: {0}%使对手全属性-{1},若先出手则{2}%使对手全属性-{3} +type Effect857 struct { + node.EffectNode +} + +func (e *Effect857) Skill_Use() bool { + if len(e.Args()) < 4 { + return true + } + + success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100) + if success { + applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[1].IntPart())) + } + + if e.IsFirst() { + firstSuccess, _, _ := e.Input.Player.Roll(int(e.Args()[2].IntPart()), 100) + if firstSuccess { + applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[3].IntPart())) + } + } + return true +} + +// Effect 858: 造成的伤害提升,伤害提升的倍数等于对手能力下降等级总和乘以{0}% +type Effect858 struct { + node.EffectNode +} + +func (e *Effect858) Damage_Mul(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 { + return true + } + + totalDown := totalOppPropDownLevels(e.Ctx().Opp) + if totalDown <= 0 { + return true + } + + percent := e.Args()[0].Mul(alpacadecimal.NewFromInt(totalDown)) + zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100).Add(percent)).Div(alpacadecimal.NewFromInt(100)) + return true +} + +// Effect 859: 吸收对手能力提升,吸收成功减少对手1/{0}最大体力 +type Effect859 struct { + node.EffectNode +} + +func (e *Effect859) OnSkill() bool { + if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + canSteal := false + for i, v := range e.Ctx().Opp.Prop[:] { + if v <= 0 { + continue + } + if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) { + canSteal = true + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v) + } + } + if !canSteal { + return true + } + + damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0]) + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: damage, + }) + return true +} + +// Effect 860: 获得{0}层神耀能量 +type Effect860 struct { + node.EffectNode +} + +func (e *Effect860) Skill_Use() bool { + if len(e.Args()) == 0 { + return true + } + + e.Ctx().Our.AddDivineEnergy(int(e.Args()[0].IntPart())) + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 856, &Effect856{}) + input.InitEffect(input.EffectType.Skill, 857, &Effect857{}) + input.InitEffect(input.EffectType.Skill, 858, &Effect858{}) + input.InitEffect(input.EffectType.Skill, 859, &Effect859{}) + input.InitEffect(input.EffectType.Skill, 860, &Effect860{}) +} diff --git a/logic/service/fight/effect/861_865.go b/logic/service/fight/effect/861_865.go new file mode 100644 index 000000000..616f504cf --- /dev/null +++ b/logic/service/fight/effect/861_865.go @@ -0,0 +1,130 @@ +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" +) + +// Effect 861: {0}回合内若对手使用属性技能则令对手所有技能降低{1}点PP值 +type Effect861 struct { + RoundEffectArg0Base +} + +func (e *Effect861) Skill_Use_ex() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS { + return true + } + + e.Ctx().Opp.DelPP(int(e.Args()[1].IntPart())) + return true +} + +// Effect 862: 消耗自身所有神耀能量,每消耗1层此技能威力提升{0} +type Effect862 struct { + node.EffectNode +} + +func (e *Effect862) SkillHit() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || len(e.Args()) == 0 { + return true + } + + energy := e.Ctx().Our.ConsumeDivineEnergy() + if energy <= 0 { + return true + } + + e.Ctx().SkillEntity.XML.Power += energy * int(e.Args()[0].IntPart()) + return true +} + +// Effect 863: 后出手则下{0}回合令对手使用的攻击技能无效 +type Effect863 struct { + node.EffectNode +} + +func (e *Effect863) Skill_Use() bool { + if e.IsFirst() { + return true + } + + addSubEffect(e.Ctx().Our, e.Ctx().Opp, &e.EffectNode, &Effect863Sub{}, -1) + return true +} + +type Effect863Sub struct { + RoundEffectArg0Base +} + +func (e *Effect863Sub) ActionStart(a, b *action.SelectSkillAction) bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + + e.Ctx().SkillEntity.SetMiss() + return true +} + +// Effect 864: 本回合未击败对手则下{0}回合反弹受到伤害的1/{1} +type Effect864 struct { + node.EffectNode +} + +func (e *Effect864) Skill_Use() bool { + if e.Ctx().Opp.CurrentPet.Info.Hp == 0 { + return true + } + + addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect864Sub{}, -1) + return true +} + +type Effect864Sub struct { + RoundEffectArg0Base +} + +func (e *Effect864Sub) DamageSubEx(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 { + return true + } + if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + reflectDamage := zone.Damage.Div(e.Args()[1]) + if reflectDamage.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: reflectDamage, + }) + return true +} + +// Effect 865: 击败对手则获得{0}层神耀能量 +type Effect865 struct { + node.EffectNode +} + +func (e *Effect865) Skill_Use() bool { + if len(e.Args()) == 0 || e.Ctx().Opp.CurrentPet.Info.Hp > 0 { + return true + } + + e.Ctx().Our.AddDivineEnergy(int(e.Args()[0].IntPart())) + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 861, &Effect861{}) + input.InitEffect(input.EffectType.Skill, 862, &Effect862{}) + input.InitEffect(input.EffectType.Skill, 863, &Effect863{}) + input.InitEffect(input.EffectType.Skill, 864, &Effect864{}) + input.InitEffect(input.EffectType.Skill, 865, &Effect865{}) +} diff --git a/logic/service/fight/effect/866_870.go b/logic/service/fight/effect/866_870.go new file mode 100644 index 000000000..cbaa0aba4 --- /dev/null +++ b/logic/service/fight/effect/866_870.go @@ -0,0 +1,156 @@ +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" +) + +// Effect 866: 若打出致命一击则获得{0}层神耀能量, 否则获得{1}层 +type Effect866 struct { + node.EffectNode +} + +func (e *Effect866) Skill_Use() bool { + if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil { + return true + } + + gain := int(e.Args()[1].IntPart()) + if e.Ctx().SkillEntity.Crit != 0 { + gain = int(e.Args()[0].IntPart()) + } + e.Ctx().Our.AddDivineEnergy(gain) + return true +} + +// Effect 867: 消除对手回合类效果,消除成功使对手下回合先制-{0} +type Effect867 struct { + node.EffectNode +} + +func (e *Effect867) Skill_Use() bool { + if len(e.Args()) == 0 { + return true + } + + before := activeTurnEffectCount(e.Ctx().Opp) + e.Ctx().Opp.CancelTurn(e.Ctx().Our) + if before <= 0 { + return true + } + + addSubEffect(e.Ctx().Our, e.Ctx().Opp, &e.EffectNode, &Effect867Sub{}, -1) + return true +} + +type Effect867Sub struct { + FixedDuration1Base +} + +func (e *Effect867Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + if current == nil || current.SkillEntity == nil { + return true + } + + current.SkillEntity.XML.Priority -= int(e.Args()[0].IntPart()) + return true +} + +// Effect 868: 消除对手能力提升状态,消除成功则令对手下回合所有技能先制-{0} +type Effect868 struct { + node.EffectNode +} + +func (e *Effect868) Skill_Use() bool { + if len(e.Args()) == 0 { + return true + } + + cleared := false + for i, v := range e.Ctx().Opp.Prop[:] { + if v <= 0 { + continue + } + if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) { + cleared = true + } + } + if !cleared { + return true + } + + addSubEffect(e.Ctx().Our, e.Ctx().Opp, &e.EffectNode, &Effect868Sub{}, -1) + return true +} + +type Effect868Sub struct { + FixedDuration1Base +} + +func (e *Effect868Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + if current == nil || current.SkillEntity == nil { + return true + } + + current.SkillEntity.XML.Priority -= int(e.Args()[0].IntPart()) + return true +} + +// Effect 869: 附加自身速度{0}%的百分比伤害,每次触发增加{1}%,最高{2}% +type Effect869 struct { + AddLvelEffect +} + +func (e *Effect869) Skill_Use() bool { + percent := e.Args()[0] + if e.UseSkillCount > 1 { + percent = percent.Add(e.Args()[1].Mul(alpacadecimal.NewFromInt(e.UseSkillCount - 1))) + } + if percent.Cmp(e.Args()[2]) > 0 { + percent = e.Args()[2] + } + + damage := e.Ctx().Our.GetProp(4).Mul(percent).Div(alpacadecimal.NewFromInt(100)) + if damage.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: damage, + }) + return true +} + +// Effect 870: 吸取对手{0}点体力 +type Effect870 struct { + node.EffectNode +} + +func (e *Effect870) Skill_Use() bool { + if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + drain := e.Args()[0] + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: drain, + }) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain) + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 866, &Effect866{}) + input.InitEffect(input.EffectType.Skill, 867, &Effect867{}) + input.InitEffect(input.EffectType.Skill, 868, &Effect868{}) + input.InitEffect(input.EffectType.Skill, 869, &Effect869{}) + input.InitEffect(input.EffectType.Skill, 870, &Effect870{}) +} diff --git a/logic/service/fight/effect/effect_info_map.go b/logic/service/fight/effect/effect_info_map.go index 6edfdd42d..f0d946e92 100644 --- a/logic/service/fight/effect/effect_info_map.go +++ b/logic/service/fight/effect/effect_info_map.go @@ -358,9 +358,29 @@ var effectInfoByID = map[int]string{ 608: "若对手体力低于1/2,该技能先制额外+1", 612: "{0}%概率攻击{1}次", 614: "{0}回合内若对手使用攻击技能则对手{1}", + 668: "若对手处于能力提升状态则先制额外+1", + 669: "当回合击败对手则下回合自身攻击先制+1", + 670: "{0}回合,每回合附加{1}的{2}值的{3}%的百分比伤害", + 671: "若对手处于异常状态则恢复造成伤害的{0}%的体力", + 672: "当回合击败对手则恢复自身全部体力", 139: "50%威力301-350、30%威力101-300,20%威力5-100", 620: "{0}回合内致命一击率上升{1}/16", 626: "随机使自己{0}项能力+{1}", + 627: "对手处于能力提升状态时附加其{0}值{1}%的百分比伤害", + 628: "若对手处于能力下降状态则造成伤害的{0}%恢复体力", + 629: "消除{0}状态,消除成功下回合自身先制+{1}", + 630: "{0}回合内{1}状态被消除,则有{2}%概率使对手{3}", + 631: "消除{0}状态,消除成功下回合造成伤害提升{1}%", + 632: "造成伤害{0}{1},则下{2}回合必定暴击", + 633: "造成伤害{0}{1},则造成伤害的{2}%恢复体力", + 634: "若当前体力{0}对手,则造成伤害的{1}%恢复体力", + 635: "吸收对手能力上升状态,吸收成功,下回合先制+{0}", + 636: "消除{0}状态,消除成功则令对手{1}", + 637: "若对手处于异常状态,则对手{0}{1}", + 638: "若对手{0},技能威力提升{1}%", + 639: "造成伤害{0}{1},则下{2}回合所有技能附带{3}点固定伤害", + 640: "命中后{0}%使对手{1}{2}回合,遇到天敌概率翻倍", + 641: "命中后{0}%使对手进入流血状态", 680: "先出手时{0}%使对手{1}{2}回合", 681: "下{0}回合自身攻击技能必定致命、必定命中", 682: "受到的伤害超过{0},自身{1}", @@ -381,6 +401,31 @@ var effectInfoByID = map[int]string{ 726: "下{0}回合若对手先出手,则令对手当回合使用的攻击技能无效", 727: "后出手时将自身能力等级返回至上一回合结束时", 728: "自身处于能力提升状态时,回合结束时直接减少对手1/{0}最大体力", + 841: "使对手和自身同时降低1/{0}最大体力", + 842: "若自身处于能力提升状态则造成的攻击伤害额外提升{0}%", + 843: "下{0}回合令自身所有技能先制+{1}", + 844: "若攻击未打出致命一击则吸取对手最大体力的1/{0}", + 845: "若自身当前体力高于最大体力的1/{0}则威力提升{1}%", + 846: "{0}%概率,使对手随机进入{1}控制类异常状态", + 847: "为自身附加{0}点护盾", + 848: "对手每处于一种能力下降状态附加{0}点固定伤害", + 849: "{0}回合内每回合使用技能则造成伤害前随机吸取对手{1}项能力值-1", + 850: "{0}回合内每回合有{1}%的概率免疫当回合受到的攻击伤害", + 856: "消除对手回合类效果,消除成功则恢复自身最大体力的1/{0}", + 857: "{0}%使对手全属性-{1},若先出手则{2}%使对手全属性-{3}", + 858: "造成的伤害提升,伤害提升的倍数等于对手能力下降等级总和乘以{0}%", + 859: "吸收对手能力提升,吸收成功减少对手1/{0}最大体力", + 860: "获得{0}层神耀能量", + 861: "{0}回合内若对手使用属性技能则令对手所有技能降低{1}点PP值", + 862: "消耗自身所有神耀能量,每消耗1层此技能威力提升{0}", + 863: "后出手则下{0}回合令对手使用的攻击技能无效", + 864: "本回合未击败对手则下{0}回合反弹受到伤害的1/{1}", + 865: "击败对手则获得{0}层神耀能量", + 866: "若打出致命一击则获得{0}层神耀能量, 否则获得{1}层", + 867: "消除对手回合类效果,消除成功使对手下回合先制-{0}", + 868: "消除对手能力提升状态,消除成功则令对手下回合所有技能先制-{0}", + 869: "附加自身速度{0}%的百分比伤害,每次触发增加{1}%,最高{2}%", + 870: "吸取对手{0}点体力", 851: "使对手随机进入害怕、失明、烧伤、冻伤、中毒其中{0}种异常状态", 852: "附加自身最大体力{0}%的百分比伤害并恢复等量体力,恢复体力时若自身体力低于最大体力的1/{1}则恢复效果和百分比伤害翻倍", 853: "附加自身最大体力值与速度值总和{0}%的百分比伤害,每次使用增加{1}%,最高{2}%", @@ -388,7 +433,37 @@ var effectInfoByID = map[int]string{ 855: "将下次受到的伤害{0}%反馈给对手", 690: "下{0}回合,能力提升状态消失则对手使用属性技能失效", 776: "下{0}回合自身造成的攻击伤害翻倍", + 1016: "造成的伤害不足{0}则下{1}次攻击造成的伤害提高{2}%", + 1017: "消耗自身所有护盾值,造成等量固定伤害", + 1018: "{0}回合内若受到的伤害低于{1}则免疫伤害并造成等同于伤害量的固定伤害", + 1019: "造成的攻击伤害若高于{0}则令对手{1}回合内使用的属性技能无效", + 1020: "全属性+{0},对手不处于能力提升状态时强化效果翻倍", + 1021: "对手不处于能力提升状态时造成的伤害提高{0}%", + 1022: "吸取对手能力提升状态,吸取成功则吸取对手{0}点体力", + 1023: "{0}回合内{1}%闪避对手攻击,若对手MISS则恢复自身最大体力的1/{2}", + 1024: "{0}回合内{1}%的概率免疫对手攻击伤害,未触发则回合结束时附加{2}%伤害量的百分比伤害", + 1025: "吸取对手能力提升状态,吸取成功则恢复自身最大体力的1/{0}", + 1026: "下{0}回合,每回合都使对手的先制-{1}", + 1027: "{0}回合内若自身不处于能力提升状态则附加{1}点固定伤害", + 1028: "命中后{0}回合内每回合使对手{1},若未触发则减少对手最大体力的1/{7}", + 1029: "造成的伤害低于{0}则下{1}回合自身先制+{2}", + 1030: "将自身能力下降状态反馈给对手,反馈成功则对手{0}", 1044: "吸取对手能力提升状态,吸取成功则下{0}回合造成的伤害翻倍", + 1097: "造成的攻击伤害若低于280则令对手疲惫;未击败对手则令对手下1回合使用的攻击技能无效;技能结束后对手体力值高于0,则50%进行一次额外行动以触发星皇之怒(星皇之怒:50%令对手失明,未触发则2回合内令对手使用的属性技能无效)", + 1098: "致命一击率提升20%,每次使用增加20%,最高100%;打出致命一击后令自身下2次技能触发的星皇之怒威力不再减少;技能结束后对手体力值高于0,则50%进行一次额外行动以触发星皇之怒(星皇之怒:下2次自身使用的攻击技能先制+2)", + 1099: "消除对手能力提升状态,消除成功则自身免疫下{0}次受到的异常状态", + 1100: "{0}回合内若对手使用属性技能则随机进入烧伤、冻伤、中毒、麻痹、害怕、睡眠中的一种异常状态,未触发则下{1}回合造成的伤害提高{2}%", + 1101: "命中后{0}%秒杀对方,若MISS则自身死亡,使对手随机{1}个技能的PP值归零且全属性-{2}", + 1102: "{0}回合内若对手使用属性技能则{1},未触发则减少对手1/{2}最大体力", + 1103: "若对手处于能力提升状态则造成的攻击伤害额外提升{0}%", + 1104: "造成的伤害低于{0}则吸取对手1/{1}最大体力", + 1105: "{0}回合内每回合攻击附加自身攻击和特攻中最高一项{1}%的百分比伤害", + 1106: "当回合造成的攻击伤害若高于{0}则{1}%令对手{2}", + 1107: "未击败对手则{0}%自身全属性+{1},{2}%对手全属性-{3}", + 1108: "自身每处于一种能力提升状态则技能连击数+{0},对手每处于一种弱化状态则技能连击数+{1}", + 1109: "{0}回合内若自身能力提升状态被消除则吸取对手最大体力的1/{1}", + 1110: "反转对手能力提升状态,反转成功则令对手下{0}次属性技能失效,反转失败则消除对手能力提升状态", + 1111: "{0}%令对手{1},未触发则{2}回合内自身造成的攻击伤害额外提升{3}%", 1146: "双方每处于{0}种能力提升状态则附加{1}点固定伤害", 1605: "{0}%令对手{1}", } diff --git a/logic/service/fight/effect/effect_status.go b/logic/service/fight/effect/effect_status.go index 88400460d..24ca5ea83 100644 --- a/logic/service/fight/effect/effect_status.go +++ b/logic/service/fight/effect/effect_status.go @@ -247,6 +247,7 @@ func init() { input.InitEffect(input.EffectType.Status, int(info.PetStatus.Poisoned), &ContinuousDamage{}) // 中毒 input.InitEffect(input.EffectType.Status, int(info.PetStatus.Frozen), &ContinuousDamage{}) // 冻伤 input.InitEffect(input.EffectType.Status, int(info.PetStatus.Burned), &Burned{}) // 烧伤 + input.InitEffect(input.EffectType.Status, int(info.PetStatus.Bleeding), &ContinuousDamage{}) // 流血 input.InitEffect(input.EffectType.Status, int(info.PetStatus.Weakened), &Weakened{}) // 衰弱 input.InitEffect(input.EffectType.Status, int(info.PetStatus.Confused), &Confused{}) // 混乱 input.InitEffect(input.EffectType.Status, int(info.PetStatus.Blind), &Blind{}) // 失明 diff --git a/logic/service/fight/info/BattlePetEntity.go b/logic/service/fight/info/BattlePetEntity.go index 2977b454d..fa80d1684 100644 --- a/logic/service/fight/info/BattlePetEntity.go +++ b/logic/service/fight/info/BattlePetEntity.go @@ -13,7 +13,9 @@ type EnumAttrType int type BattlePetEntity struct { xmlres.PetInfo - Info model.PetInfo //通过偏移赋值 + Info model.PetInfo //通过偏移赋值 + Shield alpacadecimal.Decimal + DivineEnergy int //*input.Input //PType int diff --git a/logic/service/fight/input/divine_energy.go b/logic/service/fight/input/divine_energy.go new file mode 100644 index 000000000..0b99a5e89 --- /dev/null +++ b/logic/service/fight/input/divine_energy.go @@ -0,0 +1,37 @@ +package input + +func (our *Input) CurrentDivineEnergy() int { + if our == nil || our.CurrentPet == nil { + return 0 + } + return our.CurrentPet.DivineEnergy +} + +func (our *Input) AddDivineEnergy(value int) bool { + if our == nil || our.CurrentPet == nil || value <= 0 { + return false + } + + our.CurrentPet.DivineEnergy += value + if our.CurrentPet.DivineEnergy < 0 { + our.CurrentPet.DivineEnergy = 0 + } + return true +} + +func (our *Input) ConsumeDivineEnergy() int { + if our == nil || our.CurrentPet == nil { + return 0 + } + + value := our.CurrentPet.DivineEnergy + our.CurrentPet.DivineEnergy = 0 + return value +} + +func (our *Input) ClearDivineEnergy() { + if our == nil || our.CurrentPet == nil { + return + } + our.CurrentPet.DivineEnergy = 0 +} diff --git a/logic/service/fight/input/fight.go b/logic/service/fight/input/fight.go index 856e15389..63ce9efd1 100644 --- a/logic/service/fight/input/fight.go +++ b/logic/service/fight/input/fight.go @@ -152,11 +152,6 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) { return true }) } - - if sub.Type == info.DamageType.Red { //红才会产生造成伤害 - our.Opp.SumDamage = sub.Damage.Add(our.Opp.SumDamage) // 叠加总伤害 这里相当于记录红伤 - - } if ok { our.Exec(func(t Effect) bool { @@ -165,6 +160,16 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) { return true }) } + if sub.Damage.Cmp(alpacadecimal.Zero) < 0 { + sub.Damage = alpacadecimal.Zero + } + if shieldAbsorb := our.AbsorbShieldDamage(sub.Damage); shieldAbsorb.Cmp(alpacadecimal.Zero) > 0 { + sub.Damage = sub.Damage.Sub(shieldAbsorb) + } + if sub.Type == info.DamageType.Red { //红才会产生造成伤害 + our.Opp.SumDamage = sub.Damage.Add(our.Opp.SumDamage) // 叠加总伤害 这里相当于记录红伤 + + } if sub.Type == info.DamageType.Red { //红才会产生造成伤害 our.Opp.AttackValue.LostHp += uint32(sub.Damage.IntPart()) //红伤落实 diff --git a/logic/service/fight/input/shield.go b/logic/service/fight/input/shield.go new file mode 100644 index 000000000..fd418db65 --- /dev/null +++ b/logic/service/fight/input/shield.go @@ -0,0 +1,51 @@ +package input + +import "github.com/alpacahq/alpacadecimal" + +func (our *Input) CurrentShield() alpacadecimal.Decimal { + if our == nil || our.CurrentPet == nil { + return alpacadecimal.Zero + } + return our.CurrentPet.Shield +} + +func (our *Input) HasShield() bool { + return our.CurrentShield().Cmp(alpacadecimal.Zero) > 0 +} + +func (our *Input) AddShield(value alpacadecimal.Decimal) bool { + if our == nil || our.CurrentPet == nil { + return false + } + if value.Cmp(alpacadecimal.Zero) <= 0 { + return false + } + our.CurrentPet.Shield = our.CurrentPet.Shield.Add(value) + return true +} + +func (our *Input) AbsorbShieldDamage(damage alpacadecimal.Decimal) alpacadecimal.Decimal { + if our == nil || our.CurrentPet == nil { + return alpacadecimal.Zero + } + if damage.Cmp(alpacadecimal.Zero) <= 0 || our.CurrentPet.Shield.Cmp(alpacadecimal.Zero) <= 0 { + return alpacadecimal.Zero + } + + absorbed := alpacadecimal.Min(our.CurrentPet.Shield, damage) + our.CurrentPet.Shield = our.CurrentPet.Shield.Sub(absorbed) + if our.CurrentPet.Shield.Cmp(alpacadecimal.Zero) < 0 { + our.CurrentPet.Shield = alpacadecimal.Zero + } + return absorbed +} + +func (our *Input) ConsumeAllShield() alpacadecimal.Decimal { + if our == nil || our.CurrentPet == nil { + return alpacadecimal.Zero + } + + value := our.CurrentPet.Shield + our.CurrentPet.Shield = alpacadecimal.Zero + return value +}