基于Vue实现原神抽卡简易代码算法(纯金光率)

编程入门 行业动态 更新时间:2024-10-13 12:17:32

基于Vue实现原神抽卡简易代码<a href=https://www.elefans.com/category/jswz/34/1770096.html style=算法(纯金光率)"/>

基于Vue实现原神抽卡简易代码算法(纯金光率)

狠人话不多,直接上代码就完事了,代码中有详细说明…


<template><div id="container"><button @click="clickGoodLuck(1)">祈愿1次</button><button @click="clickGoodLuck(10)">祈愿10次</button></div>
</template>
<script>export default {name: "elect",data() {return {// 抽卡概率属性probability_golden: 0.6,	//金卡基础概率probability_violet: 5.1,	//紫卡基础概率totoalCount: 0,				//总抽卡次数accNoGoldenCount: 0, 		//不出金次数accNoVioletCount: 0, 		//不出紫次数awardColor: "blue",			//出啥颜色卡};},methods: {// 点击抽卡 1次 or 10次clickGoodLuck(times) {if (times == 1) {thisputeProOne();} else {thisputeProTen();}},// 抽中金卡,重新初始化initAwardedGolden(){this.probability_golden = 0.6;this.accNoGoldenCount = 0;this.awardColor = "golden";},// 抽中紫卡,重新初始化initAwardedViolet(){this.probability_violet = 5.1;this.accNoVioletCount = 0;this.awardColor = "violet";},//单抽概率计算computeProOne(){this.totoalCount++;let randomGolden = (Math.random() * 100).toFixed(2);let randomNumViolet = (Math.random() * 100).toFixed(2);//是否出金 出金大保低if(this.accNoGoldenCount>=90){console.log("出金啦/大保低:", this.probability_golden, "~" + randomGolden+" 抽卡次数:",this.totoalCount);this.initAwardedGolden();return;}//是否出金 出金小保低if(this.accNoGoldenCount>=73){if (this.probability_golden >= randomGolden) {console.log("出金啦/小保低:", this.probability_golden, "~" + randomGolden+" 抽卡次数:",this.totoalCount);this.initAwardedGolden();return;}else{this.probability_golden += 6;}}//是否出金  出金小欧皇if(this.accNoGoldenCount<=73){if (this.probability_golden >= randomGolden) {console.log("出金啦/欧皇:", this.probability_golden, "~" + randomGolden+" 抽卡次数:",this.totoalCount);this.initAwardedGolden();return;}}//是否出紫 if(this.probability_violet >= randomNumViolet){console.log("出紫/欧皇:", this.probability_violet, "~" + randomNumViolet+" 抽卡次数:",this.totoalCount);this.initAwardedViolet();}else{this.accNoVioletCount++;if(this.accNoVioletCount==8){this.probability_violet += 51;}if(this.accNoVioletCount==9){this.probability_violet = 100;}// 出蓝this.awardColor = "blue";console.log("出蓝:", this.probability_violet, "~" + randomNumViolet+" 抽卡次数:",this.totoalCount);}this.accNoGoldenCount++;},//10连概率计算computeProTen(){for (let i = 0; i < 10; i++) {thisputeProOne();}},},};
</script>

在console控制台查看抽卡信息:

古有云:绝云天府有仙徒,其名申鹤习神术。

壁纸放送:

更多推荐

基于Vue实现原神抽卡简易代码算法(纯金光率)

本文发布于:2024-02-19 14:51:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1764503.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:算法   简易   代码   Vue   原神抽卡

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!