62 lines
1.4 KiB
Go
62 lines
1.4 KiB
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
|
|
"github.com/gogf/gf/v2/util/grand"
|
|
)
|
|
|
|
var effect1116StatusPool = []int{
|
|
int(info.PetStatus.Burned),
|
|
int(info.PetStatus.Frozen),
|
|
int(info.PetStatus.Poisoned),
|
|
int(info.PetStatus.Paralysis),
|
|
int(info.PetStatus.Fear),
|
|
int(info.PetStatus.Sleep),
|
|
}
|
|
|
|
func addRandomStatuses1116(owner, target *input.Input, count int) bool {
|
|
if owner == nil || target == nil || count <= 0 {
|
|
return false
|
|
}
|
|
if count > len(effect1116StatusPool) {
|
|
count = len(effect1116StatusPool)
|
|
}
|
|
|
|
perm := grand.Perm(len(effect1116StatusPool))
|
|
applied := false
|
|
for _, idx := range perm[:count] {
|
|
statusEffect := owner.InitEffect(input.EffectType.Status, effect1116StatusPool[idx])
|
|
if statusEffect != nil {
|
|
target.AddEffect(owner, statusEffect)
|
|
applied = true
|
|
}
|
|
}
|
|
return applied
|
|
}
|
|
|
|
// Effect 1116: 随机附加{0}种异常状态,未触发则消除对手回合类效果
|
|
type Effect1116 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1116) OnSkill() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
if count := int(e.Args()[0].IntPart()); addRandomStatuses1116(e.Ctx().Our, e.Ctx().Opp, count) {
|
|
return true
|
|
}
|
|
|
|
if e.Ctx().Opp != nil {
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1116, &Effect1116{})
|
|
}
|