上传竞技场积分公式代码
This commit is contained in:
parent
1788e4bd5f
commit
7546c87ff4
@ -408,13 +408,13 @@ func (this *modelArena) integralCompute(red, bule *pb.ArenaPlayer, iswin bool) {
|
||||
return
|
||||
}
|
||||
if iswin {
|
||||
red.Changeintegral = int32(redactive.KValue * float32(1-1/float32(1+10^((bule.Integral-red.Integral)/400))))
|
||||
bule.Changeintegral = int32(buleactive.KValue * float32(0-1/float32(1+10^((red.Integral-bule.Integral)/400))))
|
||||
red.Changeintegral = int32(float64(redactive.KValue) * float64(1-1/float32(1+math.Pow(10, float64(float64(bule.Integral-red.Integral)/400)))))
|
||||
bule.Changeintegral = int32(float64(buleactive.KValue) * float64(0-1/float64(1+math.Pow(10, float64(float64(red.Integral-bule.Integral))/400))))
|
||||
red.Integral = red.Integral + red.Changeintegral
|
||||
bule.Integral = bule.Integral + bule.Changeintegral
|
||||
} else {
|
||||
red.Changeintegral = int32(redactive.KValue * float32(0-1/float32(1+10^((bule.Integral-red.Integral)/400))))
|
||||
bule.Changeintegral = int32(redactive.KValue * float32(1-1/float32(1+10^((red.Integral-bule.Integral)/400))))
|
||||
red.Changeintegral = int32(float64(redactive.KValue) * float64(0-1/float64(1+math.Pow(10, float64(float64(bule.Integral-red.Integral)/400)))))
|
||||
bule.Changeintegral = int32(float64(redactive.KValue) * float64(1-1/float64(1+math.Pow(10, float64(float64(red.Integral-bule.Integral)/400)))))
|
||||
red.Integral = red.Integral + red.Changeintegral
|
||||
bule.Integral = bule.Integral + bule.Changeintegral
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"go_dreamfactory/lego/sys/mgo"
|
||||
r "go_dreamfactory/lego/sys/redis"
|
||||
"go_dreamfactory/pb"
|
||||
"math"
|
||||
"math/rand"
|
||||
"sync"
|
||||
"testing"
|
||||
@ -163,3 +164,17 @@ func TestUpdateMany(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func Test_Area(t *testing.T) {
|
||||
var (
|
||||
k int32 = 30
|
||||
red int32 = 110
|
||||
bule int32 = 375
|
||||
)
|
||||
temp := float64(1 - 1/float32(1+float64(math.Pow(10, float64(float64(bule-red)/400)))))
|
||||
fmt.Println(temp)
|
||||
redChangeintegral := int32(float64(k) * temp)
|
||||
fmt.Println(redChangeintegral)
|
||||
// red.Changeintegral = int32(redactive.KValue * float32(1-1/float32(1+10^((bule.Integral-red.Integral)/400))))
|
||||
// bule.Changeintegral = int32(buleactive.KValue * float32(0-1/float32(1+10^((red.Integral-bule.Integral)/400))))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user