204 lines
5.3 KiB
Go
204 lines
5.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 1183: 解除自身能力下降状态,解除成功则自身{0}回合内造成的伤害提高{1}%
|
|
type Effect1183 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1183) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
cleared := false
|
|
for i, v := range e.Ctx().Our.Prop[:] {
|
|
if v < 0 && e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
cleared = true
|
|
}
|
|
}
|
|
if !cleared {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1183, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1183Sub struct {
|
|
node.EffectNode
|
|
percent alpacadecimal.Decimal
|
|
}
|
|
|
|
func (e *Effect1183Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
if len(a) > 0 {
|
|
e.Duration(a[0])
|
|
}
|
|
if len(a) > 1 {
|
|
e.percent = alpacadecimal.NewFromInt(int64(a[1]))
|
|
}
|
|
}
|
|
|
|
func (e *Effect1183Sub) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
zone.Damage = zone.Damage.Mul(hundred.Add(e.percent)).Div(hundred)
|
|
return true
|
|
}
|
|
|
|
// Effect 1184: 激发自身潜能,使用后下{0}回合自身获得奇迹之力效果
|
|
type Effect1184 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1184) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1184, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1184Sub struct {
|
|
RoundEffectArg0Base
|
|
active bool
|
|
doubled bool
|
|
}
|
|
|
|
func (e *Effect1184Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
current.SkillEntity.XML.Priority += 1
|
|
e.active = true
|
|
e.doubled, _, _ = e.Input.Player.Roll(50, 100)
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1184Sub) Damage_Mul(zone *info.DamageZone) bool {
|
|
if !e.active || !e.doubled || zone == nil || zone.Type != info.DamageType.Red {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1184Sub) OnSkill() bool {
|
|
if !e.active {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
|
return true
|
|
}
|
|
|
|
damage := e.Ctx().Our.CurPet[0].GetMaxHP().Div(alpacadecimal.NewFromInt(3))
|
|
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: damage,
|
|
})
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1184Sub) Action_end() bool {
|
|
e.active = false
|
|
e.doubled = false
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1184Sub) Action_end_ex() bool {
|
|
e.active = false
|
|
e.doubled = false
|
|
return true
|
|
}
|
|
|
|
// Effect 1185: 消耗自身当前最大体力的1/{0}并使对手受到等量百分比伤害
|
|
type Effect1185 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1185) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
damage := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[0])
|
|
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: damage})
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage})
|
|
return true
|
|
}
|
|
|
|
// Effect 1186: {0}回合内每回合攻击附加自身双防值总和{1}%的百分比伤害
|
|
type Effect1186 struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1186) OnSkill() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
totalDefense := e.Ctx().Our.GetProp(1).Add(e.Ctx().Our.GetProp(3))
|
|
damage := totalDefense.Mul(e.Args()[1]).Div(hundred)
|
|
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 1187: {0}%令对手{1},未触发则消除对手回合类效果
|
|
type Effect1187 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1187) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
|
|
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1183, &Effect1183{})
|
|
input.InitEffect(input.EffectType.Sub, 1183, &Effect1183Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1184, &Effect1184{})
|
|
input.InitEffect(input.EffectType.Sub, 1184, &Effect1184Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1185, &Effect1185{})
|
|
input.InitEffect(input.EffectType.Skill, 1186, &Effect1186{})
|
|
input.InitEffect(input.EffectType.Skill, 1187, &Effect1187{})
|
|
}
|