227 lines
6.0 KiB
Go
227 lines
6.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"
|
|
"github.com/gogf/gf/v2/util/grand"
|
|
)
|
|
|
|
var effect1059ControlStatuses = []int{
|
|
int(info.PetStatus.Paralysis),
|
|
int(info.PetStatus.Tired),
|
|
int(info.PetStatus.Fear),
|
|
int(info.PetStatus.Petrified),
|
|
int(info.PetStatus.Sleep),
|
|
}
|
|
|
|
type Effect1057 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1057) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1057, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1057Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1057Sub) PropBefer(source *input.Input, prop int8, level int8) bool {
|
|
if prop < 0 || int(prop) >= len(e.Ctx().Our.Prop) {
|
|
return true
|
|
}
|
|
if level != 0 || e.Ctx().Our.Prop[prop] <= 0 {
|
|
return true
|
|
}
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
type Effect1058 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1058) OnSkill() bool {
|
|
if len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
|
if success {
|
|
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
|
return true
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1058, int(e.Args()[2].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1058Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1058Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
e.Ctx().SkillEntity.SetMiss()
|
|
return true
|
|
}
|
|
|
|
type Effect1059 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1059) Skill_Use() bool {
|
|
if len(e.Args()) < 5 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: e.Ctx().Our.CurPet[0].GetHP(),
|
|
})
|
|
|
|
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
|
if success {
|
|
count := int(e.Args()[1].IntPart())
|
|
if count > len(effect1059ControlStatuses) {
|
|
count = len(effect1059ControlStatuses)
|
|
}
|
|
for _, idx := range grand.Perm(len(effect1059ControlStatuses))[:count] {
|
|
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, effect1059ControlStatuses[idx])
|
|
}
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1059, int(e.Args()[2].IntPart()), int(e.Args()[3].IntPart()), int(e.Args()[4].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1059Sub struct{ node.EffectNode }
|
|
|
|
func (e *Effect1059Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.CanStack(false)
|
|
e.Duration(1)
|
|
}
|
|
|
|
func (e *Effect1059Sub) SwitchOut(in *input.Input) bool { return true }
|
|
|
|
func (e *Effect1059Sub) SwitchIn(in *input.Input) bool {
|
|
if in != e.Ctx().Our || len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
|
|
damageSub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 10591, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
|
if damageSub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, damageSub)
|
|
}
|
|
prioritySub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 10592, int(e.Args()[0].IntPart()), int(e.Args()[2].IntPart()))
|
|
if prioritySub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, prioritySub)
|
|
}
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
type Effect1059DamageSub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1059DamageSub) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100).Add(e.Args()[1])).Div(alpacadecimal.NewFromInt(100))
|
|
return true
|
|
}
|
|
|
|
type Effect1059PrioritySub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1059PrioritySub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current == nil || current.SkillEntity == nil {
|
|
return true
|
|
}
|
|
current.SkillEntity.XML.Priority += int(e.Args()[1].IntPart())
|
|
return true
|
|
}
|
|
|
|
type Effect1060 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1060) OnSkill() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
absorbed := false
|
|
for i, v := range e.Ctx().Opp.Prop[:] {
|
|
if v <= 0 {
|
|
continue
|
|
}
|
|
if !e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
continue
|
|
}
|
|
absorbed = true
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
|
|
}
|
|
if !absorbed {
|
|
return true
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1060, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1060Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1060Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
e.Ctx().SkillEntity.SetMiss()
|
|
return true
|
|
}
|
|
|
|
type Effect1061 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1061) OnSkill() bool {
|
|
reversed := false
|
|
for i, v := range e.Ctx().Opp.Prop[:] {
|
|
if v <= 0 {
|
|
continue
|
|
}
|
|
if !e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v) {
|
|
continue
|
|
}
|
|
reversed = true
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
|
|
}
|
|
if !reversed {
|
|
clearPositivePropsTo(e.Ctx().Opp, e.Ctx().Our)
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1057, &Effect1057{})
|
|
input.InitEffect(input.EffectType.Sub, 1057, &Effect1057Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1058, &Effect1058{})
|
|
input.InitEffect(input.EffectType.Sub, 1058, &Effect1058Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1059, &Effect1059{})
|
|
input.InitEffect(input.EffectType.Sub, 1059, &Effect1059Sub{})
|
|
input.InitEffect(input.EffectType.Sub, 10591, &Effect1059DamageSub{})
|
|
input.InitEffect(input.EffectType.Sub, 10592, &Effect1059PrioritySub{})
|
|
input.InitEffect(input.EffectType.Skill, 1060, &Effect1060{})
|
|
input.InitEffect(input.EffectType.Sub, 1060, &Effect1060Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1061, &Effect1061{})
|
|
}
|