模拟阴阳师抽卡-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'})
                }
            }
        }

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值