feat: 新增战斗效果并优化boss逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-07 09:55:06 +08:00
committed by cnb
parent a192ffa6bc
commit 7bb0ef856a
7 changed files with 92 additions and 22 deletions

View File

@@ -1,7 +1,6 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
@@ -11,10 +10,10 @@ type NewSel54 struct {
NewSel0
}
func (e *NewSel54) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
func (e *NewSel54) Action_end() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return
return true
}
// 扣除我方体力
@@ -28,6 +27,7 @@ func (e *NewSel54) TurnStart(fattack *action.SelectSkillAction, sattack *action.
Type: info.DamageType.Fixed,
Damage: e.Args()[0],
})
return true
}
func init() {

View File

@@ -1,7 +1,6 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
@@ -11,9 +10,9 @@ type NewSel71 struct {
NewSel0
}
func (e *NewSel71) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
func (e *NewSel71) Action_end() bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return
return true
}
// 每回合结束后对手降低n体力受到伤害
@@ -24,6 +23,7 @@ func (e *NewSel71) TurnStart(fattack *action.SelectSkillAction, sattack *action.
// 每回合结束后自身的恢复m体力
e.Ctx().Our.Heal(e.Ctx().Our, nil, e.Args()[1])
return true
}
func init() {

View File

@@ -0,0 +1,31 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
/**
* 438 n概率恢复1/m
*/
func init() {
input.InitEffect(input.EffectType.Skill, 438, &Effect438{})
}
type Effect438 struct {
node.EffectNode
}
func (e *Effect438) OnSkill() bool {
ok, _, _ := e.Input.Player.Roll(e.SideEffectArgs[0], 100)
if !ok {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[1]))
return true
}

View File

@@ -0,0 +1,36 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
/**
* 439
*/
func init() {
input.InitEffect(input.EffectType.Skill, 439, &Effect439{})
}
type Effect439 struct {
node.EffectNode
}
func (e *Effect439) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
}
func (e *Effect439) Action_end() bool {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[1],
})
return true
}

View File

@@ -58,13 +58,14 @@ func (e *EffectRandomStatus) OnSkill() bool {
// 初始化注册Effect74和Effect75通过不同配置区分
func init() {
// Effect7410%中毒、10%烧伤、10%冻伤70%无效果)
input.InitEffect(input.EffectType.Skill, 74, newEffectRandomStatus([]statusRange{
tf := newEffectRandomStatus([]statusRange{
{upper: 10, status: info.PetStatus.Poisoned}, // 0-9中毒
{upper: 20, status: info.PetStatus.Burned}, // 10-19烧伤
{upper: 30, status: info.PetStatus.Frozen}, // 20-29冻伤
}))
})
// Effect7410%中毒、10%烧伤、10%冻伤70%无效果)
input.InitEffect(input.EffectType.Skill, 74, tf)
input.InitEffect(input.EffectType.Skill, 451, tf)
// Effect7510%麻痹、10%睡眠、10%害怕70%无效果)
input.InitEffect(input.EffectType.Skill, 75, newEffectRandomStatus([]statusRange{
{upper: 10, status: info.PetStatus.Paralysis}, // 0-9麻痹

View File

@@ -43,10 +43,8 @@ type MapBossInfo struct {
Pos model.Pos
IsShow int32 `struc:"uint32" json:"is_show"` // 雷伊首次出现的时候给2,正常精灵给1,雷伊是否首次出现的判断是否首次刷新,
PosInfo []model.Pos `struc:"skip"`
MaxHP int `struc:"skip"`
PosIndex uint32 `struc:"skip"`
//Wer []int32 `struc:"skip"`
Event configm.Event `struc:"skip"`
Config configm.MapNode
}
// 这里存储星球的map

View File

@@ -207,10 +207,7 @@ func (ret *Space) init() {
Region: v.NodeID, //这个是注册的index
Hp: v.HP,
PosInfo: ParseCoordinateString(v.Pos),
MaxHP: int(v.HP),
}
if v.Event != nil {
info.Event = *v.Event
Config: v,
}
ret.MapBossSInfo.INFO = append(ret.MapBossSInfo.INFO, info)
@@ -245,10 +242,16 @@ func (p *Space) IsMatch(t model.Event) bool {
}
func (ret *Space) GenBoss() {
var res info.MapBossSInfo
res.Wer = ret.Wer
for i := 0; i < len(ret.MapBossSInfo.INFO); i++ {
if !ret.IsMatch(ret.MapBossSInfo.INFO[i].Event) {
ret.MapBossSInfo.INFO[i].IsShow = 0
if !ret.IsMatch(*ret.MapBossSInfo.INFO[i].Config.Event) {
if ret.MapBossSInfo.INFO[i].IsShow != 0 {
ret.MapBossSInfo.INFO[i].IsShow = 0
res.INFO = append(res.INFO, ret.MapBossSInfo.INFO[i])
}
continue
}
s := len(ret.MapBossSInfo.INFO[i].PosInfo)
@@ -260,15 +263,16 @@ func (ret *Space) GenBoss() {
if ret.IsChange {
ret.MapBossSInfo.INFO[i].IsShow = 2
}
res.INFO = append(res.INFO, ret.MapBossSInfo.INFO[i])
}
ret.Broadcast(nil, 2021, &ret.MapBossSInfo)
ret.Broadcast(nil, 2021, &res)
}
func (ret *Space) HealHP() {
for _, v := range ret.MapBossSInfo.INFO {
atomic.StoreInt32(&v.Hp, int32(v.MaxHP))
atomic.StoreInt32(&v.Hp, int32(v.Config.HP))
}
}
func (ret *Space) GenWer() {