140 lines
3.3 KiB
Go
140 lines
3.3 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 1047: {0}%令对手{1},未触发则吸取对手最大体力的1/{2}
|
||
type Effect1047 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1047) Skill_Use() bool {
|
||
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
||
if success {
|
||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
|
||
if statusEffect != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
return true
|
||
}
|
||
|
||
if e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[2])
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Percent,
|
||
Damage: damage,
|
||
})
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
|
||
return true
|
||
}
|
||
|
||
// Effect 1048: 若对手处于异常状态则自身造成的攻击伤害额外提升{0}%
|
||
type Effect1048 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1048) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
if !e.Ctx().Opp.StatEffect_Exist_all() {
|
||
return true
|
||
}
|
||
|
||
addSkillPowerPercent(e.Ctx().SkillEntity, e.Args()[0])
|
||
return true
|
||
}
|
||
|
||
// Effect 1049: 击败对手则自身全属性+{0}
|
||
type Effect1049 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1049) Skill_Use() bool {
|
||
if e.Ctx().Opp.CurPet[0].Info.Hp > 0 {
|
||
return true
|
||
}
|
||
|
||
boost := int8(e.Args()[0].IntPart())
|
||
for i := range e.Ctx().Our.Prop {
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boost)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1050: 未击败对手则下{0}回合攻击使对手{1}%{2}
|
||
type Effect1050 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1050) Skill_Use() bool {
|
||
if e.Ctx().Opp.CurPet[0].Info.Hp <= 0 {
|
||
return true
|
||
}
|
||
|
||
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect1050Sub{}, -1)
|
||
return true
|
||
}
|
||
|
||
type Effect1050Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1050Sub) OnSkill() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.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 {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1051: 对手体力高于{0}则将对手体力减少到{1}
|
||
type Effect1051 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1051) Skill_Use() bool {
|
||
currentHP := e.Ctx().Opp.CurPet[0].GetHP()
|
||
if currentHP.Cmp(e.Args()[0]) <= 0 {
|
||
return true
|
||
}
|
||
|
||
targetHP := e.Args()[1]
|
||
if targetHP.Cmp(alpacadecimal.Zero) < 0 {
|
||
targetHP = alpacadecimal.Zero
|
||
}
|
||
if currentHP.Cmp(targetHP) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Opp.CurPet[0].Info.Hp = uint32(targetHP.IntPart())
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 1047, &Effect1047{})
|
||
input.InitEffect(input.EffectType.Skill, 1048, &Effect1048{})
|
||
input.InitEffect(input.EffectType.Skill, 1049, &Effect1049{})
|
||
input.InitEffect(input.EffectType.Skill, 1050, &Effect1050{})
|
||
input.InitEffect(input.EffectType.Sub, 1050, &Effect1050Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1051, &Effect1051{})
|
||
}
|