From e7e8f3aad8a10dbcac41805e9785cbe033b35b55 Mon Sep 17 00:00:00 2001 From: hahwu <31872165+hahwu@users.noreply.github.com> Date: Wed, 19 Mar 2025 10:50:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A0=E7=89=A9=E5=AE=9D=E8=97=8F=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../game/mod/friendTreasure.go/friendTreasure.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/server/game/mod/friendTreasure.go/friendTreasure.go b/src/server/game/mod/friendTreasure.go/friendTreasure.go index 656d9542..59741706 100644 --- a/src/server/game/mod/friendTreasure.go/friendTreasure.go +++ b/src/server/game/mod/friendTreasure.go/friendTreasure.go @@ -20,6 +20,9 @@ type FriendTreasureMod struct { const ( FRIEND_TYPE_ALIVE = 1 FRIEND_TYPE_NOT_ALIVE = 2 + + GAME_STATUS_IDLE = 0 // 未开始 + GAME_STATUS_START = 1 // 开始 ) func (f *FriendTreasureMod) InitData() { @@ -34,7 +37,7 @@ func (f *FriendTreasureMod) ZeroUpdate() { f.Pos = nil f.List = make(map[int]*msg.TreasureInfo) f.List2 = nil - f.Status = 0 + f.Status = GAME_STATUS_IDLE } func (f *FriendTreasureMod) InitGame(List []*msg.TreasureInfo, List2 []int32) { @@ -50,7 +53,7 @@ func (f *FriendTreasureMod) AddStar(Star int) { } func (f *FriendTreasureMod) Flip(Pos int) ([]*item.Item, error) { - if f.Status == 0 { + if f.Status == GAME_STATUS_IDLE { return nil, fmt.Errorf("game not start") } f.Shift++ @@ -59,15 +62,15 @@ func (f *FriendTreasureMod) Flip(Pos int) ([]*item.Item, error) { if Info.Type == FRIEND_TYPE_ALIVE { ProbMap := friendTreasureCfg.GetChestProb() Prob := GoUtil.RandMap(ProbMap) - Info.Status = 1 + Info.Status = GAME_STATUS_START return friendTreasureCfg.GetChestItems(Prob), nil } - Info.Status = 1 + Info.Status = GAME_STATUS_START return nil, nil } func (f *FriendTreasureMod) EndGame() ([]*item.Item, int, error) { - if f.Status == 0 { + if f.Status == GAME_STATUS_IDLE { return nil, 0, fmt.Errorf("game is over") } // f.Shift++ @@ -83,7 +86,7 @@ func (f *FriendTreasureMod) EndGame() ([]*item.Item, int, error) { } f.Star = 0 f.Shift = 0 - f.Status = 2 + f.Status = GAME_STATUS_IDLE return Reward, FriendItemNum, nil }