All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
feat(fight): 新增疲惫状态并优化睡眠状态机制 - 实现疲惫状态(StatusTired),仅限制攻击技能,允许属性技能正常使用 - 重构睡眠状态,改为在被攻击且未miss时立即解除,而非技能使用后 - 修复寄生种子效果触发时机,改为回合开始时触发 - 调整寄生效果的目标为技能施放者而非
345 lines
11 KiB
Go
345 lines
11 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"
|
||
"github.com/gogf/gf/v2/util/grand"
|
||
)
|
||
|
||
// Effect 2170: 对手不处于异常时先制+1且必命中
|
||
type Effect2170 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2170) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||
if current != nil && current.SkillEntity != nil && !e.Ctx().Opp.StatEffect_Exist_all() {
|
||
current.SkillEntity.XML.Priority += 1
|
||
current.SkillEntity.XML.MustHit = 1
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2171: 每有1级能力下降状态吸血,对手能力提升时效果翻倍
|
||
type Effect2171 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2171) SkillHit() bool {
|
||
if len(e.Args()) == 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
drain := 0
|
||
for _, v := range e.Ctx().Our.Prop[:] {
|
||
if v < 0 {
|
||
drain += int(-v)
|
||
}
|
||
}
|
||
if drain <= 0 {
|
||
return true
|
||
}
|
||
heal := alpacadecimal.NewFromInt(int64(drain)).Mul(e.Args()[0])
|
||
if e.Ctx().Opp.HasPropADD() {
|
||
heal = heal.Mul(alpacadecimal.NewFromInt(2))
|
||
}
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
||
return true
|
||
}
|
||
|
||
// Effect 2172: 自身体力不满时附加效果
|
||
type Effect2172 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2172) OnSkill() bool {
|
||
if len(e.Args()) < 2 || e.Ctx().Our.CurPet[0] == nil {
|
||
return true
|
||
}
|
||
if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Our.CurPet[0].GetMaxHP()) < 0 {
|
||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2173: 转移对手异常,并按转移项数削减对手PP
|
||
type Effect2173 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2173) OnSkill() bool {
|
||
if len(e.Args()) < 1 {
|
||
return true
|
||
}
|
||
moved := 0
|
||
for i, v := range e.Ctx().Opp.Prop[:] {
|
||
if v < 0 {
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
|
||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
|
||
moved++
|
||
}
|
||
}
|
||
if moved > 0 {
|
||
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[0].IntPart()))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2174: 对手每有1项PP为0时吸血,未受固定伤害则追加真实伤害
|
||
type Effect2174 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2174) OnSkill() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
zeros := 0
|
||
if e.Ctx().Our.CurPet[0] != nil {
|
||
for _, s := range e.Ctx().Our.CurPet[0].Info.SkillList {
|
||
if s.PP <= 0 {
|
||
zeros++
|
||
}
|
||
}
|
||
}
|
||
if zeros <= 0 {
|
||
return true
|
||
}
|
||
heal := alpacadecimal.NewFromInt(int64(zeros)).Mul(e.Args()[0])
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
||
if e.Ctx().Opp.CurPet[0] != nil && e.Ctx().Opp.CurPet[0].GetHP().Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.True, Damage: heal})
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2175: 技能无效时随机附加若干非限制类异常
|
||
type Effect2175 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2175) Skill_Use_ex() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
statuses := []int{
|
||
int(info.PetStatus.Paralysis),
|
||
int(info.PetStatus.Fear),
|
||
int(info.PetStatus.Tired),
|
||
int(info.PetStatus.Sleep),
|
||
}
|
||
for _, idx := range grand.Perm(len(statuses))[:minInt(int(e.Args()[0].IntPart()), len(statuses))] {
|
||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, statuses[idx])
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2176: 令对手高威力攻击技能PP归零
|
||
type Effect2176 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2176) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
|
||
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2177: 获得八荒之力,常驻无视攻击免疫和能力提升效果
|
||
type Effect2177 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2177) Skill_Use() bool {
|
||
e.Ctx().Our.AddShield(alpacadecimal.NewFromInt(1))
|
||
return true
|
||
}
|
||
|
||
// Effect 2178: 星荟缠时攻击强化,低血时翻倍
|
||
type Effect2178 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2178) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 || e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
if e.Ctx().Opp.CurPet[0] != nil && e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Opp.CurPet[0].GetHP()) < 0 {
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100 + int64(e.Args()[0].IntPart()))).Div(alpacadecimal.NewFromInt(100))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2179: 星火之灾攻击强化,低血时翻倍
|
||
type Effect2179 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2179) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 || e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
if e.Ctx().Opp.CurPet[0] != nil && e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Opp.CurPet[0].GetHP()) < 0 {
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100 + int64(e.Args()[0].IntPart()))).Div(alpacadecimal.NewFromInt(100))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2180: 星海之浸攻击强化,低血时翻倍
|
||
type Effect2180 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2180) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 || e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
if e.Ctx().Opp.CurPet[0] != nil && e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Opp.CurPet[0].GetHP()) < 0 {
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100 + int64(e.Args()[0].IntPart()))).Div(alpacadecimal.NewFromInt(100))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2181: 解除自身异常状态
|
||
type Effect2181 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2181) Skill_Use() bool {
|
||
clearTargetEffects(e.Ctx().Our, e.Ctx().Our)
|
||
return true
|
||
}
|
||
|
||
// Effect 2182: 每次命中消耗全部攻击PP并按消耗量提升威力
|
||
type Effect2182 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2182) SkillHit() bool {
|
||
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
lost := totalLostPP2045(e.Ctx().Our)
|
||
if lost <= 0 {
|
||
return true
|
||
}
|
||
e.Ctx().SkillEntity.XML.Power += int(int64(lost) * e.Args()[2].IntPart())
|
||
return true
|
||
}
|
||
|
||
// Effect 2183: 自身能力提升时攻击强化
|
||
type Effect2183 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2183) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
if e.Ctx().Our.HasPropADD() {
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100 + int64(e.Args()[0].IntPart()))).Div(alpacadecimal.NewFromInt(100))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2184: 命中率提升并无视自身1级命中下降
|
||
type Effect2184 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2184) SkillHit_ex() bool {
|
||
if e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
e.Ctx().SkillEntity.XML.Accuracy += 10
|
||
return true
|
||
}
|
||
|
||
// Effect 2185: 命中率提升并无视自身1级命中下降
|
||
type Effect2185 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2185) SkillHit_ex() bool { return true }
|
||
|
||
// Effect 2186: 命中率提升并无视自身1级命中下降
|
||
type Effect2186 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2186) SkillHit_ex() bool { return true }
|
||
|
||
// Effect 2187: 命中率提升并无视自身1级命中下降
|
||
type Effect2187 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2187) SkillHit_ex() bool { return true }
|
||
|
||
// Effect 2188: 命中率提升0%并无视自身1级命中下降
|
||
type Effect2188 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2188) SkillHit_ex() bool { return true }
|
||
|
||
// Effect 2189: 自身PP总和高于对手时附加效果
|
||
type Effect2189 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2189) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
if totalLostPP2045(e.Ctx().Our) > totalLostPP2045(e.Ctx().Opp) {
|
||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2190: 占位效果
|
||
type Effect2190 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2190) Skill_Use() bool { return true }
|
||
|
||
// Effect 2191: 为对手附加浪潮聚焦
|
||
type Effect2191 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2191) Skill_Use() bool {
|
||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Confused))
|
||
return true
|
||
}
|
||
|
||
// Effect 2192: 自身不处于能力提升状态时先制+1
|
||
type Effect2192 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2192) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||
if current != nil && current.SkillEntity != nil && !e.Ctx().Our.HasPropADD() {
|
||
current.SkillEntity.XML.Priority += 1
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2193: 自身不处于能力提升状态时触发若干轮效果
|
||
type Effect2193 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2193) Skill_Use() bool {
|
||
if len(e.Args()) < 11 || e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
if !e.Ctx().Our.HasPropADD() {
|
||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
|
||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||
}
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2194: 击败对手时对方出战精灵附加致命诅咒
|
||
type Effect2194 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2194) OnSkill() bool {
|
||
if e.Ctx().Opp.CurPet[0] == nil {
|
||
return true
|
||
}
|
||
addTimedStatus(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.DrainedHP), 4)
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 2170, &Effect2170{})
|
||
input.InitEffect(input.EffectType.Skill, 2171, &Effect2171{})
|
||
input.InitEffect(input.EffectType.Skill, 2172, &Effect2172{})
|
||
input.InitEffect(input.EffectType.Skill, 2173, &Effect2173{})
|
||
input.InitEffect(input.EffectType.Skill, 2174, &Effect2174{})
|
||
input.InitEffect(input.EffectType.Skill, 2175, &Effect2175{})
|
||
input.InitEffect(input.EffectType.Skill, 2176, &Effect2176{})
|
||
input.InitEffect(input.EffectType.Skill, 2177, &Effect2177{})
|
||
input.InitEffect(input.EffectType.Skill, 2178, &Effect2178{})
|
||
input.InitEffect(input.EffectType.Skill, 2179, &Effect2179{})
|
||
input.InitEffect(input.EffectType.Skill, 2180, &Effect2180{})
|
||
input.InitEffect(input.EffectType.Skill, 2181, &Effect2181{})
|
||
input.InitEffect(input.EffectType.Skill, 2182, &Effect2182{})
|
||
input.InitEffect(input.EffectType.Skill, 2183, &Effect2183{})
|
||
input.InitEffect(input.EffectType.Skill, 2184, &Effect2184{})
|
||
input.InitEffect(input.EffectType.Skill, 2185, &Effect2185{})
|
||
input.InitEffect(input.EffectType.Skill, 2186, &Effect2186{})
|
||
input.InitEffect(input.EffectType.Skill, 2187, &Effect2187{})
|
||
input.InitEffect(input.EffectType.Skill, 2188, &Effect2188{})
|
||
input.InitEffect(input.EffectType.Skill, 2189, &Effect2189{})
|
||
input.InitEffect(input.EffectType.Skill, 2190, &Effect2190{})
|
||
input.InitEffect(input.EffectType.Skill, 2191, &Effect2191{})
|
||
input.InitEffect(input.EffectType.Skill, 2192, &Effect2192{})
|
||
input.InitEffect(input.EffectType.Skill, 2193, &Effect2193{})
|
||
input.InitEffect(input.EffectType.Skill, 2194, &Effect2194{})
|
||
}
|