AI 积分波动处理

This commit is contained in:
meixiongfeng 2023-11-10 16:01:30 +08:00
parent 6715575176
commit dd3a0a9dbb

View File

@ -2,9 +2,11 @@ package entertainment
import ( import (
"context" "context"
"crypto/rand"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"math/big"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
@ -89,17 +91,18 @@ func (this *matchComp) MatchNotic(players map[string]interface{}) (err error) {
if robots, err := this.module.ModuleTools.RandRobotConfig(1); err == nil { if robots, err := this.module.ModuleTools.RandRobotConfig(1); err == nil {
if len(robots) > 0 { if len(robots) > 0 {
p2 = &pb.PlayerData{ p2 = &pb.PlayerData{
Userinfo: &pb.BaseUserInfo{ Userinfo: &pb.BaseUserInfo{Uid: "999", Sid: "", Name: robots[0].Name, Gender: robots[0].Sex, Skin: robots[0].Showid, Aframe: "", Title: "", Lv: robots[0].Lvshow},
Uid: "999", Cardid: this.module.configure.GetRobotGameConsumeHero(),
Sid: "", }
Name: robots[0].Name, n1, _ := rand.Int(rand.Reader, big.NewInt(100)) // AI 玩家积分波动
Gender: robots[0].Sex, if n1.Int64()%2 == 0 {
Skin: robots[0].Showid, p2.Consumeexp = p1.Consumeexp + int32(n1.Int64())
Aframe: "", } else {
Title: "", p2.Consumeexp = p1.Consumeexp - int32(n1.Int64())
Lv: robots[0].Lvshow, if p2.Consumeexp < 0 { // 负数过滤
}, n1, _ := rand.Int(rand.Reader, big.NewInt(100))
Cardid: this.module.configure.GetRobotGameConsumeHero(), p2.Consumeexp = int32(n1.Int64())
}
} }
} }
} }