178 lines
4.6 KiB
Go
178 lines
4.6 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 1198: 对手不处于能力下降状态则造成的伤害提高{0}%
|
|
type Effect1198 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1198) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
if e.Ctx().Opp.HasPropSub() {
|
|
return true
|
|
}
|
|
|
|
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[0])).Div(hundred)
|
|
return true
|
|
}
|
|
|
|
// Effect 1199: 吸取对手能力提升状态,吸取成功则对手{0}回合内无法通过自身技能恢复体力
|
|
type Effect1199 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1199) Skill_Use() bool {
|
|
absorbed := false
|
|
for i, v := range e.Ctx().Opp.Prop[:] {
|
|
if v <= 0 {
|
|
continue
|
|
}
|
|
if !e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
continue
|
|
}
|
|
absorbed = true
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
|
|
}
|
|
if !absorbed || len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 679, int(e.Args()[0].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1200: {0}回合内受到攻击则{1}%对手{2},未触发则消除对手回合类效果
|
|
type Effect1200 struct {
|
|
RoundEffectArg0Base
|
|
triggered bool
|
|
}
|
|
|
|
func (e *Effect1200) DamageSubEx(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
|
if success {
|
|
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
|
|
e.triggered = true
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1200) TurnEnd() {
|
|
if !e.triggered && e.Duration() == 1 {
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
}
|
|
e.EffectNode.TurnEnd()
|
|
}
|
|
|
|
// Effect 1201: 先出手时{0}%使对手{1},未触发则下{2}回合自身先制+{3}
|
|
type Effect1201 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1201) Skill_Use() bool {
|
|
if len(e.Args()) < 4 || !e.IsFirst() {
|
|
return true
|
|
}
|
|
|
|
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
|
if success {
|
|
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1201, int(e.Args()[2].IntPart()), int(e.Args()[3].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1201Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1201Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current == nil || current.SkillEntity == nil || len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
current.SkillEntity.XML.Priority += int(e.Args()[1].IntPart())
|
|
return true
|
|
}
|
|
|
|
// Effect 1202: 造成的伤害低于{0}则自身下{1}次受到的伤害降低{2}点
|
|
type Effect1202 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1202) Skill_Use() bool {
|
|
if len(e.Args()) < 3 || e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1202, int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1202Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
reduce int
|
|
}
|
|
|
|
func (e *Effect1202Sub) 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.reduce = a[1]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1202Sub) DamageSubEx(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 || e.reduce <= 0 {
|
|
return true
|
|
}
|
|
|
|
reduceDamage := alpacadecimal.NewFromInt(int64(e.reduce))
|
|
if zone.Damage.Cmp(reduceDamage) > 0 {
|
|
zone.Damage = zone.Damage.Sub(reduceDamage)
|
|
} else {
|
|
zone.Damage = alpacadecimal.Zero
|
|
}
|
|
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1198, &Effect1198{})
|
|
input.InitEffect(input.EffectType.Skill, 1199, &Effect1199{})
|
|
input.InitEffect(input.EffectType.Skill, 1200, &Effect1200{})
|
|
input.InitEffect(input.EffectType.Skill, 1201, &Effect1201{})
|
|
input.InitEffect(input.EffectType.Sub, 1201, &Effect1201Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1202, &Effect1202{})
|
|
input.InitEffect(input.EffectType.Sub, 1202, &Effect1202Sub{})
|
|
}
|