pet_home_server/src/server/game/mod/charge/ChargeFunc.go
2025-10-11 11:06:13 +08:00

62 lines
1.4 KiB
Go

package charge
import (
"math"
)
func GetChessDiamond(Lv, Type int) int {
Diamond := 0.0
if Type == 1 {
Diamond = 0.27 * math.Exp(float64(Lv)*0.56)
} else {
Diamond = 2.64 * math.Pow(float64(Lv), 2.43)
}
d := int(Diamond)
if d > 10 {
r := d % 10
if r > 3 {
return d - r
}
}
return max(1, d)
}
// func getChessMainRand(Color string) []*Rand {
// r := make([]*Rand, 0)
// for i := 6; i <= 10; i++ {
// Diamond := int(math.Pow(2, float64(i-1)) / 2.5)
// ChessId := mergeDataCfg.GetChessIdByLvAndColor(i, Color)
// if ChessId == 0 {
// continue
// }
// r = append(r, &Rand{ChessId: ChessId, Diamond: Diamond})
// }
// return r
// }
// func getChessSecondaryRand(Color string) []*Rand {
// r := make([]*Rand, 0)
// for i := 5; i <= 9; i++ {
// Diamond := int((math.Pow(2, float64(i-1)) / 2.5) * 2)
// ChessId := mergeDataCfg.GetChessIdByLvAndColor(i, Color)
// if ChessId == 0 {
// continue
// }
// r = append(r, &Rand{ChessId: ChessId, Diamond: Diamond})
// }
// return r
// }
// func getChessSubRand(Color string) []*Rand {
// r := make([]*Rand, 0)
// for i := 5; i <= 9; i++ {
// Diamond := int(math.Pow(2, float64(i-1))/2.5 + 6.4)
// ChessId := mergeDataCfg.GetChessIdByLvAndColor(i, Color)
// if ChessId == 0 {
// continue
// }
// r = append(r, &Rand{ChessId: ChessId, Diamond: Diamond})
// }
// return r
// }