Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复因明日方舟新增“中坚寻访”导致抽卡模拟不可用的问题 #1418

Merged
merged 1 commit into from
May 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions plugins/draw_card/handles/prts_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
class Operator(BaseData):
recruit_only: bool # 公招限定
event_only: bool # 活动获得干员
core_only:bool #中坚干员
# special_only: bool # 升变/异格干员


Expand Down Expand Up @@ -54,7 +55,7 @@ def get_card(self, add: float) -> Operator:
all_operators = [
x
for x in self.ALL_OPERATOR
if x.star == star and not any([x.limited, x.recruit_only, x.event_only])
if x.star == star and not any([x.limited, x.recruit_only, x.event_only,x.core_only])
]
acquire_operator = None

Expand Down Expand Up @@ -151,11 +152,16 @@ def _init_data(self):
Operator(
name=value["名称"],
star=int(value["星级"]),
limited="干员寻访" not in value["获取途径"],
limited="标准寻访" not in value["获取途径"] and "中坚寻访" not in value["获取途径"],
recruit_only=True
if "干员寻访" not in value["获取途径"] and "公开招募" in value["获取途径"]
if "标准寻访" not in value["获取途径"] and "中坚寻访" not in value["获取途径"] and "公开招募" in value["获取途径"]
else False,
event_only=True
if "活动获取" in value["获取途径"]
else False,
core_only=True
if "标准寻访" not in value["获取途径"] and "中坚寻访" in value["获取途径"]
else False,
event_only=True if "活动获取" in value["获取途径"] else False,
)
for key, value in self.load_data().items()
if "阿米娅" not in key
Expand Down Expand Up @@ -271,22 +277,27 @@ async def update_up_char(self):
for char in chars:
star = char.split("(")[0].count("★")
name = re.split(r"[:(]", char)[1] if "★(" not in char else re.split("):", char)[1] # 有的括号在前面有的在后面
dual_up = False
if "\\" in name:
names = name.split("\\")
dual_up = True
elif "/" in name:
names = name.split("/")
dual_up = True
else:
names = [name] # 既有用/分割的,又有用\分割的

names = [name.replace("[限定]", "").strip() for name in names]
zoom = 1
if "权值" in char:
match = re.search(r"(在.*?以.*?(\d+).*?倍权值.*?)", char)
Copy link
Contributor Author

@RenYuan2004 RenYuan2004 May 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原代码此处错误抓取了“5”(倍)并将up权值设置为了5.0,实际概率经计算后约为0.03(截止至2023.5.14,为5/52*2%)

zoom = 0.03
else:
match = re.search(r"(占.*?的.*?(\d+).*?%)", char)
zoom = 1
if match:
zoom = float(match.group(1))
zoom = zoom / 100 if zoom > 10 else zoom
if dual_up == True:
zoom = float(match.group(1))/2
else:
zoom = float(match.group(1))
zoom = zoom / 100 if zoom > 1 else zoom
for name in names:
up_chars.append(
UpChar(name=name, star=star, limited=False, zoom=zoom)
Expand Down