131 lines
3.0 KiB
Go
131 lines
3.0 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 1011: {0}回合内有{1}%的概率免疫对手攻击技能造成的伤害并直接扣除对手等量体力
|
||
type Effect1011 struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1011) DamageLockEx(t *info.DamageZone) bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
if t.Type != info.DamageType.Red || t.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
||
if !success {
|
||
return true
|
||
}
|
||
|
||
damage := t.Damage
|
||
t.Damage = alpacadecimal.Zero
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: damage,
|
||
})
|
||
return true
|
||
}
|
||
|
||
// Effect 1012: 吸取对手能力提升状态,吸取成功则为自身附加{0}点护盾
|
||
type Effect1012 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1012) OnSkill() bool {
|
||
canSteal := false
|
||
for i, v := range e.Ctx().Opp.Prop[:] {
|
||
if v <= 0 {
|
||
continue
|
||
}
|
||
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
|
||
canSteal = true
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
|
||
}
|
||
}
|
||
if canSteal {
|
||
e.Ctx().Our.AddShield(e.Args()[0])
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1013: 自身每处于{0}种能力提升状态,则为自身附加{1}点护盾
|
||
type Effect1013 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1013) OnSkill() bool {
|
||
step := int(e.Args()[0].IntPart())
|
||
if step <= 0 {
|
||
return true
|
||
}
|
||
|
||
boostCount := 0
|
||
for _, v := range e.Ctx().Our.Prop[:] {
|
||
if v > 0 {
|
||
boostCount++
|
||
}
|
||
}
|
||
|
||
shieldTimes := boostCount / step
|
||
if shieldTimes <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Our.AddShield(e.Args()[1].Mul(alpacadecimal.NewFromInt(int64(shieldTimes))))
|
||
return true
|
||
}
|
||
|
||
// Effect 1014: 全属性+{0},自身当前体力高于最大体力的1/{1}时强化效果翻倍
|
||
type Effect1014 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1014) OnSkill() bool {
|
||
boostValue := int8(e.Args()[0].IntPart())
|
||
threshold := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[1])
|
||
if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) > 0 {
|
||
boostValue *= 2
|
||
}
|
||
|
||
for i := 0; i < 6; i++ {
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boostValue)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1015: 自身体力低于对手时恢复自身最大体力的1/{0}
|
||
type Effect1015 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1015) OnSkill() bool {
|
||
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) >= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Our.Heal(
|
||
e.Ctx().Our,
|
||
&action.SelectSkillAction{},
|
||
e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0]),
|
||
)
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 1011, &Effect1011{})
|
||
input.InitEffect(input.EffectType.Skill, 1012, &Effect1012{})
|
||
input.InitEffect(input.EffectType.Skill, 1013, &Effect1013{})
|
||
input.InitEffect(input.EffectType.Skill, 1014, &Effect1014{})
|
||
input.InitEffect(input.EffectType.Skill, 1015, &Effect1015{})
|
||
}
|