feat: 添加战胜规则配置模块
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-21 00:57:18 +08:00
committed by cnb
parent d9a99155d9
commit 1969c01f3e
6 changed files with 133 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ import (
"blazing/logic/service/fight"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/player"
configmodel "blazing/modules/config/model"
@@ -97,12 +98,34 @@ func (Controller) PlayerFightBoss(data1 *fight.ChallengeBossInboundInfo, p *play
}
ai.Prop[0] = 2
fight.NewFight(p, ai, func(foi model.FightOverInfo) {
var fighc *fight.FightC
fighc, _ = fight.NewFight(p, ai, func(foi model.FightOverInfo) {
if mdata.WinBonusID != 0 {
if foi.Reason == 0 && foi.WinnerId == p.Info.UserID {
p.SptCompletedTask(mdata.WinBonusID, 1)
if len(mdata.Rule) == 0 {
if foi.Reason == 0 && foi.WinnerId == p.Info.UserID {
p.SptCompletedTask(mdata.WinBonusID, 1)
}
} else {
//说明是带规则的
iswin := true
for _, v := range service.NewFightRuleService().GetByRuleIdxs(mdata.Rule) {
r := input.GetRule(int64(v.RuleIdx))
if r != nil {
r.SetArgs(v.Args...)
if !(r.Exec(fighc, &foi)) {
iswin = false
break
}
}
}
if iswin {
p.SptCompletedTask(mdata.WinBonusID, 1)
}
}
}
//p.Done.Exec(model.MilestoneMode.BOSS, []uint32{p.Info.MapID, data.BossId, uint32(foi.Reason)}, nil)

View File

@@ -6,3 +6,7 @@ func InitRule(id int64, t RuleI) {
RuleM[id] = t
}
func GetRule(id int64) RuleI {
return RuleM[id]
}