Files
bl/logic/service/fight/effect/759_763.go
xinian 023128be25
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
feat: 新增战斗效果实现
新增大量战斗效果逻辑实现,包括效果ID 678-708、734-743、744-748,并更新对应的效果描述映射。
2026-03-30 20:19:41 +08:00

162 lines
3.8 KiB
Go

package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 759: 消除对手能力上升状态,消除成功则{0}回合内对手每回合{1}{2}
type Effect759 struct {
node.EffectNode
}
func (e *Effect759) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
cleared := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
cleared = true
}
}
if !cleared {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 759, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect759Sub struct {
RoundEffectArg0Base
}
func (e *Effect759Sub) TurnEnd() {
if len(e.Args()) < 3 {
e.EffectNode.TurnEnd()
return
}
propID := int8(e.Args()[1].IntPart())
if propID >= 0 && int(propID) < len(e.Ctx().Our.Prop) {
e.Ctx().Our.SetProp(e.Ctx().Opp, propID, int8(e.Args()[2].IntPart()))
}
e.EffectNode.TurnEnd()
}
// Effect 760: 攻击时造成的伤害不会出现微弱(克制关系为微弱时都变成普通)
type Effect760 struct {
node.EffectNode
}
func (e *Effect760) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
typeRate := float64(e.Ctx().Our.AttackValue.Offensive)
if typeRate <= 0 || typeRate >= 1 {
return true
}
zone.Damage = zone.Damage.Div(alpacadecimal.NewFromFloat(typeRate))
return true
}
// Effect 761: {0}回合内对手恢复体力时恢复效果减少{1}%
type Effect761 struct {
node.EffectNode
}
func (e *Effect761) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 761, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect761Sub struct {
RoundEffectArg0Base
}
func (e *Effect761Sub) Heal_Pre(ac action.BattleActionI, value *int) bool {
if len(e.Args()) < 2 || value == nil || *value <= 0 {
return true
}
reduced := alpacadecimal.NewFromInt(int64(*value)).Mul(hundred.Sub(e.Args()[1])).Div(hundred)
*value = int(reduced.IntPart())
return true
}
// Effect 762: {0}回合内每回合恢复自身已损失体力的{1}%
type Effect762 struct {
RoundEffectArg0Base
}
func (e *Effect762) TurnEnd() {
if len(e.Args()) < 2 {
e.EffectNode.TurnEnd()
return
}
missing := e.Ctx().Our.CurrentPet.GetMaxHP().Sub(e.Ctx().Our.CurrentPet.GetHP())
if missing.Cmp(alpacadecimal.Zero) > 0 {
heal := missing.Mul(e.Args()[1]).Div(hundred)
if heal.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Our.Heal(e.Ctx().Our, nil, heal)
}
}
e.EffectNode.TurnEnd()
}
// Effect 763: 自身不处于能力提升状态时则{0}
type Effect763 struct {
node.EffectNode
}
func (e *Effect763) Skill_Use() bool {
if e.Ctx().Our.HasPropADD() {
return true
}
for i, arg := range e.Args() {
if i >= len(e.Ctx().Our.Prop) {
break
}
level := int8(arg.IntPart())
if level == 0 {
continue
}
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), level)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 759, &Effect759{})
input.InitEffect(input.EffectType.Sub, 759, &Effect759Sub{})
input.InitEffect(input.EffectType.Skill, 760, &Effect760{})
input.InitEffect(input.EffectType.Skill, 761, &Effect761{})
input.InitEffect(input.EffectType.Sub, 761, &Effect761Sub{})
input.InitEffect(input.EffectType.Skill, 762, &Effect762{})
input.InitEffect(input.EffectType.Skill, 763, &Effect763{})
}