模拟阴阳师抽卡-vue

模拟阴阳师抽卡-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、关键代码

// 抽卡函数
        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'})
                }
            }
        }

由于不会自动更新卡池内容,所以不是式神不是最新人物。

暂无评论

发送评论 编辑评论


				
上一篇
下一篇