158 lines
3.7 KiB
Go
158 lines
3.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"
|
|
"github.com/gogf/gf/v2/util/grand"
|
|
)
|
|
|
|
// Effect 648: 若对手下次使用的攻击技能未命中则令对手{0}
|
|
type Effect648 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect648) Skill_Use() bool {
|
|
monitor := e.Ctx().Our.InitEffect(input.EffectType.Sub, 648, int(e.Args()[0].IntPart()))
|
|
if monitor != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, monitor)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect648Sub struct {
|
|
FixedDurationNeg1Base
|
|
}
|
|
|
|
func (e *Effect648Sub) SkillHit_ex() bool {
|
|
skill := e.Ctx().SkillEntity
|
|
if skill == nil || skill.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
if skill.AttackTime == 0 {
|
|
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[0].IntPart()))
|
|
if statusEffect != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
|
}
|
|
}
|
|
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
// Effect 649: {0}回合内受到攻击则有{1}%概率{2}{3}
|
|
type Effect649 struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect649) Action_end_ex() bool {
|
|
skill := e.Ctx().SkillEntity
|
|
if skill == nil || skill.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
|
if !success {
|
|
return true
|
|
}
|
|
|
|
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart()))
|
|
if statusEffect == nil {
|
|
return true
|
|
}
|
|
|
|
statusEffect.Duration(int(e.Args()[3].IntPart()))
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
|
return true
|
|
}
|
|
|
|
// Effect 650: 当次攻击击败对手,则自身{0}
|
|
type Effect650 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect650) Skill_Use() bool {
|
|
if e.Ctx().Opp.CurPet[0].Info.Hp > 0 {
|
|
return true
|
|
}
|
|
|
|
applyEffectPropChanges(e.Ctx().Our, e.Ctx().Our, e.SideEffectArgs, false)
|
|
return true
|
|
}
|
|
|
|
// Effect 651: {0}回合内每回合随机恢复{1}-{2}点体力
|
|
type Effect651 struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect651) TurnEnd() {
|
|
minHeal := int(e.Args()[1].IntPart())
|
|
maxHeal := int(e.Args()[2].IntPart())
|
|
if maxHeal < minHeal {
|
|
maxHeal = minHeal
|
|
}
|
|
|
|
healValue := minHeal
|
|
if maxHeal > minHeal {
|
|
healValue += grand.Intn(maxHeal - minHeal + 1)
|
|
}
|
|
if healValue > 0 {
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, alpacadecimal.NewFromInt(int64(healValue)))
|
|
}
|
|
|
|
e.EffectNode.TurnEnd()
|
|
}
|
|
|
|
// Effect 652: 消除对手能力上升状态,消除成功下{0}回合必定暴击
|
|
type Effect652 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect652) Skill_Use() bool {
|
|
cleared := false
|
|
for i, v := range e.Ctx().Opp.Prop[:] {
|
|
if v <= 0 {
|
|
continue
|
|
}
|
|
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
cleared = true
|
|
}
|
|
}
|
|
if !cleared {
|
|
return true
|
|
}
|
|
|
|
subEffect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 652, int(e.Args()[0].IntPart()))
|
|
if subEffect != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, subEffect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect652Sub struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect652Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().SkillEntity.XML.CritRate = 16
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 648, &Effect648{})
|
|
input.InitEffect(input.EffectType.Sub, 648, &Effect648Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 649, &Effect649{})
|
|
input.InitEffect(input.EffectType.Skill, 650, &Effect650{})
|
|
input.InitEffect(input.EffectType.Skill, 651, &Effect651{})
|
|
input.InitEffect(input.EffectType.Skill, 652, &Effect652{})
|
|
input.InitEffect(input.EffectType.Sub, 652, &Effect652Sub{})
|
|
}
|