147 lines
3.2 KiB
Go
147 lines
3.2 KiB
Go
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"
|
|
)
|
|
|
|
// Effect 846: {0}%概率,使对手随机进入{1}控制类异常状态
|
|
type Effect846 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect846) OnSkill() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
|
if !success {
|
|
return true
|
|
}
|
|
|
|
controlStatuses := []int{
|
|
int(info.PetStatus.Paralysis),
|
|
int(info.PetStatus.Tired),
|
|
int(info.PetStatus.Fear),
|
|
int(info.PetStatus.Petrified),
|
|
int(info.PetStatus.Sleep),
|
|
}
|
|
count := int(e.Args()[1].IntPart())
|
|
if count <= 0 {
|
|
return true
|
|
}
|
|
if count > len(controlStatuses) {
|
|
count = len(controlStatuses)
|
|
}
|
|
|
|
indices := grand.Perm(len(controlStatuses))
|
|
for _, idx := range indices[:count] {
|
|
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, controlStatuses[idx])
|
|
if statusEffect != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
|
}
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// Effect 847: 为自身附加{0}点护盾
|
|
type Effect847 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect847) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Our.AddShield(e.Args()[0])
|
|
return true
|
|
}
|
|
|
|
// Effect 848: 对手每处于一种能力下降状态附加{0}点固定伤害
|
|
type Effect848 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect848) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
count := int64(0)
|
|
for _, v := range e.Ctx().Opp.Prop[:] {
|
|
if v < 0 {
|
|
count++
|
|
}
|
|
}
|
|
if count == 0 {
|
|
return true
|
|
}
|
|
|
|
damage := e.Args()[0].Mul(alpacadecimal.NewFromInt(count))
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: damage,
|
|
})
|
|
return true
|
|
}
|
|
|
|
// Effect 849: {0}回合内每回合使用技能则造成伤害前随机吸取对手{1}项能力值-1
|
|
type Effect849 struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect849) SkillHit() bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
count := int(e.Args()[1].IntPart())
|
|
if count <= 0 {
|
|
return true
|
|
}
|
|
|
|
for i := 0; i < count; i++ {
|
|
propIdx := int8(grand.Intn(6))
|
|
if !e.Ctx().Opp.SetProp(e.Ctx().Our, propIdx, -1) {
|
|
continue
|
|
}
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, propIdx, 1)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 850: {0}回合内每回合有{1}%的概率免疫当回合受到的攻击伤害
|
|
type Effect850 struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect850) DamageLockEx(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red {
|
|
return true
|
|
}
|
|
|
|
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
|
if success {
|
|
zone.Damage = alpacadecimal.Zero
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 846, &Effect846{})
|
|
input.InitEffect(input.EffectType.Skill, 847, &Effect847{})
|
|
input.InitEffect(input.EffectType.Skill, 848, &Effect848{})
|
|
input.InitEffect(input.EffectType.Skill, 849, &Effect849{})
|
|
input.InitEffect(input.EffectType.Skill, 850, &Effect850{})
|
|
}
|