宠物宝藏优化
This commit is contained in:
parent
822477f49a
commit
70ab147a3d
@ -9,11 +9,21 @@ import (
|
||||
const (
|
||||
CFG_FRIEND_TREASURE_PROB = "FriendTreasureProb"
|
||||
CFG_FRIEND_TREASURE_CHEST = "FriendTreasureChest"
|
||||
CFG_FRIEND_TREASURE_CONST = "FriendTreasureConst"
|
||||
)
|
||||
|
||||
func init() {
|
||||
gamedata.InitCfg(CFG_FRIEND_TREASURE_PROB)
|
||||
gamedata.InitCfg(CFG_FRIEND_TREASURE_CHEST)
|
||||
gamedata.InitCfg(CFG_FRIEND_TREASURE_CONST)
|
||||
}
|
||||
|
||||
func GetBigReward() []*item.Item {
|
||||
data, err := gamedata.GetDataByKey(CFG_FRIEND_TREASURE_CONST, "big_reward")
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return gamedata.GetItemList(data, "Value")
|
||||
}
|
||||
|
||||
func GetFriendTreasureProb(Num int) map[int]int {
|
||||
|
||||
@ -70,13 +70,17 @@ func (f *FriendTreasureMod) EndGame() ([]*item.Item, int, error) {
|
||||
if f.Status == 0 {
|
||||
return nil, 0, fmt.Errorf("game is over")
|
||||
}
|
||||
f.Shift++
|
||||
// f.Shift++
|
||||
ProbAdd := friendTreasureCfg.GetProbAdd(f.Shift)
|
||||
ItemNum := int(float64(f.Star) * (100.0 + float64(ProbAdd)) / 100.0)
|
||||
FriendItemNum := ItemNum / 10
|
||||
Reward := []*item.Item{
|
||||
{Id: item.ITEM_STAR_ID, Num: ItemNum},
|
||||
}
|
||||
if f.Shift == 9 {
|
||||
BigReward := friendTreasureCfg.GetBigReward()
|
||||
Reward = append(Reward, BigReward...)
|
||||
}
|
||||
f.Star = 0
|
||||
f.Shift = 0
|
||||
f.Status = 2
|
||||
|
||||
Loading…
Reference in New Issue
Block a user