228 lines
5.5 KiB
Go
228 lines
5.5 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 1675: 反转对手能力提升状态,反转成功则对手{0}回合内无法通过自身技能恢复体力
|
||
type Effect1675 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1675) Skill_Use() bool {
|
||
reversed := false
|
||
for i, v := range e.Ctx().Opp.Prop[:] {
|
||
if v <= 0 {
|
||
continue
|
||
}
|
||
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v) {
|
||
reversed = true
|
||
}
|
||
}
|
||
if !reversed || len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1675, int(e.Args()[0].IntPart()))
|
||
if effect != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1675Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1675Sub) Heal_Pre(ac action.BattleActionI, value *int) bool {
|
||
if value == nil || *value <= 0 {
|
||
return true
|
||
}
|
||
if _, ok := ac.(*action.SelectSkillAction); !ok {
|
||
return true
|
||
}
|
||
|
||
*value = 0
|
||
return true
|
||
}
|
||
|
||
// Effect 1676: {0}回合内每回合使用技能{1}%令对手{2},未触发则令自身全属性+{3}
|
||
type Effect1676 struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1676) 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
|
||
}
|
||
}
|
||
|
||
boost := int8(e.Args()[3].IntPart())
|
||
for i := 0; i < 6; i++ {
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boost)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1677: 附加给自身{0}点固定伤害(致死时令自身残留1点体力),附加给对手{1}点固定伤害,令自身下{2}次受到的攻击伤害转化为体力
|
||
type Effect1677 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1677) Skill_Use() bool {
|
||
if len(e.Args()) < 3 {
|
||
return true
|
||
}
|
||
|
||
selfDamage := e.Args()[0]
|
||
if selfDamage.Cmp(alpacadecimal.Zero) > 0 {
|
||
currentHP := e.Ctx().Our.CurrentPet.GetHP()
|
||
if currentHP.Cmp(alpacadecimal.NewFromInt(1)) > 0 {
|
||
maxSelfDamage := currentHP.Sub(alpacadecimal.NewFromInt(1))
|
||
if selfDamage.Cmp(maxSelfDamage) > 0 {
|
||
selfDamage = maxSelfDamage
|
||
}
|
||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: selfDamage,
|
||
})
|
||
}
|
||
}
|
||
|
||
if e.Args()[1].Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: e.Args()[1],
|
||
})
|
||
}
|
||
|
||
if e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1677, int(e.Args()[2].IntPart()))
|
||
if effect != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1677Sub struct {
|
||
node.EffectNode
|
||
remaining int
|
||
}
|
||
|
||
func (e *Effect1677Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
if len(a) > 0 {
|
||
e.remaining = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect1677Sub) DamageLockEx(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 {
|
||
return true
|
||
}
|
||
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, zone.Damage)
|
||
zone.Damage = alpacadecimal.Zero
|
||
e.remaining--
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1678: 附加自身防御和特防能力提升总段数x{0}的固定伤害
|
||
type Effect1678 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1678) OnSkill() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
|
||
total := int64(0)
|
||
if e.Ctx().Our.Prop[1] > 0 {
|
||
total += int64(e.Ctx().Our.Prop[1])
|
||
}
|
||
if e.Ctx().Our.Prop[3] > 0 {
|
||
total += int64(e.Ctx().Our.Prop[3])
|
||
}
|
||
if total <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: e.Args()[0].Mul(alpacadecimal.NewFromInt(total)),
|
||
})
|
||
return true
|
||
}
|
||
|
||
// Effect 1679: 造成的伤害高于{0}则{1}%令对手{2},未触发则吸取对手最大体力的1/{3}
|
||
type Effect1679 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1679) Skill_Use() bool {
|
||
if len(e.Args()) < 4 {
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
||
return true
|
||
}
|
||
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) <= 0 {
|
||
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])
|
||
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
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 1675, &Effect1675{})
|
||
input.InitEffect(input.EffectType.Sub, 1675, &Effect1675Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1676, &Effect1676{})
|
||
input.InitEffect(input.EffectType.Skill, 1677, &Effect1677{})
|
||
input.InitEffect(input.EffectType.Sub, 1677, &Effect1677Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1678, &Effect1678{})
|
||
input.InitEffect(input.EffectType.Skill, 1679, &Effect1679{})
|
||
}
|