PK参数权重 系数= (属性 - 基准属性)/100 R = (体重 - 基准属性)*0.05 + (心情 - 心情)*K*0.4 + (饱食度 - 饱食度)*R*0.4 **********************体重绝对优势****************************** // 纯比体重 // 17,100,100 Vs 130,100,100 R1 = (17 - 50) * 0.05 = -1.65 R2 = (130 - 50) * 0.05 = 4 R2 > R1,R2赢 // 如果心情好 // 17,80,100 Vs 130,40,100 R1 =
(player1, player2 catInfo)
| 233 | R2 > R1,R2赢 |
| 234 | */ |
| 235 | func pkweight(player1, player2 catInfo) (winer, loser catInfo) { |
| 236 | weightOfplayer1 := (player1.Weight-50)*0.05 + |
| 237 | float64((player1.Mood-player2.Mood)*(player1.Mood-50))*0.4 + |
| 238 | (player1.Satiety-player2.Satiety)*(player1.Satiety-50)*0.4 |
| 239 | weightOfplayer2 := (player2.Weight-50)*0.05 + |
| 240 | float64((player2.Mood-player1.Mood)*(player2.Mood-50))*0.4 + |
| 241 | (player2.Satiety-player1.Satiety)*(player2.Satiety-50)*0.4 |
| 242 | if weightOfplayer1 > weightOfplayer2 { |
| 243 | return player1, player2 |
| 244 | } |
| 245 | return player2, player1 |
| 246 | } |