170 lines
3.6 KiB
Go
170 lines
3.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 621: 消除对手能力上升状态,消除成功对手{0}{1}
|
||
type Effect621 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect621) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
if !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
|
||
return true
|
||
}
|
||
|
||
propID := int(e.Args()[0].IntPart())
|
||
if propID < 0 || propID >= 6 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propID), int8(e.Args()[1].IntPart()))
|
||
return true
|
||
}
|
||
|
||
// Effect 622: 自身{0},{6}%概率强化效果翻倍
|
||
type Effect622 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect622) Skill_Use() bool {
|
||
if len(e.SideEffectArgs) < 7 {
|
||
return true
|
||
}
|
||
|
||
double := false
|
||
success, _, _ := e.Input.Player.Roll(e.SideEffectArgs[6], 100)
|
||
double = success
|
||
|
||
for i, v := range e.SideEffectArgs[:6] {
|
||
if v == 0 {
|
||
continue
|
||
}
|
||
if double {
|
||
v *= 2
|
||
}
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(v))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 623: 消除自身能力下降状态,消除成功下{0}回合自身直接攻击必定暴击
|
||
type Effect623 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect623) Skill_Use() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
|
||
cleared := false
|
||
for i, v := range e.Ctx().Our.Prop[:] {
|
||
if v >= 0 {
|
||
continue
|
||
}
|
||
if e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) {
|
||
cleared = true
|
||
}
|
||
}
|
||
if !cleared {
|
||
return true
|
||
}
|
||
|
||
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect623Sub{}, -1)
|
||
return true
|
||
}
|
||
|
||
type Effect623Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect623Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
||
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().SkillEntity.XML.CritRate = 16
|
||
return true
|
||
}
|
||
|
||
// Effect 624: 消除对手能力上升状态,消除成功{0}回合内受到伤害减少{1}点
|
||
type Effect624 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect624) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
if !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
|
||
return true
|
||
}
|
||
|
||
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect624Sub{}, -1)
|
||
return true
|
||
}
|
||
|
||
type Effect624Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect624Sub) DamageSubEx(zone *info.DamageZone) bool {
|
||
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
|
||
return true
|
||
}
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
|
||
reduction := e.Args()[1]
|
||
if zone.Damage.Cmp(reduction) > 0 {
|
||
zone.Damage = zone.Damage.Sub(reduction)
|
||
} else {
|
||
zone.Damage = alpacadecimal.Zero
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 625: 使对手{0},若对手处于弱化状态,弱化效果翻倍
|
||
type Effect625 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect625) Skill_Use() bool {
|
||
double := e.Ctx().Opp.HasPropSub()
|
||
|
||
for i, v := range e.SideEffectArgs[:min(len(e.SideEffectArgs), 6)] {
|
||
if v == 0 {
|
||
continue
|
||
}
|
||
if double {
|
||
v *= 2
|
||
}
|
||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(v))
|
||
}
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 621, &Effect621{})
|
||
input.InitEffect(input.EffectType.Skill, 622, &Effect622{})
|
||
input.InitEffect(input.EffectType.Skill, 623, &Effect623{})
|
||
input.InitEffect(input.EffectType.Sub, 623, &Effect623Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 624, &Effect624{})
|
||
input.InitEffect(input.EffectType.Sub, 624, &Effect624Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 625, &Effect625{})
|
||
}
|