用java写一个简单的明日方舟抽卡模拟器

 
import java.util.Random;
import java.util.Scanner;

public class cc3 {
    public static void main(String[] args) {
        //导包随机数和键盘录入
        Random as=new Random();
        int there,four,five,six;

        String[] Liu={"陈","煌","能天使","推进之王","伊芙利特","星熊","闪灵","银灰","夜莺","艾雅法拉","赫拉格","塞雷娅","莫斯提马","风笛","阿","麦哲伦","傀影","斯卡蒂","安洁莉娜","黑","刻俄柏","温蒂","早露","铃兰","棘刺","森蚺","史尔特尔","瑕光","泥岩","山","空弦","嵯峨","异客","凯尔希","卡涅利安","帕拉斯","水月","琴柳","远牙","焰尾","灵知","老鲤","澄闪","菲亚梅塔","号角","艾丽妮","多萝西","斥罪","黑键","白铁"};
        String[] Wu={"四月","薄绿","特米米","安哲拉","贾维","蜜蜡","断崖","莱恩哈特","月禾","极境","巫恋","慑砂","惊蛰","吽","灰喉","布洛卡","苇草","华法琳","赫默","梅尔","天火","陨星","白金","蓝毒","幽灵鲨","拉普兰德","芙兰卡","德克萨斯","凛冬","白面鸮","槐琥","送葬人","星极","格劳克斯","诗怀雅","夜魔","食铁兽","狮蝎 ","空","真理","初雪","崖心","守林人","普罗旺斯","可颂","雷蛇","红","临光","明椒"," 达格达","但书","晓歌","承曦格雷伊","星源","车尔尼","掠风","洛洛","风丸","夏栎","夜半","极光","蚀清","灰毫","桑葚","羽毛笔","绮良","贝娜","赤冬","熔泉","乌有","图耶","爱丽丝"," 卡夫卡","阿米娅","絮雨","奥斯塔"};
        String[] Si={"铅踝","褐果","罗比菈塔","深靛","豆苗","松果","杰克","泡泡","芳汀","酸糖","孑","卡达","波登可","刻刀","宴","清流","安比尔","梅","红云","坚雷","桃金娘","苏苏洛","格雷伊","猎蜂","阿消","地灵","深海色","古米","蛇屠箱","角峰","调香师","嘉维尔","末药","暗索","砾","慕斯","霜叶","缠丸","杜宾","红豆","白雪","流星","杰西卡","远山","夜烟"};
        String[] San={"斑点","泡普卡","月见夜","空爆","梓兰","史都华德","安赛尔","芙蓉","炎熔","安德切尔","克洛丝","米格鲁","卡缇","王博","玫兰莎","翎羽","香草","芬"};
        //生成计数器
        int x = 0,f;
        //生成概率
        double lg = 2.00,
                wg = (100.00 - lg) * 0.08,
                sg = (100.00 - lg) * 0.58;

        Scanner bs = new Scanner(System.in);
        //循环主体
        while (true) {
            System.out.println("输入0退出");
            System.out.println("输入任意数任意抽");
            //六星计数
            int y=0;
            int b = bs.nextInt();
            if (b==0) {
                return;
            }else {
                for (int i = 0; i <b; i++) {
                    f = as.nextInt(99);
                    //判断生成数字,输出星级
                    if (f < lg) {
                        six= as.nextInt(Liu.length-1);
                        System.out.println("******---/"+Liu[six]+"/---");
                        System.out.println(x);
                        y++;//六星数量计数

                        x = 0;//清空保底
                        lg = 2.00;//清空保底时,重置概率
                    } else if (lg <= f & f < wg) {
                        five= as.nextInt(Wu.length-1);
                        System.out.println("***** /"+Wu[five]);
                        x++;
                    } else if (wg < f & f < sg) {
                        four= as.nextInt(Si.length-1);
                        System.out.println("****  /"+Si[four]);
                        x++;
                    } else {
                        there= as.nextInt(San.length-1);
                        System.out.println("***   /"+San[there]);
                        x++;
                    }
                    //大于50抽,每一抽加2%概率
                    if (x > 50) {
                        lg = (x - 50) * 2 + 2;
                    }
                }
                System.out.println(y+"个六星");
                if(y>0) {
                    System.out.println("平均" + b / y + "抽一个");

                }
            }
        }
    }
}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值