181 lines
5.5 KiB
Go
181 lines
5.5 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/gogf/gf/v2/util/grand"
|
|
)
|
|
|
|
var effect1078Statuses = []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 activeStatusCount(target *input.Input, statuses []int) int {
|
|
if target == nil {
|
|
return 0
|
|
}
|
|
count := 0
|
|
for _, statusID := range statuses {
|
|
if target.StatEffect_Exist(info.EnumPetStatus(statusID)) {
|
|
count++
|
|
}
|
|
}
|
|
return count
|
|
}
|
|
|
|
// Effect 1077: {0}回合内对手使用攻击技能后使对手{1},未触发则对手下{2}回合属性技能命中效果失效
|
|
type Effect1077 struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1077) Skill_Use_ex() bool {
|
|
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
statusID := int(e.Args()[1].IntPart())
|
|
before := e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(statusID))
|
|
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, statusID)
|
|
if before || e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(statusID)) {
|
|
return true
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1077, int(e.Args()[2].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1077Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1077Sub) SkillHit_ex() bool {
|
|
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
e.Ctx().SkillEntity.XML.MustHit = 1
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1078: 使对手随机进入{0}种异常状态,未触发则下{1}回合自身属性技能先制+{2}
|
|
type Effect1078 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1078) OnSkill() bool {
|
|
if len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
count := int(e.Args()[0].IntPart())
|
|
if count > len(effect1078Statuses) {
|
|
count = len(effect1078Statuses)
|
|
}
|
|
before := activeStatusCount(e.Ctx().Opp, effect1078Statuses)
|
|
if count > 0 {
|
|
for _, idx := range grand.Perm(len(effect1078Statuses))[:count] {
|
|
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, effect1078Statuses[idx])
|
|
}
|
|
}
|
|
if activeStatusCount(e.Ctx().Opp, effect1078Statuses) > before {
|
|
return true
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1078, int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1078Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1078Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() != info.Category.STATUS {
|
|
return true
|
|
}
|
|
current.SkillEntity.XML.Priority += int(e.Args()[1].IntPart())
|
|
return true
|
|
}
|
|
|
|
// Effect 1079: 命中后{0}%令对手{1},未触发则下{2}回合自身攻击技能先制+{3}
|
|
type Effect1079 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1079) OnSkill() bool {
|
|
if len(e.Args()) < 4 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
|
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, 1079, int(e.Args()[2].IntPart()), int(e.Args()[3].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1079Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1079Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
current.SkillEntity.XML.Priority += int(e.Args()[1].IntPart())
|
|
return true
|
|
}
|
|
|
|
// Effect 1080: 连续使用时先制+1
|
|
type Effect1080 struct {
|
|
node.EffectNode
|
|
lastSkillID int
|
|
}
|
|
|
|
func (e *Effect1080) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current == nil || current.SkillEntity == nil {
|
|
return true
|
|
}
|
|
if e.lastSkillID != 0 && current.SkillEntity.XML.ID == e.lastSkillID {
|
|
current.SkillEntity.XML.Priority += 1
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1080) SkillHit() bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.AttackTime == 0 {
|
|
return true
|
|
}
|
|
e.lastSkillID = e.Ctx().SkillEntity.XML.ID
|
|
return true
|
|
}
|
|
|
|
// Effect 1081: 若对手处于能力提升状态则先制+1
|
|
type Effect1081 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1081) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
if !e.Ctx().Opp.HasPropADD() {
|
|
return true
|
|
}
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current == nil || current.SkillEntity == nil {
|
|
return true
|
|
}
|
|
current.SkillEntity.XML.Priority += 1
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1077, &Effect1077{})
|
|
input.InitEffect(input.EffectType.Sub, 1077, &Effect1077Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1078, &Effect1078{})
|
|
input.InitEffect(input.EffectType.Sub, 1078, &Effect1078Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1079, &Effect1079{})
|
|
input.InitEffect(input.EffectType.Sub, 1079, &Effect1079Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1080, &Effect1080{})
|
|
input.InitEffect(input.EffectType.Skill, 1081, &Effect1081{})
|
|
}
|