Files
bl/logic/service/fight/effect/1670_1674.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

162 lines
4.0 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 1670: {0}%令对手{1},对手为自身天敌时概率提升{2}%,未触发则消除对手回合类效果
type Effect1670 struct {
node.EffectNode
}
func (e *Effect1670) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
chance := int(e.Args()[0].IntPart())
if e.ISNaturalEnemy() {
chance += int(e.Args()[2].IntPart())
if chance > 100 {
chance = 100
}
}
success, _, _ := e.Input.Player.Roll(chance, 100)
if success {
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
return true
}
}
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
return true
}
// Effect 1671: 造成的攻击伤害不低于{0},若对手处于能力提升状态则造成的攻击伤害不低于{1}
type Effect1671 struct {
node.EffectNode
}
func (e *Effect1671) DamageFloor(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
if len(e.Args()) < 2 {
return true
}
threshold := e.Args()[0]
if e.Ctx().Opp.HasPropADD() {
threshold = e.Args()[1]
}
if zone.Damage.Cmp(threshold) < 0 {
zone.Damage = threshold
}
return true
}
// Effect 1672: 出手时若自身未满体力则吸取对手{0}点体力
type Effect1672 struct {
node.EffectNode
}
func (e *Effect1672) OnSkill() bool {
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Our.CurrentPet.GetMaxHP()) >= 0 {
return true
}
drain := e.Args()[0]
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: drain,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain)
return true
}
// Effect 1673: 命中后{0}%的概率秒杀对手,未触发则造成的伤害不少于{1}
type Effect1673 struct {
node.EffectNode
}
func (e *Effect1673) DamageFloor(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
if len(e.Args()) < 2 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
zone.Damage = e.Ctx().Opp.CurrentPet.GetMaxHP()
return true
}
if zone.Damage.Cmp(e.Args()[1]) < 0 {
zone.Damage = e.Args()[1]
}
return true
}
// Effect 1674: {0}回合内每回合使用技能吸取对手最大体力的1/{1},若对手未受到百分比伤害则额外附加{2}点真实伤害
type Effect1674 struct {
RoundEffectArg0Base
}
func (e *Effect1674) OnSkill() bool {
if len(e.Args()) < 3 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
if damage.Cmp(alpacadecimal.Zero) > 0 {
beforeHP := e.Ctx().Opp.CurrentPet.Info.Hp
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,
})
if e.Ctx().Opp.CurrentPet.Info.Hp < beforeHP {
return true
}
}
if e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.True,
Damage: e.Args()[2],
})
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1670, &Effect1670{})
input.InitEffect(input.EffectType.Skill, 1671, &Effect1671{})
input.InitEffect(input.EffectType.Skill, 1672, &Effect1672{})
input.InitEffect(input.EffectType.Skill, 1673, &Effect1673{})
input.InitEffect(input.EffectType.Skill, 1674, &Effect1674{})
}