boss属性丢失,全部被限制属性不能超越,应该给ai和玩家施加不同的getinfo方法
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

道具扣除判断,因为判断扣完大于0,所以导致只剩一个的时候,道具成功使用但是不会扣除数量
This commit is contained in:
xinian
2026-04-15 14:44:46 +08:00
parent 5a7e20efec
commit 523d835ac0
3 changed files with 10 additions and 2 deletions

View File

@@ -1,8 +1,16 @@
package player package player
import "blazing/modules/player/model"
type AI_player struct { type AI_player struct {
baseplayer baseplayer
CanCapture int CanCapture int
BossScript string BossScript string
} }
func (p *AI_player) GetPetInfo(_ uint32) []model.PetInfo {
ret := make([]model.PetInfo, 0, len(p.Info.PetList))
ret = append(ret, p.Info.PetList...)
return ret
}

View File

@@ -61,7 +61,7 @@ func (s *ItemService) UPDATE(id uint32, count int) error {
if ok { if ok {
updateModel := s.dbm(s.Model).Where("item_id", id) updateModel := s.dbm(s.Model).Where("item_id", id)
if count < 0 { if count < 0 {
updateModel = updateModel.Where("item_cnt + ? > 0", count) updateModel = updateModel.Where("item_cnt + ? >= 0", count)
} }
result, err := updateModel.Increment("item_cnt", count) result, err := updateModel.Increment("item_cnt", count)

View File

@@ -173,7 +173,7 @@ func updateItemCountTx(tx gdb.TX, userID uint32, id uint32, count int) error {
Where("is_vip", cool.Config.ServerInfo.IsVip). Where("is_vip", cool.Config.ServerInfo.IsVip).
Where("item_id", id) Where("item_id", id)
if count < 0 { if count < 0 {
updateModel = updateModel.Where("item_cnt + ? > 0", count) updateModel = updateModel.Where("item_cnt + ? >= 0", count)
} }
result, err := updateModel.Increment("item_cnt", count) result, err := updateModel.Increment("item_cnt", count)