Ubuntu

기능: 플레이한 챔피언 퀴즈 생성

Showing 1 changed file with 21 additions and 0 deletions
...@@ -320,6 +320,27 @@ function generateQuiz() { ...@@ -320,6 +320,27 @@ function generateQuiz() {
320 info = `${fakerData.name}의 LCK 통산 승률 : ${lckWR}%`; 320 info = `${fakerData.name}의 LCK 통산 승률 : ${lckWR}%`;
321 generateOX(quizO, quizX, info); 321 generateOX(quizO, quizX, info);
322 //#endregion 322 //#endregion
323 +
324 + //#region 챔피언 플레이 ox
325 + var champions = fakerData.champions;
326 + var champList = Object.keys(champions);
327 + var rareChampList = [];
328 + for (i = 0; i < champList.length; i++) {
329 + if (champions[champList[i]].totalGamePlay <= 2) {
330 + rareChampList.push(champions[champList[i]]);
331 + }
332 + }
333 + for (i = 0; i < 4; i++) {
334 + var champIndex = Math.floor(Math.random() * rareChampList.length);
335 + quizO = `${fakerData.name}는 대회에서 '${rareChampList[champIndex].name}'를 플레이한 적이 있다.`;
336 + quizX = `${fakerData.name}는 대회에서 '${rareChampList[champIndex].name}'를 플레이한 적이 없다.`;
337 + info = `'${rareChampList[champIndex].name}' : ${rareChampList[champIndex].totalGamePlay}게임,
338 + ${rareChampList[champIndex].totalWin}승, ${rareChampList[champIndex].kDA}KDA`;
339 + generateOX(quizO, quizX, info);
340 +
341 + champList.splice(champIndex,1);
342 + }
343 + //#endregion
323 } 344 }
324 345
325 function generateOX(quizO, quizX, moreInfo) { 346 function generateOX(quizO, quizX, moreInfo) {
......