222 lines
5.4 KiB
Go
222 lines
5.4 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 1158: 自身每处于{0}种能力提升状态则附加{1}点固定伤害,遇到天敌时效果翻倍
|
|
type Effect1158 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1158) OnSkill() bool {
|
|
if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
count := countPositivePropKinds(e.Ctx().Our) / int(e.Args()[0].IntPart())
|
|
if count <= 0 {
|
|
return true
|
|
}
|
|
|
|
damage := e.Args()[1].Mul(alpacadecimal.NewFromInt(int64(count)))
|
|
if e.ISNaturalEnemy() {
|
|
damage = damage.Mul(alpacadecimal.NewFromInt(2))
|
|
}
|
|
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: damage,
|
|
})
|
|
return true
|
|
}
|
|
|
|
// Effect 1159: 吸取对手能力提升状态,吸取成功则自身免疫下{0}次受到的异常状态
|
|
type Effect1159 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1159) Skill_Use() bool {
|
|
copied := false
|
|
for i, v := range e.Ctx().Opp.Prop[:] {
|
|
if v <= 0 {
|
|
continue
|
|
}
|
|
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
|
|
copied = true
|
|
}
|
|
}
|
|
if !copied || len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1099, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1160: 获得{0}点护盾,护盾消失时吸取对手{1}点体力且令对手随机{2}个技能的PP值归零
|
|
type Effect1160 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1160) Skill_Use() bool {
|
|
if len(e.Args()) < 3 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Our.AddShield(e.Args()[0])
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1160, int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1160Sub struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1160Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.CanStack(false)
|
|
e.Duration(-1)
|
|
}
|
|
|
|
func (e *Effect1160Sub) ShieldChange(before, after alpacadecimal.Decimal) bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if before.Cmp(alpacadecimal.Zero) <= 0 || after.Cmp(alpacadecimal.Zero) > 0 {
|
|
return true
|
|
}
|
|
|
|
damage := e.Args()[0]
|
|
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: damage,
|
|
})
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
|
|
}
|
|
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
// Effect 1161: {0}回合内若对手恢复体力则自身恢复等量体力的{1}%
|
|
type Effect1161 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1161) OnSkill() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1161, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1161Sub struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect1161Sub) Heal_Pre(ac action.BattleActionI, value *int) bool {
|
|
if len(e.Args()) < 2 || value == nil || *value <= 0 {
|
|
return true
|
|
}
|
|
|
|
heal := alpacadecimal.NewFromInt(int64(*value)).Mul(e.Args()[1]).Div(hundred)
|
|
if heal.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.Heal(e.Ctx().Opp, &action.SelectSkillAction{}, heal)
|
|
return true
|
|
}
|
|
|
|
// Effect 1162: {0}回合内每回合都有{1}%概率令对手{2},未触发则下{4}次受到的伤害减少{5}点
|
|
type Effect1162 struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect1162) TurnEnd() {
|
|
if len(e.Args()) < 6 {
|
|
e.RoundEffectArg0Base.TurnEnd()
|
|
return
|
|
}
|
|
|
|
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok {
|
|
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
|
|
e.RoundEffectArg0Base.TurnEnd()
|
|
return
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1162, int(e.Args()[4].IntPart()), int(e.Args()[5].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
e.RoundEffectArg0Base.TurnEnd()
|
|
}
|
|
|
|
type Effect1162Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect1162Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1162Sub) DamageSubEx(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
reduce := e.Args()[1]
|
|
if zone.Damage.Cmp(reduce) <= 0 {
|
|
zone.Damage = alpacadecimal.Zero
|
|
} else {
|
|
zone.Damage = zone.Damage.Sub(reduce)
|
|
}
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1158, &Effect1158{})
|
|
input.InitEffect(input.EffectType.Skill, 1159, &Effect1159{})
|
|
input.InitEffect(input.EffectType.Skill, 1160, &Effect1160{})
|
|
input.InitEffect(input.EffectType.Sub, 1160, &Effect1160Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1161, &Effect1161{})
|
|
input.InitEffect(input.EffectType.Sub, 1161, &Effect1161Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1162, &Effect1162{})
|
|
input.InitEffect(input.EffectType.Sub, 1162, &Effect1162Sub{})
|
|
}
|