Featured image of post 明日方舟寻访模拟器

明日方舟寻访模拟器

拙作

博主几年前初学Python时摸的屑程序,代码相当繁琐(
仓库链接: https://github.com/AllenWu233/arknights_simulation

pool.py

pool.py

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# 0和重复的元素只是为了控制概率
test = {
    'description':'无',
    'six_up':['Aup',0],
    'five_up':['Bup',0],
    'six_stars':['A1','A2','A3'],
    'five_stars':['B1','B2','B3'],
    'four_stars':['C1','C2','C3','C4'],
    'three_stars':['D1','D2','D3','D4','D5'],
    }

# 这个池子没有up!
test2 = {
    'description':'这个池子没有up!',
    'six_up':[0],
    'five_up':[0],
    'six_stars':['能天使','黑','安洁莉娜','银灰','莫斯提马','夜莺','星熊','陈',
        '阿','煌','麦哲伦','赫拉格','斯卡蒂','塞雷娅','闪灵','艾雅法拉','伊芙利特',
        '推进之王','刻俄柏','风笛','傀影','温蒂','早露','铃兰','棘刺','森蚺',
        '史尔特尔','瑕光','泥岩','山','空弦','嵯峨','异客','凯尔希','夕','年',
        'W','迷迭香','浊心斯卡蒂'],
    'five_stars':['狮蝎','食铁兽','蓝毒','拉普兰德','幽灵鲨','德克萨斯','槐琥',
        '赫默','红','白面鸮','空','吽','灰喉','布洛卡','苇草','送葬人','星极',
        '格劳克斯','诗怀雅','夜魔','真理','初雪','崖心','守林人','普罗旺斯','可颂',
        '雷蛇','临光','华法琳','梅尔','天火','陨星','白金','芙兰卡','凛冬','惊蛰',
        '慑砂','巫恋','极境','石棉','月禾','莱恩哈特','断崖','蜜蜡','贾维','安哲拉',
        '燧石','四月','奥斯塔','絮雨','卡夫卡','爱丽丝','乌有','熔泉','赤冬'],
    'four_stars':['安比尔','梅','红云','桃金娘','苏苏洛','格雷伊','猎蜂','阿消',
       '地灵','深海色','古米','蛇屠箱','角峰','调香师','末药','暗索','砾','慕斯',
       '霜叶','缠丸','杜宾','红豆','清道夫','白雪','流星','杰西卡','远山','夜烟',
        '宴','刻刀','波登可','卡达','孑','酸糖','芳汀','泡泡','杰克','松果','豆苗'],
    'three_stars':['芬','炎熔','月见夜','香草','史都华德','卡缇','米格鲁','斑点',
        '空爆','梓兰','芙蓉','克洛丝','玫兰莎','翎羽','泡普卡','安赛尔'],
    }

# '浊心斯卡蒂'和'凯尔希'占六星出率的70%,'W'在剩余出率中以5倍权值出率提升
#  '赤冬'占五星出率的50%
深悼 = {
    'description':"'浊心斯卡蒂'和'凯尔希'占六星出率的70%,"+
        "'W'在剩余出率中以5倍权值出率提升;\n"+
        "'赤冬'占五星出率的50%",
    'six_up':['浊心斯卡蒂','凯尔希','浊心斯卡蒂','凯尔希','浊心斯卡蒂','凯尔希',
        '浊心斯卡蒂','凯尔希','浊心斯卡蒂','凯尔希','浊心斯卡蒂','凯尔希',
        '浊心斯卡蒂','凯尔希',
        0,0,0,0,0,0],
    'five_up':['赤冬',0],
    'six_stars':['能天使','推进之王','伊芙利特','艾雅法拉','安洁莉娜','闪灵',
        '夜莺','星熊','塞雷娅','银灰','斯卡蒂','陈','黑','赫拉格','麦哲伦',
        '莫斯提马','煌','阿','刻俄柏','风笛','傀影','温蒂','早露','铃兰','棘刺',
        '森蚺','史尔特尔','瑕光','泥岩','山','空弦','嵯峨','异客',
        'W','W','W','W','W'],
    'five_stars':['白面鸮','凛冬','德克萨斯','芙兰卡','拉普兰德','幽灵鲨','蓝毒',
        '白金','陨星','天火','梅尔','赫默','华法琳','临光','红','雷蛇','可颂',
        '普罗旺斯','守林人','崖心','初雪','真理','空','狮竭','食铁兽','夜魔',
        '诗怀雅','格劳克斯','星极','送葬人','槐琥','苇草','布洛卡','灰喉','吽',
        '惊蛰','慑砂','巫恋','极境','石棉','月禾','莱恩哈特','断崖','蜜蜡','贾维',
        '安哲拉','燧石','四月','奥斯塔','絮雨','卡夫卡','爱丽丝','乌有','熔泉'],
    'four_stars':['夜烟','远山','杰西卡','流星','白雪','清道夫','红豆','杜宾',
        '缠丸','霜叶','慕斯','砾','暗索','末药','调香师','角峰','蛇屠箱','古米',
        '深海色','地灵','阿消','猎蜂','格雷伊','苏苏洛','桃金娘','红云','梅',
        '安比尔','宴','刻刀','波登可','卡达','孑','酸糖','芳汀','泡泡','杰克',
        '松果','豆苗'],
    'three_stars':['芬','香草','翎羽','玫兰莎','卡缇','米格鲁','克洛丝','炎熔',
        '芙蓉','安赛尔','史都华德','梓兰','空爆','月见夜','班点','泡普卡'],
    }

阿and森蚺 = {
    'description':"'阿'和'森蚺'占六星出率的50%;\n"+
        "'白面鸮'、'蓝毒'和'真理'占五星出率的50%",
    'six_up':['阿','森蚺',0,0],
    'five_up':['白面鸮','蓝毒','真理',0,0,0],
    'six_stars':['能天使','黑','安洁莉娜','银灰','莫斯提马','夜莺','星熊','陈',
        '阿','煌','麦哲伦','赫拉格','斯卡蒂','塞雷娅','闪灵','艾雅法拉','伊芙利特',
        '推进之王','刻俄柏','风笛','傀影','温蒂','早露','铃兰','棘刺','森蚺',
        '史尔特尔','瑕光','泥岩','山','空弦','嵯峨','异客','凯尔希'],
    'five_stars':['狮蝎','食铁兽','蓝毒','拉普兰德','幽灵鲨','德克萨斯','槐琥',
        '赫默','红','白面鸮','空','吽','灰喉','布洛卡','苇草','送葬人','星极',
        '格劳克斯','诗怀雅','夜魔','真理','初雪','崖心','守林人','普罗旺斯','可颂',
        '雷蛇','临光','华法琳','梅尔','天火','陨星','白金','芙兰卡','凛冬','惊蛰',
        '慑砂','巫恋','极境','石棉','月禾','莱恩哈特','断崖','蜜蜡','贾维','安哲拉',
        '燧石','四月','奥斯塔','絮雨','卡夫卡','爱丽丝','乌有','熔泉','赤冬'],
    'four_stars':['安比尔','梅','红云','桃金娘','苏苏洛','格雷伊','猎蜂','阿消',
       '地灵','深海色','古米','蛇屠箱','角峰','调香师','末药','暗索','砾','慕斯',
       '霜叶','缠丸','杜宾','红豆','清道夫','白雪','流星','杰西卡','远山','夜烟',
        '宴','刻刀','波登可','卡达','孑','酸糖','芳汀','泡泡','杰克','松果','豆苗'],
    'three_stars':['芬','炎熔','月见夜','香草','史都华德','卡缇','米格鲁','斑点',
        '空爆','梓兰','芙蓉','克洛丝','玫兰莎','翎羽','泡普卡','安赛尔'],
    }

联合行动 = {
    'description':'特选干员定向寻访',
    'six_up':[0],
    'five_up':[0],
    'six_stars':['夜莺','温蒂','铃兰','棘刺'],
    'five_stars':['芙兰卡','赫默','临光','极境','莱恩哈特','安哲拉'],
    'four_stars':['安比尔','梅','红云','桃金娘','苏苏洛','格雷伊','猎蜂','阿消',
       '地灵','深海色','古米','蛇屠箱','角峰','调香师','末药','暗索','砾','慕斯',
       '霜叶','缠丸','杜宾','红豆','清道夫','白雪','流星','杰西卡','远山','夜烟',
        '宴','刻刀','波登可','卡达','孑','酸糖','芳汀','泡泡','杰克','松果','豆苗'],
    'three_stars':['芬','炎熔','月见夜','香草','史都华德','卡缇','米格鲁','斑点',
        '空爆','梓兰','芙蓉','克洛丝','玫兰莎','翎羽','泡普卡','安赛尔'],
    }

艾雅法拉and史尔特尔 = {
    'description':"'艾雅法拉'和'史尔特尔'占六星出率的50%;\n"+
        "'凛冬'、'槐琥'和'华法琳'占五星出率的50%",
    'six_up':['艾雅法拉','史尔特尔',0,0],
    'five_up':['凛冬','槐琥','华法琳',0,0,0],
    'six_stars':['能天使','黑','安洁莉娜','银灰','莫斯提马','夜莺','星熊','陈',
        '阿','煌','麦哲伦','赫拉格','斯卡蒂','塞雷娅','闪灵','艾雅法拉','伊芙利特',
        '推进之王','刻俄柏','风笛','傀影','温蒂','早露','铃兰','棘刺','森蚺',
        '史尔特尔','瑕光','泥岩','山','空弦','嵯峨','异客','凯尔希'],
    'five_stars':['狮蝎','食铁兽','蓝毒','拉普兰德','幽灵鲨','德克萨斯','槐琥',
        '赫默','红','白面鸮','空','吽','灰喉','布洛卡','苇草','送葬人','星极',
        '格劳克斯','诗怀雅','夜魔','真理','初雪','崖心','守林人','普罗旺斯','可颂',
        '雷蛇','临光','华法琳','梅尔','天火','陨星','白金','芙兰卡','凛冬','惊蛰',
        '慑砂','巫恋','极境','石棉','月禾','莱恩哈特','断崖','蜜蜡','贾维','安哲拉',
        '燧石','四月','奥斯塔','絮雨','卡夫卡','爱丽丝','乌有','熔泉','赤冬'],
    'four_stars':['安比尔','梅','红云','桃金娘','苏苏洛','格雷伊','猎蜂','阿消',
       '地灵','深海色','古米','蛇屠箱','角峰','调香师','末药','暗索','砾','慕斯',
       '霜叶','缠丸','杜宾','红豆','清道夫','白雪','流星','杰西卡','远山','夜烟',
        '宴','刻刀','波登可','卡达','孑','酸糖','芳汀','泡泡','杰克','松果','豆苗'],
    'three_stars':['芬','炎熔','月见夜','香草','史都华德','卡缇','米格鲁','斑点',
        '空爆','梓兰','芙蓉','克洛丝','玫兰莎','翎羽','泡普卡','安赛尔'],
    }

不协和音程 = {
    'description':"'黑键'占六星出率的50%;\n"+
        "'濯尘芙蓉'和'蓝毒'占五星出率的50%",
    'six_up':['黑键',0],
    'five_up':['濯尘芙蓉','蓝毒',0,0],
    'six_stars':['能天使','黑','安洁莉娜','银灰','莫斯提马','夜莺','星熊','陈',
        '阿','煌','麦哲伦','赫拉格','斯卡蒂','塞雷娅','闪灵','艾雅法拉','伊芙利特',
        '推进之王','刻俄柏','风笛','傀影','温蒂','早露','铃兰','棘刺','森蚺',
        '史尔特尔','瑕光','泥岩','山','空弦','嵯峨','异客','凯尔希','卡涅利安',
        '帕拉斯','水月','琴柳','远牙','焰尾','灵知','老鲤','澄闪','菲亚梅塔',
        '号角','艾丽妮','黑键'],
    'five_stars':['狮蝎','食铁兽','蓝毒','拉普兰德','幽灵鲨','德克萨斯','槐琥',
        '赫默','红','白面鸮','空','吽','灰喉','布洛卡','苇草','送葬人','星极',
        '格劳克斯','诗怀雅','夜魔','真理','初雪','崖心','守林人','普罗旺斯',
        '可颂','雷蛇','临光','华法琳','梅尔','天火','陨星','白金','芙兰卡',
        '凛冬','惊蛰','慑砂','巫恋','极境','石棉','月禾','莱恩哈特','断崖',
        '蜜蜡','贾维','安哲拉','燧石','四月','奥斯塔','絮雨','卡夫卡','爱丽丝',
        '乌有','熔泉','赤冬','绮良','羽毛笔','桑葚','灰毫','蚀清','极光','夜半',
        '夏栎','风丸','洛洛','掠风','濯尘芙蓉'],
    'four_stars':['安比尔','梅','红云','桃金娘','苏苏洛','格雷伊','猎蜂','阿消',
        '地灵','深海色','古米','蛇屠箱','角峰','调香师','末药','暗索','砾',
        '慕斯','霜叶','缠丸','杜宾','红豆','清道夫','白雪','流星','杰西卡',
        '远山','夜烟','宴','刻刀','波登可','卡达','孑','酸糖','芳汀','泡泡',
        '杰克','松果','豆苗','深靛','罗比菈塔','褐果'],
    'three_stars':['芬','炎熔','月见夜','香草','史都华德','卡缇','米格鲁','斑点',
        '空爆','梓兰','芙蓉','克洛丝','玫兰莎','翎羽','泡普卡','安赛尔'],
    }

pools = ['test','terst2','深悼','阿and森蚺','联合行动','艾雅法拉and史尔特尔','不协和音程']

arknights_simulation.py

arknights_simulation.py

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
from random import randint
# from time import sleep

import pool

# 一系列要用到的变量
result = []  # 储存抽卡结果
dic = {}  # 定义空字典以共享引用卡池的字典
six, five, four, three = 0, 0, 0, 0  # 用于判断各个星级出现的总数
five_new = True  # 判断首次五星保底
first_recharge = False  # 判断首充
counter1 = 1
counter2 = 0
n = 0  # 用于判断保底次数
# 初始化至纯源石数和合成玉数,选择卡池,展示概率
print("欢迎来到Allen寻访模拟器!\n合成玉不足时,至纯源石会自动转换成合成玉!(1至纯源石=180合成玉)")
while 1:
    try:
        stone = input('请输入初始至纯源石数:')
        stone = int(stone)
        jade = input('请输入初始合成玉数:')
        jade = int(jade)
        break
    except ValueError:
        print('请正确输入数值!')
show_pools = "请选择卡池:\n"  # 卡池展示与选择
for i in pool.pools:
    show_pools += f'{counter1}.{i}\n'
    counter1 += 1
while 1:
    tip = input('\n' + show_pools)
    try:
        dic = eval(f'pool.{pool.pools[int(tip) - 1]}')
        break
    except:
        print("请正确选择卡池!")
# 将六星和五星分别整理到一个集合中,以便展示结果时使用
six_up_result = set(dic['six_up'])
six_up_result.remove(0)
five_up_result = set(dic['five_up'])
five_up_result.remove(0)
six_stars_result = set(dic['six_stars']) | six_up_result
five_stars_result = set(dic['five_stars']) | five_up_result
# 打印卡池
print(f"已选择卡池:{pool.pools[int(tip) - 1]}\n★★★★★★ 六星(2%):", end='')
for i in six_stars_result:
    print(i, end=',')
print("\n★★★★★ 五星(8%):", end='')
for i in five_stars_result:
    print(i, end=',')
print("\n★★★★ 四星(50%):", end='')
for i in dic['four_stars']:
    print(i, end=',')
print("\n★★★ 三星(40%):", end='')
for i in dic['three_stars']:
    print(i, end=',')
print(f"\n\n描述:{dic['description']}\n")


def one():
    """判断抽卡结果"""
    global six, five, four, three, n, five_new, counter2  # 定义全局变量
    # sleep(0.5)
    n += 1
    if n <= 50:
        num = 50
    else:
        num = n  # 判断抽卡次数
    if five_new:
        counter2 += 1  # 判断首次五星保底
    if five_new is True and counter2 == 10:
        new_operator = dic['five_up'][randint(0, len(dic['five_up'])) - 1]
        if new_operator != 0:
            result.append(new_operator)
            print(f'★★★★★ {new_operator}')
        else:
            new_operator = dic['five_stars'][randint(0, len(dic['five_stars'])) - 1]
            result.append(new_operator)
            print(f'★★★★★ {new_operator}')
        five += 1
        five_new = False
    else:
        b = randint(1, 1000)
        if 1 <= b <= 20 + (num - 50) * 20:  # 六星
            new_operator = dic['six_up'][randint(0, len(dic['six_up'])) - 1]
            if new_operator != 0:
                result.append(new_operator)
                print(f'★★★★★★ {new_operator}')
            else:
                new_operator = dic['six_stars'][randint(0, len(dic['six_stars'])) - 1]
                result.append(new_operator)
                print(f'★★★★★★ {new_operator}')
            six += 1
            n = 0  # 重置抽卡次数
            five_new = False
        elif 921 <= b <= 1000:  # 五星
            new_operator = dic['five_up'][randint(0, len(dic['five_up'])) - 1]
            if new_operator != 0:
                result.append(new_operator)
                print(f'★★★★★ {new_operator}')
            else:
                new_operator = dic['five_stars'][randint(0, len(dic['five_stars'])) - 1]
                result.append(new_operator)
                print(f'★★★★★ {new_operator}')
            five += 1
            five_new = False
        elif 421 <= b <= 920:  # 四星
            new_operator = dic['four_stars'][randint(0, len(dic['four_stars'])) - 1]
            four += 1
            result.append(new_operator)
            print(f'★★★★ {new_operator}')
        else:  # 三星
            new_operator = dic['three_stars'][randint(0, len(dic['three_stars'])) - 1]
            three += 1
            result.append(new_operator)
            print(f'★★★ {new_operator}')


def ten():
    """十连"""
    for _ in range(10):
        one()


# 主程序部分
active = True
while active:
    a = input(f"\n至纯源石数:{stone} 合成玉数:{jade}\n输入1单抽,输入2十连:\n(输入'q'以退出)")
    while a == '1':
        if jade >= 600:  # 判断合成玉是否足够
            jade -= 600
            one()
            break
        else:  # 尝试将至纯源石转换成合成玉
            if stone >= 1:
                stone -= 1
                jade += 180
            else:  # 至纯源石不足
                break
    while a == '2':
        if jade >= 6000:  # 判断合成玉是否足够
            jade -= 6000
            ten()
            break
        else:
            if stone >= (6000 - jade) / 180:  # 尝试将至纯源石转换成合成玉
                if (6000 - jade) % 180 == 0:  # 当所需合成玉数能转换成整数颗至纯源石时
                    stone -= int((6000 - jade) / 180)
                    jade = 6000
                else:  # 当所需合成玉数不能转换成整数颗至纯源石时
                    stone -= int((6000 - jade) // 180 + 1)
                    jade += int(((6000 - jade) // 180 + 1) * 180)
            else:
                print('至纯源石不足!请单抽!')
                break
    if a == 'q':  # 退出主程序
        break
    while stone * 180 + jade < 600:  # 氪金系统
        tip = input(f'\n至纯源石数:{stone} 合成玉数:{jade}\n至纯源石不足,是否氪金?首充双倍!(¥648=130至纯源石)(y/n)')
        if tip == 'y':  # 确认氪金
            if not first_recharge:
                stone += 260
            else:
                stone += 130
            print('氪金成功!')
        if tip == 'n':  # 取消氪金并退出主程序
            active = False
            break
# 抽卡结果展示
print(f'\n抽卡数:{len(result)}')
# 打印抽卡结果
print("★★★★★★六星:", end="")
for i in six_stars_result:
    if i in result:  # 判断抽卡结果
        print(f"{i}:{(result.count(i))}", end=" ")
print(f"总数:{six}")

print("★★★★★五星:", end="")
for i in five_stars_result:
    if i in result:  # 判断抽卡结果
        print(f"{i}:{(result.count(i))}", end=" ")
print(f"总数:{five}")

print("★★★★四星:", end="")
for i in dic['four_stars']:
    if i in result:  # 判断抽卡结果
        print(f"{i}:{(result.count(i))}", end=" ")
print(f"总数:{four}")

print("★★★三星:", end="")
for i in dic['three_stars']:
    if i in result:  # 判断抽卡结果
        print(f"{i}:{(result.count(i))}", end=" ")
# 打印总览
print(f"总数:{three}\n消耗合成玉:{len(result) * 600}")
try:  # 防止抽卡数为零时报错
    luck = six / len(result)
except ZeroDivisionError:
    luck = 0.000
print(f"\n六星出货占比:{'%.3f' % luck}")
# if float(luck) > 0.03:
#     print("双黄出货全满潜")
# else:
#     print("醒来枕边泪点点")
# print('\n已退出模拟器!')

input("\n输入任意值以退出......")

虽然很难看,但至少能玩啊(笑)

Built with Hugo
主题 StackJimmy 设计