update code

This commit is contained in:
HibiKier
2021-09-05 02:21:38 +08:00
parent 21a5feda43
commit 7afb099c12
84 changed files with 3377 additions and 1404 deletions
+24
View File
@@ -0,0 +1,24 @@
from configs.config import MAX_SIGN_GOLD
from typing import Union
from .config import PROB_DATA
import random
def random_event(impression: float) -> 'Union[str, int], str':
"""
签到随机事件
:param impression: 好感度
:return: 额外奖励 和 类型
"""
rand = random.random() - impression / 1000
for prob in PROB_DATA.keys():
if rand <= prob:
return PROB_DATA[prob], 'props'
gold = random.randint(1, random.randint(1, int(1 if impression < 1 else impression)))
gold = MAX_SIGN_GOLD if gold > MAX_SIGN_GOLD else gold
return gold, 'gold'