Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
实现1383-1387技能效果,包括自然祝福状态下的属性强化、自然祝福层数管理、护盾效果等
69 lines
1.5 KiB
Go
69 lines
1.5 KiB
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
)
|
|
|
|
// Effect 1389: {0}回合内自身能力提升状态被消除或吸取则{1}%使对手{2},未触发则消除对手回合类效果
|
|
type Effect1389 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1389) Skill_Use() bool {
|
|
if len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(
|
|
input.EffectType.Sub,
|
|
1389,
|
|
int(e.Args()[0].IntPart()),
|
|
int(e.Args()[1].IntPart()),
|
|
int(e.Args()[2].IntPart()),
|
|
)
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1389Sub struct {
|
|
RoundEffectArg0Base
|
|
triggered bool
|
|
}
|
|
|
|
func (e *Effect1389Sub) PropBefer(source *input.Input, prop int8, level int8) bool {
|
|
if e.triggered || source != e.Ctx().Opp {
|
|
return true
|
|
}
|
|
if prop < 0 || int(prop) >= len(e.Ctx().Our.Prop) {
|
|
return true
|
|
}
|
|
if level != 0 || e.Ctx().Our.Prop[prop] <= 0 {
|
|
return true
|
|
}
|
|
if len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
|
|
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
|
if !success {
|
|
return true
|
|
}
|
|
if addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart())) {
|
|
e.triggered = true
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1389Sub) TurnEnd() {
|
|
if !e.triggered && e.Duration() == 1 {
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
}
|
|
e.EffectNode.TurnEnd()
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1389, &Effect1389{})
|
|
input.InitEffect(input.EffectType.Sub, 1389, &Effect1389Sub{})
|
|
}
|