200 lines
4.6 KiB
Go
200 lines
4.6 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"
|
|
)
|
|
|
|
// Effect 780: {0}回合内受到攻击则{1}%令对手随机{2}个技能PP值归零
|
|
type Effect780 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect780) Skill_Use() bool {
|
|
if len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 780, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect780Sub struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect780Sub) Skill_Use_ex() bool {
|
|
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
|
if !success {
|
|
return true
|
|
}
|
|
|
|
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[2].IntPart()))
|
|
return true
|
|
}
|
|
|
|
// Effect 781: 消除对手回合类效果,消除成功则{0}回合内令对手使用的属性技能无效
|
|
type Effect781 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect781) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
before := activeTurnEffectCount(e.Ctx().Opp)
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
if before <= 0 {
|
|
return true
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 781, int(e.Args()[0].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect781Sub struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect781Sub) 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
|
|
}
|
|
|
|
// Effect 782: {0}%令对手{1},每次使用概率增加{2}%,最高概率{3}%
|
|
type Effect782 struct {
|
|
node.EffectNode
|
|
useCount int
|
|
}
|
|
|
|
func (e *Effect782) OnSkill() bool {
|
|
if len(e.Args()) < 4 {
|
|
return true
|
|
}
|
|
|
|
chance := int(e.Args()[0].IntPart()) + e.useCount*int(e.Args()[2].IntPart())
|
|
maxChance := int(e.Args()[3].IntPart())
|
|
if chance > maxChance {
|
|
chance = maxChance
|
|
}
|
|
|
|
success, _, _ := e.Input.Player.Roll(chance, 100)
|
|
e.useCount++
|
|
if !success {
|
|
return true
|
|
}
|
|
|
|
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
|
return true
|
|
}
|
|
|
|
// Effect 783: {0}回合内自身能力提升状态被消除或吸取时附加对手最大体力1/{1}的百分比伤害
|
|
type Effect783 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect783) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 783, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect783Sub struct {
|
|
RoundEffectArg0Base
|
|
triggered bool
|
|
}
|
|
|
|
func (e *Effect783Sub) PropBefer(in *input.Input, prop int8, level int8) bool {
|
|
if len(e.Args()) < 2 || in != e.Ctx().Our || e.triggered {
|
|
return true
|
|
}
|
|
if int(prop) < 0 || int(prop) >= len(e.Ctx().Our.Prop) {
|
|
return true
|
|
}
|
|
if level > 0 || e.Ctx().Our.Prop[prop] <= 0 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
|
|
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.triggered = true
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Percent,
|
|
Damage: damage,
|
|
})
|
|
return true
|
|
}
|
|
|
|
func (e *Effect783Sub) Action_end() bool {
|
|
e.triggered = false
|
|
return true
|
|
}
|
|
|
|
func (e *Effect783Sub) Action_end_ex() bool {
|
|
e.triggered = false
|
|
return true
|
|
}
|
|
|
|
// Effect 784: 若本回合击败对手则将对手的能力提升效果转移到自己身上
|
|
type Effect784 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect784) Skill_Use() bool {
|
|
if e.Ctx().Opp.CurrentPet.Info.Hp > 0 {
|
|
return true
|
|
}
|
|
|
|
for i, v := range e.Ctx().Opp.Prop[:] {
|
|
if v <= 0 {
|
|
continue
|
|
}
|
|
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 780, &Effect780{})
|
|
input.InitEffect(input.EffectType.Sub, 780, &Effect780Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 781, &Effect781{})
|
|
input.InitEffect(input.EffectType.Sub, 781, &Effect781Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 782, &Effect782{})
|
|
input.InitEffect(input.EffectType.Skill, 783, &Effect783{})
|
|
input.InitEffect(input.EffectType.Sub, 783, &Effect783Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 784, &Effect784{})
|
|
}
|