模擬陰陽師抽卡-vue

模擬陰陽師抽卡鏈接
原文鏈接

1、概率說明

我分了兩種
(1)平常的概率:R階78.75%,SR階20%,SSR階1%,SP階0.25%
(2)活動2.5倍概率:SP階0.625 SSR階2.5 SR階20 R階76.875

2、關鍵代碼

// 抽卡函數(shù)
        people_push(){
            var rand = (Math.random()*100000).toString().split(".")[0]
            if(this.proba == 1){
                // R階78.75%,SR階20%,SSR階1%,SP階0.25%
                if(0<=rand && rand<250){
                    this.data.push({type: 'sp', url: 'http://my.sinye.xyz/appimg/yys/sp/'+Math.round(Math.random()*14)+'.jpg'})
                }else if(250<=rand && rand<1250){
                    this.data.push({type: 'ssr', url: 'http://my.sinye.xyz/appimg/yys/ssr/'+Math.round(Math.random()*31)+'.jpg'})
                }else if(1250<=rand && rand<21250){
                    this.data.push({type: 'sr', url: 'http://my.sinye.xyz/appimg/yys/sr/'+Math.round(Math.random()*51)+'.jpg'})
                }else if(21250<=rand && rand<=100000){
                    this.data.push({type: 'r', url: 'http://my.sinye.xyz/appimg/yys/r/'+Math.round(Math.random()*33)+'.jpg'})
                }
            }else if(this.proba == 2.5){
                // SP階0.625 SSR階2.5 SR階20 R階76.875
                if(0<=rand && rand<625){
                    this.data.push({type: 'sp', url: 'http://my.sinye.xyz/appimg/yys/sp/'+Math.round(Math.random()*14)+'.jpg'})
                }else if(625<=rand && rand<3125){
                    this.data.push({type: 'ssr', url: 'http://my.sinye.xyz/appimg/yys/ssr/'+Math.round(Math.random()*31)+'.jpg'})
                }else if(3125<=rand && rand<23125){
                    this.data.push({type: 'sr', url: 'http://my.sinye.xyz/appimg/yys/sr/'+Math.round(Math.random()*51)+'.jpg'})
                }else if(23125<=rand && rand<=100000){
                    this.data.push({type: 'r', url: 'http://my.sinye.xyz/appimg/yys/r/'+Math.round(Math.random()*33)+'.jpg'})
                }
            }
        }

由于不會自動更新卡池內(nèi)容,所以不是式神不是最新人物。

?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容