165 lines
3.8 KiB
Go
165 lines
3.8 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/logic/service/fight/info"
|
||
"blazing/logic/service/fight/input"
|
||
"blazing/logic/service/fight/node"
|
||
|
||
"github.com/alpacahq/alpacadecimal"
|
||
)
|
||
|
||
// Effect 1253: 击败对手则自身能力提升等级翻倍
|
||
type Effect1253 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1253) Skill_Use() bool {
|
||
if e.Ctx().Opp.CurrentPet.Info.Hp > 0 {
|
||
return true
|
||
}
|
||
|
||
for i, v := range e.Ctx().Our.Prop[:] {
|
||
if v > 0 {
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
|
||
}
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1254: 先出手时消除对手回合类效果
|
||
type Effect1254 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1254) Skill_Use() bool {
|
||
if e.IsFirst() {
|
||
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1255: {0}回合内每回合使用技能则{1}%令对手{2},未触发则附加对手最大体力1/{3}的百分比伤害
|
||
type Effect1255 struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1255) OnSkill() bool {
|
||
if len(e.Args()) < 4 {
|
||
return true
|
||
}
|
||
|
||
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
||
if success {
|
||
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
|
||
}
|
||
|
||
if e.Args()[3].Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[3])
|
||
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Percent,
|
||
Damage: damage,
|
||
})
|
||
return true
|
||
}
|
||
|
||
// Effect 1256: 造成的伤害低于{0}时令对手{1},未触发则自身下{2}次攻击造成的伤害额外提升{3}%
|
||
type Effect1256 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1256) Skill_Use() bool {
|
||
if len(e.Args()) < 4 {
|
||
return true
|
||
}
|
||
|
||
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) < 0 {
|
||
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
|
||
}
|
||
|
||
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1256, int(e.Args()[2].IntPart()), int(e.Args()[3].IntPart()))
|
||
if effect != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1256Sub struct {
|
||
node.EffectNode
|
||
remaining int
|
||
percent alpacadecimal.Decimal
|
||
}
|
||
|
||
func (e *Effect1256Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
if len(a) > 0 {
|
||
e.remaining = a[0]
|
||
}
|
||
if len(a) > 1 {
|
||
e.percent = alpacadecimal.NewFromInt(int64(a[1]))
|
||
}
|
||
}
|
||
|
||
func (e *Effect1256Sub) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 {
|
||
return true
|
||
}
|
||
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100).Add(e.percent)).Div(alpacadecimal.NewFromInt(100))
|
||
e.remaining--
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1257: 对手不处于异常状态则吸取对手最大体力的1/{0}
|
||
type Effect1257 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1257) OnSkill() bool {
|
||
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
if e.Ctx().Opp.StatEffect_Exist_all() {
|
||
return true
|
||
}
|
||
|
||
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0])
|
||
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Percent,
|
||
Damage: damage,
|
||
})
|
||
e.Ctx().Our.Heal(e.Ctx().Our, nil, damage)
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 1253, &Effect1253{})
|
||
input.InitEffect(input.EffectType.Skill, 1254, &Effect1254{})
|
||
input.InitEffect(input.EffectType.Skill, 1255, &Effect1255{})
|
||
input.InitEffect(input.EffectType.Skill, 1256, &Effect1256{})
|
||
input.InitEffect(input.EffectType.Sub, 1256, &Effect1256Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1257, &Effect1257{})
|
||
}
|