discord.js计算视频游戏中Map列表上两个团队的胜率

gxwragnw  于 2021-09-13  发布在  Java
关注(0)|答案(0)|浏览(179)

我正在制作一个机器人,可以计算出哪两支球队在csgo的8张不同Map上的获胜率最好。
我试着做一个函数来计算获胜率,但我不能将它提取到每个团队的变量中。所以我可以在discord机器人中显示它。有什么办法可以做到这一点吗?

const mapPool = ["de_ancient", "de_dust2", "de_inferno", "de_mirage", "de_nuke", "de_overpass", "de_train", "de_vertigo"];

//displayes absolute winrates. percentdisplay = perc1/(perc1+perc2)*100
function displayAbsoluteWinrates(){
  for(a = 0; a < mapPool.length; a++){
    perc1 = team1stats[mapPool[a]];
    perc2 = team2stats[mapPool[a]];
    percent1 = (perc1/(perc1+perc2)*100).toFixed(0);
    percent2 = (perc2/(perc1+perc2)*100).toFixed(0);

    var team1map = mapPool[a];

    //var div1 = document.getElementById("t1"+mapPool[a]);
    //div1.innerText = percent1+"%";

    //var div2 = document.getElementById("t2"+mapPool[a]);
    //div2.innerText = percent2+"%";

    if(percent2 > percent1){
      //div1.style.backgroundColor = "red";
      //div2.style.backgroundColor = "green";
    }else{
      //div1.style.backgroundColor = "green";
      //div2.style.backgroundColor = "red";
    }
    if(percent2 == percent1){
      //div1.style.backgroundColor = "darkorange";
      //div2.style.backgroundColor = "darkorange";
    }
  }
}

I've rewritten some code that was meant to be for an HTML site into a discord bot.

Sorry if my explanation isn't that good.

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题