From 5a5a1db2a32829acc021e249b8ea036dc0ca3dab Mon Sep 17 00:00:00 2001 From: xinian Date: Sat, 4 Apr 2026 07:06:00 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=BF=81=E7=A7=BB=20effect=20?= =?UTF-8?q?=E8=87=B3=E6=96=B0=E8=AF=AD=E4=B9=89=E4=B8=8A=E4=B8=8B=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task-233-effects-1780-1784.md | 36 ---- .../task-234-effects-1785-1789.md | 36 ---- .../task-295-effects-2090-2094.md | 36 ---- .../task-301-effects-2120-2124.md | 35 ---- ...t-multi-battle-refactor-task-2026-04-04.md | 27 +++ logic/service/fight/boss/NewSeIdx_2.go | 2 +- logic/service/fight/effect/1097_1101.go | 134 ++++++++++----- logic/service/fight/effect/1263_1287.go | 142 ++++++++-------- logic/service/fight/effect/1288_1312.go | 148 ++++++++-------- logic/service/fight/effect/1448_1472.go | 124 +++++++------- logic/service/fight/effect/1473_1497.go | 122 ++++++------- logic/service/fight/effect/1770_1794.go | 160 +++++++++++++----- logic/service/fight/effect/2070_2094.go | 18 +- logic/service/fight/effect/2120_2144.go | 93 +++++++--- logic/service/fight/effect/effect_680_690.go | 90 +++++++--- logic/service/fight/effect/effect_info_map.go | 20 +++ 16 files changed, 671 insertions(+), 552 deletions(-) delete mode 100644 docs/effect-unimplemented-tasks/task-233-effects-1780-1784.md delete mode 100644 docs/effect-unimplemented-tasks/task-234-effects-1785-1789.md delete mode 100644 docs/effect-unimplemented-tasks/task-295-effects-2090-2094.md delete mode 100644 docs/effect-unimplemented-tasks/task-301-effects-2120-2124.md diff --git a/docs/effect-unimplemented-tasks/task-233-effects-1780-1784.md b/docs/effect-unimplemented-tasks/task-233-effects-1780-1784.md deleted file mode 100644 index 1d5f84eb6..000000000 --- a/docs/effect-unimplemented-tasks/task-233-effects-1780-1784.md +++ /dev/null @@ -1,36 +0,0 @@ -# Task 233: Effects 1780-1784 - -## 目标 - -- 补齐以下 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 1780 -- `argsNum`: `5` -- `info`: `消耗自身全部体力,减少对手当前体力的1/{0},同时使己方下1只出场精灵获得点数等同于对手最大体力值1/{1}的护盾且下{2}次技能先制+{3},护盾最多可获得{4}点` - -### Effect 1781 -- `argsNum`: `2` -- `info`: `若自身拥有的护盾值高于{0}则令自身下{1}回合回合类效果无法被消除` - -### Effect 1782 -- `argsNum`: `0` -- `info`: `自身存在护盾则先制+2` - -### Effect 1783 -- `argsNum`: `2` -- `info`: `消除敌我双方回合类效果,消除任意一项成功则敌我双方同时进入{0}状态,若任意一方回合类效果无法被消除则令对手下{1}回合无法主动切换精灵` -- `param`: `1,0,0` - -### Effect 1784 -- `argsNum`: `1` -- `info`: `{0}回合内对手使用技能时自身免疫对手下1次非致命一击造成的攻击伤害` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-234-effects-1785-1789.md b/docs/effect-unimplemented-tasks/task-234-effects-1785-1789.md deleted file mode 100644 index e43ca66fc..000000000 --- a/docs/effect-unimplemented-tasks/task-234-effects-1785-1789.md +++ /dev/null @@ -1,36 +0,0 @@ -# Task 234: Effects 1785-1789 - -## 目标 - -- 补齐以下 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 1785 -- `argsNum`: `3` -- `info`: `{0}回合内每回合使用技能吸取对手最大体力的1/{1},吸取体力时若自身为满体力则恢复己方所有不在场精灵{2}点体力` - -### Effect 1786 -- `argsNum`: `2` -- `info`: `{0}回合内若自身回合类效果被消除则对手下{1}次使用的攻击技能附加效果失效` - -### Effect 1787 -- `argsNum`: `1` -- `info`: `沙之力量觉醒,使自身下{0}次攻击获得黯天之尘效果` - -### Effect 1788 -- `argsNum`: `3` -- `info`: `{0}%令对手{1},未触发则附加自身最大体力{2}%的百分比伤害,若对手免疫百分比伤害则转变为真实伤害` -- `param`: `1,1,1` - -### Effect 1789 -- `argsNum`: `1` -- `info`: `预留,{0}` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-295-effects-2090-2094.md b/docs/effect-unimplemented-tasks/task-295-effects-2090-2094.md deleted file mode 100644 index 4130607a5..000000000 --- a/docs/effect-unimplemented-tasks/task-295-effects-2090-2094.md +++ /dev/null @@ -1,36 +0,0 @@ -# Task 295: Effects 2090-2094 - -## 目标 - -- 补齐以下 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 2090 -- `argsNum`: `0` -- `info`: `空元之诗·均:附加双方体力上限差值50%的次元·龙系伤害,自身体力上限高于对手时额外吸取对手第五技能剩余的PP值,自身体力上限低于对手时附加伤害翻倍` - -### Effect 2091 -- `argsNum`: `1` -- `info`: `` - -### Effect 2092 -- `argsNum`: `2` -- `info`: `全属性+{0}并将空妄诗章补充至与自身先制等级相等,自身没有空妄诗章时额外书写{1}篇,拥有时强化效果翻倍` - -### Effect 2093 -- `argsNum`: `5` -- `info`: `{0}回合内使用技能吸取对手最大体力的1/{1},自身体力低于1/{2}时效果翻倍,吸取后若对手体力未减少则{3}回合内对手{4}` -- `param`: `23,4,4` - -### Effect 2094 -- `argsNum`: `3` -- `info`: `自身每有1篇空妄诗章造成的攻击伤害提升{0}%,若空妄诗章的篇数高于{1}则每有1篇额外附加{2}点真实伤害` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-301-effects-2120-2124.md b/docs/effect-unimplemented-tasks/task-301-effects-2120-2124.md deleted file mode 100644 index dfde4c428..000000000 --- a/docs/effect-unimplemented-tasks/task-301-effects-2120-2124.md +++ /dev/null @@ -1,35 +0,0 @@ -# Task 301: Effects 2120-2124 - -## 目标 - -- 补齐以下 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 2120 -- `argsNum`: `2` -- `info`: `自身为对手天敌时下{0}次受到攻击的伤害减少{1}%` - -### Effect 2121 -- `argsNum`: `1` -- `info`: `未击败对手则己方在场精灵吸取对手最大体力的{0}%,吸取后若对手体力未减少则延续至下回合` - -### Effect 2122 -- `argsNum`: `2` -- `info`: `获得{0}点护罩,护罩消失时自身所有技能PP值+{1}` - -### Effect 2123 -- `argsNum`: `1` -- `info`: `消除对手回合类效果,消除成功令对手感染且自身每有1点灵茉之芯额外附加中毒、睡眠、寄生中的前1种异常状态,未触发则吸取对手最大体力的1/{0}` - -### Effect 2124 -- `argsNum`: `1` -- `info`: `{0}%的概率造成伤害翻倍,自身处于能力提升状态或对手处于能力下降状态时概率翻倍` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/fight-multi-battle-refactor-task-2026-04-04.md b/docs/fight-multi-battle-refactor-task-2026-04-04.md index 5f1f09192..35a5ddd95 100644 --- a/docs/fight-multi-battle-refactor-task-2026-04-04.md +++ b/docs/fight-multi-battle-refactor-task-2026-04-04.md @@ -11,12 +11,39 @@ - 切宠同步改为携带 `actorIndex`,同一玩家多上场位的切宠播报不再冲突 - 开战同步结构新增当前战斗位数组,同时保留 `Info1/Info2` 兼容旧结构 - `FightI` 已补充 `UseSkillAt/ChangePetAt/UseItemAt/GetCurrPETAt` +- `NewFight` 已改为包装 `NewFightWithOptions(...)`,创建阶段开始支持 option/builder 扩展 +- `Ctx` 已拆分为 `LegacySides + EffectBinding`,effect 本体上挂载上下文,并补充 `Source/Carrier/Target` +- 核心执行链已开始迁移到真实 source/target 语义:`AddEffect`、`Exec`、`Damage`、`SetProp`、主技能结算流程会注入实际对手上下文 +- 已迁移一批公共/高复用 effect 到新语义,包括状态基类、击败触发、物攻附加状态、`1097-1101`、`680-690`、部分魂印基础逻辑 +- 本轮继续完成了 `1263-1287`、`1288-1312`、`1448-1472`、`1473-1497` 四组 effect 的迁移,已不再直接依赖 `Ctx().Our/Opp`,统一改为 `CarrierInput()/OpponentInput()` 访问当前承载侧与对位侧 - 增加了动作队列的基础单测,覆盖“同玩家不同槽位保留”和“同槽位动作替换” 本轮仍保留的限制: - `enterturn` 和大量 `effect/node` 逻辑仍是双动作上下文,因此当前实现采用“动作列表排序 + 跨阵营配对兼容执行”的过渡方案,而不是一次性重写所有效果系统 - `NewFight` 仍按现有建房流程创建双方 1 个战斗位;本轮打通的是多战斗位结算骨架和接口,不是外部建房入口的全量切换 +- 大量具体 effect 仍在使用旧的 `Ctx().Our/Opp` 语义;当前已迁移的是上下文承载方式、执行链和部分公共基类,具体 effect 仍需继续分批迁移 + +### 0.1 effect 迁移增量记录 + +本轮新增完成: + +- `logic/service/fight/effect/1263_1287.go` +- `logic/service/fight/effect/1288_1312.go` +- `logic/service/fight/effect/1448_1472.go` +- `logic/service/fight/effect/1473_1497.go` + +这两组文件当前迁移策略是: + +- 旧语义中的 `Our` 统一视为“当前执行/承载该 effect 的输入侧”,迁移为 `CarrierInput()` +- 旧语义中的 `Opp` 统一迁移为当前结算上下文里的对位输入侧,即 `OpponentInput()` +- 暂不在这一轮强行把所有 effect 重写成纯 `Source/Target/Carrier` 三元语义;先保证 hostile sub-effect、回合类 effect、挂在对手身上的限制类 effect 都不再依赖 legacy 字段访问 + +### 0.2 下一批待迁移队列 + +高密度遗留文件已继续向后推进,`1448-1497` 这两个分段本轮已清理完成。 + +下一轮继续迁移时,建议直接对 effect 包执行一次全量扫描,按“仍包含 `Ctx().Our/Opp` 的 grouped file”继续往后收口,而不是再只盯固定编号段。 ## 1. 任务目标 diff --git a/logic/service/fight/boss/NewSeIdx_2.go b/logic/service/fight/boss/NewSeIdx_2.go index 5066d0ef6..edc1eadf6 100644 --- a/logic/service/fight/boss/NewSeIdx_2.go +++ b/logic/service/fight/boss/NewSeIdx_2.go @@ -16,7 +16,7 @@ func (e *NewSel2) EFFect_Befer(in *input.Input, effEffect input.Effect) bool { return true } - if in != e.Ctx().Opp { + if in != e.OpponentInput() { return true } if input.IS_Stat(effEffect) { diff --git a/logic/service/fight/effect/1097_1101.go b/logic/service/fight/effect/1097_1101.go index 09b7b4887..b4147dcf2 100644 --- a/logic/service/fight/effect/1097_1101.go +++ b/logic/service/fight/effect/1097_1101.go @@ -21,52 +21,57 @@ type Effect1097 struct { } func (e *Effect1097) Skill_Use() bool { + source := e.SourceInput() + target := e.OpponentInput() + if source == nil || target == nil { + return true + } 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 skill.AttackTime != 0 && source.SumDamage.Cmp(alpacadecimal.NewFromInt(280)) < 0 { + tiredEffect := source.InitEffect(input.EffectType.Status, int(info.PetStatus.Tired)) if tiredEffect != nil { tiredEffect.Duration(1) - e.Ctx().Opp.AddEffect(e.Ctx().Our, tiredEffect) + target.AddEffect(source, tiredEffect) } } - if e.Ctx().Opp.CurPet[0].Info.Hp > 0 { - disableAttack := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1097, 1, 0) + if target.CurPet[0].Info.Hp > 0 { + disableAttack := source.InitEffect(input.EffectType.Sub, 1097, 1, 0) if disableAttack != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, disableAttack) + target.AddEffect(source, disableAttack) } } if e.starFuryActive { - if e.Ctx().Opp.CurPet[0].Info.Hp <= 0 { + if target.CurPet[0].Info.Hp <= 0 { return true } - success, _, _ := e.Input.Player.Roll(50, 100) + success, _, _ := source.Player.Roll(50, 100) if success { - blindEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Blind)) + blindEffect := source.InitEffect(input.EffectType.Status, int(info.PetStatus.Blind)) if blindEffect != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, blindEffect) + target.AddEffect(source, blindEffect) } return true } - disableStatus := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1097, 2, 1) + disableStatus := source.InitEffect(input.EffectType.Sub, 1097, 2, 1) if disableStatus != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, disableStatus) + target.AddEffect(source, disableStatus) } return true } - if e.Ctx().Opp.CurPet[0].Info.Hp <= 0 { + if target.CurPet[0].Info.Hp <= 0 { return true } - success, _, _ := e.Input.Player.Roll(50, 100) + success, _, _ := source.Player.Roll(50, 100) if !success { return true } @@ -80,7 +85,7 @@ func (e *Effect1097) Skill_Use() bool { } e.starFuryActive = true - executeExtraSkill(e.Ctx().Our, e.Ctx().Opp, furySkill) + executeExtraSkill(source, target, furySkill) e.starFuryActive = false return true } @@ -153,11 +158,15 @@ func (e *Effect1098) SetArgs(t *input.Input, a ...int) { } func (e *Effect1098) SkillHit() bool { + source := e.SourceInput() + if source == nil { + return true + } if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { return true } - success, _, _ := e.Input.Player.Roll(e.critChance, 100) + success, _, _ := source.Player.Roll(e.critChance, 100) if success { e.Ctx().SkillEntity.XML.CritRate = 16 } @@ -165,6 +174,11 @@ func (e *Effect1098) SkillHit() bool { } func (e *Effect1098) Skill_Use() bool { + source := e.SourceInput() + target := e.OpponentInput() + if source == nil || target == nil { + return true + } skill := e.Ctx().SkillEntity if skill == nil { return true @@ -181,18 +195,18 @@ func (e *Effect1098) Skill_Use() bool { } if e.starFuryActive { - priorityEffect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1098, 2) + priorityEffect := source.InitEffect(input.EffectType.Sub, 1098, 2) if priorityEffect != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, priorityEffect) + source.AddEffect(source, priorityEffect) } return true } - if e.Ctx().Opp.CurPet[0].Info.Hp <= 0 { + if target.CurPet[0].Info.Hp <= 0 { return true } - success, _, _ := e.Input.Player.Roll(50, 100) + success, _, _ := source.Player.Roll(50, 100) if !success { return true } @@ -210,7 +224,7 @@ func (e *Effect1098) Skill_Use() bool { } e.starFuryActive = true - executeExtraSkill(e.Ctx().Our, e.Ctx().Opp, furySkill) + executeExtraSkill(source, target, furySkill) e.starFuryActive = false return true } @@ -235,7 +249,11 @@ func (e *Effect1098Sub) ComparePre(fattack, sattack *action.SelectSkillAction) b return true } - current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + source := e.SourceInput() + if source == nil { + return true + } + current := actionByPlayer(fattack, sattack, source.UserID) if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() == info.Category.STATUS { return true } @@ -254,12 +272,17 @@ type Effect1099 struct { } func (e *Effect1099) Skill_Use() bool { + source := e.SourceInput() + target := e.OpponentInput() + if source == nil || target == nil { + return true + } cleared := false - for i, level := range e.Ctx().Opp.Prop[:] { + for i, level := range target.Prop[:] { if level <= 0 { continue } - if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) { + if target.SetProp(source, int8(i), 0) { cleared = true } } @@ -267,9 +290,9 @@ func (e *Effect1099) Skill_Use() bool { return true } - immuneEffect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1099, int(e.Args()[0].IntPart())) + immuneEffect := source.InitEffect(input.EffectType.Sub, 1099, int(e.Args()[0].IntPart())) if immuneEffect != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, immuneEffect) + source.AddEffect(source, immuneEffect) } return true } @@ -293,7 +316,7 @@ func (e *Effect1099Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bo e.Alive(false) return true } - if in != e.Ctx().Opp || !input.IS_Stat(effEffect) { + if in != e.OpponentInput() || !input.IS_Stat(effEffect) { return true } @@ -311,23 +334,33 @@ type Effect1100 struct { } func (e *Effect1100) Skill_Use_ex() bool { + source := e.SourceInput() + target := e.OpponentInput() + if source == nil || target == nil { + return true + } 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()) + statusEffect := source.InitEffect(input.EffectType.Status, randomStatus1100()) if statusEffect != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + target.AddEffect(source, statusEffect) } return true } func (e *Effect1100) TurnEnd() { + source := e.SourceInput() 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 source == nil { + e.EffectNode.TurnEnd() + return + } + boostEffect := source.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) + source.AddEffect(source, boostEffect) } } e.EffectNode.TurnEnd() @@ -364,6 +397,8 @@ type Effect1101 struct { } func (e *Effect1101) DamageFloor(zone *info.DamageZone) bool { + source := e.SourceInput() + target := e.OpponentInput() if zone == nil || zone.Type != info.DamageType.Red { return true } @@ -371,22 +406,33 @@ func (e *Effect1101) DamageFloor(zone *info.DamageZone) bool { return true } - success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100) + if source == nil { + return true + } + success, _, _ := source.Player.Roll(int(e.Args()[0].IntPart()), 100) if !success { return true } - zone.Damage = e.Ctx().Opp.CurPet[0].GetMaxHP() + if target == nil { + return true + } + zone.Damage = target.CurPet[0].GetMaxHP() return true } func (e *Effect1101) Skill_Use() bool { + source := e.SourceInput() + target := e.OpponentInput() + if source == nil || target == nil { + return true + } if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.AttackTime == 0 { - e.Ctx().Our.CurPet[0].Info.Hp = 0 + source.CurPet[0].Info.Hp = 0 } - zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[1].IntPart())) - applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[2].IntPart())) + zeroRandomSkillPP(target, int(e.Args()[1].IntPart())) + applyAllPropDown(source, target, int8(e.Args()[2].IntPart())) return true } @@ -398,13 +444,13 @@ func executeExtraSkill(attacker, defender *input.Input, skill *info.SkillEntity) skill.XML.MustHit = 1 skill.AttackTimeC(attacker.Prop[5]) - defender.Exec(func(effect input.Effect) bool { + defender.ExecWithOpponent(attacker, func(effect input.Effect) bool { effect.Ctx().SkillEntity = skill effect.SkillHit_ex() return true }) - attacker.Exec(func(effect input.Effect) bool { + attacker.ExecWithOpponent(defender, func(effect input.Effect) bool { effect.Ctx().SkillEntity = skill effect.SkillHit() return true @@ -415,7 +461,7 @@ func executeExtraSkill(attacker, defender *input.Input, skill *info.SkillEntity) originalProps[0], originalProps[1] = attacker.Prop, defender.Prop originalPetInfo[0], originalPetInfo[1] = attacker.CurPet[0].Info, defender.CurPet[0].Info - attacker.Exec(func(effect input.Effect) bool { + attacker.ExecWithOpponent(defender, func(effect input.Effect) bool { effect.Ctx().SkillEntity = skill effect.CalculatePre() return true @@ -440,7 +486,7 @@ func executeExtraSkill(attacker, defender *input.Input, skill *info.SkillEntity) sumDamage = sumDamage.Mul(alpacadecimal.NewFromInt(2)) } - attacker.Exec(func(effect input.Effect) bool { + attacker.ExecWithOpponent(defender, func(effect input.Effect) bool { effect.Ctx().SkillEntity = skill effect.OnSkill() return true @@ -452,7 +498,7 @@ func executeExtraSkill(attacker, defender *input.Input, skill *info.SkillEntity) }) if defender.CurPet[0].Info.Hp > 0 { - defender.Exec(func(effect input.Effect) bool { + defender.ExecWithOpponent(attacker, func(effect input.Effect) bool { effect.Ctx().SkillEntity = skill effect.Skill_Use_ex() return true @@ -460,19 +506,19 @@ func executeExtraSkill(attacker, defender *input.Input, skill *info.SkillEntity) } if attacker.CurPet[0].Info.Hp > 0 { - attacker.Exec(func(effect input.Effect) bool { + attacker.ExecWithOpponent(defender, func(effect input.Effect) bool { effect.Ctx().SkillEntity = skill effect.Skill_Use() return true }) } - defender.Exec(func(effect input.Effect) bool { + defender.ExecWithOpponent(attacker, func(effect input.Effect) bool { effect.Ctx().SkillEntity = skill effect.Action_end_ex() return true }) - attacker.Exec(func(effect input.Effect) bool { + attacker.ExecWithOpponent(defender, func(effect input.Effect) bool { effect.Ctx().SkillEntity = skill effect.Action_end() return true diff --git a/logic/service/fight/effect/1263_1287.go b/logic/service/fight/effect/1263_1287.go index 90976c1c7..395f30808 100644 --- a/logic/service/fight/effect/1263_1287.go +++ b/logic/service/fight/effect/1263_1287.go @@ -63,17 +63,17 @@ func (e *Effect1263) Skill_Use() bool { } divisor := e.Args()[0] - if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Opp.CurPet[0].GetHP()) < 0 { + if e.CarrierInput().CurPet[0].GetHP().Cmp(e.OpponentInput().CurPet[0].GetHP()) < 0 { divisor = e.Args()[1] } - damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(divisor) + damage := e.OpponentInput().CurPet[0].GetMaxHP().Div(divisor) if damage.Cmp(alpacadecimal.Zero) <= 0 { return true } - 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) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: damage}) + e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, damage) return true } @@ -95,9 +95,9 @@ func (e *Effect1265) Skill_Use() bool { if len(e.Args()) < 2 { return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1265, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart())) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1265, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart())) if effect != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + e.CarrierInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -142,9 +142,9 @@ func (e *Effect1266) Skill_Use_ex() bool { return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1266, int(e.Args()[1].IntPart())) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1266, int(e.Args()[1].IntPart())) if effect != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, effect) + e.OpponentInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -191,13 +191,13 @@ func (e *Effect1267) Skill_Use_ex() bool { } e.triggered = true - applyOneOfStatuses(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart())) + applyOneOfStatuses(e.CarrierInput(), e.OpponentInput(), int(e.Args()[1].IntPart())) return true } func (e *Effect1267) TurnEnd() { if !e.triggered && e.Duration() == 1 { - e.Ctx().Opp.CancelTurn(e.Ctx().Our) + e.OpponentInput().CancelTurn(e.CarrierInput()) } e.EffectNode.TurnEnd() } @@ -208,12 +208,12 @@ type Effect1268 struct { } func (e *Effect1268) Skill_Use() bool { - if len(e.Args()) == 0 || e.Ctx().Opp.CurPet[0].Info.Hp > 0 { + if len(e.Args()) == 0 || e.OpponentInput().CurPet[0].Info.Hp > 0 { return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1268, int(e.Args()[0].IntPart())) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1268, int(e.Args()[0].IntPart())) if effect != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + e.CarrierInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -232,7 +232,7 @@ func (e *Effect1268Sub) TurnStart(fattack, sattack *action.SelectSkillAction) { e.Alive(false) return } - applyOneOfStatuses(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart())) + applyOneOfStatuses(e.CarrierInput(), e.OpponentInput(), int(e.Args()[0].IntPart())) e.Alive(false) } @@ -246,12 +246,12 @@ func (e *Effect1269) SkillHit_ex() bool { return true } - damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[1]) + damage := e.OpponentInput().CurPet[0].GetMaxHP().Div(e.Args()[1]) if damage.Cmp(alpacadecimal.Zero) <= 0 { return true } - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage) - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage}) + e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, damage) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: damage}) return true } @@ -266,12 +266,12 @@ func (e *Effect1270) OnSkill() bool { } success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100) if success { - applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart())) + applyStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[1].IntPart())) return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1270, int(e.Args()[2].IntPart())) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1270, int(e.Args()[2].IntPart())) if effect != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, effect) + e.OpponentInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -319,14 +319,14 @@ func (e *Effect1271) OnSkill() bool { success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100) if success { - applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart())) + applyStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[2].IntPart())) e.triggered = true return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1271, int(e.Args()[3].IntPart()), int(e.Args()[4].IntPart()), int(e.Args()[5].IntPart())) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1271, int(e.Args()[3].IntPart()), int(e.Args()[4].IntPart()), int(e.Args()[5].IntPart())) if effect != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + e.CarrierInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -351,7 +351,7 @@ func (e *Effect1271Sub) OnSkill() bool { } success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100) if success { - applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart())) + applyStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[2].IntPart())) } e.remaining-- if e.remaining <= 0 { @@ -366,11 +366,11 @@ type Effect1272 struct { } func (e *Effect1272) OnSkill() bool { - shield := e.Ctx().Our.CurrentShield() + shield := e.CarrierInput().CurrentShield() if shield.Cmp(alpacadecimal.Zero) <= 0 { return true } - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: shield}) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: shield}) return true } @@ -383,14 +383,14 @@ func (e *Effect1273) OnSkill() bool { if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 { return true } - if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Our.CurPet[0].GetMaxHP()) != 0 { + if e.CarrierInput().CurPet[0].GetHP().Cmp(e.CarrierInput().CurPet[0].GetMaxHP()) != 0 { return true } - damage := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[0]) + damage := e.CarrierInput().CurPet[0].GetMaxHP().Div(e.Args()[0]) if damage.Cmp(alpacadecimal.Zero) <= 0 { return true } - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage}) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: damage}) return true } @@ -404,12 +404,12 @@ func (e *Effect1274) OnSkill() bool { return true } chance := int(e.Args()[0].IntPart()) - if e.Ctx().Opp.HasPropSub() { + if e.OpponentInput().HasPropSub() { chance *= 2 } success, _, _ := e.Input.Player.Roll(chance, 100) if success { - applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart())) + applyStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[1].IntPart())) } return true } @@ -423,10 +423,10 @@ func (e *Effect1275) Skill_Use() bool { if len(e.Args()) == 0 { return true } - e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Our.CurPet[0].GetHP()}) - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1275, int(e.Args()[0].IntPart())) + e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.CarrierInput().CurPet[0].GetHP()}) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1275, int(e.Args()[0].IntPart())) if effect != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + e.CarrierInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -468,10 +468,10 @@ func (e *Effect1276) Skill_Use() bool { if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 { return true } - damage := e.Ctx().Our.CurPet[0].GetHP().Div(e.Args()[0]) - e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Our.CurPet[0].GetHP()}) + damage := e.CarrierInput().CurPet[0].GetHP().Div(e.Args()[0]) + e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.CarrierInput().CurPet[0].GetHP()}) if damage.Cmp(alpacadecimal.Zero) > 0 { - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage}) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: damage}) } return true } @@ -482,19 +482,19 @@ type Effect1277 struct { } func (e *Effect1277) Skill_Use() bool { - if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Opp.CurPet[0].GetHP()) > 0 { + if e.CarrierInput().CurPet[0].GetHP().Cmp(e.OpponentInput().CurPet[0].GetHP()) > 0 { leave := alpacadecimal.NewFromInt(1) - if e.Ctx().Our.CurPet[0].GetHP().Cmp(leave) > 0 { - e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Our.CurPet[0].GetHP().Sub(leave)}) + if e.CarrierInput().CurPet[0].GetHP().Cmp(leave) > 0 { + e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.CarrierInput().CurPet[0].GetHP().Sub(leave)}) } - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: alpacadecimal.NewFromInt(int64(grand.N(350, 550)))}) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: alpacadecimal.NewFromInt(int64(grand.N(350, 550)))}) return true } - lost := e.Ctx().Our.CurPet[0].GetHP() - e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: lost}) - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: lost}) - applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Paralysis)) + lost := e.CarrierInput().CurPet[0].GetHP() + e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: lost}) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: lost}) + applyStatusByID(e.CarrierInput(), e.OpponentInput(), int(info.PetStatus.Paralysis)) return true } @@ -509,12 +509,12 @@ func (e *Effect1278) OnSkill() bool { } success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100) if success { - applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart())) + applyStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[1].IntPart())) return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1278, int(e.Args()[2].IntPart())) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1278, int(e.Args()[2].IntPart())) if effect != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + e.CarrierInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -536,7 +536,7 @@ func (e *Effect1278Sub) DamageLockEx(zone *info.DamageZone) bool { if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 { return true } - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: zone.Damage}) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: zone.Damage}) zone.Damage = alpacadecimal.Zero e.remaining-- if e.remaining <= 0 { @@ -555,17 +555,17 @@ func (e *Effect1279) OnSkill() bool { return true } reversed := false - for i, v := range e.Ctx().Our.Prop[:] { - if v < 0 && e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), -2*v) { + for i, v := range e.CarrierInput().Prop[:] { + if v < 0 && e.CarrierInput().SetProp(e.CarrierInput(), int8(i), -2*v) { reversed = true } } if !reversed { return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1279, int(e.Args()[0].IntPart())) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1279, int(e.Args()[0].IntPart())) if effect != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, effect) + e.OpponentInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -614,9 +614,9 @@ func (e *Effect1280) OnSkill() bool { if percent > max { percent = max } - damage := e.Ctx().Our.CurPet[0].GetHP().Mul(alpacadecimal.NewFromInt(int64(percent))).Div(alpacadecimal.NewFromInt(100)) + damage := e.CarrierInput().CurPet[0].GetHP().Mul(alpacadecimal.NewFromInt(int64(percent))).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.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: damage}) } e.bonus += int(e.Args()[1].IntPart()) return true @@ -628,20 +628,20 @@ type Effect1281 struct { } func (e *Effect1281) Skill_Use() bool { - shield := e.Ctx().Our.CurrentShield() + shield := e.CarrierInput().CurrentShield() if shield.Cmp(alpacadecimal.Zero) <= 0 { return true } - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: shield}) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: shield}) if shield.Cmp(alpacadecimal.NewFromInt(300)) > 0 { - dmg := e.Ctx().Our.CurPet[0].GetMaxHP().Div(alpacadecimal.NewFromInt(3)) - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: dmg}) + dmg := e.CarrierInput().CurPet[0].GetMaxHP().Div(alpacadecimal.NewFromInt(3)) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: dmg}) return true } if shield.Cmp(alpacadecimal.NewFromInt(300)) < 0 { - val := e.Ctx().Our.CurPet[0].GetMaxHP().Div(alpacadecimal.NewFromInt(3)) - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, val) - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: val}) + val := e.CarrierInput().CurPet[0].GetMaxHP().Div(alpacadecimal.NewFromInt(3)) + e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, val) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: val}) } return true } @@ -655,7 +655,7 @@ func (e *Effect1282) Skill_Use() bool { if len(e.Args()) == 0 { return true } - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Args()[0]}) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Args()[0]}) return true } @@ -673,7 +673,7 @@ func (e *Effect1283) OnSkill() bool { boost *= 2 } for i := 0; i < 6; i++ { - e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boost) + e.CarrierInput().SetProp(e.CarrierInput(), int8(i), boost) } return true } @@ -687,9 +687,9 @@ func (e *Effect1284) Skill_Use() bool { if len(e.Args()) == 0 || !e.IsFirst() { return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1284, int(e.Args()[0].IntPart())) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1284, int(e.Args()[0].IntPart())) if effect != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, effect) + e.OpponentInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -729,10 +729,10 @@ type Effect1285 struct { } func (e *Effect1285) Skill_Use() bool { - if len(e.Args()) == 0 || e.Ctx().Opp.CurPet[0].Info.Hp == 0 { + if len(e.Args()) == 0 || e.OpponentInput().CurPet[0].Info.Hp == 0 { return true } - zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[0].IntPart())) + zeroRandomSkillPP(e.OpponentInput(), int(e.Args()[0].IntPart())) return true } @@ -754,13 +754,13 @@ func (e *Effect1287) OnSkill() bool { if len(e.Args()) < 2 { return true } - absorbed := clearPositivePropsTo(e.Ctx().Opp, e.Ctx().Our) + absorbed := clearPositivePropsTo(e.OpponentInput(), e.CarrierInput()) if !absorbed { return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1287, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart())) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1287, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart())) if effect != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + e.CarrierInput().AddEffect(e.CarrierInput(), effect) } return true } diff --git a/logic/service/fight/effect/1288_1312.go b/logic/service/fight/effect/1288_1312.go index d9e964d8b..1f4ee2904 100644 --- a/logic/service/fight/effect/1288_1312.go +++ b/logic/service/fight/effect/1288_1312.go @@ -79,9 +79,9 @@ func (e *Effect1288) Skill_Use() bool { if len(e.Args()) < 3 { return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1288, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart())) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1288, 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) + e.CarrierInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -119,20 +119,20 @@ func (e *Effect1289) OnSkill() bool { return true } reflected := false - for i, v := range e.Ctx().Our.Prop[:] { + for i, v := range e.CarrierInput().Prop[:] { if v >= 0 { continue } - if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 2*v) { + if e.OpponentInput().SetProp(e.CarrierInput(), int8(i), 2*v) { reflected = true } } if !reflected { return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1289, int(e.Args()[0].IntPart())) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1289, int(e.Args()[0].IntPart())) if effect != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, effect) + e.OpponentInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -173,18 +173,18 @@ func (e *Effect1290) Skill_Use() bool { if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 { return true } - heal := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[0]) + heal := e.CarrierInput().CurPet[0].GetMaxHP().Div(e.Args()[0]) if heal.Cmp(alpacadecimal.Zero) <= 0 { return true } low := false if e.Args()[1].Cmp(alpacadecimal.Zero) > 0 { - threshold := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[1]) - low = e.Ctx().Our.CurPet[0].GetHP().Cmp(threshold) < 0 + threshold := e.CarrierInput().CurPet[0].GetMaxHP().Div(e.Args()[1]) + low = e.CarrierInput().CurPet[0].GetHP().Cmp(threshold) < 0 } - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal) + e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, heal) if low { - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: heal}) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: heal}) } return true } @@ -196,12 +196,12 @@ func (e *Effect1291) Skill_Use() bool { if len(e.Args()) < 3 { return true } - if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) <= 0 { + if e.CarrierInput().SumDamage.Cmp(e.Args()[0]) <= 0 { return true } success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100) if success { - applyRandomNStatuses(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()), effect1291Statuses) + applyRandomNStatuses(e.CarrierInput(), e.OpponentInput(), int(e.Args()[2].IntPart()), effect1291Statuses) } return true } @@ -210,10 +210,10 @@ func (e *Effect1291) Skill_Use() bool { type Effect1292 struct{ node.EffectNode } func (e *Effect1292) ComparePre(fattack, sattack *action.SelectSkillAction) bool { - if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Opp.CurPet[0].GetHP()) >= 0 { + if e.CarrierInput().CurPet[0].GetHP().Cmp(e.OpponentInput().CurPet[0].GetHP()) >= 0 { return true } - current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + current := actionByPlayer(fattack, sattack, e.CarrierInput().UserID) if current == nil || current.SkillEntity == nil { return true } @@ -228,9 +228,9 @@ func (e *Effect1293) Skill_Use() bool { if len(e.Args()) < 2 { return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1293, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart())) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1293, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart())) if effect != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + e.CarrierInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -258,7 +258,7 @@ func (e *Effect1293Sub) DamageLockEx(zone *info.DamageZone) bool { } zone.Damage = alpacadecimal.Zero for i := 0; i < 6; i++ { - e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(e.boost)) + e.CarrierInput().SetProp(e.CarrierInput(), int8(i), int8(e.boost)) } e.remaining-- if e.remaining <= 0 { @@ -271,17 +271,17 @@ func (e *Effect1293Sub) DamageLockEx(zone *info.DamageZone) bool { type Effect1294 struct{ node.EffectNode } func (e *Effect1294) Skill_Use() bool { - cleared := clearBothProps(e.Ctx().Our, e.Ctx().Opp) + cleared := clearBothProps(e.CarrierInput(), e.OpponentInput()) if cleared { - effect := e.Ctx().Our.InitEffect(input.EffectType.Status, 1294) + effect := e.CarrierInput().InitEffect(input.EffectType.Status, 1294) if effect != nil { - applyRandomNStatuses(e.Ctx().Our, e.Ctx().Opp, 2, effect1291Statuses) + applyRandomNStatuses(e.CarrierInput(), e.OpponentInput(), 2, effect1291Statuses) } return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1294) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1294) if effect != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + e.CarrierInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -289,9 +289,9 @@ func (e *Effect1294) Skill_Use() bool { type Effect1294Sub struct{ node.EffectNode } func (e *Effect1294Sub) TurnEnd() { - damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(alpacadecimal.NewFromInt(3)) + damage := e.OpponentInput().CurPet[0].GetMaxHP().Div(alpacadecimal.NewFromInt(3)) if damage.Cmp(alpacadecimal.Zero) > 0 { - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage}) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: damage}) } e.Alive(false) } @@ -303,9 +303,9 @@ func (e *Effect1295) Skill_Use() bool { if len(e.Args()) == 0 || !e.IsFirst() { return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1295, int(e.Args()[0].IntPart())) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1295, int(e.Args()[0].IntPart())) if effect != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + e.CarrierInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -313,7 +313,7 @@ func (e *Effect1295) Skill_Use() bool { type Effect1295Sub struct{ FixedDuration1Base } func (e *Effect1295Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool { - if in != e.Ctx().Opp || !input.IS_Stat(effEffect) { + if in != e.OpponentInput() || !input.IS_Stat(effEffect) { return true } return false @@ -330,7 +330,7 @@ func (e *Effect1296) DamageLockEx(zone *info.DamageZone) bool { if !ok { return true } - applyAnyStatus(e.Ctx().Our, e.Ctx().Our, effect1296Statuses[0]) + applyAnyStatus(e.CarrierInput(), e.CarrierInput(), effect1296Statuses[0]) return true } @@ -341,16 +341,16 @@ func (e *Effect1297) Skill_Use() bool { if len(e.Args()) < 2 { return true } - before := activeTurnEffectCount(e.Ctx().Opp) - e.Ctx().Opp.CancelTurn(e.Ctx().Our) + before := activeTurnEffectCount(e.OpponentInput()) + e.OpponentInput().CancelTurn(e.CarrierInput()) if before > 0 { - applyAnyStatus(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart())) + applyAnyStatus(e.CarrierInput(), e.OpponentInput(), int(e.Args()[0].IntPart())) return true } - damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[1]) + damage := e.OpponentInput().CurPet[0].GetMaxHP().Div(e.Args()[1]) if damage.Cmp(alpacadecimal.Zero) > 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) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: damage}) + e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, damage) } return true } @@ -359,12 +359,12 @@ func (e *Effect1297) Skill_Use() bool { type Effect1298 struct{ node.EffectNode } func (e *Effect1298) Skill_Use() bool { - cleared := clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) + cleared := clearPositiveProps(e.OpponentInput(), e.CarrierInput()) if !cleared { return true } - for _, pet := range e.Ctx().Opp.AllPet { - if pet == nil || !pet.Alive() || pet == e.Ctx().Opp.CurPet[0] { + for _, pet := range e.OpponentInput().AllPet { + if pet == nil || !pet.Alive() || pet == e.OpponentInput().CurPet[0] { continue } damage := pet.GetMaxHP().Div(alpacadecimal.NewFromInt(4)) @@ -383,11 +383,11 @@ func (e *Effect1299) SkillHit_ex() bool { if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { return true } - if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.NewFromInt(300)) >= 0 { + if e.CarrierInput().SumDamage.Cmp(alpacadecimal.NewFromInt(300)) >= 0 { return true } - for _, pet := range e.Ctx().Opp.AllPet { - if pet == nil || !pet.Alive() || pet == e.Ctx().Opp.CurPet[0] { + for _, pet := range e.OpponentInput().AllPet { + if pet == nil || !pet.Alive() || pet == e.OpponentInput().CurPet[0] { continue } pet.Info.ModelHP(-100) @@ -399,7 +399,7 @@ func (e *Effect1299) Skill_Use_ex() bool { if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS { return true } - healBench(e.Ctx().Our, alpacadecimal.NewFromInt(100)) + healBench(e.CarrierInput(), alpacadecimal.NewFromInt(100)) return true } @@ -413,7 +413,7 @@ func (e *Effect1300) DamageDivEx(zone *info.DamageZone) bool { reduce := zone.Damage.Mul(e.Args()[1]).Div(alpacadecimal.NewFromInt(100)) zone.Damage = zone.Damage.Sub(reduce) if zone.Damage.Cmp(e.Args()[2]) > 0 { - applyRandomNStatuses(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[3].IntPart()), effect1291Statuses) + applyRandomNStatuses(e.CarrierInput(), e.OpponentInput(), int(e.Args()[3].IntPart()), effect1291Statuses) } return true } @@ -422,12 +422,12 @@ func (e *Effect1300) DamageDivEx(zone *info.DamageZone) bool { type Effect1301 struct{ node.EffectNode } func (e *Effect1301) Skill_Use() bool { - if e.Ctx().Our.CurPet[0].GetHP().Cmp(alpacadecimal.NewFromInt(300)) >= 0 { + if e.CarrierInput().CurPet[0].GetHP().Cmp(alpacadecimal.NewFromInt(300)) >= 0 { return true } - e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Our.CurPet[0].GetHP()}) - for _, pet := range e.Ctx().Opp.AllPet { - if pet == nil || !pet.Alive() || pet == e.Ctx().Opp.CurPet[0] { + e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.CarrierInput().CurPet[0].GetHP()}) + for _, pet := range e.OpponentInput().AllPet { + if pet == nil || !pet.Alive() || pet == e.OpponentInput().CurPet[0] { continue } damage := pet.GetMaxHP().Div(alpacadecimal.NewFromInt(2)) @@ -449,12 +449,12 @@ func (e *Effect1302) OnSkill() bool { boost *= 2 } for i := 0; i < 6; i++ { - e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boost) + e.CarrierInput().SetProp(e.CarrierInput(), int8(i), boost) } if success { return true } - clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) + clearPositiveProps(e.OpponentInput(), e.CarrierInput()) return true } @@ -462,14 +462,14 @@ func (e *Effect1302) OnSkill() bool { type Effect1303 struct{ RoundEffectArg0Base } func (e *Effect1303) OnSkill() bool { - base := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(alpacadecimal.NewFromInt(3)) - if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Our.CurPet[0].GetMaxHP().Div(alpacadecimal.NewFromInt(2))) < 0 { + base := e.OpponentInput().CurPet[0].GetMaxHP().Div(alpacadecimal.NewFromInt(3)) + if e.CarrierInput().CurPet[0].GetHP().Cmp(e.CarrierInput().CurPet[0].GetMaxHP().Div(alpacadecimal.NewFromInt(2))) < 0 { base = base.Mul(alpacadecimal.NewFromInt(2)) } - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: base}) - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, base) - if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Our.CurPet[0].GetMaxHP()) == 0 { - healBench(e.Ctx().Our, alpacadecimal.NewFromInt(100)) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: base}) + e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, base) + if e.CarrierInput().CurPet[0].GetHP().Cmp(e.CarrierInput().CurPet[0].GetMaxHP()) == 0 { + healBench(e.CarrierInput(), alpacadecimal.NewFromInt(100)) } return true } @@ -494,7 +494,7 @@ func (e *Effect1305) OnSkill() bool { return true } live, dead := 0, 0 - for _, pet := range e.Ctx().Our.AllPet { + for _, pet := range e.CarrierInput().AllPet { if pet == nil { continue } @@ -504,9 +504,9 @@ func (e *Effect1305) OnSkill() bool { dead++ } } - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, alpacadecimal.NewFromInt(int64(live)*e.Args()[0].IntPart())) + e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, alpacadecimal.NewFromInt(int64(live)*e.Args()[0].IntPart())) if dead > 0 { - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: alpacadecimal.NewFromInt(int64(dead) * e.Args()[1].IntPart())}) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: alpacadecimal.NewFromInt(int64(dead) * e.Args()[1].IntPart())}) } return true } @@ -515,11 +515,11 @@ func (e *Effect1305) OnSkill() bool { type Effect1306 struct{ node.EffectNode } func (e *Effect1306) Skill_Use() bool { - if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.NewFromInt(350)) >= 0 { + if e.CarrierInput().SumDamage.Cmp(alpacadecimal.NewFromInt(350)) >= 0 { return true } - for _, pet := range e.Ctx().Opp.AllPet { - if pet == nil || !pet.Alive() || pet == e.Ctx().Opp.CurPet[0] { + for _, pet := range e.OpponentInput().AllPet { + if pet == nil || !pet.Alive() || pet == e.OpponentInput().CurPet[0] { continue } pet.Info.ModelHP(-100) @@ -531,10 +531,10 @@ func (e *Effect1306) Skill_Use() bool { type Effect1307 struct{ node.EffectNode } func (e *Effect1307) Skill_Use() bool { - if e.Ctx().Opp.CurPet[0].Info.Hp == 0 { + if e.OpponentInput().CurPet[0].Info.Hp == 0 { return true } - healBench(e.Ctx().Our, alpacadecimal.NewFromInt(100)) + healBench(e.CarrierInput(), alpacadecimal.NewFromInt(100)) return true } @@ -551,7 +551,7 @@ func (e *Effect1309) OnSkill() bool { return true } damage := e.Args()[0] - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: damage}) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: damage}) return true } @@ -562,12 +562,12 @@ func (e *Effect1310) OnSkill() bool { if len(e.Args()) == 0 { return true } - if !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) { + if !clearPositiveProps(e.OpponentInput(), e.CarrierInput()) { return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1310, int(e.Args()[0].IntPart())) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1310, int(e.Args()[0].IntPart())) if effect != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + e.CarrierInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -590,7 +590,7 @@ func (e *Effect1310Sub) ComparePre(fattack, sattack *action.SelectSkillAction) b e.Alive(false) return true } - current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + current := actionByPlayer(fattack, sattack, e.CarrierInput().UserID) if current != nil && current.SkillEntity != nil { current.SkillEntity.XML.Priority += 7 } @@ -609,7 +609,7 @@ func (e *Effect1311) Skill_Use_ex() bool { return true } for i := 0; i < 6; i++ { - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -int8(e.Args()[1].IntPart())) + e.OpponentInput().SetProp(e.CarrierInput(), int8(i), -int8(e.Args()[1].IntPart())) } return true } @@ -622,17 +622,17 @@ func (e *Effect1312) OnSkill() bool { return true } cleared := false - for i, v := range e.Ctx().Our.Prop[:] { - if v < 0 && e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) { + for i, v := range e.CarrierInput().Prop[:] { + if v < 0 && e.CarrierInput().SetProp(e.CarrierInput(), int8(i), 0) { cleared = true } } if !cleared { return true } - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1312, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart())) + effect := e.CarrierInput().InitEffect(input.EffectType.Sub, 1312, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart())) if effect != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + e.CarrierInput().AddEffect(e.CarrierInput(), effect) } return true } @@ -659,7 +659,7 @@ func (e *Effect1312Sub) ComparePre(fattack, sattack *action.SelectSkillAction) b e.Alive(false) return true } - current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + current := actionByPlayer(fattack, sattack, e.CarrierInput().UserID) if current != nil && current.SkillEntity != nil { current.SkillEntity.XML.Priority += e.priority } diff --git a/logic/service/fight/effect/1448_1472.go b/logic/service/fight/effect/1448_1472.go index 5f3081e8e..b9059a5b6 100644 --- a/logic/service/fight/effect/1448_1472.go +++ b/logic/service/fight/effect/1448_1472.go @@ -46,11 +46,11 @@ func randomSkillPPZero(target *input.Input, count int) { type Effect1448 struct{ node.EffectNode } func (e *Effect1448) Damage_Mul(zone *info.DamageZone) bool { - if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 || e.Ctx().Our.CurPet[0] == nil { + if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 || e.CarrierInput().CurPet[0] == nil { return true } - maxHP := e.Ctx().Our.CurPet[0].GetMaxHP() - curHP := e.Ctx().Our.CurPet[0].GetHP() + maxHP := e.CarrierInput().CurPet[0].GetMaxHP() + curHP := e.CarrierInput().CurPet[0].GetHP() if curHP.Mul(e.Args()[0]).Cmp(maxHP) >= 0 { return true } @@ -65,9 +65,9 @@ func (e *Effect1449) Skill_Use() bool { if len(e.Args()) < 2 { return true } - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1449, e.SideEffectArgs...) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1449, e.SideEffectArgs...) if eff != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, eff) + e.OpponentInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -82,7 +82,7 @@ func (e *Effect1449Sub) Heal_Pre(_ action.BattleActionI, amount *int) bool { } damage := alpacadecimal.NewFromInt(int64(*amount)).Div(e.Args()[1]) if damage.Cmp(alpacadecimal.Zero) > 0 { - e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage}) + e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: damage}) } *amount = 0 return true @@ -96,14 +96,14 @@ func (e *Effect1450) Skill_Use() bool { return true } drain := e.Args()[0] - for _, s := range e.Ctx().Opp.CurPet[0].Info.SkillList { + for _, s := range e.OpponentInput().CurPet[0].Info.SkillList { if s.PP < uint32(e.Args()[1].IntPart()) { drain = drain.Mul(alpacadecimal.NewFromInt(2)) break } } - 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) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: drain}) + e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, drain) return true } @@ -114,12 +114,12 @@ func (e *Effect1451) Skill_Use() bool { if len(e.Args()) < 2 { return true } - if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Opp.CurPet[0].GetHP()) > 0 { - e.Ctx().Our.AddShield(e.Args()[0]) + if e.CarrierInput().CurPet[0].GetHP().Cmp(e.OpponentInput().CurPet[0].GetHP()) > 0 { + e.CarrierInput().AddShield(e.Args()[0]) return true } - heal := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[1]) - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal) + heal := e.CarrierInput().CurPet[0].GetMaxHP().Div(e.Args()[1]) + e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, heal) return true } @@ -130,9 +130,9 @@ func (e *Effect1452) Skill_Use() bool { if len(e.Args()) == 0 { return true } - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1452, e.SideEffectArgs...) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1452, e.SideEffectArgs...) if eff != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, eff) + e.CarrierInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -151,9 +151,9 @@ func (e *Effect1452Sub) Damage_Mul(zone *info.DamageZone) bool { type Effect1453 struct{ node.EffectNode } func (e *Effect1453) Skill_Use() bool { - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1453, e.SideEffectArgs...) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1453, e.SideEffectArgs...) if eff != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, eff) + e.CarrierInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -196,7 +196,7 @@ func (e *Effect1455) Damage_Mul(zone *info.DamageZone) bool { maxHits := int(e.Args()[1].IntPart()) zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(int64(maxHits))) if maxHits > 0 { - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Opp.CurPet[0].GetHP()}) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.OpponentInput().CurPet[0].GetHP()}) } return true } @@ -208,12 +208,12 @@ func (e *Effect1456) Skill_Use() bool { if len(e.Args()) < 2 { return true } - maxHP := e.Ctx().Our.CurPet[0].GetMaxHP() - e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Our.CurPet[0].GetHP()}) - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: maxHP.Div(e.Args()[0])}) - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1456, e.SideEffectArgs...) + maxHP := e.CarrierInput().CurPet[0].GetMaxHP() + e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.CarrierInput().CurPet[0].GetHP()}) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: maxHP.Div(e.Args()[0])}) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1456, e.SideEffectArgs...) if eff != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, eff) + e.CarrierInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -236,10 +236,10 @@ func (e *Effect1457) OnSkill() bool { } success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100) if success { - addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart())) + addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[2].IntPart())) return true } - randomSkillPPZero(e.Ctx().Opp, int(e.Args()[3].IntPart())) + randomSkillPPZero(e.OpponentInput(), int(e.Args()[3].IntPart())) return true } @@ -247,9 +247,9 @@ func (e *Effect1457) OnSkill() bool { type Effect1458 struct{ node.EffectNode } func (e *Effect1458) Skill_Use() bool { - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1458, e.SideEffectArgs...) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1458, e.SideEffectArgs...) if eff != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, eff) + e.CarrierInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -267,7 +267,7 @@ func (e *Effect1458Sub) SkillHit_ex() bool { } if len(e.Args()) >= 4 { if ok, _, _ := e.Input.Player.Roll(int(e.Args()[2].IntPart()), 100); ok { - addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[3].IntPart())) + addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[3].IntPart())) } } return true @@ -281,12 +281,12 @@ func (e *Effect1459) ActionStart(a, b *action.SelectSkillAction) bool { return true } if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok { - addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart())) + addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[1].IntPart())) return true } - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1459, e.SideEffectArgs...) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1459, e.SideEffectArgs...) if eff != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, eff) + e.OpponentInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -322,10 +322,10 @@ func (e *Effect1461) Skill_Use() bool { if len(e.Args()) == 0 { return true } - heal := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[0]) - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal) - if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Opp.CurPet[0].GetHP()) < 0 { - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: heal}) + heal := e.CarrierInput().CurPet[0].GetMaxHP().Div(e.Args()[0]) + e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, heal) + if e.CarrierInput().CurPet[0].GetHP().Cmp(e.OpponentInput().CurPet[0].GetHP()) < 0 { + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: heal}) } return true } @@ -334,9 +334,9 @@ func (e *Effect1461) Skill_Use() bool { type Effect1462 struct{ node.EffectNode } func (e *Effect1462) Skill_Use() bool { - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1462, e.SideEffectArgs...) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1462, e.SideEffectArgs...) if eff != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, eff) + e.CarrierInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -349,7 +349,7 @@ func (e *Effect1462Sub) DamageAdd(zone *info.DamageZone) bool { } bonus := e.Args()[1] boosted := false - for _, v := range e.Ctx().Our.Prop[:] { + for _, v := range e.CarrierInput().Prop[:] { if v > 0 { boosted = true break @@ -369,9 +369,9 @@ func (e *Effect1463) ActionStart(a, b *action.SelectSkillAction) bool { if !e.IsFirst() { return true } - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1463) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1463) if eff != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, eff) + e.CarrierInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -382,11 +382,11 @@ func (e *Effect1463Sub) DamageLock(zone *info.DamageZone) bool { if zone == nil || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 { return true } - if e.Ctx().Our.CurPet[0].GetHP().Cmp(zone.Damage) > 0 { + if e.CarrierInput().CurPet[0].GetHP().Cmp(zone.Damage) > 0 { return true } zone.Damage = alpacadecimal.Zero - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurPet[0].GetMaxHP()) + e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, e.CarrierInput().CurPet[0].GetMaxHP()) return true } @@ -394,14 +394,14 @@ func (e *Effect1463Sub) DamageLock(zone *info.DamageZone) bool { type Effect1464 struct{ node.EffectNode } func (e *Effect1464) OnSkill() bool { - if e.Ctx().Opp.CurPet[0].Info.Hp > 0 || len(e.Args()) < 3 { + if e.OpponentInput().CurPet[0].Info.Hp > 0 || len(e.Args()) < 3 { return true } - if !e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) { + if !e.OpponentInput().StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) { return true } if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok { - addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart())) + addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[2].IntPart())) } return true } @@ -419,8 +419,8 @@ func (e *Effect1465) ActionStart(a, b *action.SelectSkillAction) bool { } return true } - for i := range e.Ctx().Opp.Prop[:] { - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(-e.Args()[0].IntPart())) + for i := range e.OpponentInput().Prop[:] { + e.OpponentInput().SetProp(e.CarrierInput(), int8(i), int8(-e.Args()[0].IntPart())) } return true } @@ -429,9 +429,9 @@ func (e *Effect1465) ActionStart(a, b *action.SelectSkillAction) bool { type Effect1466 struct{ node.EffectNode } func (e *Effect1466) Skill_Use() bool { - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1466, e.SideEffectArgs...) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1466, e.SideEffectArgs...) if eff != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, eff) + e.CarrierInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -443,7 +443,7 @@ func (e *Effect1466Sub) SkillHit_ex() bool { return true } if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok { - addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart())) + addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[2].IntPart())) } return true } @@ -465,7 +465,7 @@ func (e *Effect1467) Skill_Use() bool { } indexes := grand.Perm(6) for i := 0; i < count && i < len(indexes); i++ { - e.Ctx().Our.SetProp(e.Ctx().Our, int8(indexes[i]), int8(boost)) + e.CarrierInput().SetProp(e.CarrierInput(), int8(indexes[i]), int8(boost)) } return true } @@ -478,7 +478,7 @@ func (e *Effect1468) Skill_Use() bool { return true } triggered := false - for _, target := range []*input.Input{e.Ctx().Our, e.Ctx().Opp} { + for _, target := range []*input.Input{e.CarrierInput(), e.OpponentInput()} { for _, eff := range target.Effects { if eff != nil && eff.Alive() { eff.Alive(false) @@ -487,8 +487,8 @@ func (e *Effect1468) Skill_Use() bool { } } if triggered { - damageByFixed(e.Ctx().Our, e.Ctx().Opp, e.Args()[0].IntPart()) - randomSkillPPZero(e.Ctx().Opp, int(e.Args()[1].IntPart())) + damageByFixed(e.CarrierInput(), e.OpponentInput(), e.Args()[0].IntPart()) + randomSkillPPZero(e.OpponentInput(), int(e.Args()[1].IntPart())) } return true } @@ -497,9 +497,9 @@ func (e *Effect1468) Skill_Use() bool { type Effect1469 struct{ node.EffectNode } func (e *Effect1469) Skill_Use() bool { - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1469, e.SideEffectArgs...) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1469, e.SideEffectArgs...) if eff != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, eff) + e.CarrierInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -521,7 +521,7 @@ func (e *Effect1470) SkillHit() bool { if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { return true } - e.Ctx().SkillEntity.XML.Power += int(e.Ctx().Our.CurPet[0].Info.Dv) + e.Ctx().SkillEntity.XML.Power += int(e.CarrierInput().CurPet[0].Info.Dv) return true } @@ -533,7 +533,7 @@ func (e *Effect1471) Skill_Use() bool { return true } removed := false - for _, eff := range e.Ctx().Opp.Effects { + for _, eff := range e.OpponentInput().Effects { if eff != nil && eff.Alive() { eff.Alive(false) removed = true @@ -541,12 +541,12 @@ func (e *Effect1471) Skill_Use() bool { } if removed { if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok { - addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart())) + addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[1].IntPart())) } return true } - heal := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[2]) - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal) + heal := e.CarrierInput().CurPet[0].GetMaxHP().Div(e.Args()[2]) + e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, heal) return true } @@ -558,7 +558,7 @@ func (e *Effect1472) Damage_Mul(zone *info.DamageZone) bool { return true } boosted := false - for _, v := range e.Ctx().Our.Prop[:] { + for _, v := range e.CarrierInput().Prop[:] { if v > 0 { boosted = true break diff --git a/logic/service/fight/effect/1473_1497.go b/logic/service/fight/effect/1473_1497.go index f68412363..ecc1a9f7c 100644 --- a/logic/service/fight/effect/1473_1497.go +++ b/logic/service/fight/effect/1473_1497.go @@ -17,7 +17,7 @@ func (e *Effect1473) Skill_Use() bool { return true } cleared := false - for _, eff := range e.Ctx().Opp.Effects { + for _, eff := range e.OpponentInput().Effects { if eff == nil || !eff.Alive() { continue } @@ -25,7 +25,7 @@ func (e *Effect1473) Skill_Use() bool { cleared = true } if cleared { - randomSkillPPZero(e.Ctx().Opp, int(e.Args()[0].IntPart())) + randomSkillPPZero(e.OpponentInput(), int(e.Args()[0].IntPart())) } return true } @@ -34,9 +34,9 @@ func (e *Effect1473) Skill_Use() bool { type Effect1474 struct{ node.EffectNode } func (e *Effect1474) Skill_Use() bool { - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1474, e.SideEffectArgs...) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1474, e.SideEffectArgs...) if eff != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, eff) + e.CarrierInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -47,11 +47,11 @@ type Effect1474Sub struct { } func (e *Effect1474Sub) PropBefer(in *input.Input, prop, level int8) bool { - if in != e.Ctx().Our || level >= 0 { + if in != e.CarrierInput() || level >= 0 { return true } e.removed++ - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{ Type: info.DamageType.Fixed, Damage: e.Args()[1], }) @@ -62,9 +62,9 @@ func (e *Effect1474Sub) PropBefer(in *input.Input, prop, level int8) bool { type Effect1475 struct{ node.EffectNode } func (e *Effect1475) Skill_Use() bool { - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1475, e.SideEffectArgs...) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1475, e.SideEffectArgs...) if eff != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, eff) + e.CarrierInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -87,11 +87,11 @@ func (e *Effect1476) Skill_Use() bool { return true } delta := int8(-e.Args()[0].IntPart()) - if e.Ctx().Our.CurPet[0].GetHP().Mul(e.Args()[1]).Cmp(e.Ctx().Our.CurPet[0].GetMaxHP()) < 0 { + if e.CarrierInput().CurPet[0].GetHP().Mul(e.Args()[1]).Cmp(e.CarrierInput().CurPet[0].GetMaxHP()) < 0 { delta *= 2 } - for i := range e.Ctx().Opp.Prop[:] { - e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), delta) + for i := range e.OpponentInput().Prop[:] { + e.OpponentInput().SetProp(e.CarrierInput(), int8(i), delta) } return true } @@ -104,7 +104,7 @@ func (e *Effect1477) Skill_Use() bool { return true } cleared := false - for _, target := range []*input.Input{e.Ctx().Our, e.Ctx().Opp} { + for _, target := range []*input.Input{e.CarrierInput(), e.OpponentInput()} { for _, eff := range target.Effects { if eff == nil || !eff.Alive() { continue @@ -114,9 +114,9 @@ func (e *Effect1477) Skill_Use() bool { } } if cleared { - drain := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[0]) - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: drain}) - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain) + drain := e.OpponentInput().CurPet[0].GetMaxHP().Div(e.Args()[0]) + e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: drain}) + e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, drain) } return true } @@ -125,9 +125,9 @@ func (e *Effect1477) Skill_Use() bool { type Effect1478 struct{ node.EffectNode } func (e *Effect1478) Skill_Use() bool { - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1478, e.SideEffectArgs...) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1478, e.SideEffectArgs...) if eff != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, eff) + e.CarrierInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -135,7 +135,7 @@ func (e *Effect1478) Skill_Use() bool { type Effect1478Sub struct{ RoundEffectArg0Base } func (e *Effect1478Sub) SwitchOut(in *input.Input) bool { - if in == e.Ctx().Opp { + if in == e.OpponentInput() { e.Alive(false) } return true @@ -148,10 +148,10 @@ func (e *Effect1479) Skill_Use() bool { if len(e.Args()) == 0 { return true } - e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Our.CurPet[0].GetHP()}) - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1479, e.SideEffectArgs...) + e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.CarrierInput().CurPet[0].GetHP()}) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1479, e.SideEffectArgs...) if eff != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, eff) + e.OpponentInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -194,7 +194,7 @@ func (e *Effect1481) Damage_Mul(zone *info.DamageZone) bool { return true } chance := int(e.Args()[0].IntPart()) - for _, v := range e.Ctx().Opp.Prop[:] { + for _, v := range e.OpponentInput().Prop[:] { if v < 0 { chance *= 2 break @@ -217,10 +217,10 @@ func (e *Effect1482) Skill_Use() bool { return true } if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok { - addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart())) + addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[1].IntPart())) return true } - for _, eff := range e.Ctx().Opp.Effects { + for _, eff := range e.OpponentInput().Effects { if eff != nil && eff.Alive() { eff.Alive(false) } @@ -232,9 +232,9 @@ func (e *Effect1482) Skill_Use() bool { type Effect1483 struct{ node.EffectNode } func (e *Effect1483) Skill_Use() bool { - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1483, e.SideEffectArgs...) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1483, e.SideEffectArgs...) if eff != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, eff) + e.CarrierInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -243,9 +243,9 @@ type Effect1483Sub struct{ RoundEffectArg0Base } func (e *Effect1483Sub) Skill_Use() bool { if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Crit > 0 { - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1483, e.SideEffectArgs...) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1483, e.SideEffectArgs...) if eff != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, eff) + e.OpponentInput().AddEffect(e.CarrierInput(), eff) } } return true @@ -262,10 +262,10 @@ func (e *Effect1483Sub) SkillHit_ex() bool { type Effect1484 struct{ node.EffectNode } func (e *Effect1484) ComparePre(fattack, sattack *action.SelectSkillAction) bool { - if e.Ctx().Our.CurPet[0].GetHP().Mul(alpacadecimal.NewFromInt(2)).Cmp(e.Ctx().Our.CurPet[0].GetMaxHP()) >= 0 { + if e.CarrierInput().CurPet[0].GetHP().Mul(alpacadecimal.NewFromInt(2)).Cmp(e.CarrierInput().CurPet[0].GetMaxHP()) >= 0 { return true } - current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + current := actionByPlayer(fattack, sattack, e.CarrierInput().UserID) if current != nil && current.SkillEntity != nil { current.SkillEntity.XML.Priority += 1 } @@ -280,7 +280,7 @@ func (e *Effect1485) OnSkill() bool { return true } boosted := false - for _, v := range e.Ctx().Opp.Prop[:] { + for _, v := range e.OpponentInput().Prop[:] { if v > 0 { boosted = true break @@ -290,11 +290,11 @@ func (e *Effect1485) OnSkill() bool { return true } if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok { - addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart())) + addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[1].IntPart())) return true } if ok, _, _ := e.Input.Player.Roll(int(e.Args()[2].IntPart()), 100); ok { - addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[3].IntPart())) + addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[3].IntPart())) } return true } @@ -307,7 +307,7 @@ func (e *Effect1486) Damage_Mul(zone *info.DamageZone) bool { return true } chance := int(e.Args()[0].IntPart()) - if e.Ctx().Our.HasShield() { + if e.CarrierInput().HasShield() { chance *= 2 } if chance > 100 { @@ -323,10 +323,10 @@ func (e *Effect1486) Damage_Mul(zone *info.DamageZone) bool { type Effect1487 struct{ node.EffectNode } func (e *Effect1487) ComparePre(fattack, sattack *action.SelectSkillAction) bool { - if !e.Ctx().Our.HasShield() { + if !e.CarrierInput().HasShield() { return true } - current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + current := actionByPlayer(fattack, sattack, e.CarrierInput().UserID) if current != nil && current.SkillEntity != nil { current.SkillEntity.XML.Priority += 1 } @@ -341,7 +341,7 @@ func (e *Effect1488) OnSkill() bool { return true } if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok { - addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart())) + addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[1].IntPart())) } return true } @@ -354,12 +354,12 @@ func (e *Effect1489) OnSkill() bool { return true } if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok { - addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart())) + addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[1].IntPart())) return true } - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1489, e.SideEffectArgs...) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1489, e.SideEffectArgs...) if eff != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, eff) + e.CarrierInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -384,12 +384,12 @@ func (e *Effect1490) OnSkill() bool { return true } if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok { - addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart())) + addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[1].IntPart())) return true } - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1490, e.SideEffectArgs...) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1490, e.SideEffectArgs...) if eff != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, eff) + e.OpponentInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -410,7 +410,7 @@ func (e *Effect1491) ComparePre(fattack, sattack *action.SelectSkillAction) bool if !e.ISNaturalEnemy() { return true } - current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + current := actionByPlayer(fattack, sattack, e.CarrierInput().UserID) if current != nil && current.SkillEntity != nil { current.SkillEntity.XML.Priority += 1 } @@ -425,7 +425,7 @@ func (e *Effect1492) OnSkill() bool { return true } down := false - for _, v := range e.Ctx().Opp.Prop[:] { + for _, v := range e.OpponentInput().Prop[:] { if v < 0 { down = true break @@ -434,7 +434,7 @@ func (e *Effect1492) OnSkill() bool { if !down { return true } - applyRandomStatuses1507(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart())) + applyRandomStatuses1507(e.CarrierInput(), e.OpponentInput(), int(e.Args()[0].IntPart())) return true } @@ -442,10 +442,10 @@ func (e *Effect1492) OnSkill() bool { type Effect1493 struct{ node.EffectNode } func (e *Effect1493) Skill_Use() bool { - e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Our.CurPet[0].GetHP()}) - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1493) + e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.CarrierInput().CurPet[0].GetHP()}) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1493) if eff != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, eff) + e.CarrierInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -453,7 +453,7 @@ func (e *Effect1493) Skill_Use() bool { type Effect1493Sub struct{ node.EffectNode } func (e *Effect1493Sub) SwitchIn(in *input.Input) bool { - if in != e.Ctx().Our { + if in != e.CarrierInput() { return true } e.Duration(3) @@ -464,11 +464,11 @@ func (e *Effect1493Sub) SwitchIn(in *input.Input) bool { type Effect1494 struct{ node.EffectNode } func (e *Effect1494) OnSkill() bool { - if len(e.Args()) < 2 || e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Our.CurPet[0].GetMaxHP()) != 0 { + if len(e.Args()) < 2 || e.CarrierInput().CurPet[0].GetHP().Cmp(e.CarrierInput().CurPet[0].GetMaxHP()) != 0 { return true } if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok { - randomSkillPPZero(e.Ctx().Opp, int(e.Args()[1].IntPart())) + randomSkillPPZero(e.OpponentInput(), int(e.Args()[1].IntPart())) } return true } @@ -481,7 +481,7 @@ func (e *Effect1495) Skill_Use() bool { return true } swapped := false - for _, i := range e.Ctx().Opp.Prop[:] { + for _, i := range e.OpponentInput().Prop[:] { if i > 0 { swapped = true break @@ -491,7 +491,7 @@ func (e *Effect1495) Skill_Use() bool { return true } if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok { - randomSkillPPZero(e.Ctx().Opp, int(e.Args()[1].IntPart())) + randomSkillPPZero(e.OpponentInput(), int(e.Args()[1].IntPart())) } return true } @@ -503,11 +503,11 @@ func (e *Effect1496) Skill_Use() bool { if len(e.Args()) < 3 { return true } - e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Our.CurPet[0].GetHP()}) - e.Ctx().Our.AddShield(e.Args()[0]) - eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1496, e.SideEffectArgs...) + e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.CarrierInput().CurPet[0].GetHP()}) + e.CarrierInput().AddShield(e.Args()[0]) + eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1496, e.SideEffectArgs...) if eff != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, eff) + e.CarrierInput().AddEffect(e.CarrierInput(), eff) } return true } @@ -516,7 +516,7 @@ type Effect1496Sub struct{ RoundEffectArg0Base } func (e *Effect1496Sub) TurnEnd() { if len(e.Args()) >= 3 { - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[2]) + e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, e.Args()[2]) } e.EffectNode.TurnEnd() } @@ -525,9 +525,9 @@ func (e *Effect1496Sub) TurnEnd() { type Effect1497 struct{ node.EffectNode } func (e *Effect1497) Skill_Use() bool { - heal := e.Ctx().Our.CurrentShield().Add(e.Ctx().Opp.CurrentShield()) + heal := e.CarrierInput().CurrentShield().Add(e.OpponentInput().CurrentShield()) if heal.Cmp(alpacadecimal.Zero) > 0 { - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal) + e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, heal) } return true } diff --git a/logic/service/fight/effect/1770_1794.go b/logic/service/fight/effect/1770_1794.go index 9c9d4684b..48e37c2c2 100644 --- a/logic/service/fight/effect/1770_1794.go +++ b/logic/service/fight/effect/1770_1794.go @@ -8,6 +8,7 @@ import ( "blazing/logic/service/fight/node" "github.com/alpacahq/alpacadecimal" + "github.com/gogf/gf/v2/util/grand" ) // Effect 1770: 开启战魂附体:免疫对手下1次攻击技能造成的伤害,若对手使用的攻击技能PP值为满则自身额外免疫下1次受到的固定伤害和百分比伤害 @@ -419,25 +420,17 @@ func (e *Effect1780) OnSkill() bool { shield = e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[1]) } if shield.Cmp(alpacadecimal.Zero) > 0 { - if capShield := e.Args()[4]; capShield.Cmp(alpacadecimal.Zero) > 0 { - current := e.Ctx().Our.CurrentShield() - if current.Cmp(capShield) < 0 { - remain := capShield.Sub(current) - if shield.Cmp(remain) > 0 { - shield = remain - } - } else { - shield = alpacadecimal.Zero - } - } - if shield.Cmp(alpacadecimal.Zero) > 0 { - e.Ctx().Our.AddShield(shield) + if capShield := e.Args()[4]; capShield.Cmp(alpacadecimal.Zero) > 0 && shield.Cmp(capShield) > 0 { + shield = capShield } } if e.Args()[2].Cmp(alpacadecimal.Zero) > 0 { sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1780, int(e.Args()[2].IntPart()), int(e.Args()[3].IntPart())) if sub != nil { + if s, ok := sub.(*Effect1780Sub); ok { + s.shield = shield + } e.Ctx().Our.AddEffect(e.Ctx().Our, sub) } } @@ -447,6 +440,7 @@ func (e *Effect1780) OnSkill() bool { type Effect1780Sub struct { node.EffectNode remaining int + shield alpacadecimal.Decimal } func (e *Effect1780Sub) SetArgs(t *input.Input, a ...int) { @@ -457,6 +451,15 @@ func (e *Effect1780Sub) SetArgs(t *input.Input, a ...int) { } } +func (e *Effect1780Sub) SwitchIn(in *input.Input) bool { + if in != e.Ctx().Our || e.shield.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + in.AddShield(e.shield) + e.shield = alpacadecimal.Zero + return true +} + func (e *Effect1780Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { if e.remaining <= 0 { e.Alive(false) @@ -536,34 +539,29 @@ func (e *Effect1783) Skill_Use() bool { return true } - cleared := false - for _, target := range []*input.Input{e.Ctx().Our, e.Ctx().Opp} { - for _, eff := range target.Effects { - if eff == nil || !eff.Alive() { - continue - } - id := eff.ID() - if id.GetEffectType() != input.EffectType.Sub { - continue - } - eff.Alive(false) - cleared = true - } - } + beforeOur := countTurnEffects(e.Ctx().Our) + beforeOpp := countTurnEffects(e.Ctx().Opp) + e.Ctx().Our.CancelTurn(e.Ctx().Our) + e.Ctx().Opp.CancelTurn(e.Ctx().Our) + + afterOur := countTurnEffects(e.Ctx().Our) + afterOpp := countTurnEffects(e.Ctx().Opp) + + cleared := afterOur < beforeOur || afterOpp < beforeOpp if cleared { - st := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[0].IntPart())) - if st != nil { - e.Ctx().Our.AddEffect(e.Ctx().Our, st) + if statusID := int(e.Args()[0].IntPart()); statusID > 0 { + if st := e.Ctx().Our.InitEffect(input.EffectType.Status, statusID); st != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, st) + } + if st := e.Ctx().Our.InitEffect(input.EffectType.Status, statusID); st != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, st) + } } - oppStatus := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[0].IntPart())) - if oppStatus != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, oppStatus) - } - return true } - if e.Args()[1].Cmp(alpacadecimal.Zero) > 0 { + failure := (beforeOur > 0 && afterOur > 0) || (beforeOpp > 0 && afterOpp > 0) + if failure && e.Args()[1].Cmp(alpacadecimal.Zero) > 0 { sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1783, int(e.Args()[1].IntPart())) if sub != nil { e.Ctx().Opp.AddEffect(e.Ctx().Our, sub) @@ -628,18 +626,26 @@ func (e *Effect1784) Skill_Use() bool { type Effect1784Sub struct { RoundEffectArg0Base + blocked bool +} + +func (e *Effect1784Sub) TurnStart(fattack, sattack *action.SelectSkillAction) { + e.blocked = false } func (e *Effect1784Sub) DamageLockEx(zone *info.DamageZone) bool { if zone == nil || zone.Type != info.DamageType.Red || e.Ctx().Our == nil || e.Ctx().Our.CurPet[0] == nil { return true } + if e.blocked { + return true + } currentHP := e.Ctx().Our.CurPet[0].GetHP() if zone.Damage.Cmp(currentHP) >= 0 { return true } zone.Damage = alpacadecimal.Zero - e.Alive(false) + e.blocked = true return true } @@ -785,12 +791,82 @@ func (e *Effect1786Debuff) SkillHit_ex() bool { return true } +func restoreRandomPP(owner *input.Input, attempts int) { + if owner == nil || owner.CurPet[0] == nil || attempts <= 0 { + return + } + skills := owner.CurPet[0].Info.SkillList + if len(skills) == 0 { + return + } + + for i := 0; i < attempts; i++ { + idx := grand.N(0, len(skills)) + skill := &skills[idx] + if xmlSkill, ok := xmlres.SkillMap[int(skill.ID)]; ok { + maxPP := uint32(xmlSkill.MaxPP) + if maxPP == 0 || skill.PP >= maxPP { + continue + } + skill.PP++ + } + } +} + // Effect 1787: 沙之力量觉醒,使自身下{0}次攻击获得鳞天之尘效果 type Effect1787 struct { node.EffectNode } -func (e *Effect1787) Skill_Use() bool { return true } +func (e *Effect1787) Skill_Use() bool { + if len(e.Args()) == 0 { + return true + } + sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1787, int(e.Args()[0].IntPart())) + if sub != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect1787Sub struct { + node.EffectNode + remaining int +} + +func (e *Effect1787Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.Duration(-1) + if len(a) > 0 { + e.remaining = a[0] + } +} + +func (e *Effect1787Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + if e.remaining <= 0 { + 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++ + return true +} + +func (e *Effect1787Sub) Damage_Mul(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(180)).Div(alpacadecimal.NewFromInt(100)) + restoreRandomPP(e.Ctx().Our, 2) + e.remaining-- + if e.remaining <= 0 { + e.Alive(false) + } + return true +} // Effect 1788: {0}%令对手{1},未触发则附加自身最大体力的{2}%的百分比伤害,若对手免疫百分比伤害则转变为真实伤害 type Effect1788 struct { @@ -816,10 +892,17 @@ func (e *Effect1788) Skill_Use() bool { return true } + before := e.Ctx().Opp.CurPet[0].GetHP() e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ Type: info.DamageType.Percent, Damage: damage, }) + if e.Ctx().Opp.CurPet[0].GetHP().Cmp(before) == 0 { + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.True, + Damage: damage, + }) + } return true } @@ -980,6 +1063,7 @@ func init() { input.InitEffect(input.EffectType.Sub, 1786, &Effect1786Sub{}) input.InitEffect(input.EffectType.Sub, 1786, &Effect1786Debuff{}) input.InitEffect(input.EffectType.Skill, 1787, &Effect1787{}) + input.InitEffect(input.EffectType.Sub, 1787, &Effect1787Sub{}) input.InitEffect(input.EffectType.Skill, 1788, &Effect1788{}) input.InitEffect(input.EffectType.Skill, 1789, &Effect1789{}) input.InitEffect(input.EffectType.Skill, 1780, &Effect1780{}) diff --git a/logic/service/fight/effect/2070_2094.go b/logic/service/fight/effect/2070_2094.go index 2b91b0423..83c0e3d3b 100644 --- a/logic/service/fight/effect/2070_2094.go +++ b/logic/service/fight/effect/2070_2094.go @@ -853,17 +853,16 @@ func (e *Effect2090) Skill_Use() bool { if e.Ctx().Our == nil || e.Ctx().Opp == nil || e.Ctx().Our.CurPet[0] == nil || e.Ctx().Opp.CurPet[0] == nil { return true } - if e.Ctx().Our.CurPet[0].GetMaxHP().Cmp(e.Ctx().Opp.CurPet[0].GetMaxHP()) <= 0 { - return true - } if len(e.Ctx().Opp.CurPet[0].Info.SkillList) < 5 { return true } - pp := e.Ctx().Opp.CurPet[0].Info.SkillList[4].PP - if pp <= 0 { - return true + if e.Ctx().Our.CurPet[0].GetMaxHP().Cmp(e.Ctx().Opp.CurPet[0].GetMaxHP()) > 0 { + pp := e.Ctx().Opp.CurPet[0].Info.SkillList[4].PP + if pp <= 0 { + return true + } + e.Ctx().Opp.CurPet[0].Info.SkillList[4].PP = 0 } - e.Ctx().Opp.CurPet[0].Info.SkillList[4].PP = 0 return true } @@ -964,7 +963,7 @@ func (e *Effect2093Sub) Skill_Use() bool { 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) if e.Ctx().Opp.CurPet[0].Info.Hp >= before { - return true + addTimedStatus(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[4].IntPart()), int(e.Args()[3].IntPart())) } return true } @@ -986,7 +985,8 @@ func (e *Effect2094) Damage_Mul(zone *info.DamageZone) bool { zone.Damage = zone.Damage.Mul(hundred.Add(bonus)).Div(hundred) } if count > int(e.Args()[1].IntPart()) { - extra := alpacadecimal.NewFromInt(int64(count) * e.Args()[2].IntPart()) + extraCount := count - int(e.Args()[1].IntPart()) + extra := alpacadecimal.NewFromInt(int64(extraCount) * e.Args()[2].IntPart()) if extra.Cmp(alpacadecimal.Zero) > 0 { zone.Damage = zone.Damage.Add(extra) } diff --git a/logic/service/fight/effect/2120_2144.go b/logic/service/fight/effect/2120_2144.go index fe80703f3..538ec92a0 100644 --- a/logic/service/fight/effect/2120_2144.go +++ b/logic/service/fight/effect/2120_2144.go @@ -53,6 +53,8 @@ const ( status2136ReturnLife = 2136 status2138ShadowSeed = 2138 status2139ShadowRoot = 2139 + petStatusInfect = 27 // 0-255 ID from legacy data + statusLingMoCore = 2300 // placeholder ID for 灵茉之芯 stacks ) var effect2137StatusRounds = []info.EnumPetStatus{ @@ -162,11 +164,36 @@ func hasShadowSeed(target *input.Input) bool { return getAliveStatusEffect(target, status2138ShadowSeed) != nil } +func drainMaxHP2121(owner, target *input.Input, percent alpacadecimal.Decimal) bool { + if owner == nil || target == nil || target.CurPet[0] == nil || percent.Cmp(alpacadecimal.Zero) <= 0 { + return false + } + damage := target.CurPet[0].GetMaxHP().Mul(percent).Div(hundred) + if damage.Cmp(alpacadecimal.Zero) <= 0 { + return false + } + before := target.CurPet[0].GetHP() + target.Damage(owner, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage}) + owner.Heal(owner, &action.SelectSkillAction{}, damage) + return target.CurPet[0].GetHP().Cmp(before) < 0 +} + +func lingMoCoreCount2123(target *input.Input) int { + eff := getAliveStatusEffect(target, statusLingMoCore) + if eff == nil { + return 0 + } + if eff.Stack() > 0 { + return eff.Stack() + } + return 1 +} + // Effect 2120: 自身为对手天敌时n回合内受到攻击的伤害减少m% type Effect2120 struct{ node.EffectNode } func (e *Effect2120) Skill_Use() bool { - if len(e.Args()) < 2 { + if len(e.Args()) < 2 || !e.ISNaturalEnemy() { return true } eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2120, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart())) @@ -177,20 +204,27 @@ func (e *Effect2120) Skill_Use() bool { } func (e *Effect2120) DamageDivEx(zone *info.DamageZone) bool { - if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 || !e.ISNaturalEnemy() { - return true - } - zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100 - int64(e.Args()[1].IntPart()))).Div(alpacadecimal.NewFromInt(100)) return true } type Effect2120Sub struct{ RoundEffectArg0Base } +func (e *Effect2120Sub) DamageDivEx(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 { + return true + } + zone.Damage = zone.Damage.Mul(hundred.Sub(e.Args()[1])).Div(hundred) + return true +} + // Effect 2121: 未击败对手则己方场下精灵吸取对手最大体力的n% type Effect2121 struct{ node.EffectNode } func (e *Effect2121) Skill_Use() bool { - if len(e.Args()) == 0 || e.Ctx().Opp.CurPet[0] == nil || e.Ctx().Opp.CurPet[0].Info.Hp <= 0 { + if len(e.Args()) == 0 || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil || e.Ctx().Opp.CurPet[0].Info.Hp <= 0 { + return true + } + if drainMaxHP2121(e.Ctx().Our, e.Ctx().Opp, e.Args()[0]) { return true } eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2121, int(e.Args()[0].IntPart())) @@ -206,23 +240,18 @@ type Effect2121Sub struct { func (e *Effect2121Sub) SetArgs(t *input.Input, a ...int) { e.EffectNode.SetArgs(t, a...) - e.Duration(-1) + e.CanStack(false) + e.Duration(1) } -func (e *Effect2121Sub) TurnEnd() { - if len(e.Args()) == 0 || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil || e.Ctx().Our == nil || e.Ctx().Our.CurPet[0] == nil { - return - } - heal := e.Ctx().Opp.CurPet[0].GetMaxHP().Mul(e.Args()[0]).Div(alpacadecimal.NewFromInt(100)) - if heal.Cmp(alpacadecimal.Zero) <= 0 { - return - } - before := e.Ctx().Opp.CurPet[0].Info.Hp - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: heal}) - healBench2121(e.Ctx().Our, heal) - if e.Ctx().Opp.CurPet[0].Info.Hp < before { +func (e *Effect2121Sub) OnSkill() bool { + if len(e.Args()) == 0 || e.Ctx().Opp == nil || e.Ctx().Our == nil { e.Alive(false) + return true } + drainMaxHP2121(e.Ctx().Our, e.Ctx().Opp, e.Args()[0]) + e.Alive(false) + return true } // Effect 2122: 获得护罩,护罩消失时自身所有技能PP值+{1} @@ -277,19 +306,32 @@ func (e *Effect2122Sub) ShieldChange(before, after alpacadecimal.Decimal) bool { type Effect2123 struct{ node.EffectNode } func (e *Effect2123) Skill_Use() bool { - if len(e.Args()) == 0 { + if len(e.Args()) == 0 || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil { return true } - if !clearTargetEffects(e.Ctx().Our, e.Ctx().Opp) { + before := activeTurnEffectCount(e.Ctx().Opp) + e.Ctx().Opp.CancelTurn(e.Ctx().Our) + if before <= 0 { damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[0]) if damage.Cmp(alpacadecimal.Zero) > 0 { e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage}) } return true } - addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Poisoned)) - addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Sleep)) - addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.DrainHP)) + + addStatusEffect(e.Ctx().Our, e.Ctx().Opp, petStatusInfect) + extraCount := lingMoCoreCount2123(e.Ctx().Our) + statuses := []int{ + int(info.PetStatus.Poisoned), + int(info.PetStatus.Sleep), + int(info.PetStatus.DrainHP), + } + if extraCount > len(statuses) { + extraCount = len(statuses) + } + for i := 0; i < extraCount; i++ { + addStatusEffect(e.Ctx().Our, e.Ctx().Opp, statuses[i]) + } return true } @@ -304,6 +346,9 @@ func (e *Effect2124) Damage_Mul(zone *info.DamageZone) bool { if e.Ctx().Our.HasPropADD() || e.Ctx().Opp.HasPropSub() { chance *= 2 } + if chance > 100 { + chance = 100 + } if ok, _, _ := e.Input.Player.Roll(chance, 100); ok { zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2)) } diff --git a/logic/service/fight/effect/effect_680_690.go b/logic/service/fight/effect/effect_680_690.go index 034c42490..4dc537a0d 100644 --- a/logic/service/fight/effect/effect_680_690.go +++ b/logic/service/fight/effect/effect_680_690.go @@ -16,18 +16,23 @@ type Effect680 struct { } func (e *Effect680) Skill_Use() bool { + source := e.SourceInput() + target := e.OpponentInput() + if source == nil || target == nil { + return true + } if !e.IsFirst() { return true } chance := int(e.Args()[0].IntPart()) - success, _, _ := e.Input.Player.Roll(chance, 100) + success, _, _ := source.Player.Roll(chance, 100) if success { statusID := int(e.Args()[1].IntPart()) duration := int(e.Args()[2].IntPart()) - statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, statusID) + statusEffect := source.InitEffect(input.EffectType.Status, statusID) if statusEffect != nil { statusEffect.Duration(duration) - e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + target.AddEffect(source, statusEffect) } } return true @@ -57,16 +62,17 @@ type Effect682 struct { } func (e *Effect682) DamageLockEx(t *info.DamageZone) bool { + source := e.SourceInput() if t.Type != info.DamageType.Red { return true } - if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) > 0 && !e.can { + if source != nil && source.SumDamage.Cmp(e.Args()[0]) > 0 && !e.can { e.can = true triggerEffectID := int(e.Args()[1].IntPart()) - effect := e.Ctx().Our.InitEffect(input.EffectType.Skill, triggerEffectID, e.SideEffectArgs[2:]...) + effect := source.InitEffect(input.EffectType.Skill, triggerEffectID, e.SideEffectArgs[2:]...) if effect != nil { effect.Duration(int(e.Args()[2].IntPart())) - e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + source.AddEffect(source, effect) } } return true @@ -78,10 +84,15 @@ type Effect683 struct { } func (e *Effect683) Skill_Use() bool { + source := e.SourceInput() + target := e.OpponentInput() + if source == nil || target == nil { + return true + } min := e.Args()[0].IntPart() max := e.Args()[1].IntPart() damage := alpacadecimal.NewFromInt(int64(min) + int64(grand.N(0, int(max-min)))) - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + target.Damage(source, &info.DamageZone{ Type: info.DamageType.Fixed, Damage: damage, }) @@ -94,15 +105,20 @@ type Effect684 struct { } func (e *Effect684) Skill_Use() bool { - if e.Ctx().Our.HasPropSub() || e.Ctx().Opp.HasPropSub() { - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + source := e.SourceInput() + target := e.OpponentInput() + if source == nil || target == nil { + return true + } + if source.HasPropSub() || target.HasPropSub() { + target.Damage(source, &info.DamageZone{ Type: info.DamageType.Fixed, Damage: e.Args()[0], }) // 解除自身能力下降状态 - for i, v := range e.Ctx().Our.Prop[:] { + for i, v := range source.Prop[:] { if v < 0 { - e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) + source.SetProp(source, int8(i), 0) } } } @@ -115,8 +131,13 @@ type Effect685 struct { } func (e *Effect685) Skill_Use() bool { - if e.Ctx().Our.HasPropADD() { - e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + source := e.SourceInput() + target := e.OpponentInput() + if source == nil || target == nil { + return true + } + if source.HasPropADD() { + target.Damage(source, &info.DamageZone{ Type: info.DamageType.Fixed, Damage: e.Args()[0], }) @@ -130,12 +151,17 @@ type Effect686 struct { } func (e *Effect686) Skill_Use() bool { + source := e.SourceInput() + target := e.OpponentInput() + if source == nil || target == nil { + return true + } statusID := int(e.Args()[0].IntPart()) duration := int(e.Args()[1].IntPart()) - if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(statusID)) { - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 686, duration) + if target.StatEffect_Exist(info.EnumPetStatus(statusID)) { + effect := source.InitEffect(input.EffectType.Sub, 686, duration) if effect != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, effect) + target.AddEffect(source, effect) } } return true @@ -162,11 +188,16 @@ type Effect687 struct { } func (e *Effect687) Skill_Use() bool { + source := e.SourceInput() + target := e.OpponentInput() + if source == nil || target == nil { + return true + } statusID := int(e.Args()[0].IntPart()) percent := e.Args()[1] - if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(statusID)) { - healAmount := e.Ctx().Our.SumDamage.Mul(percent).Div(alpacadecimal.NewFromInt(100)) - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + if target.StatEffect_Exist(info.EnumPetStatus(statusID)) { + healAmount := source.SumDamage.Mul(percent).Div(alpacadecimal.NewFromInt(100)) + source.Heal(source, &action.SelectSkillAction{}, healAmount) } return true } @@ -200,10 +231,14 @@ type Effect689 struct { } func (e *Effect689) Skill_Use() bool { - if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) > 0 { - maxHp := e.Ctx().Our.CurPet[0].GetMaxHP() + source := e.SourceInput() + if source == nil { + return true + } + if source.SumDamage.Cmp(e.Args()[0]) > 0 { + maxHp := source.CurPet[0].GetMaxHP() healAmount := maxHp.Div(e.Args()[1]) - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + source.Heal(source, &action.SelectSkillAction{}, healAmount) } return true } @@ -214,12 +249,17 @@ type Effect690 struct { } func (e *Effect690) PropBefer(in *input.Input, prop int8, level int8) bool { - if in == e.Ctx().Our && level < 0 { + source := e.SourceInput() + target := e.OpponentInput() + if source == nil || target == nil { + return true + } + if in == source && level < 0 { // 能力下降被应用时(自身能力提升被消除),让对手属性技能失效 - effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 690) + effect := source.InitEffect(input.EffectType.Sub, 690) if effect != nil { effect.Duration(e.Duration()) - e.Ctx().Opp.AddEffect(e.Ctx().Our, effect) + target.AddEffect(source, effect) } } return true diff --git a/logic/service/fight/effect/effect_info_map.go b/logic/service/fight/effect/effect_info_map.go index 24f4ea538..eb2a60b44 100644 --- a/logic/service/fight/effect/effect_info_map.go +++ b/logic/service/fight/effect/effect_info_map.go @@ -1090,6 +1090,11 @@ var effectInfoByID = map[int]string{ 2227: "消除对手能力提升状态,消除成功对手下{0}回合无法主动切换精灵", 2228: "{0}回合内对手造成的固定伤害和百分比伤害减少{1}%", 2229: "{0}回合内使用技能则全属性+1,自身回合类效果、能力提升效果被消除、吸取时触发自身的登场效果", + 2120: "自身为对手天敌时下{0}次受到攻击的伤害减少{1}%", + 2121: "未击败对手则己方在场精灵吸取对手最大体力的{0}%,吸取后若对手体力未减少则延续至下回合", + 2122: "获得{0}点护罩,护罩消失时自身所有技能PP值+{1}", + 2123: "消除对手回合类效果,消除成功令对手感染且自身每有1点灵茉之芯额外附加中毒、睡眠、寄生中的前1种异常状态,未触发则吸取对手最大体力的1/{0}", + 2124: "{0}%的概率造成伤害翻倍,自身处于能力提升状态或对手处于能力下降状态时概率翻倍", 1601: "命中后附加自身最大体力{0}%的百分比伤害,若打出的攻击伤害为奇数则额外恢复等量体力值", 1602: "{0}回合内每回合使用技能恢复自身最大体力的1/{1},恢复体力时若自身为满体力则恢复己方所有不在场精灵{2}点体力", 1603: "{0}%降低对手所有PP值{1}点", @@ -1243,6 +1248,21 @@ var effectInfoByID = map[int]string{ 1064: "对大暗黑天长老造成的伤害提高{0}%", 1065: "{0}回合内每回合使用技能恢复自身最大体力的1/{1}并造成等量百分比伤害,恢复体力时若自身体力低于最大体力的1/{2}则恢复效果和百分比伤害翻倍", 1066: "造成的伤害低于{0}则附加{1}点固定伤害,若先出手则固定伤害提高{2}点", + 1780: "消耗自身全部体力,减少对手当前体力的1/{0},同时使己方下1只出场精灵获得点数等同于对手最大体力值1/{1}的护盾且下{2}次技能先制+{3},护盾最多可获得{4}点", + 1781: "若自身拥有的护盾值高于{0}则令自身下{1}回合回合类效果无法被消除", + 1782: "自身存在护盾则先制+2", + 1783: "消除敌我双方回合类效果,消除任意一项成功则敌我双方同时进入{0}状态,若任意一方回合类效果无法被消除则令对手下{1}回合无法主动切换精灵", + 1784: "{0}回合内对手使用技能时自身免疫对手下1次非致命一击造成的攻击伤害", + 1785: "{0}回合内每回合使用技能吸取对手最大体力的1/{1},吸取体力时若自身为满体力则恢复己方所有不在场精灵{2}点体力", + 1786: "{0}回合内若自身回合类效果被消除则对手下{1}次使用的攻击技能附加效果失效", + 1787: "沙之力量觉醒,使自身下{0}次攻击获得黯天之尘效果", + 1788: "{0}%令对手{1},未触发则附加自身最大体力{2}%的百分比伤害,若对手免疫百分比伤害则转变为真实伤害", + 1789: "预留,{0}", + 2090: "空元之诗·均:附加双方体力上限差值50%的次元·龙系伤害,自身体力上限高于对手时额外吸取对手第五技能剩余的PP值,自身体力上限低于对手时附加伤害翻倍", + 2091: "空妄诗章计数状态", + 2092: "全属性+{0}并将空妄诗章补充至与自身先制等级相等,自身没有空妄诗章时额外书写{1}篇,拥有时强化效果翻倍", + 2093: "{0}回合内使用技能吸取对手最大体力的1/{1},自身体力低于1/{2}时效果翻倍,吸取后若对手体力未减少则{3}回合内对手{4}", + 2094: "自身每有1篇空妄诗章造成的攻击伤害提升{0}%,若空妄诗章的篇数高于{1}则每有1篇额外附加{2}点真实伤害", } func EffectInfo(id int) string {