playroom翻牌游戏优化

This commit is contained in:
hahwu 2026-03-05 18:48:25 +08:00
parent c72761d627
commit aa7ee2a381
3 changed files with 24 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import (
"math"
decorateCfg "server/conf/decorate"
limitedTimeEventCfg "server/conf/limited_time_event"
orderCfg "server/conf/order"
"server/game/mod/item"
GoUtil "server/game_util"
"server/msg"
@ -119,6 +120,18 @@ func (d *Decorate) GetDecorateCostItem(AreaId, DecorateId int, DecorateOffIsExis
return Items, PetExp, PartItemList
}
func (d *Decorate) GetNextNeedStar() int {
DecorateAll := decorateCfg.GetAllSortIdByAreaId(d.AreaId)
SubAlice := GoUtil.SubSlices(DecorateAll, GoUtil.MapIntToIntSlice(d.FinishList))
orderFactor := orderCfg.GetOrderFactor(d.GetAreaId())
sort.Ints(SubAlice)
if len(SubAlice) > 0 {
NeedStar := decorateCfg.GetStarCost(d.AreaId, SubAlice[0])
return (NeedStar*orderFactor)/1000 + NeedStar
}
return 0
}
// 一键装饰
func (d *Decorate) DecorateAll(Star int, DecorateOffIsExist bool) ([]*item.Item, []*item.Item, int, []int, []interface{}, int) {
DecorateAll := decorateCfg.GetAllSortIdByAreaId(d.AreaId)

View File

@ -3407,7 +3407,14 @@ func ReqPlayroomInfo(player *Player, buf []byte) error {
}
} else {
PlayroomMod.SetGameId(playroom.GAME_TYPE_FILP)
PlayroomMod.SetGameRewardFlip(int(float64(PlayerData.Star)*0.03), int(float64(PlayerData.Star)*0.05), int(float64(PlayerData.Star)*0.1))
DecorateMod := player.PlayMod.getDecorateMod()
needStar := DecorateMod.GetNextNeedStar()
highReward := int(float64(needStar) * 0.75)
if highReward < PlayerData.Star {
PlayroomMod.SetGameRewardFlip(max(int(float64(needStar)*0.1), 10), max(int(float64(needStar)*0.3), 10), max(int(float64(needStar)*0.75), 10))
} else {
PlayroomMod.SetGameRewardFlip(max(10, int(float64(PlayerData.Star)*0.1)), max(10, int(float64(PlayerData.Star)*0.5)), max(PlayerData.Star, 10))
}
}
player.PlayMod.save()
player.PlayroomVisit(Targer)

View File

@ -92,8 +92,9 @@ func TestFixUserData(t *testing.T) {
func TestRandInt(t *testing.T) {
p1 := new(game.Player)
p1.InitPlayer("3625212")
MailMod := p1.GetMailMod()
MailMod.BackData()
DecorateMod := p1.GetDecorateMod()
needStar := DecorateMod.GetNextNeedStar()
fmt.Printf("Next need star: %d\n", needStar)
}
func TestEndless(t *testing.T) {