抽卡模拟器测试版

更新日期: 2024-10-21  最新编辑:木丶阿伦

<img class="img_ring ring" id="ring" src="" alt="" /> <img class="img_ring ring_0" id="ring_0" src="./img/ring2_0.jpg" alt="" /> <img class="img_ring ring_1" id="ring_1" src="./img/ring2_1.jpg" alt="" /> <img class="img_ring ring_2" id="ring_2" src="./img/ring2_2.jpg" alt="" />

抽卡
抽卡*10
如有问题概不负责!




var percent_up_50 = 0.8; var percent_up_45 = 0.4; var percent_other_50 = 0.6; var percent_other_45 = 0.2; var percent_other_2_50 = 0.6; var percent_other_2_45 = 1.4; var percent_40 = 96; var percent_35 = 0; var percent_30 = 0;

var arr_star_3 = [ { name:'马努埃尔',star:3}, { name:'伊布林',star:3}, { name:'哈利',star:3}, { name:'霍尔赫',star:3}, { name:'萨莉亚',star:3}, { name:'佩妮',star:3}, { name:'迪艾格',star:3}, { name:'费丽妮',star:3}, { name:'比利',star:3}, { name:'赫塞',star:3}, { name:'帕尔',star:3}, { name:'特利',star:3}, { name:'弗昂',star:3}, { name:'卡萝尔',star:3}, { name:'科妮',star:3}, { name:'古提',star:3}, { name:'薇薇安',star:3}, { name:'萨妮',star:3}, { name:'伍格',star:3}, { name:'南娜',star:3}, { name:'梅妮',star:3}, { name:'弗利欧',star:3}, { name:'尤妮丝',star:3}, { name:'多利',star:3}, ]; var arr_star_4 = [ { name:'普利基特',star:4 }, { name:'洛洛',star:4 }, { name:'雪娜',star:4 }, { name:'约伦',star:4 }, { name:'勒凡',star:4 }, { name:'波拉',star:4 }, { name:'艾弗伦',star:4 }, { name:'肯尼斯',star:4 }, { name:'科尔尼利亚',star:4 }, { name:'杜兰',star:4 }, { name:'纳尔',star:4 }, { name:'梅贝儿',star:4 }, { name:'伊利斯',star:4 }, { name:'法维欧',star:4 }, { name:'莉塔',star:4 }, { name:'歇尔薇',star:4 }, { name:'罗迪恩',star:4 }, { name:'玛德蕾妮',star:4 }, { name:'诺艾尔',star:4 }, { name:'塞德里克',star:4 }, { name:'梅诺',star:4 }, { name:'巴拉德',star:4 }, { name:'贝尔加',star:4 }, { name:'阿孜莱特',star:4 }, { name:'卡米拉',star:4 }, { name:'迈尔斯',star:4 }, { name:'贝尔特朗',star:4 }, { name:'洁卡莉特',star:4 }, { name:'塔希尔',star:4 }, { name:'特里休',star:4 }, { name:'阿什兰',star:4 }, { name:'劳拉',star:4 }, { name:'佩雷迪尔',star:4 }, { name:'米娜',star:4 }, { name:'卢塞塔',star:4 }, { name:'拉莫纳',star:4 }, { name:'梅蕾特',star:4 }, { name:'皮雅',star:4 }, { name:'哈因茨',star:4 }, { name:'德文',star:4 }, { name:'克雷斯',star:4 }, { name:'卡尔茨',star:4 }, { name:'温格特',star:4 } ]; var arr_star_5_up = [ { name:'奥黛特',star:5 }, ]; var arr_star_5_other = [ { name:'多萝德娅',star:5 }, ]; var arr_star_5_other_2 = [ { name:'洁卡莉特Ex',star:5 }, { name:'亚芬',star:5 }, { name:'乌·鲁代',star:5 }, { name:'泰蕾兹',star:5 }, { name:'莱欧尼尔',star:5 }, { name:'海茵特',star:5 }, { name:'普里姆萝洁',star:5 }, { name:'赛拉斯',star:5 }, { name:'斯凯亚克罗',star:5 }, { name:'菲欧儿',star:5 }, { name:'米罗德',star:5 }, { name:'薇欧拉',star:5 }, { name:'莉妮特',star:5 }, { name:'吉尔德罗伊',star:5 }, { name:'特欧',star:5 }, { name:'索菲亚',star:5 }, { name:'拉斯',star:5 }, { name:'赛西莉',star:5 }, { name:'莲见',star:5 }, { name:'尼兰娜拉',star:5 }, { name:'欧尔贝克',star:5 }, { name:'欧菲莉亚',star:5 }, { name:'希斯柯特',star:5 }, { name:'哈雷',star:5 }, ];


var arr_result = []; var max_result_level = 3; var step = 0;


var total_num = 0; var up_num = 0; var up_half_num = 0; var other_num = 0; var other_half_num = 0;

// 截取字符串 function extractContentBetweenStrings(text, start, end) { var pattern = new RegExp(start + '((.*?)(?=' + end + '))', 'gm'); var matches = text.match(pattern); if (matches) { return matches[0].replace(start, ); } return null; }

function ringMoveIn(count = 1) { var obj_ring = document.getElementById("ring"); obj_ring.style = "display: block;" setTimeout(()=>{ getRoles(count);

},3500) } function getRoles(count = 1) { for (var i = 0; i < count; i++) { cardResult(); }


$("#ring").css("display","none");


if (max_result_level == 5) { $("#ring_2").css("display","block") } else if (max_result_level == 4) { $("#ring_1").css("display","block") } else { $("#ring_0").css("display","block") }

step = 2;

} function cardResult() {


var result_num = Math.floor(Math.random() * 1000)/10.0;

console.log(result_num) var result_role = {}; var star_curr_num = 3; if(result_num < percent_up_50.toFixed(2)) { result_role = getRole("up_50"); } else if(result_num < (percent_up_50 + percent_up_45).toFixed(2)) { result_role = getRole("up_45"); } else if(result_num < (percent_up_50 + percent_up_45 + percent_other_50).toFixed(2)) { result_role = getRole("other_50"); } else if(result_num < (percent_up_50 + percent_up_45 + percent_other_50 + percent_other_45).toFixed(2)) { result_role = getRole("other_45"); } else if(result_num < (percent_up_50 + percent_up_45 + percent_other_50 + percent_other_45 + percent_other_2_50).toFixed(2)) { result_role = getRole("other_2_50"); } else if(result_num < (percent_up_50 + percent_up_45 + percent_other_50 + percent_other_45 + percent_other_2_50 + percent_other_2_45).toFixed(2)) { result_role = getRole("other_2_45"); } else { result_role = getRole("40"); }

if(max_result_level < result_role.star) { max_result_level = result_role.star; } arr_result.push(result_role);


} function getRole( str_star = "30") {

var thisArr = []; var star_num = 3; var half = false; if(str_star == "30") { thisArr = arr_star_3; star_num = 3; half = false; } else if(str_star == "35") { thisArr = arr_star_4; star_num = 3; half = true; } else if( str_star == "40") { thisArr = arr_star_4; star_num = 4; half = false; } else if(str_star == "other_2_45") { thisArr = arr_star_5_other_2; other_half_num ++; star_num = 4; half = true; } else if(str_star == "other_2_50") { thisArr = arr_star_5_other_2; other_num ++; star_num = 5; half = false; } else if(str_star == "other_45") { thisArr = arr_star_5_other; other_half_num ++; star_num = 4; half = true; } else if(str_star == "other_50") { thisArr = arr_star_5_other; other_num ++; star_num = 5; half = false; } else if(str_star == "up_45") { thisArr = arr_star_5_up; up_half_num ++; star_num = 4; half = true; } else if(str_star == "up_50") { thisArr = arr_star_5_up; up_num ++; star_num = 5; half = false; } else { return { name:"",img:"" } }


var arr_length = thisArr.length; var random_num = Math.floor(Math.random() * arr_length); var result = thisArr[random_num]; result.star = star_num; result.half = half; console.log(str_star) console.log(result) return result;

} function clickWindow() { if(step != 2) return; step = 3;

var obj_result_area = document.getElementsByClassName("result_area")[0]; obj_result_area.style = "display:flex;"

// 正常流程 setTimeout(()=>{

obj_result_area.style = "display:flex;background-image: url(https://i.17173cdn.com/g8bz6k/octopathsp/5/58/db_ck_bg.png?20240904091141);background-color:transparent;" $(".img_ring").each(function(){ $(this).css("display","none") }) var obj_all_result = document.getElementsByClassName("all_Result")[0];

obj_all_result.innerHTML = "

" + "本次抽卡" + total_num + "次,消费" + total_num * 30 + "钻石" + "
" + "抽到5星当期UP角色" + up_num + "次,4.5星当期UP角色" + up_half_num + "次
其他5星角色" + other_num + '次,其他4.5星角色' + other_half_num + '次' + "

";

showResults(); },2500)


} function showResults() { var str_html = ""; for (var i = 0; i < arr_result.length; i++) { var objThis = arr_result[i];

str_html = str_html + "

" + "
" + objThis.name + "
" + "
";

for(var j = 0; j < objThis.star ; j ++) { str_html = str_html + "★" } if(objThis.half) { str_html = str_html + "☆" }


var roleData = getRoleDataWithRoleName(objThis.name); var img_lh = "https://wiki.17173.com/octopathsp/thumb.php?f=角色立绘-角色编号" + roleData[0] + ".png&width=200x"; var img_xs = "https://wiki.17173.com/octopathsp/thumb.php?f=" + roleData[2] + ".png&width=100x";


str_html = str_html + "
" + "<img class='img' src='" + img_lh + "'/>" + "<img class='img_xs' src='" + img_xs + "' />" + "

"

}


$(".result_area").each(function(){

$(this).html(str_html).load() })

setTimeout(()=>{ step = 0; },1000) }

function clickStart( count = 1) {

if(step != 0) return step = 1; max_result_level = 3; arr_result = [];

total_num = total_num + count;

setTimeout(function(){ $("#window_area").css("background-color","transparent"); },1000)

var obj_result_area = document.getElementsByClassName("result_area")[0]; obj_result_area.style = "display:none;background-color:#FFFFFF;" obj_result_area.innerHTML = "";


getRoles(count);

}

function initFunc() { $(document).ready(function() { $('#btn_start_1').on("click",function() { console.log('clickStart(1)'); clickStart(1)

}); $('#btn_start_2').on("click",()=>{ console.log('clickStart(10)'); clickStart(10) }); $('#window_area').on("click",()=>{ clickWindow() }); });

}

initFunc()