180 lines
4.6 KiB
Go
180 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 1438: 若对手处于能力下降状态,则{0}回合内令对手使用的属性技能无效
|
|
type Effect1438 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1438) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 || !e.Ctx().Opp.HasPropSub() {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1438, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1438Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1438Sub) 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 1439: 对手处于能力下降状态造成的伤害提升{0}%
|
|
type Effect1439 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1439) Damage_Mul(zone *info.DamageZone) bool {
|
|
if len(e.Args()) == 0 || zone == nil || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
if !e.Ctx().Opp.HasPropSub() {
|
|
return true
|
|
}
|
|
|
|
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[0])).Div(hundred)
|
|
return true
|
|
}
|
|
|
|
// Effect 1440: 免疫下{0}次自身受到的异常状态
|
|
type Effect1440 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1440) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1440, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1440Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect1440Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
e.CanStack(false)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1440Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
if in != e.Ctx().Opp || !input.IS_Stat(effEffect) {
|
|
return true
|
|
}
|
|
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return false
|
|
}
|
|
|
|
// Effect 1441: 解除自身能力下降状态,解除成功则使对手随机{0}个技能PP值归零
|
|
type Effect1441 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1441) Skill_Use() bool {
|
|
cleared := false
|
|
for i, v := range e.Ctx().Our.Prop[:] {
|
|
if v >= 0 {
|
|
continue
|
|
}
|
|
if e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
cleared = true
|
|
}
|
|
}
|
|
if cleared && len(e.Args()) > 0 {
|
|
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[0].IntPart()))
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1442: {0}回合内每回合{1}%闪避对手攻击,未触发则回合结束时{2}%令对手{3}
|
|
type Effect1442 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1442) Skill_Use() bool {
|
|
if len(e.Args()) < 4 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1442, e.SideEffectArgs...)
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1442Sub struct {
|
|
node.EffectNode
|
|
triggered bool
|
|
}
|
|
|
|
func (e *Effect1442Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.CanStack(false)
|
|
if len(a) > 0 {
|
|
e.Duration(a[0])
|
|
}
|
|
}
|
|
|
|
func (e *Effect1442Sub) SkillHit_ex() bool {
|
|
if len(e.Args()) < 4 || e.triggered || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 || e.Ctx().SkillEntity.AttackTime == 2 {
|
|
return true
|
|
}
|
|
|
|
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok && e.Ctx().SkillEntity.SetMiss() {
|
|
e.triggered = true
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1442Sub) TurnEnd() {
|
|
if !e.triggered && len(e.Args()) >= 4 {
|
|
statusID := int(e.Args()[3].IntPart())
|
|
if statusID > 0 {
|
|
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[2].IntPart()), 100); ok {
|
|
addStatusByID(e.Ctx().Our, e.Ctx().Opp, statusID)
|
|
}
|
|
}
|
|
}
|
|
|
|
e.triggered = false
|
|
e.EffectNode.TurnEnd()
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1438, &Effect1438{})
|
|
input.InitEffect(input.EffectType.Sub, 1438, &Effect1438Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1439, &Effect1439{})
|
|
input.InitEffect(input.EffectType.Skill, 1440, &Effect1440{})
|
|
input.InitEffect(input.EffectType.Sub, 1440, &Effect1440Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1441, &Effect1441{})
|
|
input.InitEffect(input.EffectType.Skill, 1442, &Effect1442{})
|
|
input.InitEffect(input.EffectType.Sub, 1442, &Effect1442Sub{})
|
|
}
|