docs(effect): 移除已完成的效果任务文档 移除effects 876-1061范围内的任务文档,这些effect已经实现或不再需要跟踪。 包括task-053至task-089的多个任务列表,涵盖各种战斗效果的实现说明。 ```
186 lines
4.7 KiB
Go
186 lines
4.7 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 881: Priority +3 when self has any negative stat stage.
|
|
type Effect881 struct{ node.EffectNode }
|
|
|
|
func (e *Effect881) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
if !e.Ctx().Our.HasPropSub() {
|
|
return true
|
|
}
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current != nil && current.SkillEntity != nil {
|
|
current.SkillEntity.XML.Priority += 3
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 882: For each positive stat stage kind on self, increase skill power by {0}.
|
|
type Effect882 struct{ node.EffectNode }
|
|
|
|
func (e *Effect882) SkillHit() bool {
|
|
if len(e.Args()) == 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
boostKinds := countPositivePropKinds(e.Ctx().Our)
|
|
if boostKinds <= 0 {
|
|
return true
|
|
}
|
|
e.Ctx().SkillEntity.XML.Power += boostKinds * int(e.Args()[0].IntPart())
|
|
return true
|
|
}
|
|
|
|
// Effect 883: On hit, reduce opponent next switched-in pet max HP by {0}% up to {1}%.
|
|
type Effect883 struct{ node.EffectNode }
|
|
|
|
func (e *Effect883) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.AttackTime == 0 {
|
|
return true
|
|
}
|
|
|
|
step := int(e.Args()[0].IntPart())
|
|
capPercent := int(e.Args()[1].IntPart())
|
|
if step <= 0 || capPercent <= 0 {
|
|
return true
|
|
}
|
|
|
|
if exist := e.Ctx().Opp.GetEffect(input.EffectType.Sub, 883); exist != nil {
|
|
if sub, ok := exist.(*Effect883Sub); ok {
|
|
sub.AddReduction(step, capPercent)
|
|
return true
|
|
}
|
|
}
|
|
|
|
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 883, step, capPercent)
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect883Sub struct {
|
|
node.EffectNode
|
|
reducePercent int
|
|
capPercent int
|
|
}
|
|
|
|
func (e *Effect883Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.CanStack(false)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.reducePercent = a[0]
|
|
}
|
|
if len(a) > 1 {
|
|
e.capPercent = a[1]
|
|
}
|
|
if e.capPercent <= 0 {
|
|
e.capPercent = e.reducePercent
|
|
}
|
|
if e.capPercent > 100 {
|
|
e.capPercent = 100
|
|
}
|
|
if e.reducePercent > e.capPercent {
|
|
e.reducePercent = e.capPercent
|
|
}
|
|
if e.reducePercent < 0 {
|
|
e.reducePercent = 0
|
|
}
|
|
}
|
|
|
|
func (e *Effect883Sub) AddReduction(step, cap int) {
|
|
if cap > 0 {
|
|
e.capPercent = cap
|
|
}
|
|
if e.capPercent > 100 {
|
|
e.capPercent = 100
|
|
}
|
|
if step <= 0 {
|
|
return
|
|
}
|
|
e.reducePercent += step
|
|
if e.capPercent > 0 && e.reducePercent > e.capPercent {
|
|
e.reducePercent = e.capPercent
|
|
}
|
|
}
|
|
|
|
func (e *Effect883Sub) SwitchIn(in *input.Input) bool {
|
|
if in != e.Ctx().Our || e.reducePercent <= 0 || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil {
|
|
return true
|
|
}
|
|
currentMax := e.Ctx().Our.CurrentPet.GetMaxHP()
|
|
newMax := currentMax.Mul(hundred.Sub(alpacadecimal.NewFromInt(int64(e.reducePercent)))).Div(hundred)
|
|
if newMax.Cmp(alpacadecimal.NewFromInt(1)) < 0 {
|
|
newMax = alpacadecimal.NewFromInt(1)
|
|
}
|
|
e.Ctx().Our.CurrentPet.Info.MaxHp = uint32(newMax.IntPart())
|
|
if e.Ctx().Our.CurrentPet.Info.Hp > e.Ctx().Our.CurrentPet.Info.MaxHp {
|
|
e.Ctx().Our.CurrentPet.Info.Hp = e.Ctx().Our.CurrentPet.Info.MaxHp
|
|
}
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
// Effect 884: Make opponent's next used skill invalid.
|
|
type Effect884 struct{ node.EffectNode }
|
|
|
|
func (e *Effect884) Skill_Use() bool {
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 884)
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect884Sub struct{ node.EffectNode }
|
|
|
|
func (e *Effect884Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.CanStack(false)
|
|
e.Duration(-1)
|
|
}
|
|
|
|
func (e *Effect884Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
if e.Ctx().SkillEntity == nil {
|
|
return true
|
|
}
|
|
e.Ctx().SkillEntity.SetMiss()
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
// Effect 885: Increase all stats by {0}, doubled when current HP > opponent HP.
|
|
type Effect885 struct{ node.EffectNode }
|
|
|
|
func (e *Effect885) OnSkill() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
boost := int8(e.Args()[0].IntPart())
|
|
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) > 0 {
|
|
boost *= 2
|
|
}
|
|
for i := 0; i < 6; i++ {
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boost)
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 881, &Effect881{})
|
|
input.InitEffect(input.EffectType.Skill, 882, &Effect882{})
|
|
input.InitEffect(input.EffectType.Skill, 883, &Effect883{})
|
|
input.InitEffect(input.EffectType.Sub, 883, &Effect883Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 884, &Effect884{})
|
|
input.InitEffect(input.EffectType.Sub, 884, &Effect884Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 885, &Effect885{})
|
|
}
|