Files
bl/logic/service/fight/effect/1363_1367.go
2026-04-01 02:53:23 +08:00

188 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/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
"github.com/gogf/gf/v2/util/grand"
)
var effect1364StatusPool = []int{
int(info.PetStatus.Burned),
int(info.PetStatus.Frozen),
int(info.PetStatus.Poisoned),
22, // 焚烬
int(info.PetStatus.IceBound),
27, // 感染
}
func addRandomStatuses1364(owner, target *input.Input, count int) (applied int, controlApplied bool) {
if owner == nil || target == nil || count <= 0 {
return 0, false
}
if count > len(effect1364StatusPool) {
count = len(effect1364StatusPool)
}
indexes := grand.Perm(len(effect1364StatusPool))
for _, idx := range indexes {
statusID := effect1364StatusPool[idx]
eff := owner.InitEffect(input.EffectType.Status, statusID)
if eff == nil {
continue
}
target.AddEffect(owner, eff)
applied++
if statusID == int(info.PetStatus.IceBound) {
controlApplied = true
}
if applied >= count {
break
}
}
return applied, controlApplied
}
func addRandomStatuses1367(owner, target *input.Input, count int) int {
if owner == nil || target == nil || count <= 0 || len(effect1394Statuses) == 0 {
return 0
}
if count > len(effect1394Statuses) {
count = len(effect1394Statuses)
}
applied := 0
for _, idx := range grand.Perm(len(effect1394Statuses))[:count] {
statusEffect := owner.InitEffect(input.EffectType.Status, effect1394Statuses[idx])
if statusEffect == nil {
continue
}
target.AddEffect(owner, statusEffect)
applied++
}
return applied
}
// Effect 1363: 造成的伤害低于{0}则{1}%令对手{2},未触发则消除对手回合类效果
type Effect1363 struct{ node.EffectNode }
func (e *Effect1363) Skill_Use() bool {
if len(e.Args()) < 3 || e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 {
return true
}
ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if ok && addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart())) {
return true
}
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
return true
}
// Effect 1364: 令对手随机进入烧伤、冻伤、中毒、焚烬、冰封、感染中的2种异常状态未触发控制类异常状态则2回合内令对手使用的属性技能无效
type Effect1364 struct{ node.EffectNode }
func (e *Effect1364) Skill_Use() bool {
_, controlApplied := addRandomStatuses1364(e.Ctx().Our, e.Ctx().Opp, 2)
if controlApplied {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1284, 2)
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
// Effect 1365: 命中后{0}%令对手{1},自身每损失{2}%的体力则进入异常概率提升{3}%
type Effect1365 struct{ node.EffectNode }
func (e *Effect1365) OnSkill() bool {
if len(e.Args()) < 4 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
if e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
maxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
curHP := e.Ctx().Our.CurrentPet.GetHP()
lostHPPercent := maxHP.Sub(curHP).Mul(hundred).Div(maxHP).IntPart()
additionalStacks := lostHPPercent / e.Args()[2].IntPart()
chance := int(e.Args()[0].IntPart() + additionalStacks*e.Args()[3].IntPart())
if chance > 100 {
chance = 100
}
if ok, _, _ := e.Input.Player.Roll(chance, 100); ok {
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
}
return true
}
// Effect 1366: 附加攻击伤害{0}%的百分比伤害,每次使用增加{1}%,最高{2}%
type Effect1366 struct{ AddLvelEffect }
func (e *Effect1366) Skill_Use() bool {
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
percent := e.Args()[0]
if e.UseSkillCount > 1 {
percent = percent.Add(e.Args()[1].Mul(alpacadecimal.NewFromInt(e.UseSkillCount - 1)))
}
if percent.Cmp(e.Args()[2]) > 0 {
percent = e.Args()[2]
}
if percent.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Our.SumDamage.Mul(percent).Div(hundred)
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
return true
}
// Effect 1367: 随机附加{0}种异常状态,未触发则{1}回合内令对手使用的属性技能无效
type Effect1367 struct{ node.EffectNode }
func (e *Effect1367) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
if addRandomStatuses1367(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart())) > 0 {
return true
}
if e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1284, int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1363, &Effect1363{})
input.InitEffect(input.EffectType.Skill, 1364, &Effect1364{})
input.InitEffect(input.EffectType.Skill, 1365, &Effect1365{})
input.InitEffect(input.EffectType.Skill, 1366, &Effect1366{})
input.InitEffect(input.EffectType.Skill, 1367, &Effect1367{})
}