宠物宝藏优化
This commit is contained in:
parent
7dcdfbb06a
commit
e7e8f3aad8
@ -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
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user