Files
bl/logic/service/fight/effect/1398_1402.go
xinian 87fdccaddf
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
feat: 实现大量技能效果及战斗逻辑修复
2026-03-30 00:51:18 +08:00

230 lines
5.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package effect
import (
"blazing/common/data/xmlres"
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
func setSkillPowerOverride(skill *info.SkillEntity, delta int) {
if skill == nil {
return
}
move, ok := xmlres.SkillMap[int(skill.Info.ID)]
if !ok {
skill.XML.Power += delta
return
}
skill.XML.Power = move.Power + delta
}
func clearPositiveProps(target, owner *input.Input) bool {
if target == nil || owner == nil {
return false
}
cleared := false
for i, v := range target.Prop[:] {
if v <= 0 {
continue
}
if target.SetProp(owner, int8(i), 0) {
cleared = true
}
}
return cleared
}
func applyStatus(owner, target *input.Input, statusID int) {
if owner == nil || target == nil {
return
}
statusEffect := owner.InitEffect(input.EffectType.Status, statusID)
if statusEffect != nil {
target.AddEffect(owner, statusEffect)
}
}
// Effect 1398: 消除对手能力提升状态,消除成功则{0}%令对手{1},未触发则{2}%令对手{3}
type Effect1398 struct {
node.EffectNode
}
func (e *Effect1398) Skill_Use() bool {
if len(e.Args()) < 4 {
return true
}
if !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
applyStatus(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
return true
}
fallback, _, _ := e.Input.Player.Roll(int(e.Args()[2].IntPart()), 100)
if fallback {
applyStatus(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[3].IntPart()))
}
return true
}
// Effect 1399: 消除对手回合类效果,消除成功则对手{0},未触发则自身免疫下{1}次受到的异常状态
type Effect1399 struct {
node.EffectNode
}
func (e *Effect1399) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
before := activeTurnEffectCount(e.Ctx().Opp)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
if before > 0 {
applyStatus(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart()))
return true
}
immuneEffect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1399, int(e.Args()[1].IntPart()))
if immuneEffect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, immuneEffect)
}
return true
}
type Effect1399Sub struct {
node.EffectNode
remaining int
}
func (e *Effect1399Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1399Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
if e.remaining <= 0 {
e.Alive(false)
return true
}
if in != e.Ctx().Opp || !input.IS_Stat(effEffect) {
return true
}
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return false
}
// Effect 1400: {0}回合内若自身回合类效果被消除则{1}%令对手{2}
type Effect1400 struct {
node.EffectNode
}
func (e *Effect1400) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect1400Sub{}, -1)
return true
}
type Effect1400Sub struct {
RoundEffectArg0Base
triggered bool
}
func (e *Effect1400Sub) Alive(t ...bool) bool {
if len(t) > 0 && !t[0] && !e.triggered && e.Duration() > 0 && e.Ctx().Opp != nil && e.Ctx().Opp.CurrentPet.Info.Hp > 0 {
e.triggered = true
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if success {
applyStatus(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
}
}
return e.EffectNode.Alive(t...)
}
// Effect 1401: 后出手时{0}%令对手对手{1},未触发则使自身下{2}回合必定致命一击
type Effect1401 struct {
node.EffectNode
}
func (e *Effect1401) Skill_Use() bool {
if len(e.Args()) < 3 || e.IsFirst() {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
applyStatus(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
return true
}
critEffect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1401, int(e.Args()[2].IntPart()))
if critEffect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, critEffect)
}
return true
}
type Effect1401Sub struct {
node.EffectNode
}
func (e *Effect1401Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
if len(a) > 0 {
e.Duration(a[0])
}
}
func (e *Effect1401Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
// Effect 1402: 技能威力提升1点不受其他威力提升/下降效果加成
type Effect1402 struct {
node.EffectNode
}
func (e *Effect1402) CalculatePre() bool {
if e.Ctx().SkillEntity == nil {
return true
}
setSkillPowerOverride(e.Ctx().SkillEntity, 1)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1398, &Effect1398{})
input.InitEffect(input.EffectType.Skill, 1399, &Effect1399{})
input.InitEffect(input.EffectType.Sub, 1399, &Effect1399Sub{})
input.InitEffect(input.EffectType.Skill, 1400, &Effect1400{})
input.InitEffect(input.EffectType.Sub, 1400, &Effect1400Sub{})
input.InitEffect(input.EffectType.Skill, 1401, &Effect1401{})
input.InitEffect(input.EffectType.Sub, 1401, &Effect1401Sub{})
input.InitEffect(input.EffectType.Skill, 1402, &Effect1402{})
}