docs(effect): 移除已完成的效果任务文档 移除effects 876-1061范围内的任务文档,这些effect已经实现或不再需要跟踪。 包括task-053至task-089的多个任务列表,涵盖各种战斗效果的实现说明。 ```
129 lines
3.6 KiB
Go
129 lines
3.6 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"
|
||
)
|
||
|
||
func ownDefensePairSum(in *input.Input) alpacadecimal.Decimal {
|
||
if in == nil {
|
||
return alpacadecimal.Zero
|
||
}
|
||
return in.GetProp(1).Add(in.GetProp(3))
|
||
}
|
||
|
||
// Effect 941: 出手时有概率使对手{0},概率等同于出手时自身当前体力百分比
|
||
type Effect941 struct{ node.EffectNode }
|
||
|
||
func (e *Effect941) OnSkill() bool {
|
||
if len(e.Args()) == 0 || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil {
|
||
return true
|
||
}
|
||
maxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||
if maxHP.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
chance := int(e.Ctx().Our.CurrentPet.GetHP().Mul(hundred).Div(maxHP).IntPart())
|
||
if chance <= 0 {
|
||
return true
|
||
}
|
||
if chance > 100 {
|
||
chance = 100
|
||
}
|
||
success, _, _ := e.Input.Player.Roll(chance, 100)
|
||
if !success {
|
||
return true
|
||
}
|
||
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart()))
|
||
return true
|
||
}
|
||
|
||
// Effect 942: 消除对手回合类效果,消除成功则吸取对手最大体力的1/{0}
|
||
type Effect942 struct{ node.EffectNode }
|
||
|
||
func (e *Effect942) Skill_Use() bool {
|
||
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
before := activeTurnEffectCount(e.Ctx().Opp)
|
||
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
||
if before <= 0 {
|
||
return true
|
||
}
|
||
damage := e.Ctx().Opp.CurrentPet.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.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
|
||
return true
|
||
}
|
||
|
||
// Effect 943: 附加自身防御、特防总和{0}%的百分比伤害
|
||
type Effect943 struct{ node.EffectNode }
|
||
|
||
func (e *Effect943) OnSkill() bool {
|
||
if len(e.Args()) == 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
damage := ownDefensePairSum(e.Ctx().Our).Mul(e.Args()[0]).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 944: {0}回合内对手使用攻击技能时受到自身防御、特防总和{1}%的百分比伤害
|
||
type Effect944 struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect944) Skill_Use_ex() bool {
|
||
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
damage := ownDefensePairSum(e.Ctx().Our).Mul(e.Args()[1]).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 945: 消除对手回合类效果,消除成功则恢复自身全部体力
|
||
type Effect945 struct{ node.EffectNode }
|
||
|
||
func (e *Effect945) Skill_Use() bool {
|
||
before := activeTurnEffectCount(e.Ctx().Opp)
|
||
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
||
if before <= 0 {
|
||
return true
|
||
}
|
||
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Sub(e.Ctx().Our.CurrentPet.GetHP())
|
||
if heal.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 941, &Effect941{})
|
||
input.InitEffect(input.EffectType.Skill, 942, &Effect942{})
|
||
input.InitEffect(input.EffectType.Skill, 943, &Effect943{})
|
||
input.InitEffect(input.EffectType.Skill, 944, &Effect944{})
|
||
input.InitEffect(input.EffectType.Skill, 945, &Effect945{})
|
||
}
|