detopoi 1 jaar geleden
bovenliggende
commit
e1004931d2

+ 79 - 10
game/algo/rougeGen.py

@@ -19,14 +19,17 @@ last_theme = {
 
 theme_map = {
     "theme_1": {"A": T.theme1_A_mon_dic, "B": T.theme1_B_mon_dic, "C": T.theme1_C_mon_dic, "D": T.theme1_D_mon_dic},
-    "theme_2": {"A": T.theme2_A_mon_dic, "B": T.theme2_B_mon_dic, "C": T.theme2_C_mon_dic},
+    "theme_2": {"A": T.theme2_A_mon_dic, "B": T.theme2_B_mon_dic, "C": T.theme2_C_mon_dic, "D": T.theme2_D_mon_dic},
     "theme_3": {"A": T.theme3_A_mon_dic, "B": T.theme3_B_mon_dic, "C": T.theme3_C_mon_dic},
+    # "theme_1": {"A": T.theme1_C_mon_dic, "B": T.theme1_C_mon_dic, "C": T.theme1_C_mon_dic, "D": T.theme1_C_mon_dic},
+    # "theme_2": {"A": T.theme2_B_mon_dic, "B": T.theme2_B_mon_dic, "C": T.theme2_B_mon_dic, "D": T.theme2_B_mon_dic},
+    # "theme_3": {"A": T.theme3_B_mon_dic, "B": T.theme3_B_mon_dic, "C": T.theme3_B_mon_dic},
 }
 
 
 def get_random_theme(theme):
     global last_theme
-    if theme == "theme_1":
+    if theme in {"theme_1", "theme_2"}:
         candidates = ["A", "B", "C", "D"]
     else:
         candidates = ["A", "B", "C"]
@@ -468,12 +471,16 @@ def district_obstacles_allocation(total_dis_point: list, total_s_e, diff, theme_
         final_op.append(opt)
         op_points.remove(opt)
     battle_points = op_points
-    battle_points.append(total_s_e[0])
+    if level_num not in [3, 8, 13, 18]:
+        battle_points.append(total_s_e[0])
     battle_points.append(total_s_e[1])
     # 现在battle_points为所有战斗点,而op_points为所有其他节点
     battle_dict = {}
     opt_dict = {}
     general_dict = {}
+    if level_num in [3, 8, 13, 18]:
+        opt_dict[total_s_e[0]] = "bank"
+        general_dict[total_s_e[0]] = "bank"
     for room in final_op:
         # 对于每个坐标,随机选择一个种类
         chosen_category = random.choice(optional_type_list)
@@ -536,6 +543,8 @@ def district_obstacles_allocation(total_dis_point: list, total_s_e, diff, theme_
             wall, cube, district = S.boss_cell_generate(diff, theme_dic, cell_type, room)
         elif general_dict[room] == "shop":
             wall, district = S.shop_cell_generate(room, shop_level, level_num)
+        elif general_dict[room] == "bank":
+            wall, district = S.bank(room)
         elif general_dict[room] == "exercise":
             wall, cube, district = S.exercise_cell_generate(room)
         elif general_dict[room] == "casino":
@@ -940,6 +949,8 @@ def main_func():
         R.rouge_theme_2 = "永东寒原"
     elif theme_2 == T.theme2_C_mon_dic:
         R.rouge_theme_2 = "迷雾古林"
+    elif theme_2 == T.theme2_D_mon_dic:
+        R.rouge_theme_2 = "猩红书阁"
     if theme_3 == T.theme3_A_mon_dic:
         R.rouge_story = "地狱矿工"
         R.rouge_theme_3 = "熔岩深矿"
@@ -1338,6 +1349,67 @@ def main_func():
                                      ["elem8", "elem69", "elem70", "elem105", "elem7", "elem75"],
                                      ["forestpve", "forestpve", "forestpve"], ["elem37", "elem38", "elem39"],
                                      "wallemd.ogg", must_speed=True)
+    elif theme_2 == T.theme2_D_mon_dic:
+        data_map6 = generalMapJson(
+            map6_se,
+            ["HDMC",  "HDMC",   "HDMC",  "HDMC", "HDMC", "HDMC", "HDMC"],
+            ["elem152", "elem128", "elem129", "elem153", "elem151", "elem154", "elem262"],
+            ["HDMC", "HDMC"],
+            ["elem201", "elem242"],
+            ["HDMC"],
+            ["elem101"],
+            "rogue_library1.ogg", final_point_6, final_cube_6,
+            district_6, [], [], final_fog_6
+        )
+        data_att6 = OptionalMapJson(direction_6, ["HDMC"], ["elem152"], ["HDMC"], ["elem101"], "rogue_library1.ogg")
+        data_map7 = generalMapJson(
+            map7_se,
+            ["HDMC",  "HDMC",   "HDMC",   "HDMC",   "HDMC",  "HDMC", "HDMC", "HDMC", "HDMC"],
+            ["elem152", "elem128", "elem128", "elem129", "elem129", "elem153", "elem151", "elem154", "elem262"],
+            ["HDMC", "HDMC"],
+            ["elem201", "elem242"],
+            ["HDMC"],
+            ["elem101"],
+            "rogue_library1.ogg", final_point_7, final_cube_7,
+            district_7, [], [], final_fog_7
+        )
+        data_att7 = OptionalMapJson(direction_7, ["HDMC"], ["elem152"], ["HDMC"], ["elem101"], "rogue_library1.ogg")
+        data_map8 = generalMapJson(
+            map8_se,
+            ["HDMC",  "HDMC",   "HDMC",   "HDMC",   "HDMC",  "HDMC", "HDMC", "HDMC", "HDMC", "HDMC", "HDMC"],
+            ["elem152", "elem128", "elem128", "elem128", "elem129", "elem129", "elem129", "elem153", "elem151", "elem154", "elem262"],
+            ["HDMC", "HDMC"],
+            ["elem242", "elem201"],
+            ["HDMC"],
+            ["elem101"],
+            "rogue_library1.ogg", final_point_8, final_cube_8,
+            district_8, [], [], final_fog_8
+        )
+        data_att8 = OptionalMapJson(direction_8, ["HDMC"], ["elem152"], ["HDMC"], ["elem101"], "rogue_library1.ogg")
+        data_map9 = generalMapJson(
+            map9_se,
+            ["HDMC",  "HDMC",   "HDMC",  "HDMC", "HDMC", "HDMC", "HDMC", "HDMC", "HDMC"],
+            ["elem128", "elem129", "elem152", "elem152", "elem152", "elem153", "elem151", "elem154", "elem262"],
+            ["HDMC", "HDMC", "HDMC"],
+            ["elem242", "elem242", "elem201"],
+            ["HDMC"],
+            ["elem135"],
+            "rogue_library2.ogg", final_point_9, final_cube_9,
+            district_9, [], [], final_fog_9
+        )
+        data_att9 = OptionalMapJson(direction_9, ["HDMC"], ["elem128"], ["HDMC"], ["elem135"], "rogue_library2.ogg")
+        data_map10 = generalMapJson(
+            map10_se,
+            ["HDMC",  "HDMC",   "HDMC",  "HDMC", "HDMC", "HDMC", "HDMC", "HDMC", "HDMC"],
+            ["elem128", "elem129", "elem152", "elem152", "elem152", "elem153", "elem151", "elem154", "elem262"],
+            ["HDMC"],
+            ["elem242"],
+            ["HDMC"],
+            ["elem135"],
+            "rogue_library2.ogg", final_point_10, final_cube_10,
+            district_10, [], [], final_fog_10
+        )
+        data_att10 = OptionalMapJson(direction_10, ["HDMC"], ["elem128"], ["HDMC"], ["elem135"], "rogue_library2.ogg", must_speed=True)
 
     if theme_3 == T.theme3_A_mon_dic:
         data_map11 = generalMapJson(map11_se, ["mine", "mine"], ["elem5", "elem201"], ["mine", "mine", "mine"],
@@ -1817,13 +1889,10 @@ def main_func_new():  # 暂时没用
         R.rouge_story = "轮齿之怒"
         R.rouge_theme_3 = "械城之心"
 
-    # 不同难度的难度系数(顺序:     第一层/           第二层/          第三层/          艾登层/          命运层/         深海层)
-    Easy_diff_list = [10, 16, 20, 25, 32, 20, 25, 30, 35, 42, 30, 35, 40, 45, 50, 30, 35, 40, 45, 50, 35, 40, 45, 50,
-                      56, 50, 56, 64, 75, 88]
-    Hard_diff_list = [12, 18, 24, 30, 40, 24, 30, 36, 42, 54, 36, 42, 52, 64, 75, 36, 42, 52, 64, 75, 40, 48, 60, 70,
-                      80, 70, 80, 90, 100, 108]
-    Hell_diff_list = [18, 24, 30, 40, 50, 30, 36, 42, 50, 60, 42, 52, 64, 75, 88, 42, 52, 64, 75, 88, 50, 60, 72, 80,
-                      96, 80, 92, 108, 120, 140]
+    # 不同难度的难度系数(顺序:         第一层|              第二层|              第三层|              艾登层|               命运层|              深海层)
+    Easy_diff_list = [10, 16, 20, 25, 32, 20, 25, 30, 35, 42, 30, 35, 40, 45, 50, 30, 35, 40, 45, 50, 35, 40, 45, 50, 56, 50, 56, 64, 75, 88]
+    Hard_diff_list = [12, 18, 24, 30, 40, 24, 30, 36, 42, 54, 36, 42, 52, 64, 75, 36, 42, 52, 64, 75, 40, 48, 60, 70, 80, 70, 80, 90, 100, 108]
+    Hell_diff_list = [18, 24, 30, 40, 50, 30, 36, 42, 50, 60, 42, 52, 64, 75, 88, 42, 52, 64, 75, 88, 50, 60, 72, 80, 96, 80, 92, 108, 120, 140]
     diff_dic = {"Baby": Easy_diff_list, "Easy": Easy_diff_list, "Normal": Hard_diff_list, "Hell": Hell_diff_list}
 
     # import time

+ 24 - 6
game/algo/shapeGen.py

@@ -811,11 +811,11 @@ def shop_cell_generate(cell, shop_level=1, level_num=1):
     seller_1 = ["RougeShopHP100", "RougeShopDMG100", "RougeSmallHPRecoveryPotion", "RougeSmallHPRecoveryPotion", "RougeSmallHPRecoveryPotion", "RougeShopMonsterDefenseN200", "RougeShopMonsterHPN4", "RougeShopHPReviveCard", "RougeShopFlameSelfDMGN20"]
     seller_2 = ["RougeShopHP100", "RougeShopHP200", "RougeShopDMG100", "RougeShopDMG200", "RougeSmallHPRecoveryPotion", "RougeSmallHPRecoveryPotion", "RougeSmallHPRecoveryPotionMiddle", "RougeSmallHPRecoveryPotionMiddle", "RougeShopMonsterDefenseN200", "RougeShopMonsterDefenseN400", "RougeShopMonsterHPN4", "RougeShopMonsterHPN8", "RougeShopHPReviveCard", "RougeShopHPReviveCard", "RougeShopFlameSelfDMGN20", "RougeShopFlameSelfDMGN40", "RougeShopSwitchHPDMG", "RougeShopSlowImmune", "RougeShopReverseImmune", "RougeShopRootImmune", "RougeShopStunImmune", "RougeShopDestination"]
     seller_3 = ["RougeShopHP100", "RougeShopHP200", "RougeShopHP300", "RougeShopDMG100", "RougeShopDMG200", "RougeShopDMG300", "RougeSmallHPRecoveryPotion", "RougeSmallHPRecoveryPotion", "RougeSmallHPRecoveryPotionMiddle", "RougeSmallHPRecoveryPotionMiddle", "RougeSmallHPRecoveryPotionBig", "RougeSmallHPRecoveryPotionBig", "RougeSmallHPRecoveryPotionBig", "RougeShopMonsterDefenseN200", "RougeShopMonsterDefenseN400", "RougeShopMonsterDefenseN800", "RougeShopMonsterHPN4", "RougeShopMonsterHPN8", "RougeShopMonsterHPN16", "RougeShopHPReviveCard", "RougeShopHPReviveCard", "RougeShopHPReviveCard", "RougeShopFlameSelfDMGN20", "RougeShopFlameSelfDMGN40", "RougeShopFlameSelfDMGN60", "RougeShopSwitchHPDMG", "RougeShopSlowImmune", "RougeShopReverseImmune", "RougeShopRootImmune", "RougeShopStunImmune"] + \
-        ["RougeShopDestination"]
-    seller_4 = ["RougeShopHP300", "RougeShopDMG300", "RougeSmallHPRecoveryPotionBig", "RougeShopMonsterHPN16", "RougeShopHPReviveCard", "RougeShopFlameSelfDMGN60", "RougeShopSwitchHPDMG", "RougeShopSlowImmune", "RougeShopReverseImmune", "RougeShopRootImmune", "RougeShopStunImmune", "RougeShopDestination"]
+        ["RougeShopDestination", "RougeShopDefense50"]
+    seller_4 = ["RougeShopHP300", "RougeShopDMG300", "RougeShopDefense50", "RougeSmallHPRecoveryPotionBig", "RougeShopMonsterHPN16", "RougeShopHPReviveCard", "RougeShopFlameSelfDMGN60", "RougeShopSwitchHPDMG", "RougeShopSlowImmune", "RougeShopReverseImmune", "RougeShopRootImmune", "RougeShopStunImmune", "RougeShopDestination"]
     seller_5 = seller_4 # 巫术商店(用血量来买伤害/道具/金币)
-    sell_num = random.randint(3,4)
-    if shop_level==3:
+    sell_num = random.randint(3, 4)
+    if shop_level == 3:
         if random.randint(1,100)>=90:
             shop_level = 4
             sell_num = random.randint(3,4)
@@ -881,9 +881,9 @@ def combat_decision(cell, level_num):
     cube = [(4, 3), (3, 4), (6, 4), (6, 5), (5, 6), (4, 6), (8, 8), (12, 10), (11, 10), (10, 11), (10, 12), (12, 13), (13, 12)]
     district = [{"name": "RougeCombatAccept","y": 5,"x": 11},{"name": "RougeCombatRun","y": 11,"x": 5}]
     # print(R.pass_status[R.difficulty], level_num, R.story_eden, R.story_destiny)
-    if R.pass_status[R.difficulty] >= 1 and level_num == 10 and not R.story_eden and not R.story_destiny:
+    if R.pass_status[R.difficulty] >= 1 and level_num == 10 and not R.has_eden_combat:
         # print("comem on!")
-        R.story_eden = True
+        R.has_eden_combat = True
         district = [{"name": "RougeStoryEden","y": 5,"x": 11},{"name": "RougeStoryRun","y": 11,"x": 5}]
     # 坐标映射
     for mon in district:
@@ -910,6 +910,24 @@ def casino(cell):
     return final_wall, final_cube, district
 
 
+# 银行
+def bank(cell):
+    wall = [(4,9),(4,10),(4,11),(4,12),(5,10),(5,12),(6,4),(6,6),(6,9),(6,10),(6,12),(6,13),(7,3),(7,4),(7,6),(7,7),(7,9),(7,13),(8,3),(8,11),(12,9),(12,10),(12,11),(12,12),(11,10),(11,12),(10,4),(10,6),(10,9),(10,10),(10,12),(10,13),(9,3),(9,4),(9,6),(9,7),(9,9),(9,13)]
+    district = [
+        {"name": "RougeBankBorrow50","y": 9,"x": 5},
+        {"name": "RougeBankBorrow100","y": 9,"x": 11},
+        {"name": "RougeBankCostHP","y": 11,"x": 5},
+        {"name": "RougeBankCostBomb","y": 11,"x": 11},
+        {"name": "RougeBankRun","y": 5,"x": 8}
+    ]
+    for mon in district:
+        new_xy = sub_cell_map((mon["x"], mon["y"]), cell)
+        mon["x"] = new_xy[0]
+        mon["y"] = new_xy[1]
+    final_wall = sub_cell_map(wall, cell)
+    return final_wall, district
+
+
 
 
 

+ 67 - 7
game/algo/utils.py

@@ -11,14 +11,19 @@ from game.const import game as G
 from game.const import rouge as R
 from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data
 
-server_ip = "123.249.17.43:5000"
+# server_ip = "123.249.17.43:5000"
+server_ip = "8.140.226.118:5000"  # new
 ALLOWED_CHARACTERS = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_=+[]{}|;:,.<>?/")
+user_documents_folder = os.path.expanduser("~\\Documents")  # 获取用户的"文档"文件夹路径
+qqtpve_folder = os.path.join(user_documents_folder, "QQTPVE")  # 构建QQTPVE文件夹路径
+os.makedirs(qqtpve_folder, exist_ok=True)  # 确保QQTPVE文件夹存在,如果不存在则创建
+rouge_file_path = os.path.join(qqtpve_folder, "rougeOB.rougedata")  # 构建文件路径
 
 
 def load_online_config():
     file_path = os.path.join(os.getcwd(), 'login.json')  # 获取绝对路径
     if not os.path.exists(file_path):
-        print("login.json 存在")
+        print("login.json 不存在")
         login_json = {"online_mode": True, "UID": "", "username": "", "password": ""}
         with open(f'login.json', 'w', encoding='utf-8') as file:
             json.dump(login_json, file, indent=4, ensure_ascii=False)
@@ -34,6 +39,33 @@ def load_online_config():
     return login_json["online_mode"]
 
 
+def kubi_online():
+    try:
+        with open("login.json", encoding="utf-8") as f:
+            login_json = json.load(f)
+    except JSONDecodeError:
+        with open("login.json", encoding="utf-8_sig") as f:
+            login_json = json.load(f)
+    if login_json["online_mode"]:
+        try_login()
+    else:
+        choice = eg.buttonbox(msg=f"连接到酷比网络即可跨终端分享战斗经验与数据", title="酷比网络", choices=["酷比连接", "离线游戏"])
+        if choice == "酷比连接":
+            login_json["online_mode"] = True
+            with open(f'login.json', 'w', encoding='utf-8') as file:
+                json.dump(login_json, file, indent=4, ensure_ascii=False)
+            G.IS_ONLINE = True
+            if G.UID == "" and G.USERNAME == "":
+                register()
+                new_info = load_rouge_data(rouge_file_path)
+                new_info["record"] = "null"
+                result = update_profile(G.UID, new_info, G.PASSWORD)
+                print(result.get('message', '未知错误'))
+            try_login()
+        elif choice == "离线游戏":
+            return
+
+
 def try_login():
     try:
         with open("login.json", encoding="utf-8") as f:
@@ -46,9 +78,12 @@ def try_login():
             _result = uid_login(G.UID, G.PASSWORD)
             if _result.get('message', '未知错误') == "登录成功":
                 G.USERNAME = _result['user_info']['name']
+                login_json["username"] = G.USERNAME
+                with open(f'login.json', 'w', encoding='utf-8') as file:
+                    json.dump(login_json, file, indent=4, ensure_ascii=False)
                 G.IS_ONLINE = True
                 # eg.msgbox(f"{G.USERNAME}({G.UID})登录成功!", "成功")
-                choice = eg.buttonbox(msg=f"{G.USERNAME}({G.UID})登录成功!", title="欢迎", choices=["进入主界面", "修改名字", "覆盖本地数据", "离线游戏"])
+                choice = eg.buttonbox(msg=f"{G.USERNAME}({G.UID})登录成功!", title="欢迎", choices=["进入主界面", "修改名字", "覆盖本地数据", "离线游戏", "退出登录"])
                 if choice == "修改名字":
                     change_username()
                 elif choice == "覆盖本地数据":
@@ -59,16 +94,30 @@ def try_login():
                         json.dump(login_json, file, indent=4, ensure_ascii=False)
                     G.IS_ONLINE = False
                     return False
+                elif choice == "退出登录":
+                    login_json["UID"] = ""
+                    login_json["username"] = ""
+                    login_json["password"] = ""
+                    with open(f'login.json', 'w', encoding='utf-8') as file:
+                        json.dump(login_json, file, indent=4, ensure_ascii=False)
+                    register()
                 return True
-        if G.USERNAME != "":
+        elif G.USERNAME != "":
             _result = username_login(G.USERNAME, G.PASSWORD)
             if _result.get('message', '未知错误') == "登录成功":
                 G.UID = _result['user_info']['UID']
+                login_json["UID"] = G.UID
+                with open(f'login.json', 'w', encoding='utf-8') as file:
+                    json.dump(login_json, file, indent=4, ensure_ascii=False)
                 G.IS_ONLINE = True
                 eg.msgbox(f"{G.USERNAME}({G.UID})登录成功!", "成功")
                 return True
         eg.msgbox(f"登录失败!请检查登录信息或网络连接!", "失败")
     G.IS_ONLINE = False
+    login_json["online_mode"] = False
+    with open(f'login.json', 'w', encoding='utf-8') as file:
+        json.dump(login_json, file, indent=4, ensure_ascii=False)
+    G.IS_ONLINE = False
     return False
 
 
@@ -147,7 +196,7 @@ def get_online_data():
         return
     latest_data = get_profile(G.UID).get('profile', {})
     if not latest_data:
-        return
+        return get_online_data()
     if "Chunli" not in latest_data.keys():
         for hero_name in ["Chunli","Titan","Chris","SeaPrince_old","Witch","Surprise"]:
             if hero_name not in latest_data.keys():
@@ -173,7 +222,7 @@ def save_online():
     if latest_data is None:
         return
     new_data = {}
-    real_exp = int(R.rouge_exp * R.diff_exp[R.difficulty])
+    real_exp = int(R.rouge_exp * R.diff_exp[R.difficulty] + R.task_exp)
     for hero in R.hero_name.keys():
         if hero == R.rouge_hero:
             exp = int(latest_data[hero]["exp"]) + real_exp
@@ -212,7 +261,7 @@ def input_login():
     values = eg.multpasswordbox("用户登录", "输入信息", fields)
     if not values or not all(values):
         if values is None:
-            return
+            return False
     username, password = values
     try:
         with open("login.json", encoding="utf-8") as f:
@@ -227,6 +276,7 @@ def input_login():
     status = try_login()
     if not status:
         input_login()
+    return True
 
 
 def real_register():
@@ -266,6 +316,7 @@ def real_register():
 
 
 def uid_login(uid, password):
+    # return uid_login_inner(uid)
     url = f'http://{server_ip}/uid_login'
     try:
         response = requests.post(url, json={'uid': uid, 'password': password})
@@ -274,6 +325,15 @@ def uid_login(uid, password):
         return {'message': '无法连接到服务器'}
 
 
+def uid_login_inner(uid):
+    url = f'http://{server_ip}/uid_login_no_password'
+    try:
+        response = requests.post(url, json={'uid': uid})
+        return response.json()
+    except requests.exceptions.ConnectionError:
+        return {'message': '无法连接到服务器'}
+
+
 def username_login(username, password):
     url = f'http://{server_ip}/username_login'
     try:

+ 2 - 1
game/const/game.py

@@ -5,7 +5,7 @@ import sys
 # GAME_PATH = os.path.join(os.path.dirname(__file__), '..', '..')
 GAME_PATH = os.path.dirname(os.path.abspath(sys.argv[0]))
 
-VERSION = "3.1.2"
+VERSION = "3.2.7"
 SERVER = "123.249.17.43:5000"
 
 UID = 0
@@ -46,6 +46,7 @@ SPECIAL_SPEED = 1
 SPECIAL_POWER = 0
 SPECIAL_BOMB = 0
 
+ALL_CLEAR = True
 CHEAT = False
 TIME = 0
 LAST_MAP_TIME = 0

+ 49 - 25
game/const/rouge.py

@@ -3,22 +3,46 @@ from game.const import game as G
 import json
 import os
 
-# debug_mode = True
-debug_mode = False
+debug_mode = True
+# debug_mode = False
 test_mode = False
 # print_mode = True
 print_mode = False
 
 
-lv_list = [100,160,240,360,480,640,1080,2080,3600,6400,12800,25600,36800,48800]
+#       0    1    2    3    4    5    6     7     8     9    10     11     12     13     14      15      16
+lv_list = [100, 160, 240, 360, 480, 640, 1080, 2080, 3600, 6400, 12800, 25600, 36800, 48800, 188800, 888880]
+max_lv = len(lv_list) + 1       # 17
+max_valid_exp = sum(lv_list)
+cum_exp = [sum(lv_list[:k]) for k in range(max_lv)]
+# print(max_lv, max_valid_exp, cum_exp)
 
 
-def current_lv(lv):
-    if lv >= sum(lv_list):
-        return 15
-    for k in range(0, 14):
-        if sum(lv_list[:k]) <= lv < sum(lv_list[:k+1]):
-            return k + 1
+def current_lv(exp):
+    if exp >= max_valid_exp:
+        return max_lv
+    for k in range(max_lv):
+        if exp < cum_exp[k]:
+            return k
+
+
+def remain_exp(exp, current_only=False):
+    if exp >= max_valid_exp:
+        return "--"
+    for k in range(max_lv):
+        if exp < cum_exp[k]:
+            if current_only:
+                return str(exp - cum_exp[max(0, k-1)])
+            else:
+                return f"{exp - cum_exp[max(0,k-1)]}/{lv_list[k-1]}"
+
+
+def current_remain_exp(exp):
+    if exp >= max_valid_exp:
+        return "--"
+    for k in range(max_lv):
+        if exp < cum_exp[k]:
+            return str(cum_exp[k] - exp)
 
 
 def speed_lv(speed):
@@ -66,14 +90,14 @@ def coin_lv(lv):
 
 skill_map = {
     "Fox":        {1: 0.4,   2: 0.5,  3: 0.6,   4: 0.7,   5: 0.8,   6: 1},
-    "Boboli":     {1: 0.02,  2: 0.03, 3: 0.04,  4: 0.05,  5: 0.06,  6: 0.07},
-    "Naruto_old": {1: 1.3,   2: 1.5,  3: 1.6,   4: 1.8,   5: 2.0,   6: 2.4},
-    "Asha":       {1: 0.008, 2: 0.01, 3: 0.012, 4: 0.015, 5: 0.017, 6: 0.02},
+    "Boboli":     {1: 0.02,  2: 0.03, 3: 0.04,  4: 0.05,  5: 0.08,  6: 0.12},
+    "Naruto_old": {1: 1.3,   2: 1.5,  3: 1.6,   4: 1.8,   5: 2.2,   6: 2.6},
+    "Asha":       {1: 0.008, 2: 0.01, 3: 0.012, 4: 0.015, 5: 0.018, 6: 0.024},
     "Maria":      {1: 100,   2: 150,  3: 200,   4: 300,   5: 360,   6: 500},
     "Chunli":     {1: 8,     2: 7,    3: 6,     4: 5,     5: 4,     6: 3},
     "Titan":      {1: 100,   2: 180,  3: 240,   4: 300,   5: 360,   6: 450},
     "TitanDelta": {1: 0,     2: 80,   3: 60,    4: 60,    5: 60,    6: 90},
-    "Chris":      {1: 1.8,   2: 2.2,  3: 2.4,   4: 2.6,   5: 2.8,   6: 3.2},
+    "Chris":      {1: 1.8,   2: 2.2,  3: 2.4,   4: 2.6,   5: 3,     6: 3.5},
     "ChrisLV":    {1: "I",   2: "II", 3: "III", 4: "IV",  5: "V",   6: "VI"},
     "SeaPrince":  {1: 2,     2: 2,    3: 3,     4: 3,     5: 4,     6: 5},
     "SeaPrinceD": {1: 0,     2: 0,    3: 1,     4: 0,     5: 1,     6: 1},
@@ -82,7 +106,7 @@ skill_map = {
 }
 
 basic_lv_map = {
-    0: 1, 1: 1, 2: 1, 3: 1, 4: 1, 5: 2, 6: 2, 7: 2, 8: 2, 9: 3, 10: 3, 11: 4, 12: 4, 13: 4, 14: 4, 15: 4, 16: 5, 17: 6, 18: 6
+    0: 1, 1: 1, 2: 1, 3: 1, 4: 1, 5: 2, 6: 2, 7: 2, 8: 2, 9: 3, 10: 3, 11: 4, 12: 4, 13: 4, 14: 4, 15: 4, 16: 4, 17: 4, 18: 4
 }
 
 
@@ -180,12 +204,15 @@ task_RougeTreasureDestinyWizard = 0
 task_combat = 0
 task_revival = 0
 
+last_pass_theme_num = 0
+
 rouge_data = None
 rouge_hero = "Fox"
 rouge_lv = 1
 extra_lv = 0
 rouge_exp = 0
 game_exp = 0
+task_exp = 0
 rouge_story = None
 story_achieve = {
     "地狱矿工": "<您征服了炽热的熔岩火海,整个黑龙王国将永远臣服您的麾下>",
@@ -205,6 +232,8 @@ rouge_theme_5 = None
 rouge_destiny = {"RougeTreasureDestiny": 0, "RougeTreasureDestinyWizard": 0, "RougeTreasureDestinyMachine": 0}
 
 coin = 8
+coin_borrow = 0
+has_loan = False
 difficulty = "Easy"
 difficulty_num = 1
 pass_status = {"Baby": 0, "Easy": 0, "Normal": 0, "Hell": 0, "Hell+": 0}
@@ -215,6 +244,7 @@ hero_name = {
     "Witch": "嫦娥", "Surprise": "???"
 }
 diff_dic = {"Baby": "练习", "Easy": "简单", "Normal": "困难", "Hell": "炼狱", "Hell+": "炼狱+"}
+diff_order = {"Baby": 0, "Easy": 1, "Normal": 2, "Hell": 3, "Hell+": 4}
 diff_exp = {"Baby": 0.1, "Easy": 1, "Normal": 1.8, "Hell": 2.4, "Hell+": 3}
 diff_elite_num = {"Baby": 2, "Easy": 3, "Normal": 4, "Hell": 5, "Hell+": 5}
 diff_elite_normal_num = {"Baby": 3, "Easy": 4, "Normal": 5, "Hell": 6, "Hell+": 7}
@@ -242,6 +272,7 @@ story_destiny = False
 story_ocean = False
 story_skyland = False
 
+has_eden_combat = False
 has_ocean_shop = False
 
 current_standard_HP = 2500
@@ -265,7 +296,9 @@ lv_dic = {
     "lv12": {"HP": 4000, "damage": 3200, "speed": 5,   "bomb": 6},
     "lv13": {"HP": 4100, "damage": 3300, "speed": 5,   "bomb": 6},
     "lv14": {"HP": 4200, "damage": 3400, "speed": 5,   "bomb": 6},
-    "lv15": {"HP": 4500, "damage": 3500, "speed": 5.83333, "bomb": 6}
+    "lv15": {"HP": 4500, "damage": 3500, "speed": 5.83333, "bomb": 6},
+    "lv16": {"HP": 4800, "damage": 3500, "speed": 5.83333, "bomb": 6},
+    "lv17": {"HP": 5000, "damage": 3500, "speed": 5.83333, "bomb": 7}
 }
 
 
@@ -275,7 +308,7 @@ growth = {
     "Naruto_old":    {"HP": 50,  "Damage": 120},
     "Asha":          {"HP": 100, "Damage": 60},
     "Maria":         {"HP": 300, "Damage": 300},
-    "Chunli":        {"HP": 70,  "Damage": 80},
+    "Chunli":        {"HP": 150, "Damage": 150},
     "Titan":         {"HP": 200, "Damage": 100},
     "Chris":         {"HP": 100, "Damage": 100},
     "SeaPrince_old": {"HP": 80,  "Damage": 70},
@@ -284,15 +317,6 @@ growth = {
 }
 
 
-def remain_exp(exp):
-    lv_list = [100,160,240,360,480,640,1080,2080,3600,6400,12800,25600,36800,48800]
-    if exp >= sum(lv_list):
-        return "--"
-    for k in range(0,14):
-        if sum(lv_list[:k]) <= exp < sum(lv_list[:k+1]):
-            return str(exp - sum(lv_list[:k])) + "/" + str(lv_list[k])
-
-
 last_exp = 0
 last_message = ""
 

+ 37 - 5
game/const/rouge_theme.py

@@ -9,19 +9,22 @@ elite4 = ["RogueFieldLeafMonster", "RogueFieldFireThorn", "RogueFieldPlantWizard
 elite5 = ["BpurpleBigMon","BwaterMagician","CK","BfireMagician","BthunderMagician","RogueCopyMagicKKK","RogueCopyMagicWizard","RogueCopyMagicPoisonWizard"]
 elite6 = ["RogueTundraAAwakenWitch","RogueGlacierABear","RogueGlacierASnowGiant","RogueGlacierASnowSnakeKing","RogueTundraAIceMonsBallBig","RogueGlacierATroll","RogueTundraASnowGiantWhite"]
 elite7 = ["RogueForestADarkFlower","RogueForestAGiantTree","RogueForestATroll","RogueForestADragonBoss","RogueForestASnake","RogueForestAGrumpyBear","RogueForestAFungus"]
+elite8 = ["RogueLibraryDollDevil","RogueLibraryChessQueen","RogueLibraryForbiddenBook","RogueLibraryBloodMonster","RogueLibraryReaperGhost","RogueLibraryWomanPortrait","RogueLibraryTeddy","RogueLibraryBloodWitch"]
 
-elite8 = ["MineCIceMonsKing","MineCVolcanoMonsterBlue","MineCVolcanoMonsterRed","RogueCopyMineStone","RogueCopyMineLavaDragonBoss","RogueCopyMineSkeletonKnight","MineCWizard", "RogueCopyMineLavaGiant"]
-elite9 = ["GobiCTroll","RogueGobiAAnubis","GobiCStoneGiant","GobiCDragonBig","MineCVolcanoMonsterRed","RogueGobiASkeletonKnight","RogueGobiARobotBoss","RogueGobiASandDear"]
-elite10 = ["RogueLabAKubiElite","RogueLabAFireArtillery","SteamacityLabCAttackScorpion","SteamacityLabBFireCrabBig","SteamacityLabCSniperBot","SteamacityLabAZeus","SteamacitySlumCChickenBig","RogueLabATimerBot","RogueLabACloneMafia","RogueLabABigSlime","RogueLabAHugeDoll"]
 
+elite9 = ["MineCIceMonsKing","MineCVolcanoMonsterBlue","MineCVolcanoMonsterRed","RogueCopyMineStone","RogueCopyMineLavaDragonBoss","RogueCopyMineSkeletonKnight","RogueCopyMineWizard", "RogueCopyMineLavaGiant"]
+elite10 = ["GobiCTroll","RogueGobiAAnubis","GobiCStoneGiant","GobiCDragonBig","MineCVolcanoMonsterRed","RogueGobiASkeletonKnight","RogueGobiARobotBoss","RogueGobiASandDear"]
+elite11 = ["RogueLabAKubiElite","RogueLabAFireArtillery","SteamacityLabCAttackScorpion","SteamacityLabBFireCrabBig","SteamacityLabCSniperBot","SteamacityLabAZeus","SteamacitySlumCChickenBig","RogueLabATimerBot","RogueLabACloneMafia","RogueLabABigSlime","RogueLabAHugeDoll"]
+
+elite77 = ["RogueOceanAAwakenWitch","WavendAbyssSitePalaceDMantis","WavendCoralGulfDJellyBig","WavendDragonValleyDReefMonster","WavendCoralGulfDCrabBig","WavendAbyssSiteSuburbDGiantActiniaria","WavendAbyssSitePalaceDTroll","WavendAbyssSitePalaceDServant","WavendAbyssSitePalaceDHydroGun","WavendAbyssSitePalaceDApostle","WavendAbyssSiteSuburbCHarvestor","WavendDragonValleyDDragonDarkBigRogue"]
 elite88 = ["RogueEdenAMonsElite","RogueEdenADragonBig","RogueEdenAGhostRed","RogueEdenASkeletonKnight","RogueEdenAIceMonsKing","RogueEdenAVineMonster","RogueEdenAQueerGuard","RogueEdenAGhostWizardKing"]
 elite99 = ["RogueDestinyAReshaperElite","RogueDestinyASpatialGuard"]
 elite111 = ["RogueSkylandPasterElite", "RogueSkylandDevilChimera", "RogueSkylandPokerKing", "RogueSkylandPokerShieldKing", "RogueSkylandKnightElite", "RogueSkylandCardinal", "RogueSkylandStoneGiant", "RogueSkylandTemporalGuard", "RogueSkylandLightWitch"]
-elite_list = elite1 + elite2 + elite3 + elite4 + elite5 + elite6 + elite7 + elite8 + elite9 + elite10 + elite88 + elite99 + elite111
+elite_list = elite1 + elite2 + elite3 + elite4 + elite5 + elite6 + elite7 + elite8 + elite9 + elite10 + elite11 + elite77 + elite88 + elite99 + elite111
 
 
 boss_list = ["MoFaHeiAnSengLv","RogueSeaAJellyBoss","RogueParkCombativeMachineBoss",
-             "GhostRedEasy","Mo2SkeletonKnight","RogueGlacierAIceGiant","RogueTundraADragonBoss","RogueForestAWizardKing",
+             "GhostRedEasy","Mo2SkeletonKnight","RogueGlacierAIceGiant","RogueTundraADragonBoss","RogueForestAWizardKing", "RogueLibraryBloodTailorBoss"
              "MineCFireDragonBoss","RogueGobiAOsiris_1","RogueLabAMachineQueen",
              "RogueEdenABossHarran","RogueDestinyALawStabilizer","RogueDestinyALawGuardBoss","RogueOceanAGiantMonsterBotisBoss","RogueSkylandLightBoss"]
 
@@ -217,6 +220,35 @@ theme2_C_mon_dic = {
     "RogueForestAWizardKing": {"diff": 20, "max": 1, "type": "boss"}
 }
 
+
+theme2_D_mon_dic = {
+    "BsmallMon": {"diff": 3, "max": 10, "type": "normal"},
+    "BdarkSmallMon": {"diff": 6, "max": 10, "type": "normal"},
+    "RogueLibraryBloodElement": {"diff": 3, "max": 100, "type": "normal"},
+    "RogueLibraryMouse": {"diff": 5, "max": 100, "type": "normal"},
+    "RogueLibraryDoll": {"diff": 6, "max": 100, "type": "normal"},
+    "RogueLibraryGhostPortrait": {"diff": 6, "max": 3, "type": "normal"},
+    "RogueLibraryChessKnight": {"diff": 7, "max": 4, "type": "normal"},
+    "RogueLibraryChessTower": {"diff": 7, "max": 4, "type": "normal"},
+    "RogueLibraryFireBook": {"diff": 8, "max": 8, "type": "normal"},
+    "RogueLibraryIceBook": {"diff": 8, "max": 8, "type": "normal"},
+    "RogueLibraryPoisonBook": {"diff": 8, "max": 8, "type": "normal"},
+    "RogueLibrarySiXian": {"diff": 12, "max": 4, "type": "normal"},
+    "RogueLibraryYoungWitch": {"diff": 12, "max": 8, "type": "normal"},
+
+    "RogueLibraryDollDevil": {"diff": 15, "max": 8, "type": "elite"},
+    "RogueLibraryChessQueen": {"diff": 16, "max": 8, "type": "elite"},
+    "RogueLibraryForbiddenBook": {"diff": 16, "max": 4, "type": "elite"},
+    "RogueLibraryBloodMonster": {"diff": 16, "max": 8, "type": "elite"},
+    "RogueLibraryReaperGhost": {"diff": 16, "max": 8, "type": "elite"},
+    "RogueLibraryWomanPortrait": {"diff": 16, "max": 8, "type": "elite"},
+    "RogueLibraryTeddy": {"diff": 17, "max": 4, "type": "elite"},
+    "RogueLibraryBloodWitch": {"diff": 18, "max": 8, "type": "elite"},
+
+    "RogueLibraryBloodTailorBoss": {"diff": 36, "max": 1, "type": "boss"}
+}
+
+
 # ============================================================================================================================================================
 # 第三层
 theme3_A_mon_dic = {

+ 293 - 0
game/const/task.py

@@ -0,0 +1,293 @@
+import json
+import os
+from collections import defaultdict
+from datetime import datetime
+from game.const import game as G
+from game.const import window as W
+from game.const import rouge as R
+from game.level import level
+from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data
+
+user_documents_folder = os.path.expanduser("~\\Documents")  # 获取用户的"文档"文件夹路径
+qqtpve_folder = os.path.join(user_documents_folder, "QQTPVE")  # 构建QQTPVE文件夹路径
+os.makedirs(qqtpve_folder, exist_ok=True)  # 确保QQTPVE文件夹存在,如果不存在则创建
+rouge_task_file_path = os.path.join(qqtpve_folder, "rougeOB_task.rougedata")  # 构建任务文件路径
+
+
+daily_task = {
+    10001: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "进行一次游戏", "reward": 50, "freq": "d", "check": "in_level", "condition": lambda: int(level.current_level.map_name == "rogueMap1")},
+    10002: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "到达一次2-1", "reward": 50, "freq": "d", "check": "in_level", "condition": lambda: int(level.current_level.map_name == "rogueMap6")},
+    10003: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "到达一次3-1", "reward": 80, "freq": "d", "check": "in_level", "condition": lambda: int(level.current_level.map_name == "rogueMap11")},
+    10004: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏", "reward": 100, "freq": "d", "check": "finish_game", "condition": lambda: 1},
+    10005: {"target": 3, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "挑衅对手并击败敌人3次", "reward": 200, "freq": "d", "check": "npc_kill_num", "condition": "RougeCombatSuccess"},
+}
+
+weekly_task = {
+    20001: {"target": 5, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "进行5次游戏", "reward": 400, "freq": "w", "check": "in_level", "condition": lambda: int(level.current_level.map_name == "rogueMap1")},
+    20002: {"target": 5, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "到达5次2-1", "reward": 500, "freq": "w", "check": "in_level", "condition": lambda: int(level.current_level.map_name == "rogueMap6")},
+    20003: {"target": 5, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "到达5次3-1", "reward": 800, "freq": "w", "check": "in_level", "condition": lambda: int(level.current_level.map_name == "rogueMap11")},
+    20004: {"target": 5, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关5次游戏", "reward": 1200, "freq": "w", "check": "finish_game", "condition": lambda: 1},
+    20005: {"target": 5, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "还清5次银行欠款", "reward": 1500, "freq": "w", "check": "npc_kill_num", "condition": "RougeBankReturn"},
+}
+
+monthly_task = {
+    30001: {"target": 10, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "进行10次游戏", "reward": 800, "freq": "m", "check": "in_level", "condition": lambda: int(level.current_level.map_name == "rogueMap1")},
+    30002: {"target": 10, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "到达10次2-1", "reward": 1000, "freq": "m", "check": "in_level", "condition": lambda: int(level.current_level.map_name == "rogueMap6")},
+    30003: {"target": 10, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "到达10次3-1", "reward": 1600, "freq": "m", "check": "in_level", "condition": lambda: int(level.current_level.map_name == "rogueMap11")},
+    30004: {"target": 10, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关10次游戏", "reward": 3000, "freq": "m", "check": "finish_game", "condition": lambda: 1},
+    30005: {"target": 10, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "击杀10个命运收割者", "reward": 5000, "freq": "m", "check": "npc_kill_num", "condition": "RougeTreasureDestiny"},
+    30006: {"target": 2000, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "在赌场累积消费2000糖币", "reward": 5000, "freq": "m", "check": "other", "condition": lambda: 0},
+    30007: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "使用玛莉亚达成一次[重塑光影]结局(困难及以上难度)", "reward": 8000, "freq": "m", "check": "finish_game", "condition": lambda: (R.rouge_hero == "Maria" and R.diff_order[R.difficulty] >= 2 and R.rouge_story == "重塑光影")},
+    30008: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "使用波波莉达成一次[命运乐章]结局(困难及以上难度)", "reward": 8000, "freq": "m", "check": "finish_game", "condition": lambda: (R.rouge_hero == "Boboli" and R.diff_order[R.difficulty] >= 2 and R.rouge_story == "命运乐章")},
+    30009: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "使用海王子达成一次[渊海之息]结局(困难及以上难度)", "reward": 8000, "freq": "m", "check": "finish_game", "condition": lambda: (R.rouge_hero == "SeaPrince_old" and R.diff_order[R.difficulty] >= 2 and R.rouge_story == "渊海之息")},
+    30010: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "使用克莉丝达成一次[圣殿之宁]结局(困难及以上难度)", "reward": 8000, "freq": "m", "check": "finish_game", "condition": lambda: (R.rouge_hero == "Chris" and R.diff_order[R.difficulty] >= 2 and R.rouge_story == "圣殿之宁")},
+}
+
+single_task = {
+    40001: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏(任意难度)", "reward": 500, "freq": "s", "check": "finish_game", "condition": lambda: 1},
+    40002: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏(困难难度及以上难度)", "reward": 1000, "freq": "s", "check": "finish_game", "condition": lambda: (R.diff_order[R.difficulty] >= 2)},
+    40003: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏(炼狱难度及以上难度)", "reward": 2000, "freq": "s", "check": "finish_game", "condition": lambda: (R.diff_order[R.difficulty] >= 3)},
+    40004: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏(炼狱+难度)", "reward": 4000, "freq": "s", "check": "finish_game", "condition": lambda: (R.diff_order[R.difficulty] >= 4)},
+    40005: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "到达一次4-1", "reward": 500, "freq": "s", "check": "in_level", "condition": lambda: int("rogueMap16" in level.current_level.map_name)},
+    40006: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "到达一次4-5", "reward": 800, "freq": "s", "check": "in_level", "condition": lambda: int("rogueMap20" in level.current_level.map_name)},
+    40007: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏且获得大胜利(任意难度)", "reward": 1000, "freq": "s", "check": "finish_game", "condition": lambda: (G.ITEM == 0)},
+    40008: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏且获得大胜利(困难难度及以上难度)", "reward": 2000, "freq": "s", "check": "finish_game", "condition": lambda: (R.diff_order[R.difficulty] >= 2 and G.ITEM == 0)},
+    40009: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏且获得大胜利(炼狱难度及以上难度)", "reward": 4000, "freq": "s", "check": "finish_game", "condition": lambda: (R.diff_order[R.difficulty] >= 3 and G.ITEM == 0)},
+    40010: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏且获得大胜利(炼狱+难度)", "reward": 8000, "freq": "s", "check": "finish_game", "condition": lambda: (R.diff_order[R.difficulty] >= 4 and G.ITEM == 0)},
+    40011: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏且获得完全胜利(任意难度)", "reward": 2000, "freq": "s", "check": "finish_game", "condition": lambda: (G.ALL_CLEAR and G.ITEM == 0)},
+    40012: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏且获得完全胜利(困难难度及以上难度)", "reward": 4000, "freq": "s", "check": "finish_game", "condition": lambda: (R.diff_order[R.difficulty] >= 2 and G.ALL_CLEAR and G.ITEM == 0)},
+    40013: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏且获得完全胜利(炼狱难度及以上难度)", "reward": 8000, "freq": "s", "check": "finish_game", "condition": lambda: (R.diff_order[R.difficulty] >= 3 and G.ALL_CLEAR and G.ITEM == 0)},
+    40014: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏且获得完全胜利(炼狱+难度)", "reward": 16000, "freq": "s", "check": "finish_game", "condition": lambda: (R.diff_order[R.difficulty] >= 4 and G.ALL_CLEAR and G.ITEM == 0)},
+    40015: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏且通关时糖币不少于1000", "reward": 3000, "freq": "s", "check": "finish_game", "condition": lambda: (R.coin >= 1000)},
+    40016: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏且通关时糖币不少于2000", "reward": 6000, "freq": "s", "check": "finish_game", "condition": lambda: (R.coin >= 2000)},
+    40017: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏且通关时糖泡数量不少于15", "reward": 4000, "freq": "s", "check": "finish_game", "condition": lambda: (level.current_level.me.bomb >= 15)},
+    40018: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏且通关时糖泡数量不少于20", "reward": 8000, "freq": "s", "check": "finish_game", "condition": lambda: (level.current_level.me.bomb >= 20)},
+    40019: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏(炼狱难度)且通关时糖泡数量不大于5", "reward": 10000, "freq": "s", "check": "finish_game", "condition": lambda: (R.diff_order[R.difficulty] >= 3 and level.current_level.me.bomb <= 5)},
+    40020: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "通关一次游戏(炼狱+难度)且通关时糖泡数量不大于4", "reward": 15000, "freq": "s", "check": "finish_game", "condition": lambda: (R.diff_order[R.difficulty] >= 4 and level.current_level.me.bomb <= 4)},
+    40021: {"target": 1, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "在赌场中将赌场赌破产一次", "reward": 6000, "freq": "s", "check": "other", "condition": lambda: 0},
+    40022: {"target": 10, "progress": 0, "status": False, "finish_time": "1970-01-01", "title": "击杀10个因果阅律者", "reward": 6000, "freq": "s", "check": "npc_kill_num", "condition": "RougeTreasureDestinyWizard"},
+}
+
+in_level_group = dict()
+finish_game_group = dict()
+npc_kill_group = dict()
+npc_kill_name_dic = defaultdict(list)
+
+for tasks in [daily_task, weekly_task, monthly_task, single_task]:
+    for k, v in tasks.items():
+        if v["check"] == "in_level":
+            in_level_group[k] = v
+        elif v["check"] == "finish_game":
+            finish_game_group[k] = v
+        elif v["check"] == "npc_kill_num":
+            npc_kill_group[k] = v
+
+group_dic = {"in_level": in_level_group, "finish_game": finish_game_group, "npc_kill_num": npc_kill_group}
+freq_dic = {"d": daily_task, "w": weekly_task, "m": monthly_task, "s": single_task}
+
+kill_check_set = set()
+for k, v in npc_kill_group.items():
+    name = v["condition"]
+    npc_kill_name_dic[name].append(k)
+    kill_check_set.add(name)
+
+
+def update_group():
+    global in_level_group, finish_game_group
+    for tasks in [daily_task, weekly_task, monthly_task, single_task]:
+        for k, v in tasks.items():
+            if v["check"] == "in_level":
+                in_level_group[k] = v
+            elif v["check"] == "finish_game":
+                finish_game_group[k] = v
+            elif v["check"] == "npc_kill_num":
+                npc_kill_group[k] = v
+
+
+def direct_task_count(task_id, freq, amount=1):
+    global daily_task, weekly_task, monthly_task, single_task
+    group = freq_dic[freq]
+    if group[task_id]["status"]:  # 已完成
+        return
+    old_progress = group[task_id]["progress"]
+    target = group[task_id]["target"]
+    new_progress = min(target, old_progress + amount)
+    # print(group[task_id]['title'], old_progress, "=>", new_progress)
+    new_status = (new_progress >= target)
+    group[task_id]["progress"] = new_progress
+    group[task_id]["status"] = new_status
+    now = datetime.now().strftime("%Y-%m-%d")
+    group[task_id]["finish_time"] = now
+    if new_status:
+        if type(freq_dic[freq][task_id]["reward"]) == int:
+            reward_exp = freq_dic[freq][task_id]["reward"]
+            R.task_exp += reward_exp
+            R.game_exp += reward_exp
+            level.current_level.message_entry.new_message(sender='委托', message=f"已完成委托<{group[task_id]['title']}> 经验+{reward_exp}", colour=(150, 228, 99))
+
+
+
+def check_npc_kill_group(name):
+    global daily_task, weekly_task, monthly_task, single_task
+    if name in kill_check_set:
+        for task_id in npc_kill_name_dic[name]:
+            info = npc_kill_group[task_id]
+            if info["status"]:
+                return
+            freq = info["freq"]
+            old_progress = freq_dic[freq][task_id]["progress"]
+            target = freq_dic[freq][task_id]["target"]
+            new_progress = min(target, old_progress + 1)
+            new_status = (new_progress >= target)
+            freq_dic[freq][task_id]["progress"] = new_progress
+            freq_dic[freq][task_id]["status"] = new_status
+            npc_kill_group[task_id]["progress"] = new_progress
+            npc_kill_group[task_id]["status"] = new_status
+            now = datetime.now().strftime("%Y-%m-%d")
+            freq_dic[freq][task_id]["finish_time"] = now
+            npc_kill_group[task_id]["finish_time"] = now
+            if new_status:
+                reward_exp = freq_dic[freq][task_id]["reward"]
+                R.task_exp += reward_exp
+                R.game_exp += reward_exp
+                level.current_level.message_entry.new_message(sender='委托', message=f"已完成委托<{npc_kill_group[task_id]['title']}> 经验+{reward_exp}", colour=(150, 228, 99))
+
+
+def check_group(group_name):
+    global daily_task, weekly_task, monthly_task, single_task
+    group = group_dic[group_name]
+    for task_id in group.keys():
+        if group[task_id]["status"]:  # 已完成
+            continue
+        freq = group[task_id]["freq"]
+        old_progress = freq_dic[freq][task_id]["progress"]
+        target = freq_dic[freq][task_id]["target"]
+        new_progress = min(target, old_progress + freq_dic[freq][task_id]["condition"]())
+        # print(group[task_id]['title'], old_progress, "=>", new_progress)
+        new_status = (new_progress >= target)
+        freq_dic[freq][task_id]["progress"] = new_progress
+        freq_dic[freq][task_id]["status"] = new_status
+        group[task_id]["progress"] = new_progress
+        group[task_id]["status"] = new_status
+        now = datetime.now().strftime("%Y-%m-%d")
+        freq_dic[freq][task_id]["finish_time"] = now
+        group[task_id]["finish_time"] = now
+        if new_status:
+            if type(freq_dic[freq][task_id]["reward"]) == int:
+                reward_exp = freq_dic[freq][task_id]["reward"]
+                R.task_exp += reward_exp
+                R.game_exp += reward_exp
+                level.current_level.message_entry.new_message(sender='委托', message=f"已完成委托<{group[task_id]['title']}> 经验+{reward_exp}", colour=(150, 228, 99))
+            else:
+                pass
+
+
+def generate_task_json():
+    data = dict()
+    data["daily"], data["weekly"], data["monthly"], data["single"] = dict(), dict(), dict(), dict()
+    for k, v in daily_task.items():
+        data["daily"][k] = {"target": v["target"], "progress": v["progress"], "status": v["status"], "finish_time": v["finish_time"]}
+    for k, v in weekly_task.items():
+        data["weekly"][k] = {"target": v["target"], "progress": v["progress"], "status": v["status"], "finish_time": v["finish_time"]}
+    for k, v in monthly_task.items():
+        data["monthly"][k] = {"target": v["target"], "progress": v["progress"], "status": v["status"], "finish_time": v["finish_time"]}
+    for k, v in single_task.items():
+        data["single"][k] = {"target": v["target"], "progress": v["progress"], "status": v["status"], "finish_time": v["finish_time"]}
+    data["version"] = G.VERSION
+    return data
+
+
+def get_task_json():
+    if not os.path.exists(rouge_task_file_path):
+        rouge_task_data = generate_task_json()
+        save_encrypt_single_rouge_file(rouge_task_data, "rougeOB_task")
+    else:
+        rouge_task_data = load_rouge_data(rouge_task_file_path)
+        if rouge_task_data.get("version", None) is None:
+            rouge_task_data = generate_task_json()
+            save_encrypt_single_rouge_file(rouge_task_data, "rougeOB_task")
+    return rouge_task_data
+
+
+def task_time_update(data):
+    now = datetime.now().strftime("%Y-%m-%d")
+    year, month = now.split('-')[0], now.split('-')[1]
+    for k in data["daily"].keys():
+        if data["daily"][k]["status"] and data["daily"][k]["finish_time"] != now:
+            data["daily"][k]["progress"] = 0
+            data["daily"][k]["status"] = False
+    for k in data["weekly"].keys():
+        if data["weekly"][k]["status"] and not same_week(data["weekly"][k]["finish_time"], now):
+            data["weekly"][k]["progress"] = 0
+            data["weekly"][k]["status"] = False
+    for k in data["monthly"].keys():
+        if data["monthly"][k]["status"] and data["monthly"][k]["finish_time"].split('-')[0] != year or data["monthly"][k]["finish_time"].split('-')[1] != month:
+            data["monthly"][k]["progress"] = 0
+            data["monthly"][k]["status"] = False
+    save_encrypt_single_rouge_file(data, "rougeOB_task")
+    return data
+
+
+def read_task_json():
+    global daily_task, weekly_task, monthly_task, single_task
+    data = get_task_json()
+    data = task_time_update(data)
+    for k, v in data["daily"].items():
+        k = int(k)
+        daily_task[k]["target"] = v["target"]
+        daily_task[k]["progress"] = v["progress"]
+        daily_task[k]["status"] = v["status"]
+        daily_task[k]["finish_time"] = v["finish_time"]
+    for k, v in data["weekly"].items():
+        k = int(k)
+        weekly_task[k]["target"] = v["target"]
+        weekly_task[k]["progress"] = v["progress"]
+        weekly_task[k]["status"] = v["status"]
+        weekly_task[k]["finish_time"] = v["finish_time"]
+    for k, v in data["monthly"].items():
+        k = int(k)
+        monthly_task[k]["target"] = v["target"]
+        monthly_task[k]["progress"] = v["progress"]
+        monthly_task[k]["status"] = v["status"]
+        monthly_task[k]["finish_time"] = v["finish_time"]
+    for k, v in data["single"].items():
+        k = int(k)
+        single_task[k]["target"] = v["target"]
+        single_task[k]["progress"] = v["progress"]
+        single_task[k]["status"] = v["status"]
+        single_task[k]["finish_time"] = v["finish_time"]
+    update_group()
+
+
+def save_task_json():
+    data = get_task_json()
+    for k, v in daily_task.items():
+        data["daily"][k] = {"target": v["target"], "progress": v["progress"], "status": v["status"], "finish_time": v["finish_time"]}
+    for k, v in weekly_task.items():
+        data["weekly"][k] = {"target": v["target"], "progress": v["progress"], "status": v["status"], "finish_time": v["finish_time"]}
+    for k, v in monthly_task.items():
+        data["monthly"][k] = {"target": v["target"], "progress": v["progress"], "status": v["status"], "finish_time": v["finish_time"]}
+    for k, v in single_task.items():
+        data["single"][k] = {"target": v["target"], "progress": v["progress"], "status": v["status"], "finish_time": v["finish_time"]}
+    save_encrypt_single_rouge_file(data, "rougeOB_task")
+
+
+def same_week(date1_str, date2_str):
+    d1 = datetime.strptime(date1_str, "%Y-%m-%d").date()
+    d2 = datetime.strptime(date2_str, "%Y-%m-%d").date()
+    # isocalendar() → (year, week_number, weekday)
+    return d1.isocalendar()[:2] == d2.isocalendar()[:2]
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 75 - 0
game/handbook/tmp.py

@@ -0,0 +1,75 @@
+import os
+import json
+
+from game.const import rouge_theme as rt
+
+
+def main(root_dir="."):
+    for dirpath, _, filenames in os.walk(root_dir):
+        for filename in filenames:
+            if filename.lower().endswith(".json"):
+                file_path = os.path.join(dirpath, filename)
+                try:
+                    with open(file_path, "r", encoding="utf-8") as f:
+                        try:
+                            data = json.load(f)
+                        except json.JSONDecodeError:
+                            print(f"[跳过] {file_path} 不是有效的 JSON 文件")
+                            continue
+                    if data.get("skills", None) is None:
+                        continue
+                    mon_type = "normal"
+                    if data.get("elite", False):
+                        mon_type = "elite"
+                    elif data.get("boss", False):
+                        mon_type = "boss"
+                    speed = "极慢"
+                    if 1 <= data["speed"] <= 2.5:
+                        speed = "慢"
+                    elif 2.5 < data["speed"] <= 3.5:
+                        speed = "中"
+                    elif 3.5 < data["speed"] <= 4.5:
+                        speed = "快"
+                    elif 4.5 < data["speed"]:
+                        speed = "极快"
+                    sight = "极小"
+                    if 2 < data["resent_dist"] <= 3:
+                        sight = "小"
+                    elif 3 < data["resent_dist"] <= 5:
+                        sight = "中"
+                    elif 5 < data["resent_dist"] <= 7:
+                        sight = "大"
+                    elif 7 < data["resent_dist"]:
+                        sight = "极大"
+                    new_data = {
+                        "chs_name": data["chs_name"],
+                        "character": data["character"],
+                        "type": mon_type,
+                        "blood": data["blood"],
+                        "speed": speed,
+                        "contact": data["contact"],
+                        "defense": data["defense"],
+                        "resent_dist": sight,
+                        "info": "???",
+                        "strategy": "???"
+                    }
+
+                    # 覆盖写回文件
+                    with open(file_path, "w", encoding="utf-8") as f:
+                        json.dump(new_data, f, ensure_ascii=False, indent=4)
+                    print(f"[更新完成] {file_path}")
+                except Exception as e:
+                    print(f"[错误] {file_path}: {e}")
+
+
+def test():
+    l = []
+    for k in rt.theme_skyland_mon_dic.keys():
+        l.append(k)
+    print(l)
+
+
+if __name__ == "__main__":
+    main(".")
+    # test()
+    pass

+ 91 - 139
game/level/level.py

@@ -15,6 +15,7 @@ from game.algo import utils as util
 from game.const import game as G
 from game.const import rouge as R
 from game.const.rouge import speed_lv
+from game.const.task import check_group, save_task_json
 from game.algo import shapeGen as S
 from game.utils import local_data_manager as DM
 from game.frame import floor
@@ -215,7 +216,8 @@ class Level:
         self.obstacle_instances_need_to_update = True  # 需要更新列表
         self.bomb_instances = None  # BombInstance对象列表
         self.ui_instances_bot = None  # 位于main_area下的UIInstance对象列表
-        self.ui_instances_top = None  # 位于main_area上的UIInstance对象列![](C:/Users/dell/AppData/Local/Temp/previewfile_2896918733.gif)表
+        self.ui_instances_top = None  # 位于main_area上的UIInstance对象列!
+        self.ui_instances_sec = None
         self.block = None  # 三维NumPy对象,阻挡玩家
         self.block_flame = None  # 三维NumPy对象,阻挡糖跑
         self.slide_orientation = dict()  # (x, y) --> (m, n) m网格传送带方向 0无 1右 2上 3左 4下 n速度
@@ -303,16 +305,25 @@ class Level:
             self.message_entry.new_message(sender='Rogue助手', message=f"经验+{R.last_exp}, 当前等级经验: {R.last_message}")
             R.last_exp = 0
             R.last_message = ""
+        check_group("in_level")
         # print(G.CURRENT_LEVEL)
         if self.map_name == "rogueMap1":
-            pass
+            if R.last_pass_theme_num == 1:
+                self.message_entry.new_message(sender='神谕', message='勇士的不屈受到赞叹(上局到达第二层), 本局糖币+20')
+                R.coin += 20
+            elif R.last_pass_theme_num == 2:
+                self.message_entry.new_message(sender='神谕', message='勇士的无畏受到敬重(上局到达第三层), 本局糖币+30')
+                R.coin += 30
+            R.last_pass_theme_num = 0
         elif self.map_name == "rogueMap6":
+            R.last_pass_theme_num = 1
             # print(R.rouge_theme_2)
             if R.rouge_theme_2 == "永东寒原":
                 self.message_entry.new_message(sender='*区域效果(寒冷)', message='防御-200')
             elif R.rouge_theme_2 == "迷雾古林":
                 self.message_entry.new_message(sender='*区域效果(湿毒)', message='防御-200')
         elif self.map_name == "rogueMap11":
+            R.last_pass_theme_num = 2
             # print(R.rouge_theme_3)
             if R.rouge_theme_3 == "熔岩深矿":
                 self.message_entry.new_message(sender='*区域效果(战栗)', message='防御-200,伤害-200')
@@ -482,6 +493,7 @@ class Level:
         self.bomb_instances = list()
         self.ui_instances_bot = list()
         self.ui_instances_top = list()
+        self.ui_instances_sec = list()
         self.block = np.zeros((2, self.map_x + 1, self.map_y + 1), dtype=np.int64)
         self.block_flame = np.zeros((2, self.map_x + 1, self.map_y + 1), dtype=np.int64)
         # 生成网格伤害二元组映射
@@ -537,7 +549,7 @@ class Level:
         G.TOTAL_NPC = 0
         for dis in self.map_json["districts"]:
             G.TOTAL_NPC += len(dis["npcs"])
-        if self.me.blood <= 4500 and self.me.standard_damage <= 3500+G.SPECIAL_DAMAGE and self.me.standard_defense <= G.SPECIAL_DEFENSE  and self.me.standard_power <= 3+G.SPECIAL_POWER and self.me.standard_speed <= 0.234 and G.ITEM == 0:
+        if self.me.blood <= 4500 and self.me.standard_damage <= 3500+G.SPECIAL_DAMAGE and self.me.standard_defense <= G.SPECIAL_DEFENSE and self.me.standard_power <= 3+G.SPECIAL_POWER and self.me.standard_speed <= 0.234 and G.ITEM == 0:
             G.CHEAT = False
         else:
             G.CHEAT = True
@@ -637,7 +649,14 @@ class Level:
             if G.CURRENT_LEVEL == G.TOTAL_LEVEL and not G.HAS_RECORD and not R.test_mode:
                 G.HAS_RECORD = True
                 sound_player.playWin("PlayerWin")
-                WinEffect(self.me, self.me, "normal", self.skill_instances)
+                if G.ALL_CLEAR and G.ITEM == 0:
+                    WinEffect(self.me, self.me, "super", self.skill_instances)
+                elif G.ITEM == 0:
+                    WinEffect(self.me, self.me, "big", self.skill_instances)
+                else:
+                    WinEffect(self.me, self.me, "normal", self.skill_instances)
+
+                check_group("finish_game")
                 self.message_entry.new_message(sender='Rogue助手', message=f"恭喜通关!!!本局共获得经验{R.game_exp}点,达成结局:<{R.rouge_story}>({R.diff_dic[R.difficulty]}难度)")
                 self.message_entry.new_message(sender='Rogue助手', message=R.story_achieve[R.rouge_story])
                 if R.pass_status[R.difficulty] == 0 and R.difficulty != "Hell+":
@@ -650,6 +669,7 @@ class Level:
                 if os.path.exists(last_game_file_path):
                     os.remove(last_game_file_path)
                     print("清除旧数据")
+                save_task_json()
 
         if self.none_district:
             self.none_district = False
@@ -817,6 +837,8 @@ class Level:
         # 刷新ui
         for u in self.ui_instances_top:
             u.update()
+        for u in self.ui_instances_sec:
+            u.update()
         for u in self.ui_instances_bot:
             u.update()
 
@@ -889,6 +911,9 @@ class Level:
         # 显示主区域
         screen.blit(self.main_area, (0, 21), (self.scroll_x_pos - 1, self.scroll_y_pos, G.MAIN_AREA_X_POS, G.MAIN_AREA_Y_POS))
 
+        # 显示中ui
+        for u in self.ui_instances_sec:
+            u.draw(screen)
         # 显示上ui
         for u in self.ui_instances_top:
             u.draw(screen)
@@ -930,7 +955,8 @@ class Level:
             self.level_time = self.times_num - G.LAST_LEVEL_TIME
             if G.DISPLAY_FRAME_RATE:
                 # print(pygame.time.get_ticks(), self.map_time, self.times_num, G.LAST_MAP_TIME, G.TIME)
-                img = self.frame_rate_text_font.render("{:04d}, ({})游戏时长 - {:03d}:{:02d}, 关卡:{:01d}-{:01d}, 伤害:{:05d}, 速度:{:01d}/5, 糖泡:{:02d}, 糖币:{:04d}".format(self.frames_num, R.diff_dic[R.difficulty], self.map_time//60, self.map_time%60, ((G.CURRENT_LEVEL+1)//2 -1)//5+1, ((G.CURRENT_LEVEL+1)//2-1)%5+1, self.me.damage, speed_lv(self.me.speed), self.me.bomb, int(R.coin)), False, (255, 255, 255), (0, 0, 0))
+                img = self.frame_rate_text_font.render("{:04d}, ({}) {:03d}:{:02d}, 关卡:{:01d}-{:01d}, 伤害:{:05d}, 速度:{:01d}/5, 糖泡:{:02d}, 防御:{:+04d}, 糖币:{:04d}".format(self.frames_num, R.diff_dic[R.difficulty], self.map_time//60, self.map_time%60, ((G.CURRENT_LEVEL+1)//2 -1)//5+1, ((G.CURRENT_LEVEL+1)//2-1)%5+1, self.me.damage, speed_lv(self.me.speed), self.me.bomb, self.me.defense, int(R.coin)), False, (255, 255, 255), (0, 0, 0))
+                # img = self.frame_rate_text_font.render("{:04d}, ({})游戏时长 - {:03d}:{:02d}, 关卡:{:01d}-{:01d}, 伤害:{:05d}, 速度:{:01d}/5, 糖泡:{:02d}, 糖币:{:04d}".format(self.frames_num, R.diff_dic[R.difficulty], self.map_time//60, self.map_time%60, ((G.CURRENT_LEVEL+1)//2 -1)//5+1, ((G.CURRENT_LEVEL+1)//2-1)%5+1, self.me.damage, speed_lv(self.me.speed), self.me.bomb, int(R.coin)), False, (255, 255, 255), (0, 0, 0))
                 # img = self.frame_rate_text_font.render("({},{}), {:04d}, ({})游戏时长 - {:03d}:{:02d}, 关卡:{:01d}-{:01d}, 伤害:{:05d}, 速度:{:01d}/5, 糖泡:{:02d}, 糖币:{:04d}".format(self.me.x, self.me.y, self.frames_num, R.diff_dic[R.difficulty], self.map_time//60, self.map_time%60, ((G.CURRENT_LEVEL+1)//2 -1)//5+1, ((G.CURRENT_LEVEL+1)//2-1)%5+1, self.me.damage, speed_lv(self.me.speed), self.me.bomb, int(R.coin)), False, (255, 255, 255), (0, 0, 0))
                 screen.blit(img, (100, 0))
             self.frames_num = 0
@@ -956,6 +982,8 @@ class Level:
                 # print(R.current_standard_damage, G.SPECIAL_DAMAGE)
                 R.current_standard_damage -= G.SPECIAL_DAMAGE
                 R.current_standard_defense -= G.SPECIAL_DEFENSE
+                if G.CURRENT_LEVEL % 2 == 1 and not self.is_all_district_clear:
+                    G.ALL_CLEAR = False
 
                 # 构建保存文件的路径
                 user_documents_folder = os.path.expanduser("~\\Documents")  # 获取用户的"文档"文件夹路径
@@ -975,7 +1003,7 @@ class Level:
                     R.new_drop_list = []
                     save_encrypt_single_rouge_file(rouge_other_data, "rougeOBOther")
 
-                real_exp = int(R.rouge_exp * R.diff_exp[R.difficulty])
+                real_exp = int(R.rouge_exp * R.diff_exp[R.difficulty] + R.task_exp)
                 if G.IS_ONLINE:
                     self.message_entry.new_message(sender='酷比终端', message='正在同步至酷比服务器..')
                     util.save_online()
@@ -1000,92 +1028,11 @@ class Level:
                     DM.save_new_achievement(self.map_time//60, self.map_time%60)
                 R.game_exp += real_exp
                 R.rouge_exp = 0
+                R.task_exp = 0
                 # 储存游戏
                 if G.CURRENT_LEVEL % 2 == 1:
                     self.save_progress()
-
-    def check_task(self):
-        user_documents_folder = os.path.expanduser("~\\Documents")  # 获取用户的"文档"文件夹路径
-        qqtpve_folder = os.path.join(user_documents_folder, "QQTPVE")  # 构建QQTPVE文件夹路径
-        rouge_task_file_path = os.path.join(qqtpve_folder, "rougeOB_task.rougedata")  # 构建任务文件路径
-        year = str(R.today_datetime["year"])
-        month = str(R.today_datetime["month"])
-        day = str(R.today_datetime["day"])
-        # print(G.CURRENT_LEVEL, year, month, day)
-        rougeOB_task_data = load_rouge_data(rouge_task_file_path)
-        # print(rougeOB_task_data)
-        if G.CURRENT_LEVEL == 10 and not R.continuing_game:
-            rougeOB_task_data["today"]["process"] += 1
-            if rougeOB_task_data["today"]["rewarded"] == False and rougeOB_task_data["today"]["process"] >= rougeOB_task_data["today"]["finish"]:
-                rougeOB_task_data["today"]["rewarded"] = True
-                rougeOB_task_data["today"]["hero"] = R.rouge_hero
-                rougeOB_task_data["today"]["last_finish"] = year + "-" + month + "-" + day
-                R.rouge_exp += int(rougeOB_task_data["today"]["reward_exp"])
-                print("完成每日任务")
-            save_encrypt_single_rouge_file(rougeOB_task_data, "rougeOB_task")
-        if int(month) == 3:
-            if G.CURRENT_LEVEL == 20 and not R.continuing_game:
-                rougeOB_task_data[str(month)]["process"] += 1
-                if rougeOB_task_data[str(month)]["rewarded"] == False and rougeOB_task_data[str(month)]["process"] >= rougeOB_task_data[str(month)]["finish"]:
-                    rougeOB_task_data[str(month)]["rewarded"] = True
-                    rougeOB_task_data[str(month)]["hero"] = R.rouge_hero
-                    rougeOB_task_data[str(month)]["last_finish"] = year
-                    R.rouge_exp += int(rougeOB_task_data["today"]["reward_exp"])
-                    print("完成月常任务")
-                save_encrypt_single_rouge_file(rougeOB_task_data, "rougeOB_task")
-        elif int(month) in [6,7,8,9,10]:
-            hero_dic = {6: "Fox", 7: "Boboli", 8: "Naruto_old", 9: "Asha", 10: "Maria"}
-            if G.CURRENT_LEVEL == 28 and hero_dic[int(month)] == R.rouge_hero:
-                rougeOB_task_data[str(month)]["process"] += 1
-                if rougeOB_task_data[str(month)]["rewarded"] == False and rougeOB_task_data[str(month)]["process"] >= rougeOB_task_data[str(month)]["finish"]:
-                    rougeOB_task_data[str(month)]["rewarded"] = True
-                    rougeOB_task_data[str(month)]["hero"] = R.rouge_hero
-                    rougeOB_task_data[str(month)]["last_finish"] = year
-                    R.rouge_exp += int(rougeOB_task_data["today"]["reward_exp"])
-                    print("完成月常任务")
-                save_encrypt_single_rouge_file(rougeOB_task_data, "rougeOB_task")
-        elif int(month) == 11:
-            if G.CURRENT_LEVEL == 30:
-                rougeOB_task_data[str(month)]["process"] += 1
-                if rougeOB_task_data[str(month)]["rewarded"] == False and rougeOB_task_data[str(month)]["process"] >= rougeOB_task_data[str(month)]["finish"]:
-                    rougeOB_task_data[str(month)]["rewarded"] = True
-                    rougeOB_task_data[str(month)]["hero"] = R.rouge_hero
-                    rougeOB_task_data[str(month)]["last_finish"] = year
-                    R.rouge_exp += int(rougeOB_task_data["today"]["reward_exp"])
-                    print("完成月常任务")
-                save_encrypt_single_rouge_file(rougeOB_task_data, "rougeOB_task")
-        elif int(month) in [1,2,4]:
-            task_mon_dic = {1: R.task_RougeTreasureDestinyElite, 2: R.task_MineCFireDragonBoss, 4: R.task_RougeTreasureDestinyWizard}
-            if task_mon_dic[int(month)] >= 1:
-                rougeOB_task_data[str(month)]["process"] += task_mon_dic[int(month)]
-                task_mon_dic[int(month)] = 0
-                if rougeOB_task_data[str(month)]["rewarded"] == False and rougeOB_task_data[str(month)]["process"] >= rougeOB_task_data[str(month)]["finish"]:
-                    rougeOB_task_data[str(month)]["rewarded"] = True
-                    rougeOB_task_data[str(month)]["hero"] = R.rouge_hero
-                    rougeOB_task_data[str(month)]["last_finish"] = year
-                    R.rouge_exp += int(rougeOB_task_data["today"]["reward_exp"])
-                    print("完成月常任务")
-                save_encrypt_single_rouge_file(rougeOB_task_data, "rougeOB_task")
-        elif int(month) == 5:
-            if R.task_combat >= 1:
-                rougeOB_task_data[str(month)]["process"] += R.task_combat
-                if rougeOB_task_data[str(month)]["rewarded"] == False and rougeOB_task_data[str(month)]["process"] >= rougeOB_task_data[str(month)]["finish"]:
-                    rougeOB_task_data[str(month)]["rewarded"] = True
-                    rougeOB_task_data[str(month)]["hero"] = R.rouge_hero
-                    rougeOB_task_data[str(month)]["last_finish"] = year
-                    R.rouge_exp += int(rougeOB_task_data["today"]["reward_exp"])
-                    print("完成月常任务")
-                save_encrypt_single_rouge_file(rougeOB_task_data, "rougeOB_task")
-        else:
-            if R.task_revival >= 1:
-                rougeOB_task_data[str(month)]["process"] += R.task_revival
-                if rougeOB_task_data[str(month)]["rewarded"] == False and rougeOB_task_data[str(month)]["process"] >= rougeOB_task_data[str(month)]["finish"]:
-                    rougeOB_task_data[str(month)]["rewarded"] = True
-                    rougeOB_task_data[str(month)]["hero"] = R.rouge_hero
-                    rougeOB_task_data[str(month)]["last_finish"] = year
-                    R.rouge_exp += int(rougeOB_task_data["today"]["reward_exp"])
-                    print("完成月常任务")
-                save_encrypt_single_rouge_file(rougeOB_task_data, "rougeOB_task")
+                    save_task_json()
 
     # 储存游戏
     def save_progress(self):
@@ -1101,59 +1048,64 @@ class Level:
             os.remove(last_game_file_path)
             print("清除旧数据")
         # 本次数据
-        rougeOB_last_game_data = {"current_level": G.CURRENT_LEVEL,
-                                  "map_json_dic": R.map_json_dic,
-                                  "central_mapset": R.central_mapset,
-                                  "difficulty": R.difficulty,
-
-                                  "today_datetime": R.today_datetime,
-                                  "task_RougeTreasureDestinyElite": R.task_RougeTreasureDestinyElite,
-                                  "task_MineCFireDragonBoss": R.task_MineCFireDragonBoss,
-                                  "task_RougeTreasureDestinyWizard": R.task_RougeTreasureDestinyWizard,
-                                  "task_combat": R.task_combat,
-                                  "task_revival": R.task_revival,
-                                  "rouge_data": R.rouge_data,
-                                  "rouge_hero": R.rouge_hero,
-                                  "rouge_lv": R.rouge_lv,
-                                  "rouge_exp": R.rouge_exp,
-                                  "game_exp": R.game_exp,
-                                  "rouge_story": R.rouge_story,
-                                  "rouge_theme_1": R.rouge_theme_1,
-                                  "rouge_theme_2": R.rouge_theme_2,
-                                  "rouge_theme_3": R.rouge_theme_3,
-                                  "rouge_theme_4": R.rouge_theme_4,
-                                  "rouge_destiny": R.rouge_destiny,
-                                  "coin": R.coin,
-                                  "extra_lv": R.extra_lv,
-
-                                  "general_mon_dic": R.general_mon_dic,
-                                  "story_eden": R.story_eden,
-                                  "story_destiny": R.story_destiny,
-                                  "story_ocean": R.story_ocean,
-                                  "story_skyland": R.story_skyland,
-                                  "current_standard_HP": R.current_standard_HP,
-                                  "current_standard_damage": R.current_standard_damage,
-                                  "current_standard_speed": R.current_standard_speed,
-                                  "current_standard_defense": R.current_standard_defense,
-                                  "current_standard_bomb": R.current_standard_bomb,
-
-                                  "se_district": R.se_district,
-                                  "battle_district": R.battle_district,
-                                  "monster_defense_delta": R.monster_defense_delta,
-                                  "monster_HP_rate": R.monster_HP_rate,
-                                  "player_bomb_self_damage_reduce_rate": R.player_bomb_self_damage_reduce_rate,
-                                  "slow_immune": R.slow_immune,
-                                  "reverse_immune": R.reverse_immune,
-                                  "root_immune": R.root_immune,
-                                  "stun_immune": R.stun_immune,
-                                  "random_dmg": R.random_dmg,
-                                  "show_cursor": R.show_cursor,
-                                  "items": self.me.skill_remains
-                                  }
+        rougeOB_last_game_data = {
+            "current_level": G.CURRENT_LEVEL,
+            "map_json_dic": R.map_json_dic,
+            "central_mapset": R.central_mapset,
+            "difficulty": R.difficulty,
+
+            "today_datetime": R.today_datetime,
+            "task_RougeTreasureDestinyElite": R.task_RougeTreasureDestinyElite,
+            "task_MineCFireDragonBoss": R.task_MineCFireDragonBoss,
+            "task_RougeTreasureDestinyWizard": R.task_RougeTreasureDestinyWizard,
+            "task_combat": R.task_combat,
+            "task_revival": R.task_revival,
+            "rouge_data": R.rouge_data,
+            "rouge_hero": R.rouge_hero,
+            "rouge_lv": R.rouge_lv,
+            "rouge_exp": R.rouge_exp,
+            "game_exp": R.game_exp,
+            "rouge_story": R.rouge_story,
+            "rouge_theme_1": R.rouge_theme_1,
+            "rouge_theme_2": R.rouge_theme_2,
+            "rouge_theme_3": R.rouge_theme_3,
+            "rouge_theme_4": R.rouge_theme_4,
+            "rouge_destiny": R.rouge_destiny,
+            "coin": R.coin,
+            "extra_lv": R.extra_lv,
+
+            "general_mon_dic": R.general_mon_dic,
+            "story_eden": R.story_eden,
+            "story_destiny": R.story_destiny,
+            "story_ocean": R.story_ocean,
+            "story_skyland": R.story_skyland,
+            "current_standard_HP": R.current_standard_HP,
+            "current_standard_damage": R.current_standard_damage,
+            "current_standard_speed": R.current_standard_speed,
+            "current_standard_defense": R.current_standard_defense,
+            "current_standard_bomb": R.current_standard_bomb,
+
+            "se_district": R.se_district,
+            "battle_district": R.battle_district,
+            "monster_defense_delta": R.monster_defense_delta,
+            "monster_HP_rate": R.monster_HP_rate,
+            "player_bomb_self_damage_reduce_rate": R.player_bomb_self_damage_reduce_rate,
+            "slow_immune": R.slow_immune,
+            "reverse_immune": R.reverse_immune,
+            "root_immune": R.root_immune,
+            "stun_immune": R.stun_immune,
+            "random_dmg": R.random_dmg,
+            "show_cursor": R.show_cursor,
+            "items": self.me.skill_remains,
+            "item_use_num": G.ITEM,
+            "is_all_clear": G.ALL_CLEAR,
+            "last_pass_theme_num": R.last_pass_theme_num,
+            "coin_borrow": R.coin_borrow,
+            "has_loan": R.has_loan
+        }
         save_encrypt_single_rouge_file(rougeOB_last_game_data, "rougeOBLastGame")  # 储存
         print("存档成功")
 
-
     # 传送门,参数格式: {"[x1,y1]":{"type": "level", "target": [x2,y2]}, "[x3,y3]":{"type": "map", "target": 3}, "[x4,y4]":{"type": "map_set", "target": "Mo1"}}
     def portal_map(self):
         if len(self.portal_set) != 0:

+ 10 - 0
game/rogue_control.py

@@ -28,7 +28,10 @@ def garbage_collect(last_time):
 
 def rouge_reset():
     R.has_ocean_shop = False
+    R.has_eden_combat = False
     R.show_cursor = False
+    R.coin_borrow = 0
+    R.has_loan = False
     R.coin = 8
     R.current_standard_defense = 0
     R.monster_defense_delta = 0
@@ -40,6 +43,7 @@ def rouge_reset():
     R.stun_immune = 0
     R.random_dmg = False
     R.rouge_destiny["RougeTreasureDestiny"] = R.rouge_destiny["RougeTreasureDestinyWizard"] = R.rouge_destiny["RougeTreasureDestinyMachine"] = 0
+    R.story_eden, R.story_destiny, R.story_ocean, R.story_skyland = False, False, False, False
 
 
 def _preload_flame(orientation):
@@ -450,6 +454,9 @@ class Control:
         G.HAS_RECORD = False
         G.LAST_MAP_TIME = G.TIME
         G.LAST_LEVEL_TIME = G.TIME
+        G.ALL_CLEAR = True
+        R.coin_borrow = 0
+        R.has_loan = False
         G.ITEM = 0
         G.MONSTER_RECORD_LIST = []
         G.HAS_RECORD_FULL = False
@@ -535,6 +542,9 @@ class Control:
         G.CURRENT_LEVEL = 1
         G.LAST_MAP_TIME = G.TIME
         G.LAST_LEVEL_TIME = G.TIME
+        G.ALL_CLEAR = True
+        R.coin_borrow = 0
+        R.has_loan = False
         G.ITEM = 0
         # G.MONSTER_RECORD_LIST = []
         G.HAS_RECORD_FULL = False

+ 11 - 1
game/skill/cool_skill.py

@@ -219,6 +219,8 @@ class RandomSpawn1(Skill):
 
     def load(self):
         super().load()
+        if not level.current_level.in_district:
+            self.kill()
         grid = level.current_level.district_square_grid
         for x in range(grid["x1"], grid["x2"] + 1):
             for y in range(grid["y1"], grid["y2"] + 1):
@@ -339,6 +341,8 @@ class SpawnMinions2(Skill):
 
     def load(self):
         super().load()
+        if not level.current_level.in_district:
+            self.kill()
         grid = level.current_level.district_square_grid
         for x in range(grid["x1"], grid["x2"] + 1):
             for y in range(grid["y1"], grid["y2"] + 1):
@@ -391,6 +395,8 @@ class SpawnMinions3(Skill):
 
     def load(self):
         super().load()
+        if not level.current_level.in_district:
+            self.kill()
         grid = level.current_level.district_square_grid
         for x in range(grid["x1"], grid["x2"] + 1):
             for y in range(grid["y1"], grid["y2"] + 1):
@@ -443,6 +449,8 @@ class SpawnMinions4(Skill):
 
     def load(self):
         super().load()
+        if not level.current_level.in_district:
+            self.kill()
         grid = level.current_level.district_square_grid
         for x in range(grid["x1"], grid["x2"] + 1):
             for y in range(grid["y1"], grid["y2"] + 1):
@@ -495,6 +503,8 @@ class SpawnMinions5(Skill):
 
     def load(self):
         super().load()
+        if not level.current_level.in_district:
+            self.kill()
         grid = level.current_level.district_square_grid
         for x in range(grid["x1"], grid["x2"] + 1):
             for y in range(grid["y1"], grid["y2"] + 1):
@@ -1054,7 +1064,7 @@ class FourSidedAirFlow500(Skill):
                 effect.state = EffectState.DEAD
             sound_player.play("explode")
             self.kill()
-        if self.current_time - self.skill_time_init > 8000 and self.launch:
+        if (self.current_time - self.skill_time_init > 8000 and self.launch) or self.user.remain_blood <= 0:
             for e in self.effect_instances:
                 e.state = EffectState.DEAD
             self.kill()

+ 3 - 1
game/skill/new_skill.py

@@ -302,7 +302,7 @@ class BombEscape(Skill):
     def update(self):
         super().update()
         cl = level.current_level
-        if R.difficulty == "Easy":
+        if R.difficulty == "Easy" or R.difficulty == "Baby":
             pass
         else:
             right_bomb_num = len(cl.get_bomb_instance(self.user.x + 1, self.user.y))
@@ -837,6 +837,8 @@ class SpawnMinions(Skill):
 
     def load(self):
         super().load()
+        if not level.current_level.in_district:
+            self.kill()
         grid = level.current_level.district_square_grid
         for x in range(grid["x1"], grid["x2"] + 1):
             for y in range(grid["y1"], grid["y2"] + 1):

+ 4 - 1
game/skill/npc_skill.py

@@ -3,6 +3,7 @@ from math import sqrt
 import pygame.time
 
 from game.const import game as G
+from game.const import rouge as R
 from game.effect.effect_instance import EffectInstance, EffectState
 from game.level import level
 from game.skill.skill import Skill, IceSlow, GotPoisonSmoke50x3, GotPoisonSmoke80x2
@@ -250,6 +251,8 @@ class Skill21005(Skill):
         self.hit = False  # 是否命中玩家
         self.root_duration = 500  # 击中后眩晕时长
         self.slow_amount = 0
+        if R.slow_immune == 1:
+            self.kill()
 
     def load(self):
         super().load()
@@ -272,7 +275,7 @@ class Skill21005(Skill):
             an_effect.set_xy(self.to_xy[0], self.to_xy[1])
             self.effect_instances.append(an_effect)
             sound_player.play("explode2")
-            if self.hit:
+            if self.hit and R.slow_immune != 1:
                 self.effect_instances.append(EffectInstance("ice_slowed", self.to, True, self.to.effects_front))
                 sound_player.play("cry")
                 self.slow_amount = 0.3*self.to.speed

+ 263 - 0
game/skill/parametric2_skill.py

@@ -10,6 +10,7 @@ from game.const import color as C
 from game.const import game as G
 from game.skill.skill import Skill
 from game.skill.skill import *
+from game.skill.parametric_skill import CustomGotDevilPoisonEffect
 from game.effect.effect_instance import EffectState, EffectInstance
 from game.frame import bomb
 from game.frame import obstacle
@@ -2094,5 +2095,267 @@ class CustomRevengeCrossFire(Skill):
 
 
 
+# 持续掉血远程血雾([目标,[范围],[伤害],[时刻],回复比例])
+# {"target": "player"/"monster", "range": [[1,1],[3,3]], "damages": [50,50,50,...], "hurt_times": [0,1000,2000,3000,...], "recover_rate": 100}
+class CustomVampireSmokeMagic(Skill):
+
+    def __init__(self, user, to, params, skill_instances):
+        super().__init__(user, to, skill_instances)
+        self.loaded = True
+        self.dizzy_explode = True  # 眩晕爆炸
+        self.dizzy_rooted_effect = None  # 眩晕定身特效
+        self.target = params.get("target", "player")
+        self.points = params.get("range", [[1]])
+        self.damages = params.get("damages", [400])
+        self.times = params.get("hurt_times", [0])
+        self.recover_rate = params.get("recover_rate", 1)
+        if self.target == "player":
+            self.centre = (level.current_level.me.x, level.current_level.me.y)
+        else:
+            self.centre = (self.user.x, self.user.y)
+        if len(self.points[0]) == 1:
+            self.grids = []
+            grid_radius = self.points[0][0]
+            for a in range(-grid_radius, grid_radius+1):
+                for b in range(-grid_radius, grid_radius+1):
+                    self.grids.append((a+self.centre[0], b+self.centre[1]))
+        elif len(self.points[0]) == 4:
+            self.grids = []
+            x1, y1, x2, y2 = self.points[0][0], self.points[0][1], self.points[0][2], self.points[0][3]
+            for a in range(x1, x2+1):
+                for b in range(y1, y2+1):
+                    self.grids.append((a+self.centre[0], b+self.centre[1]))
+        else:
+            self.grids = [(a+self.centre[0], b+self.centre[1]) for [a, b] in self.points]
+
+    def load(self):
+        super().load()
+
+    def update(self):
+        super().update()
+        if self.current_time - self.skill_time_init > 5000:
+            if self.dizzy_rooted_effect is not None:
+                self.dizzy_rooted_effect.state = EffectState.DEAD
+            for e in self.effect_instances:
+                e.state = EffectState.DEAD
+            self.kill()
+        if self.current_time - self.skill_time_init > 1000 and self.dizzy_explode:
+            # 眩晕爆炸
+            self.dizzy_explode = False
+            self.user.rooted -= 1
+            # 检查死亡
+            if self.user.remain_blood == 0:
+                for e in self.effect_instances:
+                    e.state = EffectState.DEAD
+                self.kill()
+                return
+            # 受伤
+            if (level.current_level.me.x, level.current_level.me.y) in self.grids:
+                CustomGotDevilPoisonEffect(self.to, [self.damages, self.times], self.to.skill_instances)
+                self.user.heal(self.damages[0] * self.recover_rate)
+                sound_player.play("cry")
+            for (x, y) in self.grids:
+                an_effect = EffectInstance("blood_dizzy_explode", self.user, False, level.current_level.effects_front)
+                an_effect.set_xy(x, y)
+                self.effect_instances.append(an_effect)
+        if self.loaded:
+            # npc施法阵与眩晕范围提示
+            self.loaded = False
+            self.user.rooted += 1
+            self.user.align_xy()
+            self.effect_instances.append(EffectInstance("launch2", self.user, False, self.user.effects_front))
+            # 范围提示
+            for (x, y) in self.grids:
+                an_effect = EffectInstance("blood_dizzy_hint", self.user, False, level.current_level.effects_behind)
+                an_effect.set_xy(x, y)
+                self.effect_instances.append(an_effect)
+            sound_player.play("launch")
+
+
+
+
+
+
+
+
+
+
+# 自定义不引爆子弹
+# "params": {"number": 5, "damage": 600, "radius": 1.5, "times": 10000, "rps": 0.5, "effect": "fire_ball"}
+class CustomSurroundingFireBallStream(Skill):
+
+    def __init__(self, user, to, params, skill_instances):
+        super().__init__(user, to, skill_instances)
+        self.loaded = True
+        self.enough_energy = True
+        self.knife_charge = True
+        self.knife_begin  = True
+        self.knife_end    = True
+        self.to_xy = None
+        self.delta_x = 0
+        self.delta_y = 0
+        self.delta_len = 0
+        self.old_time = pygame.time.get_ticks()
+        self.effect_fire = None
+        self.number = params.get("number", 5)
+        self.damage = params.get("damage", 600)
+        self.points = params.get("radius", 1.5)
+        self.times  = int(params.get("times", 10000))
+        self.rps    = float(params.get("rps", 0.5))
+        self.effect = params.get("effect", "fire_ball")
+        self.hit_interval_ms = 250
+        self.r2 = 20 * 20
+        self.radius_px = int(self.points * 40)
+        self.angular_speed = 2 * pi * max(self.rps, 0.0)    # rad/s
+        self.fireballs = []                                 # [{e, angle, last_hit}]
+        self.spawned = False
+        self._last_update = pygame.time.get_ticks()
+
+    def _spawn_ring(self):
+        if self.number <= 0:
+            return
+        center_x, center_y = self.user.x_pos, self.user.y_pos
+        layer = level.current_level.effects_front
+        for i in range(self.number):
+            ang = 2 * pi * i / self.number
+            e = EffectInstance(self.effect, self.user, False, layer)
+            x = center_x + self.radius_px * cos(ang)
+            y = center_y + self.radius_px * sin(ang)
+            e.set_xy_pos(x, y)
+            self.effect_instances.append(e)
+            self.fireballs.append({"e": e, "angle": ang})
+        self.spawned = True
+        self._last_update = self.current_time
+
+    def _update_positions(self, dt_sec: float):
+        if not self.fireballs:
+            return
+        cx, cy = self.user.x_pos, self.user.y_pos
+        dtheta = self.angular_speed * dt_sec  # 增量角
+        for fb in self.fireballs:
+            fb["angle"] += dtheta
+            x = cx + self.radius_px * cos(fb["angle"])
+            y = cy + self.radius_px * sin(fb["angle"])
+            fb["e"].set_xy_pos(x, y)
+
+    def _check_collisions(self):
+        tx, ty = self.to.x_pos, self.to.y_pos
+        for fb in self.fireballs:
+            e = fb["e"]
+            dx = e.x_pos - tx
+            dy = e.y_pos - ty
+            if dx * dx + dy * dy <= self.r2:
+                self.to.try_damage(self.damage)
+                self.fireballs.remove(fb)
+                e.state = EffectState.DEAD
+                try:
+                    sound_player.play("crash")
+                except Exception as e:
+                    print(e)
+
+    def _cleanup_and_kill(self):
+        for e in self.effect_instances:
+            e.state = EffectState.DEAD
+        self.kill()
+
+    def update(self):
+        super().update()
+        # 施法者死亡或超时——直接清理
+        life_ms = self.current_time - self.skill_time_init
+        if self.user.remain_blood <= 0 or life_ms >= self.times:
+            self._cleanup_and_kill()
+            return
+
+        # 首帧生成火球环
+        if not self.spawned:
+            self._spawn_ring()
+
+        # 位置刷新(跟随 user 做圆周运动)
+        dt_ms = max(0, self.current_time - self._last_update)
+        dt_sec = dt_ms / 1000.0
+        if dt_sec > 0:
+            self._update_positions(dt_sec)
+            self._last_update = self.current_time
+
+        # 碰撞检测与结算
+        self._check_collisions()
+
+
+
+
+
+
+
+
+
+# "params": {"range": 1}
+class CustomTeleportEscape(Skill):
+    def __init__(self, user, to, params, skill_instances):
+        super().__init__(user, to, skill_instances)
+        self.range = params.get("range", 1)
+        cl = level.current_level
+        # npc传送
+        safe_grids = self.cal_to_available(cl)  # 计算全部安全格子
+        if len(safe_grids) == 0:
+            return
+        safe_point = random.choice(safe_grids)  # 随机抽取安全格子
+        self.effect_instances.append(
+            EffectInstance("blue_dots_reverse", self.user, False, self.user.effects_front)
+        )
+        self.user.set_xy(*safe_point)
+        self.effect_instances.append(
+            EffectInstance("blue_dots", self.user, False, self.user.effects_front)
+        )
+        sound_player.play("X08_01")
+
+    def cal_to_available(self, cl):
+        safe_grids = []
+        for dx in range(-self.range, self.range + 1):
+            for dy in range(-self.range, self.range + 1):
+                if self.to.y + dy < cl.map_y and self.to.x + dx < cl.map_x:
+                    if dx == 0 and dy == 0:
+                        continue
+                    if not cl.block[1][self.to.x + dx][self.to.y + dy] and len(cl.get_bomb_instance(self.to.x + dx, self.to.y + dy)) == 0:
+                        safe_grids.append((self.to.x + dx, self.to.y + dy))
+        return safe_grids
+
+
+
+
+
+
+
+# "params": {"damages": [300, 200, 100], "times": [0, 600, 1200], "spawn": [], "recove_rate": 0}
+class VampireSword5x5(Skill):
+
+    def __init__(self, user, to, params, skill_instances):
+        super().__init__(user, to, skill_instances)
+        self.used = False
+        self.damages = params.get("damages", [300, 200, 100])
+        self.times = params.get("times", [0, 600, 1200])
+        self.spawn = params.get("spawn", [])
+        self.recover_rate = params.get("recove_rate", 0)
+
+    def update(self):
+        super().update()
+        if not self.used:
+            self.used = True
+            self.effect_instances.append(
+                EffectInstance("canyon_sword", self.user, True, self.user.effects_front)
+            )
+            for to in self.to:
+                if abs(to.x - self.user.x) < 3 and abs(to.y - self.user.y) < 3 and (abs(to.x - self.user.x) + abs(to.y - self.user.y) != 4):
+                    CustomGotDevilPoisonEffect(to, [self.damages, self.times], to.skill_instances)
+                    if self.recover_rate != 0:
+                        self.user.heal(self.damages[0] * self.recover_rate)
+                    EffectInstance("thunder_explode", to, True, to.effects_front)
+                    sound_player.play("cry")
+                    for npc in self.spawn:
+                        level.current_level.npcs.append(level.current_level.get_an_npc(npc, (to.x, to.y)))
+
+        if self.current_time - self.skill_time_init > 500:
+            for e in self.effect_instances:
+                e.state = EffectState.DEAD
+            self.kill()
 
 

+ 13 - 9
game/skill/parametric_skill.py

@@ -82,6 +82,8 @@ class SpawnMinionsWithName(Skill):
 
     def load(self):
         super().load()
+        if not level.current_level.in_district:
+            self.kill()
         grid = level.current_level.district_square_grid
         for x in range(grid["x1"], grid["x2"] + 1):
             for y in range(grid["y1"], grid["y2"] + 1):
@@ -1561,6 +1563,8 @@ class CustomCleverSpawnMinionsWithName(Skill):
 
     def load(self):
         super().load()
+        if not level.current_level.in_district:
+            self.kill()
         grid = level.current_level.district_square_grid
         npcs = level.current_level.npcs
         for x in range(grid["x1"], grid["x2"] + 1):
@@ -2761,7 +2765,7 @@ class CustomGotDevilPoisonEffect(Skill):
             sound_player.play("explode2")
             self.user.try_devil_damage(int(self.damages[0]))
         if len(self.times) > 1:
-            for i in range(1,len(self.times)):
+            for i in range(1, len(self.times)):
                 if self.current_time - self.skill_time_init > self.times[i] and self.hurts[i]:
                     self.hurts[i] = False
                     self.user.try_devil_damage(int(self.damages[i]))
@@ -2821,8 +2825,8 @@ class CustomDevilSmokeMagic(Skill):
             # 受伤
             if (level.current_level.me.x, level.current_level.me.y) in self.grids:
                 CustomGotDevilPoisonEffect(self.to, [self.damages, self.times], self.to.skill_instances)
-                level.current_level.me.blood = max(1, level.current_level.me.blood-self.damages[0])
-                R.current_standard_HP = max(1, R.current_standard_HP-self.damages[0])
+                level.current_level.me.blood = max(1, level.current_level.me.blood - max(0,self.damages[0]))
+                R.current_standard_HP = max(1, R.current_standard_HP-max(0,self.damages[0]))
                 sound_player.play("cry")
             for (x,y) in self.grids:
                 an_effect = EffectInstance("devil_dizzy_explode", self.user, False, level.current_level.effects_front)
@@ -2951,8 +2955,8 @@ class CustomDevilAirKnife(Skill):
                                     if self.to.x == nx and self.to.y == ny:
                                         self.to.try_damage(self.damage_blood)
                                         # CustomGotDevilPoisonEffect(self.to, [[self.delta_blood], [0]], self.to.skill_instances)
-                                        level.current_level.me.blood = max(1, level.current_level.me.blood-self.delta_blood)
-                                        R.current_standard_HP = max(1, R.current_standard_HP-self.delta_blood)
+                                        level.current_level.me.blood = max(1, level.current_level.me.blood-max(0,self.delta_blood))
+                                        R.current_standard_HP = max(1, R.current_standard_HP-max(0,self.delta_blood))
                                         sound_player.play("cry")
                         self.explode = True
                         for e in self.effect_instances:
@@ -2963,8 +2967,8 @@ class CustomDevilAirKnife(Skill):
                         # 造成伤害
                         if self.to.x == point[0] and self.to.y == point[1]:
                             self.to.try_damage(self.damage_blood)
-                            level.current_level.me.blood = max(1, level.current_level.me.blood-self.delta_blood)
-                            R.current_standard_HP = max(1, R.current_standard_HP-self.delta_blood)
+                            level.current_level.me.blood = max(1, level.current_level.me.blood-max(0,self.delta_blood))
+                            R.current_standard_HP = max(1, R.current_standard_HP-max(0,self.delta_blood))
                             sound_player.play("cry")
                             dx, dy = e.x-self.centre[0], e.y-self.centre[1]
                             if len(self.grids) > 0:
@@ -3007,8 +3011,8 @@ class CustomDevilAirKnife(Skill):
                             if self.to.x == point[0] and self.to.y == point[1]:
                                 self.to.try_damage(self.damage_blood)
                                 # CustomGotDevilPoisonEffect(self.to, [[self.delta_blood], [0]], self.to.skill_instances)
-                                level.current_level.me.blood = max(1, level.current_level.me.blood-self.delta_blood)
-                                R.current_standard_HP = max(1, R.current_standard_HP-self.delta_blood)
+                                level.current_level.me.blood = max(1, level.current_level.me.blood-max(0,self.delta_blood))
+                                R.current_standard_HP = max(1, R.current_standard_HP-max(0,self.delta_blood))
                                 sound_player.play("cry")
                     PlayerDebuffPoisonBlood3x3(self.user, self.to, [self.to_xy[0], self.to_xy[1]], level.current_level.skill_instances)
 

+ 379 - 19
game/skill/rouge_skill.py

@@ -15,6 +15,7 @@ import pygame.time
 from game.const import game as G
 from game.const import rouge as R
 from game.const import rouge_theme as T
+from game.const.task import direct_task_count
 from game.effect.effect_instance import EffectInstance, EffectState
 from game.level import level
 from game.skill.skill import Skill, IceSlow, GotPoisonSmoke50x3, GotPoisonSmoke80x2, Protect3s
@@ -34,14 +35,6 @@ from datetime import datetime
 # logging.basicConfig(filename='OBSTACLE_SKILL.log', level=logging.INFO)
 
 
-
-
-
-
-
-
-
-
 # 终点指引
 class DestinationCursor(Skill):
 
@@ -502,6 +495,37 @@ class Shop300DMGUP(Skill):
 
 
 
+# shop防御增加50
+class Shop50DefenseUP(Skill):
+    def __init__(self, user, to, skill_instances):
+        self.charge = False
+        self.add_amount = 50
+        self.cost = 168
+        super().__init__(user, to, skill_instances)
+
+    def load(self):
+        super().load()
+
+    def update(self):
+        super().update()
+        if self.user.remain_blood <= 0:
+            self.kill()
+        if self.user.isTreasure:
+            self.charge = True
+            R.current_standard_defense += self.add_amount
+            level.current_level.me.defense += self.add_amount
+            level.current_level.me.standard_defense += self.add_amount
+            self.kill()
+        else:
+            if R.coin >= self.cost and not self.charge:
+                self.charge = True
+                R.coin -= self.cost
+                R.current_standard_defense += self.add_amount
+                level.current_level.me.defense += self.add_amount
+                level.current_level.me.standard_defense += self.add_amount
+                self.user.remain_blood = 0
+                self.kill()
+
 
 
 
@@ -1050,7 +1074,11 @@ class ShopSlowImmune(Skill):
         super().update()
         if self.user.remain_blood <= 0:
             self.kill()
-        if R.coin >= 80 and not self.charge:
+        if R.slow_immune == 1:
+            level.current_level.message_entry.new_message(sender='商人', message='您已拥有该商品的效果,无需再破费了,或者您想要做慈善?')
+            self.user.remain_blood = 0
+            self.kill()
+        if R.coin >= 80 and not self.charge and R.slow_immune != 1:
             self.charge = True
             R.coin -= 80
             R.slow_immune = 1
@@ -1070,7 +1098,11 @@ class ShopReverseImmune(Skill):
         super().update()
         if self.user.remain_blood <= 0:
             self.kill()
-        if R.coin >= 80 and not self.charge:
+        if R.reverse_immune == 1:
+            level.current_level.message_entry.new_message(sender='商人', message='您已拥有该商品的效果,无需再破费了,或者您想要做慈善?')
+            self.user.remain_blood = 0
+            self.kill()
+        if R.coin >= 80 and not self.charge and R.reverse_immune != 1:
             self.charge = True
             R.coin -= 80
             R.reverse_immune = 1
@@ -1091,7 +1123,11 @@ class ShopRootImmune(Skill):
         super().update()
         if self.user.remain_blood <= 0:
             self.kill()
-        if R.coin >= 250 and not self.charge:
+        if R.root_immune == 1:
+            level.current_level.message_entry.new_message(sender='商人', message='您已拥有该商品的效果,无需再破费了,或者您想要做慈善?')
+            self.user.remain_blood = 0
+            self.kill()
+        if R.coin >= 250 and not self.charge and R.root_immune != 1:
             self.charge = True
             R.coin -= 250
             R.root_immune = 1
@@ -1111,7 +1147,11 @@ class ShopStunImmune(Skill):
         super().update()
         if self.user.remain_blood <= 0:
             self.kill()
-        if R.coin >= 80 and not self.charge:
+        if R.stun_immune == 1:
+            level.current_level.message_entry.new_message(sender='商人', message='您已拥有该商品的效果,无需再破费了,或者您想要做慈善?')
+            self.user.remain_blood = 0
+            self.kill()
+        if R.coin >= 80 and not self.charge and R.stun_immune != 1:
             self.charge = True
             R.coin -= 80
             R.stun_immune = 1
@@ -1201,6 +1241,9 @@ class RougeTreasureRandomSpawn(Skill):
                     self.monster = "RougeTreasureDestiny"
             if R.story_destiny and random.randint(1,100) > 90:
                 self.monster = "RougeTreasureDestiny"
+            if G.CURRENT_LEVEL <= 1:
+                if R.rouge_hero == "Chunli":
+                    self.monster = "RougeTreasureBomb1"
             self.an_npc = cl.get_an_npc(self.monster, (self.user.x+3, self.user.y-3))
             cl.npcs.append(self.an_npc)
 
@@ -1673,6 +1716,7 @@ class CasinoContinue(Skill):
         if self.loaded and R.coin >= self.amount:
             self.loaded = False
             R.coin -= self.amount
+            direct_task_count(30006, "m", self.amount)
             self.loaded_eff = EffectInstance("launch2", self.user, False, self.user.effects_behind)
             sound_player.play("launch")
 
@@ -1687,6 +1731,7 @@ class CasinoContinue(Skill):
                     level.current_level.npcs.append(self.an_npc)
                 else:
                     level.current_level.message_entry.new_message(sender='酷比赌场', message="赌场破产跑路了!")
+                    direct_task_count(40021, "s")
 
             elif self.param == 2:
                 if random.randint(1, 100) <= self.prob:
@@ -1699,6 +1744,7 @@ class CasinoContinue(Skill):
                     level.current_level.npcs.append(self.an_npc)
                 else:
                     level.current_level.message_entry.new_message(sender='酷比赌场', message="赌场破产跑路了!")
+                    direct_task_count(40021, "s")
 
             elif self.param == 3:
                 if random.randint(1, 100) <= self.prob:
@@ -1711,6 +1757,7 @@ class CasinoContinue(Skill):
                     level.current_level.npcs.append(self.an_npc)
                 else:
                     level.current_level.message_entry.new_message(sender='酷比赌场', message="赌场破产跑路了!")
+                    direct_task_count(40021, "s")
 
             else:
                 if random.randint(1, 100) <= self.prob:
@@ -1723,6 +1770,7 @@ class CasinoContinue(Skill):
                     level.current_level.npcs.append(self.an_npc)
                 else:
                     level.current_level.message_entry.new_message(sender='酷比赌场', message="赌场破产跑路了!")
+                    direct_task_count(40021, "s")
 
             self.user.remain_blood = 0
             self.user.die()
@@ -1774,6 +1822,7 @@ class CasinoContinue(Skill):
             level.current_level.message_entry.new_message(sender='酷比赌场', message=f"运气不错!糖币+{int(self.amount * multi)}!")
         elif reward == "EXP":
             R.game_exp += 30
+            R.rouge_exp += 30
             level.current_level.message_entry.new_message(sender='酷比赌场', message='运气不错!经验+30!')
         elif reward == "revive":
             level.current_level.me.skill_remains[3] += 1
@@ -1891,7 +1940,7 @@ class TreasureRunRandomSpawnWithProtect(Skill):
                     self.monster = "RougeTreasureRunFail"
                     self.successful = False
                     if random.randint(1, 100) >= 50:
-                        self.monster = random.choice(["RougeTreasureRunNeedCoin100", "RougeTreasureRunNeedCoin200"])
+                        self.monster = random.choice(["RougeTreasureRunNeedCoin50", "RougeTreasureRunNeedCoin50", "RougeTreasureRunNeedCoin100", "RougeTreasureRunNeedCoin200"])
                         self.an_npc = cl.get_an_npc(self.monster, (self.user.x + 3, self.user.y - 3))
                         Protect3s(self.an_npc, self.an_npc.skill_instances)
                         cl.npcs.append(self.an_npc)
@@ -2591,6 +2640,7 @@ class CasinoAll(Skill):
                 #     mon = self.spawn_list[i]
                 #     self.an_npc = cl.get_an_npc(mon, (self.user.x + self.pos[i][0], self.user.y + self.pos[i][1]))
                 #     cl.npcs.append(self.an_npc)
+                direct_task_count(30006, "m", R.coin)
                 R.coin = 0
                 level.current_level.message_entry.new_message(sender='酷比赌场', message=f"财宝皆是虚无,去留都交给上帝定夺吧...")
                 level.current_level.message_entry.new_message(sender='命运', message='重力开始翻转,空间逐渐扭曲,苍穹之上的圣光不再挥洒')
@@ -2647,6 +2697,28 @@ class CasinoAll(Skill):
             self.kill()
 
 
+class NeedCoin50(Skill):
+
+    def __init__(self, user, to, skill_instances):
+        self.charge = False
+        self.cost = 50
+        super().__init__(user, to, skill_instances)
+
+    def load(self):
+        super().load()
+
+    def update(self):
+        super().update()
+        if R.coin >= self.cost and not self.charge:
+            self.charge = True
+            R.coin -= self.cost
+            FakeKillAll(self.user, level.current_level.npcs, self.skill_instances)
+            self.user.remain_blood = 0
+            self.user.die()
+            self.kill()
+        else:
+            level.current_level.message_entry.new_message(sender='命运', message='贫道只渡有元之人')
+            self.kill()
 
 
 class NeedCoin100(Skill):
@@ -2743,7 +2815,7 @@ class RougeExerciseSpawn(Skill):
 
             if R.extra_lv == 0:
                 level.current_level.message_entry.new_message(sender='宗师', message='夫勇者求技, 先当自废筋骨!')
-                level.current_level.message_entry.new_message(sender='宗师', message='本次修炼需消耗300生命上限, 300糖泡伤害, 1糖泡数量, 50糖币')
+                level.current_level.message_entry.new_message(sender='宗师', message='本次修炼需消耗200生命上限, 200糖泡伤害, 1糖泡数量, 50糖币')
                 self.an_npc = cl.get_an_npc("RougeExerciseStart", (self.user.x, self.user.y-2))
                 cl.npcs.append(self.an_npc)
             elif R.extra_lv == 1:
@@ -2783,14 +2855,14 @@ class RougeExerciseStart(Skill):
             self.loaded = False
             self.loaded_eff = EffectInstance("launch2", self.user, False, self.user.effects_behind)
             sound_player.play("launch")
-            R.current_standard_HP -= 300
-            level.current_level.me.blood -= 300
+            R.current_standard_HP -= 200
+            level.current_level.me.blood -= 200
             level.current_level.me.remain_blood = min(level.current_level.me.remain_blood, level.current_level.me.blood)
             if R.rouge_hero == "Fox":
                 level.current_level.me.damage = R.current_standard_damage + int(R.FoxSkill(R.rouge_lv)*(level.current_level.me.blood-level.current_level.me.remain_blood))
-            R.current_standard_damage -= 300
-            level.current_level.me.damage -= 300
-            level.current_level.me.standard_damage -= 300
+            R.current_standard_damage -= 200
+            level.current_level.me.damage -= 200
+            level.current_level.me.standard_damage -= 200
             R.current_standard_bomb = max(1, R.current_standard_bomb - 1)
             level.current_level.me.bomb = max(1, level.current_level.me.bomb - 1)
             R.coin -= 50
@@ -2864,3 +2936,291 @@ class RougeExerciseStart(Skill):
 
 
 
+class ChessKnightMove(Skill):
+
+    def __init__(self, user, to, skill_instances):
+        super().__init__(user, to, skill_instances)
+        self.loaded = False
+        if abs(self.user.x - self.to.x) <= 1 and abs(self.user.y - self.to.y) <= 1:
+            self.kill()
+        self.target_point = None
+        self.min_square_distance = 99999
+        for point in [(1,2), (1,-2), (-1,2), (-1,-2), (2,1), (-2,1), (2,-1), (-2,-1)]:
+            x, y = self.user.x + point[0], self.user.y + point[1]
+            if len(level.current_level.get_bomb_instance(x, y)) != 0:
+                continue
+            if (x, y) in level.current_level.obstacle_instances.keys():
+                continue
+            distance2 = (x - self.to.x) ** 2 + (y - self.to.y) ** 2
+            if distance2 < self.min_square_distance:
+                self.target_point = (x, y)
+                self.min_square_distance = distance2
+
+    def update(self):
+        super().update()
+        if not self.loaded:
+            self.loaded = True
+            if self.target_point is None:
+                self.kill()
+            an_effect = EffectInstance("scope", self.user, False, level.current_level.effects_front)
+            an_effect.set_xy(self.target_point[0], self.target_point[1])
+            self.effect_instances.append(an_effect)
+
+        if self.user.remain_blood <= 0:
+            self.kill()
+
+        if self.current_time - self.skill_time_init > 500 and self.loaded:
+            self.user.set_xy(self.target_point[0], self.target_point[1])
+            sound_player.play("explode2")
+            self.kill()
+
+
+
+
+
+
+
+class ChessQueenMoveMode(Skill):
+
+    def __init__(self, user, to, params, skill_instances):
+        super().__init__(user, to, skill_instances)
+        self.target_point = None
+        self.move_gap = max(params.get("move_gap", 3000), 500)
+        self.moving = False
+        self.start_moving = 0
+        self.last_move = 0
+        self.last_check = 0
+        self.effect = None
+        self.target_point = None
+
+    def update(self):
+        super().update()
+        if self.current_time - self.last_check >= 20:  # 20ms触发一次检测
+            self.last_check = self.current_time
+            if self.current_time - self.last_move >= self.move_gap and not self.moving:
+                dx, dy = level.current_level.me.x - self.user.x, level.current_level.me.y - self.user.y
+                if abs(dx) == abs(dy) or dx == 0 or dy == 0:
+                    self.last_move = self.current_time
+                    self.moving = True
+                    self.start_moving = self.current_time
+                    self.target_point = (level.current_level.me.x, level.current_level.me.y)
+                    self.effect = EffectInstance("scope", level.current_level.me, False, level.current_level.effects_front)
+                    self.effect_instances.append(self.effect)
+
+        if self.moving:
+            if self.current_time - self.start_moving > 500:  # 反应间隔
+                self.moving = False
+                self.user.set_xy(self.target_point[0], self.target_point[1])
+                self.effect.state = EffectState.DEAD
+                sound_player.play("explode2")
+
+        if self.user.remain_blood <= 0:
+            self.kill()
+
+
+
+
+
+
+
+# V我50
+class BankBorrow50(Skill):
+    def __init__(self, user, to, skill_instances):
+        self.charge = False
+        super().__init__(user, to, skill_instances)
+
+    def load(self):
+        super().load()
+
+    def update(self):
+        super().update()
+        if self.user.remain_blood <= 0:
+            self.kill()
+        if not self.charge:
+            self.charge = True
+            if R.has_loan:
+                level.current_level.message_entry.new_message(sender='柜员', message='请您先结算并还清所有欠款后再来尝试借贷')
+                self.user.remain_blood = 0
+                self.kill()
+            else:
+                R.coin += 50
+                R.coin_borrow += 50
+                self.user.remain_blood = 0
+                self.kill()
+
+
+# V我100
+class BankBorrow100(Skill):
+    def __init__(self, user, to, skill_instances):
+        self.charge = False
+        super().__init__(user, to, skill_instances)
+
+    def load(self):
+        super().load()
+
+    def update(self):
+        super().update()
+        if self.user.remain_blood <= 0:
+            self.kill()
+        if not self.charge:
+            self.charge = True
+            if R.has_loan:
+                level.current_level.message_entry.new_message(sender='柜员', message='请您先结算并还清所有欠款后再来尝试借贷')
+                self.user.remain_blood = 0
+                self.kill()
+            else:
+                R.coin += 100
+                R.coin_borrow += 100
+                self.user.remain_blood = 0
+                self.kill()
+
+
+# 生命100换25
+class BankCostHP(Skill):
+    def __init__(self, user, to, skill_instances):
+        self.charge = False
+        super().__init__(user, to, skill_instances)
+
+    def load(self):
+        super().load()
+
+    def update(self):
+        super().update()
+        if self.user.remain_blood <= 0:
+            self.kill()
+        if not self.charge:
+            self.charge = True
+            R.coin += 25
+            R.current_standard_HP -= 100
+            level.current_level.me.blood -= 100
+            level.current_level.me.remain_blood -= 100
+            if R.rouge_hero == "Fox":
+                level.current_level.me.damage = R.current_standard_damage + int(R.FoxSkill(R.rouge_lv)*(level.current_level.me.blood-level.current_level.me.remain_blood))
+            self.user.remain_blood = 0
+            self.kill()
+
+
+# 糖泡1换30
+class BankCostBomb(Skill):
+    def __init__(self, user, to, skill_instances):
+        self.charge = False
+        super().__init__(user, to, skill_instances)
+
+    def load(self):
+        super().load()
+
+    def update(self):
+        super().update()
+        if self.user.remain_blood <= 0:
+            self.kill()
+        if not self.charge:
+            self.charge = True
+            R.coin += 30
+            R.current_standard_bomb -= 1
+            level.current_level.me.bomb -= 1
+            self.user.remain_blood = 0
+            self.kill()
+
+
+
+# 结算
+class LeaveBank(Skill):
+    def __init__(self, user, to, skill_instances):
+        self.charge = False
+        super().__init__(user, to, skill_instances)
+
+    def load(self):
+        super().load()
+
+    def update(self):
+        super().update()
+        if self.user.remain_blood <= 0:
+            self.kill()
+        if not self.charge:
+            self.charge = True
+            if R.has_loan:
+                level.current_level.message_entry.new_message(sender='柜员', message=f'请您支付还清共{R.coin_borrow}糖币')
+                level.current_level.npcs.append(level.current_level.get_an_npc("RougeBankReturn", (self.user.x, self.user.y+3)))
+            else:
+                if R.coin_borrow > 0:
+                    R.has_loan = True
+                for npc in level.current_level.npcs:
+                    npc.try_damage(1000000000000000000000000000000000)
+                    npc.remain_blood = 0
+                    npc.die()
+            self.user.remain_blood = 0
+            self.kill()
+
+
+# 还钱
+class ReturnMoney(Skill):
+    def __init__(self, user, to, skill_instances):
+        self.charge = False
+        super().__init__(user, to, skill_instances)
+
+    def load(self):
+        super().load()
+
+    def update(self):
+        super().update()
+        if self.user.remain_blood <= 0:
+            self.kill()
+        if not self.charge:
+            self.charge = True
+            if R.coin >= R.coin_borrow:
+                R.coin -= R.coin_borrow
+                R.coin_borrow = 0
+                R.has_loan = False
+                level.current_level.message_entry.new_message(sender='柜员', message=f'支付成功,祝您后续旅途愉快!')
+                level.current_level.npcs.append(level.current_level.get_an_npc("RougeBankRun", (self.user.x, self.user.y-3)))
+            else:
+                level.current_level.message_entry.new_message(sender='打手', message=f'欠债还钱,天经地义,若要抵赖,必遭天谴!')
+                R.coin = 0
+                R.coin_borrow = 0
+                R.has_loan = False
+                for npc in level.current_level.npcs:
+                    if npc != self.user:
+                        npc.try_damage(1000000000000000000000000000000000)
+                        npc.remain_blood = 0
+                        npc.die()
+                if R.coin_borrow < 80:
+                    rd = random.choice([1, 2, 3])
+                    if rd == 1:
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RougeTreasureDestinyElite", (self.user.x, self.user.y+5)))
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RogueDestinyAFlower", (self.user.x-3, self.user.y-1)))
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RogueDestinyAFlower", (self.user.x+3, self.user.y-1)))
+                    elif rd == 2:
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RougeTreasureDestinyWizard", (self.user.x, self.user.y+5)))
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RogueDestinyASpatialGuard", (self.user.x+3, self.user.y-5)))
+                    else:
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RougeTreasureDestinyMachine", (self.user.x-3, self.user.y+3)))
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RogueSkylandTemporalGuard", (self.user.x+3, self.user.y-5)))
+                else:
+                    rd = random.choice([1, 2, 3])
+                    if rd == 1:
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RougeTreasureDestinyElite", (self.user.x, self.user.y+5)))
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RogueDestinyAFlower", (self.user.x-3, self.user.y-1)))
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RogueDestinyAFlower", (self.user.x-3, self.user.y-5)))
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RogueDestinyAFlower", (self.user.x+3, self.user.y-1)))
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RogueDestinyAFlower", (self.user.x+3, self.user.y-5)))
+                    elif rd == 2:
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RougeTreasureDestinyWizard", (self.user.x, self.user.y+5)))
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RogueDestinyASpatialGuard", (self.user.x+3, self.user.y-5)))
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RogueDestinyASpatialGuard", (self.user.x-3, self.user.y-5)))
+                    else:
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RougeTreasureDestinyMachine", (self.user.x-3, self.user.y+3)))
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RogueSkylandTemporalGuard", (self.user.x+3, self.user.y-5)))
+                        level.current_level.npcs.append(level.current_level.get_an_npc("RogueSkylandTemporalGuard", (self.user.x-3, self.user.y-5)))
+                for npc in level.current_level.npcs:
+                    if npc is self.user or npc.resentful:
+                        continue
+                    npc.resentful = True
+                    npc.friendly = False
+                    for i in range(len(npc.skill_names)):
+                        npc.skill_init_times[i] = npc.npc_json["skills"][i]["init"] + pygame.time.get_ticks()
+                    npc.npc_skill_time = pygame.time.get_ticks()
+            self.user.remain_blood = 0
+            self.user.die()
+            self.kill()
+
+

+ 2 - 0
game/skill/skill.py

@@ -9,6 +9,7 @@ from game.effect.effect_instance import EffectState, EffectInstance
 from game.level import level
 from game.sound import sound_player
 from game.sprite.updatable import Updatable
+from game.ui.game.game_review import GameReview
 
 
 class Skill:
@@ -1908,6 +1909,7 @@ class WinEffect(Skill):
         if self.current_time - self.skill_time_init >= 9000:
             for e in self.effect_instances:
                 e.state = EffectState.DEAD
+            level.current_level.ui_instances_sec.append(GameReview())
             self.kill()
 
         if self.running:

+ 14 - 0
game/skill/skill_map.py

@@ -309,6 +309,10 @@ skill_map = {
     # "CustomMapEarthQuake": {"skill": CustomMapEarthQuake, "target": None, "param": True, "effect": "cl"},
     "CustomPointSpawnWithNameAndCharge": {"skill": CustomPointSpawnWithNameAndCharge, "target": "me", "param": True, "effect": "cl"},
     "CustomRevengeCrossFire": {"skill": CustomRevengeCrossFire, "target": "me", "param": True, "effect": "self"},
+    "CustomVampireSmokeMagic": {"skill": CustomVampireSmokeMagic, "target": "me", "param": True, "effect": "cl"},
+    "CustomSurroundingFireBallStream": {"skill": CustomSurroundingFireBallStream, "target": "me", "param": True, "effect": "cl"},
+    "CustomTeleportEscape": {"skill": CustomTeleportEscape, "target": "me", "param": True, "effect": "self"},
+    "VampireSword5x5": {"skill": VampireSword5x5, "target": "listed_me", "param": True, "effect": "self"},
 
     "CustomLevelVariableOperation": {"skill": CustomLevelVariableOperation, "target": "me", "param": True, "effect": "self"},
     "CustomConditionBasedSkill": {"skill": CustomConditionBasedSkill, "target": "me", "param": True, "effect": "self"},
@@ -327,6 +331,7 @@ skill_map = {
     "Shop100DMGUP": {"skill": Shop100DMGUP, "target": "me", "param": None, "effect": "cl"},
     "Shop200DMGUP": {"skill": Shop200DMGUP, "target": "me", "param": None, "effect": "cl"},
     "Shop300DMGUP": {"skill": Shop300DMGUP, "target": "me", "param": None, "effect": "cl"},
+    "Shop50DefenseUP": {"skill": Shop50DefenseUP, "target": "me", "param": None, "effect": "cl"},
     "ShopHPRecoveryPotion": {"skill": ShopHPRecoveryPotion, "target": "me", "param": None, "effect": "cl"},
     "ShopHPRecoveryPotionMiddle": {"skill": ShopHPRecoveryPotionMiddle, "target": "me", "param": None, "effect": "cl"},
     "ShopHPRecoveryPotionBig": {"skill": ShopHPRecoveryPotionBig, "target": "me", "param": None, "effect": "cl"},
@@ -381,10 +386,19 @@ skill_map = {
     "DestinyChoice1": {"skill": DestinyChoice1, "target": "npcs", "param": None, "effect": "cl"},
     "DestinyChoice2": {"skill": DestinyChoice2, "target": "npcs", "param": None, "effect": "cl"},
     "AllShareDamage": {"skill": AllShareDamage, "target": "npcs", "param": None, "effect": "cl"},
+    "NeedCoin50": {"skill": NeedCoin50, "target": "npcs", "param": None, "effect": "cl"},
     "NeedCoin100": {"skill": NeedCoin100, "target": "npcs", "param": None, "effect": "cl"},
     "NeedCoin200": {"skill": NeedCoin200, "target": "npcs", "param": None, "effect": "cl"},
     "RougeExerciseSpawn": {"skill": RougeExerciseSpawn, "target": "npcs", "param": None, "effect": "self"},
     "RougeExerciseStart": {"skill": RougeExerciseStart, "target": "npcs", "param": None, "effect": "self"},
+    "ChessKnightMove": {"skill": ChessKnightMove, "target": "me", "param": None, "effect": "self"},
+    "ChessQueenMoveMode": {"skill": ChessQueenMoveMode, "target": "me", "param": True, "effect": "self"},
+    "BankBorrow50": {"skill": BankBorrow50, "target": "npcs", "param": None, "effect": "cl"},
+    "BankBorrow100": {"skill": BankBorrow100, "target": "npcs", "param": None, "effect": "cl"},
+    "BankCostHP": {"skill": BankCostHP, "target": "npcs", "param": None, "effect": "cl"},
+    "BankCostBomb": {"skill": BankCostBomb, "target": "npcs", "param": None, "effect": "cl"},
+    "LeaveBank": {"skill": LeaveBank, "target": "npcs", "param": None, "effect": "cl"},
+    "ReturnMoney": {"skill": ReturnMoney, "target": "npcs", "param": None, "effect": "cl"},
 
     "Canyon_RevengeDash": {"skill": Canyon_RevengeDash, "target": None, "param": None, "effect": "self"},
     "Canyon_Skill21044": {"skill": Canyon_Skill21044, "target": "me", "param": None, "effect": "self"},

+ 12 - 11
game/sprite/hero.py

@@ -170,7 +170,7 @@ class Hero(Player):
             R.current_standard_HP = self.blood
             R.current_standard_damage = self.damage
             R.current_standard_speed = self.speed * 1000 / (G.GAME_SQUARE)
-            R.current_standard_defense = self.standard_defense
+            R.current_standard_defense = self.standard_defense + R.bomb_effect[R.bomb_skin]["defense"]
             R.current_standard_bomb = self.bomb
         else:
             R.rouge_hero = hero_name
@@ -211,20 +211,21 @@ class Hero(Player):
         # 开发者模式
         if R.debug_mode:
             self.blood = R.current_standard_HP = self.remain_blood = 100000000
+            # self.blood = R.current_standard_HP = self.remain_blood = 8000
             self.speed = R.current_standard_speed = 0.4
             self.bomb = R.current_standard_bomb = max(7, R.current_standard_bomb)
             self.damage = R.current_standard_damage = max(100000, R.current_standard_damage)
-            # self.power = 20
+            self.power = 20
             self.wall_walking = True
             R.show_cursor = True
             R.coin = 2000
-            # R.rouge_destiny["RougeTreasureDestiny"] = R.rouge_destiny["RougeTreasureDestinyWizard"] = R.rouge_destiny["RougeTreasureDestinyMachine"] = 1
-
-            # self.blood = R.current_standard_HP = self.remain_blood = 100000000
-            # self.bomb = R.current_standard_bomb = max(7, R.current_standard_bomb)
-            # self.damage = R.current_standard_damage = max(4000, R.current_standard_damage)
-            # R.show_cursor = True
-            # R.coin = 2000
+        #     # R.rouge_destiny["RougeTreasureDestiny"] = R.rouge_destiny["RougeTreasureDestinyWizard"] = R.rouge_destiny["RougeTreasureDestinyMachine"] = 1
+        #
+        #     # self.blood = R.current_standard_HP = self.remain_blood = 100000000
+        #     # self.bomb = R.current_standard_bomb = max(7, R.current_standard_bomb)
+        #     # self.damage = R.current_standard_damage = max(4000, R.current_standard_damage)
+        #     # R.show_cursor = True
+        #     # R.coin = 2000
 
         # 技能
         item_idx = 0
@@ -341,8 +342,8 @@ class Hero(Player):
                 if delta_coin != 0:
                     delta_dmg = delta_coin * R.SeaPrinceSkill2(R.rouge_lv)
                     R.current_standard_damage += delta_dmg
-                    self.damage += delta_dmg
-                    self.standard_damage += delta_dmg
+                    self.damage = max(0, self.damage + delta_dmg)
+                    self.standard_damage = max(0, self.standard_damage + delta_dmg)
                     self.last_coin = R.coin
 
     def stimulate_x_y_changed_trigger(self):

+ 18 - 16
game/sprite/npc.py

@@ -9,6 +9,7 @@ from game.const import color as C
 from game.const import game as G
 from game.const import rouge as R
 from game.const import rouge_theme as T
+from game.const.task import check_npc_kill_group
 from game.frame import bomb, item
 from game.level import level
 from game.skill.skill import *
@@ -409,18 +410,20 @@ class Npc(Player, Throwable):
             level.current_level.me.try_damage(self.contact, "C")
 
     def check_task(self):
-        if self.stats_name == "RougeTreasureDestinyElite":
-            R.task_RougeTreasureDestinyElite += 1
-        elif self.stats_name == "MineCFireDragonBoss":
-            R.task_MineCFireDragonBoss += 1
-        elif self.stats_name == "RougeTreasureDestinyWizard":
-            R.task_RougeTreasureDestinyWizard += 1
+        # if self.stats_name == "RougeTreasureDestinyElite":
+        #     R.task_RougeTreasureDestinyElite += 1
+        # elif self.stats_name == "MineCFireDragonBoss":
+        #     R.task_MineCFireDragonBoss += 1
+        # elif self.stats_name == "RougeTreasureDestinyWizard":
+        #     R.task_RougeTreasureDestinyWizard += 1
+        if self.resentful:
+            check_npc_kill_group(self.stats_name)
 
     def die(self):
         super().die()
         sound_player.play("npc_dead")
         self.check_task()
-        if R.pass_status[R.difficulty] >= 1 and not R.story_destiny and R.story_eden and not R.story_ocean and not R.story_skyland:
+        if R.pass_status[R.difficulty] >= 1 and not R.story_destiny and not R.story_eden and not R.story_ocean and not R.story_skyland:
             if self.stats_name in ["RougeTreasureDestiny", "RougeTreasureDestinyWizard", "RougeTreasureDestinyMachine"]:
                 R.rouge_destiny[self.stats_name] = 1
                 if R.rouge_destiny["RougeTreasureDestiny"] + R.rouge_destiny["RougeTreasureDestinyWizard"] + R.rouge_destiny["RougeTreasureDestinyMachine"] == 3:
@@ -433,15 +436,13 @@ class Npc(Player, Throwable):
                     level.current_level.me.blood += 1000
                     level.current_level.me.remain_blood += 1000
                     level.current_level.game.map_set_json = level.current_level.game.map_file = R.central_mapset = {
-                        "maps": ["rogueMap1", "rogueAttMap1", "rogueMap2", "rogueAttMap2", "rogueMap3", "rogueAttMap3",
-                                 "rogueMap4", "rogueAttMap4", "rogueMap5", "rogueAttMap5",
-                                 "rogueMap6", "rogueAttMap6", "rogueMap7", "rogueAttMap7", "rogueMap8", "rogueAttMap8",
-                                 "rogueMap9", "rogueAttMap9", "rogueMap10", "rogueAttMap10",
-                                 "rogueMap11", "rogueAttMap11", "rogueMap12", "rogueAttMap12", "rogueMap13",
-                                 "rogueAttMap13", "rogueMap14", "rogueAttMap14", "rogueMap15", "rogueAttMap15_continue",
-                                 "rogueMap16_destiny", "rogueAttMap16_destiny", "rogueMap17_destiny",
-                                 "rogueAttMap17_destiny", "rogueMap18_destiny", "rogueAttMap18_destiny",
-                                 "rogueMap19_destiny", "rogueAttMap19_destiny", "rogueMap20_destiny", "rogueAttMap20_destiny"]}
+                        "maps": [
+                            "rogueMap1", "rogueAttMap1", "rogueMap2", "rogueAttMap2", "rogueMap3", "rogueAttMap3", "rogueMap4", "rogueAttMap4", "rogueMap5", "rogueAttMap5",
+                            "rogueMap6", "rogueAttMap6", "rogueMap7", "rogueAttMap7", "rogueMap8", "rogueAttMap8", "rogueMap9", "rogueAttMap9", "rogueMap10", "rogueAttMap10",
+                            "rogueMap11", "rogueAttMap11", "rogueMap12", "rogueAttMap12", "rogueMap13", "rogueAttMap13", "rogueMap14", "rogueAttMap14", "rogueMap15", "rogueAttMap15_continue",
+                            "rogueMap16_destiny", "rogueAttMap16_destiny", "rogueMap17_destiny", "rogueAttMap17_destiny", "rogueMap18_destiny", "rogueAttMap18_destiny", "rogueMap19_destiny", "rogueAttMap19_destiny", "rogueMap20_destiny", "rogueAttMap20_destiny"
+                        ]
+                    }
                     R.rouge_story = "命运乐章"
                     R.rouge_theme_4 = "重构秩序"
                     R.story_destiny = True
@@ -544,6 +545,7 @@ class Npc(Player, Throwable):
                     print("血条错误", self.chs_name, self.blood_bar_pos)
                 except:
                     pass
+        self.check_task()
         self.gene_ghost()
         self.is_dead = True
         self.remain_blood = -1

+ 8 - 1
game/sprite/player.py

@@ -8,6 +8,7 @@ from game.const import game as G
 from game.const import color as C
 from game.const import rouge as R
 from game.const import rouge_theme as T
+from game.const.task import check_group, save_task_json
 from game.algo import utils as util
 from game.frame import character
 from game.level import level
@@ -647,6 +648,8 @@ class Player(updatable.Updatable):
             #     level.current_level.add_angel(self.x, self.y)
 
     def devil_damage(self, damage_blood: int):
+        if damage_blood <= 0:
+            return
         # 真实对玩家扣减damage_blood血量
         self.remain_blood -= max(damage_blood, self.self_damage_blood)
         if self.remain_blood <= 0:
@@ -663,6 +666,8 @@ class Player(updatable.Updatable):
             self.damage = R.current_standard_damage + int(R.FoxSkill(R.rouge_lv)*(self.blood-self.remain_blood))
 
     def angel_damage(self, damage_blood: int):
+        if self.remain_blood <= 0:
+            return
         if damage_blood > self.defense:
             final_damage = (damage_blood - self.defense)
         else:
@@ -737,7 +742,7 @@ class Player(updatable.Updatable):
                 R.new_drop_list = []
                 save_encrypt_single_rouge_file(rouge_other_data, "rougeOBOther")
 
-            real_exp = int(R.rouge_exp * R.diff_exp[R.difficulty])
+            real_exp = int(R.rouge_exp * R.diff_exp[R.difficulty] + R.task_exp)
             if G.IS_ONLINE:
                 util.save_online()
                 level.current_level.message_entry.new_message(sender='Rogue助手', message='经验+'+str(real_exp) + ', 当前等级经验: ' + R.remain_exp(util.get_online_data()[R.rouge_hero]["exp"]))
@@ -755,10 +760,12 @@ class Player(updatable.Updatable):
 
             print(R.rouge_hero, ": exp + ", real_exp)
             R.rouge_exp = 0
+            R.task_exp = 0
             last_game_file_path = os.path.join(qqtpve_folder, "rougeOBLastGame.rougedata")  # 存档路径
             if os.path.exists(last_game_file_path):
                 os.remove(last_game_file_path)
                 print("清除旧数据")
+            save_task_json()
 
         self.footprint_instances.clear()
         for component in self.character_frame_idxs.keys():

+ 44 - 1
game/ui/game/dlg_pveFunc.py

@@ -1,9 +1,17 @@
+import os
 import pygame
-import game.const.game as G
 import game.const.window as W
+from game.const import game as G
+from game.const import color as C
+from game.const import rouge as R
+from game.const.task import save_task_json
+from game.const import rouge_theme as T
+from game.algo import utils as util
 from game.file_loader.fileLoader import load_png
+from game.level import level
 from game.music import music_loader
 from game.ui.ui import UIInstance
+from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data
 # from game.ui.menu.choose_hero_menu import reload_rougeOB_data
 
 
@@ -70,6 +78,41 @@ class ExitBtn(pygame.sprite.Sprite):
             self.image = self.defaultImage
         if self.mouseUp:
             self.mouseUp = False    # 退出游戏
+            # 构建保存文件的路径
+            user_documents_folder = os.path.expanduser("~\\Documents")  # 获取用户的"文档"文件夹路径
+            qqtpve_folder = os.path.join(user_documents_folder, "QQTPVE")  # 构建QQTPVE文件夹路径
+            os.makedirs(qqtpve_folder, exist_ok=True)  # 确保QQTPVE文件夹存在,如果不存在则创建
+            rouge_file_path = os.path.join(qqtpve_folder, "rougeOB.rougedata")  # 构建文件路径
+            other_file_path = os.path.join(qqtpve_folder, "rougeOBOther.rougedata")  # 构建其他文件路径
+            rouge_encrypted_data = load_rouge_data(rouge_file_path)
+            rouge_other_data = load_rouge_data(other_file_path)
+            if len(R.new_drop_list) > 0:
+                for drop in R.new_drop_list:
+                    if "bomb" in drop:
+                        if drop not in rouge_other_data["Bomb"]:
+                            rouge_other_data["Bomb"].append(drop)
+                R.new_drop_list = []
+                save_encrypt_single_rouge_file(rouge_other_data, "rougeOBOther")
+            real_exp = int(R.rouge_exp * R.diff_exp[R.difficulty] + R.task_exp)
+            if G.IS_ONLINE:
+                util.save_online()
+                level.current_level.message_entry.new_message(sender='Rogue助手', message='经验+'+str(real_exp) + ', 当前等级经验: ' + R.remain_exp(util.get_online_data()[R.rouge_hero]["exp"]))
+            else:
+                new_data = {}
+                for hero in R.hero_name.keys():
+                    if hero == R.rouge_hero:
+                        exp = rouge_encrypted_data[hero]["exp"] + real_exp
+                    else:
+                        exp = rouge_encrypted_data[hero]["exp"]
+                    lv = R.current_lv(exp)
+                    new_data[hero] = {"exp": exp, "lv": lv}
+                save_encrypt_single_rouge_file(new_data, "rougeOB")
+                level.current_level.message_entry.new_message(sender='Rogue助手', message='经验+'+str(real_exp) + ', 当前等级经验: ' + R.remain_exp(new_data[R.rouge_hero]["exp"]))
+            print(R.rouge_hero, ": exp + ", real_exp)
+            R.rouge_exp = 0
+            R.task_exp = 0
+
+            save_task_json()
             G.CONTROL.do_reset(generate_new=False)
             W.MENU.refresh()
             music_loader.play("rogue_menu.mp3", 0.7)

+ 58 - 0
game/ui/game/game_review.py

@@ -0,0 +1,58 @@
+import pygame
+from datetime import datetime
+
+import game.const.game as G
+import game.const.rouge as R
+from game.frame import character
+from game.level import level
+from game.ui.ui import UIInstance
+from game.ui.menu.component import get_font
+
+
+class GameReview(pygame.sprite.Sprite):
+
+    def __init__(self):
+        super().__init__()
+        self.bg_img = None
+        self.text = ""
+        self.title = ""
+        self.rendered_text = []
+        self.second_old = 0  # 上次设置的ui时间是多少 避免重复刷新
+        self.font = get_font("hk4e_zh-cn.ttf", 18, font_type="local", bold=True)
+        self.init_board()
+
+    def init_board(self):
+        self.bg_img = pygame.image.load("res/ui/button/task_board.png")
+        name = f"尊敬的勇士 {G.USERNAME}·" if G.USERNAME != "" else "尊敬的勇士 "
+        time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+        process = f"{R.rouge_theme_1}, {R.rouge_theme_2}, {R.rouge_theme_3}"
+        if R.rouge_theme_4 is not None:
+            process += f",{R.rouge_theme_4}"
+        win = "胜利"
+        if G.ALL_CLEAR and G.ITEM == 0:
+            win = "完全胜利"
+        elif G.ITEM == 0:
+            win = "大胜利"
+        self.text = [
+            f"{name}{R.hero_name[R.rouge_hero]} 阁下:",
+            f"您于{time}达成了:",
+            f"        <{R.rouge_story}>结局({R.diff_dic[R.difficulty]}难度){win}",
+            f"本次探索经过了: {process}",
+            f"向宗师勤勉求教了{R.extra_lv}次, 受益匪浅",
+        ]
+        self.rendered_text = [self.font.render(line, True, (0, 0, 0)) for line in self.text]
+
+    def update(self):
+        pass
+
+    def draw(self, screen: pygame.Surface):
+        screen.blit(self.bg_img, (100, 70))
+        # screen.blit(msg.text_surf, (x0, y0 - dy))
+        # img = pygame.image.load("res/img/ui/icon/bomb_0_0.png")
+        # self.sheet.blit(img, (90, 16))
+        # img = pygame.image.load("res/img/ui/common/btn_leave_0_3.png")
+        # self.sheet.blit(img, (135, 535))
+        for i, s in enumerate(self.rendered_text):
+            screen.blit(s, s.get_rect(topleft=(160, 120+24*i)))
+
+

+ 9 - 6
game/ui/game/message_input.py

@@ -1,9 +1,11 @@
+import os
 import time
 import pygame
 import pygame.freetype as freetype
 from typing import List
 import game.const.game as G
 
+
 # Initialize Pygame and Clock
 pygame.init()
 screen = pygame.display.set_mode((800, 600))
@@ -18,15 +20,16 @@ FONT_PATH = G.GAME_PATH + r"\res\font\hk4e_zh-cn.ttf"
 _font = freetype.Font(FONT_PATH, 14)
 _font_small = freetype.Font(FONT_PATH, 12)
 
+
 class Message:
-    def __init__(self, sender: str, text: str, duration_ms: int = 20000):
+    def __init__(self, sender: str, text: str, duration_ms: int = 20000, colour: tuple = (255, 255, 255)):
         self.sender = sender
         self.text = text
         self.start = pygame.time.get_ticks()
         self.duration = duration_ms
         content = f"{sender}:{text}" if text else sender
         self.shadow_surf, _ = _font_small.render(content, fgcolor=(0, 0, 0))
-        self.text_surf, _ = _font_small.render(content, fgcolor=(255, 255, 255))
+        self.text_surf, _ = _font_small.render(content, fgcolor=colour)
 
     def expired(self) -> bool:
         return pygame.time.get_ticks() - self.start > self.duration
@@ -145,8 +148,8 @@ class InputEntry(pygame.sprite.Sprite):
             screen.blit(msg.shadow_surf, (x0 + 1, y0 - dy + 1))
             screen.blit(msg.text_surf, (x0, y0 - dy))
 
-    def new_message(self, sender='', message=''):
-        self.messages.insert(0, Message(sender, message))
+    def new_message(self, sender='', message='', colour=(255, 255, 255)):
+        self.messages.insert(0, Message(sender, message, colour=colour))
         if len(self.messages) > self.max_msgs:
             self.messages.pop()
         self.last_msg_time = time.time()
@@ -183,8 +186,8 @@ class InputLevel(pygame.sprite.Sprite):
             screen.blit(msg.shadow_surf, (x0 + 1, y0 - dy + 1))
             screen.blit(msg.text_surf, (x0, y0 - dy))
 
-    def new_message(self, sender='', message=''):
-        self.messages.insert(0, Message(sender, message))
+    def new_message(self, sender='', message='', colour=(255, 255, 255)):
+        self.messages.insert(0, Message(sender, message, colour=colour))
         if len(self.messages) > self.max_msgs:
             self.messages.pop()
         self.last_msg_time = time.time()

+ 0 - 21
game/ui/game/score_board.py

@@ -116,27 +116,6 @@ class ScoreBoard(UIInstance):
             pass
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 class Timer(UIInstance):
 
     TIME_IMG_OFFSETS = (0, 27, 54, 81, 108, 135, 162, 189, 216, 243)

+ 31 - 39
game/ui/menu/choose_hero_menu.py

@@ -6,6 +6,7 @@ from datetime import datetime
 from game.const import game as G
 from game.const import window as W
 from game.const import rouge as R
+from game.const.rouge import current_lv, remain_exp, current_remain_exp
 from game.sound import sound_player
 from game.algo import utils as util
 from game.utils import local_data_manager as DM
@@ -43,15 +44,6 @@ if G.IS_ONLINE:
 rougeOB_data = check_rouge_ob_data(rougeOB_data)
 
 
-def current_lv(lv):
-    lv_list = R.lv_list
-    if lv >= sum(lv_list):
-        return "--"
-    for k in range(0, 14):
-        if sum(lv_list[:k]) <= lv < sum(lv_list[:k + 1]):
-            return str(sum(lv_list[:k + 1]) - lv)
-
-
 diff_cn = {
     "练习": "Baby",
     "简单": "Easy",
@@ -92,63 +84,63 @@ hero_cn = {
 hero_dict = {
     "Fox": {
         "own": True, "name": "小倩",
-        "exp": f"等级{rougeOB_data['Fox']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Fox']['exp'])}",
+        "exp": f"等级{current_lv(rougeOB_data['Fox']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Fox']['exp'])}",
         "info": f"技能: 自身血量减少1则糖泡伤害增加{R.FoxSkill(rougeOB_data['Fox']['lv'])}",
         "growth": f"成长: 血量: {R.growth['Fox']['HP']}, 伤害: {R.growth['Fox']['Damage']}",
         "img": pygame.image.load(r"res/img/ui/game/icon_xq.png").convert_alpha()
     },
     "Boboli": {
         "own": True, "name": "波波丽",
-        "exp": f"等级{rougeOB_data['Boboli']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Boboli']['exp'])}",
+        "exp": f"等级{current_lv(rougeOB_data['Boboli']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Boboli']['exp'])}",
         "info": f"技能: 每次攻击额外造成{int(R.BoboliSkill(rougeOB_data['Boboli']['lv']) * 100)}%真实伤害",
         "growth": f"成长: 血量: {R.growth['Boboli']['HP']}, 伤害: {R.growth['Boboli']['Damage']}",
         "img": pygame.image.load(r"res/img/ui/game/icon_bbl.png").convert_alpha()
     },
     "Naruto_old": {
         "own": True, "name": "火影",
-        "exp": f"等级{rougeOB_data['Naruto_old']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Naruto_old']['exp'])}",
+        "exp": f"等级{current_lv(rougeOB_data['Naruto_old']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Naruto_old']['exp'])}",
         "info": f"技能: 首次攻击每只怪物时攻击力变为{int(R.Naruto_oldSkill(rougeOB_data['Naruto_old']['lv']) * 100)}%",
         "growth": f"成长: 血量: {R.growth['Naruto_old']['HP']}, 伤害: {R.growth['Naruto_old']['Damage']}",
         "img": pygame.image.load(r"res/img/ui/game/icon_hy.png").convert_alpha()
     },
     "Asha": {
         "own": True, "name": "阿莎",
-        "exp": f"等级{rougeOB_data['Asha']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Asha']['exp'])}",
+        "exp": f"等级{current_lv(rougeOB_data['Asha']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Asha']['exp'])}",
         "info": f"技能: 每次糖泡造成伤害恢复血量{R.AshaSkill(rougeOB_data['Asha']['lv']) * 100}%",
         "growth": f"成长: 血量: {R.growth['Asha']['HP']}, 伤害: {R.growth['Asha']['Damage']}",
         "img": pygame.image.load(r"res/img/ui/game/icon_as.png").convert_alpha()
     },
     "Maria": {
         "own": True, "name": "玛莉亚",
-        "exp": f"等级{rougeOB_data['Maria']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Maria']['exp'])}",
+        "exp": f"等级{current_lv(rougeOB_data['Maria']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Maria']['exp'])}",
         "info": f"技能: 每次造成伤害降低怪物{R.MariaSkill2(rougeOB_data['Maria']['lv'])}防御",
         "growth": f"成长: 血量: {R.growth['Maria']['HP']}, 伤害: {R.growth['Maria']['Damage']}",
         "img": pygame.image.load(r"res/img/ui/game/icon_mly.png").convert_alpha()
     },
     "Chunli": {
         "own": True, "name": "春丽",
-        "exp": f"等级{rougeOB_data['Chunli']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Chunli']['exp'])}",
+        "exp": f"等级{current_lv(rougeOB_data['Chunli']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Chunli']['exp'])}",
         "info": f"技能: 每{R.ChunliSkill(rougeOB_data['Chunli']['lv'])}个糖泡放置一个双倍伤害超级糖泡",
         "growth": f"成长: 血量: {R.growth['Chunli']['HP']}, 伤害: {R.growth['Chunli']['Damage']}",
         "img": pygame.image.load(r"res/img/ui/game/icon_cl.png").convert_alpha()
     },
     "Titan": {
         "own": True, "name": "泰坦",
-        "exp": f"等级{rougeOB_data['Titan']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Titan']['exp'])}",
+        "exp": f"等级{current_lv(rougeOB_data['Titan']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Titan']['exp'])}",
         "info": f"技能: 初始获得{R.TitanSkill(rougeOB_data['Titan']['lv'])}防御",
         "growth": f"成长: 血量: {R.growth['Titan']['HP']}, 伤害: {R.growth['Titan']['Damage']}",
         "img": pygame.image.load(r"res/img/ui/game/icon_tt.png").convert_alpha()
     },
     "Chris": {
         "own": True, "name": "克莉斯",
-        "exp": f"等级{rougeOB_data['Chris']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Chris']['exp'])}",
+        "exp": f"等级{current_lv(rougeOB_data['Chris']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Chris']['exp'])}",
         "info": f"技能: 灵净{R.ChrisLvSkill(rougeOB_data['Chris']['lv'])}(怪物死后变为光灵协同净化升华)",  # 变身光灵, 自动寻敌(区域中)造成3x3 200%伤害, 无击杀则消失, 若无怪物目标则返回克莉丝处恢复1%生命
         "growth": f"成长: 血量: {R.growth['Chris']['HP']}, 伤害: {R.growth['Chris']['Damage']}",
         "img": pygame.image.load(r"res/img/ui/game/icon_kls.png").convert_alpha()
     },
     "SeaPrince_old": {
         "own": True, "name": "海王子",
-        "exp": f"等级{rougeOB_data['SeaPrince_old']['lv']}, 升级还需经验: {current_lv(rougeOB_data['SeaPrince_old']['exp'])}",
+        "exp": f"等级{current_lv(rougeOB_data['SeaPrince_old']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['SeaPrince_old']['exp'])}",
         "info": f"技能: 初始糖币+{R.SeaPrinceSkill1(rougeOB_data['SeaPrince_old']['lv'])}, 每持有1糖币伤害增加{R.SeaPrinceSkill2(rougeOB_data['SeaPrince_old']['lv'])}",
         "growth": f"成长: 血量: {R.growth['SeaPrince_old']['HP']}, 伤害: {R.growth['SeaPrince_old']['Damage']}",
         "img": pygame.image.load(r"res/img/ui/game/icon_hwz.png").convert_alpha()
@@ -168,11 +160,11 @@ hero_dict = {
         "img": pygame.image.load(r"res/img/ui/game/icon_random.png").convert_alpha()
     },
     "Witch": {
-        "own": True, "name": "嫦娥",
-        "exp": f"等级{rougeOB_data['Witch']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Witch']['exp'])}",
-        "info": f"[限时体验]",
-        "growth": f"成长: 血量: {R.growth['Witch']['HP']}, 伤害: {R.growth['Witch']['Damage']}",
-        "img": pygame.image.load(r"res/img/ui/game/icon_witch.png").convert_alpha()
+        "own": True, "name": "随机",
+        "exp": f"--",
+        "info": f"随机选择一个英雄(含隐藏角色)与引路人",
+        "growth": f"--",
+        "img": pygame.image.load(r"res/img/ui/game/icon_random.png").convert_alpha()
     },
 }
 
@@ -230,63 +222,63 @@ def reload_data():
     hero_dict = {
         "Fox": {
             "own": True, "name": "小倩",
-            "exp": f"等级{rougeOB_data['Fox']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Fox']['exp'])}",
+            "exp": f"等级{current_lv(rougeOB_data['Fox']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Fox']['exp'])}",
             "info": f"技能: 自身血量减少1则糖泡伤害增加{R.FoxSkill(rougeOB_data['Fox']['lv'])}",
             "growth": f"成长: 血量: {R.growth['Fox']['HP']}, 伤害: {R.growth['Fox']['Damage']}",
             "img": pygame.image.load(r"res/img/ui/game/icon_xq.png").convert_alpha()
         },
         "Boboli": {
             "own": True, "name": "波波丽",
-            "exp": f"等级{rougeOB_data['Boboli']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Boboli']['exp'])}",
+            "exp": f"等级{current_lv(rougeOB_data['Boboli']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Boboli']['exp'])}",
             "info": f"技能: 每次攻击额外造成{int(R.BoboliSkill(rougeOB_data['Boboli']['lv']) * 100)}%真实伤害",
             "growth": f"成长: 血量: {R.growth['Boboli']['HP']}, 伤害: {R.growth['Boboli']['Damage']}",
             "img": pygame.image.load(r"res/img/ui/game/icon_bbl.png").convert_alpha()
         },
         "Naruto_old": {
             "own": True, "name": "火影",
-            "exp": f"等级{rougeOB_data['Naruto_old']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Naruto_old']['exp'])}",
+            "exp": f"等级{current_lv(rougeOB_data['Naruto_old']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Naruto_old']['exp'])}",
             "info": f"技能: 首次攻击每只怪物时攻击力变为{int(R.Naruto_oldSkill(rougeOB_data['Naruto_old']['lv']) * 100)}%",
             "growth": f"成长: 血量: {R.growth['Naruto_old']['HP']}, 伤害: {R.growth['Naruto_old']['Damage']}",
             "img": pygame.image.load(r"res/img/ui/game/icon_hy.png").convert_alpha()
         },
         "Asha": {
             "own": True, "name": "阿莎",
-            "exp": f"等级{rougeOB_data['Asha']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Asha']['exp'])}",
+            "exp": f"等级{current_lv(rougeOB_data['Asha']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Asha']['exp'])}",
             "info": f"技能: 每次糖泡造成伤害恢复血量{R.AshaSkill(rougeOB_data['Asha']['lv']) * 100}%",
             "growth": f"成长: 血量: {R.growth['Asha']['HP']}, 伤害: {R.growth['Asha']['Damage']}",
             "img": pygame.image.load(r"res/img/ui/game/icon_as.png").convert_alpha()
         },
         "Maria": {
             "own": True, "name": "玛莉亚",
-            "exp": f"等级{rougeOB_data['Maria']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Maria']['exp'])}",
+            "exp": f"等级{current_lv(rougeOB_data['Maria']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Maria']['exp'])}",
             "info": f"技能: 每次造成伤害降低怪物{R.MariaSkill2(rougeOB_data['Maria']['lv'])}防御",
             "growth": f"成长: 血量: {R.growth['Maria']['HP']}, 伤害: {R.growth['Maria']['Damage']}",
             "img": pygame.image.load(r"res/img/ui/game/icon_mly.png").convert_alpha()
         },
         "Chunli": {
             "own": True, "name": "春丽",
-            "exp": f"等级{rougeOB_data['Chunli']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Chunli']['exp'])}",
+            "exp": f"等级{current_lv(rougeOB_data['Chunli']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Chunli']['exp'])}",
             "info": f"技能: 每{R.ChunliSkill(rougeOB_data['Chunli']['lv'])}个糖泡放置一个双倍伤害超级糖泡",
             "growth": f"成长: 血量: {R.growth['Chunli']['HP']}, 伤害: {R.growth['Chunli']['Damage']}",
             "img": pygame.image.load(r"res/img/ui/game/icon_cl.png").convert_alpha()
         },
         "Titan": {
             "own": True, "name": "泰坦",
-            "exp": f"等级{rougeOB_data['Titan']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Titan']['exp'])}",
+            "exp": f"等级{current_lv(rougeOB_data['Titan']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Titan']['exp'])}",
             "info": f"技能: 初始获得{R.TitanSkill(rougeOB_data['Titan']['lv'])}防御",
             "growth": f"成长: 血量: {R.growth['Titan']['HP']}, 伤害: {R.growth['Titan']['Damage']}",
             "img": pygame.image.load(r"res/img/ui/game/icon_tt.png").convert_alpha()
         },
         "Chris": {
             "own": True, "name": "克莉斯",
-            "exp": f"等级{rougeOB_data['Chris']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Chris']['exp'])}",
+            "exp": f"等级{current_lv(rougeOB_data['Chris']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['Chris']['exp'])}",
             "info": f"技能: 灵净{R.ChrisLvSkill(rougeOB_data['Chris']['lv'])}(怪物死后变为光灵协同净化升华)",  # 变身光灵, 自动寻敌(区域中)造成3x3 200%伤害, 无击杀则消失, 若无怪物目标则返回克莉丝处恢复1%生命
             "growth": f"成长: 血量: {R.growth['Chris']['HP']}, 伤害: {R.growth['Chris']['Damage']}",
             "img": pygame.image.load(r"res/img/ui/game/icon_kls.png").convert_alpha()
         },
         "SeaPrince_old": {
             "own": True, "name": "海王子",
-            "exp": f"等级{rougeOB_data['SeaPrince_old']['lv']}, 升级还需经验: {current_lv(rougeOB_data['SeaPrince_old']['exp'])}",
+            "exp": f"等级{current_lv(rougeOB_data['SeaPrince_old']['exp'])}, 升级还需经验: {current_remain_exp(rougeOB_data['SeaPrince_old']['exp'])}",
             "info": f"技能: 初始糖币+{R.SeaPrinceSkill1(rougeOB_data['SeaPrince_old']['lv'])}, 每持有1糖币伤害增加{R.SeaPrinceSkill2(rougeOB_data['SeaPrince_old']['lv'])}",
             "growth": f"成长: 血量: {R.growth['SeaPrince_old']['HP']}, 伤害: {R.growth['SeaPrince_old']['Damage']}",
             "img": pygame.image.load(r"res/img/ui/game/icon_hwz.png").convert_alpha()
@@ -306,11 +298,11 @@ def reload_data():
             "img": pygame.image.load(r"res/img/ui/game/icon_random.png").convert_alpha()
         },
         "Witch": {
-            "own": True, "name": "嫦娥",
-            "exp": f"等级{rougeOB_data['Witch']['lv']}, 升级还需经验: {current_lv(rougeOB_data['Witch']['exp'])}",
-            "info": f"[限时体验]",
-            "growth": f"成长: 血量: {R.growth['Witch']['HP']}, 伤害: {R.growth['Witch']['Damage']}",
-            "img": pygame.image.load(r"res/img/ui/game/icon_witch.png").convert_alpha()
+            "own": True, "name": "随机",
+            "exp": f"--",
+            "info": f"随机选择一个英雄(含隐藏角色)与引路人",
+            "growth": f"--",
+            "img": pygame.image.load(r"res/img/ui/game/icon_random.png").convert_alpha()
         },
     }
 
@@ -467,7 +459,7 @@ class ChoosePage:
         )
 
     def start(self):
-        if self.is_random or R.rouge_hero in {"Surprise"}:
+        if self.is_random or R.rouge_hero in {"Surprise", "Witch"}:
             if not self.is_random:
                 current = random.choice(random_hero_list)
                 R.rouge_hero = current
@@ -536,7 +528,7 @@ class ChoosePage:
                 choose_btn.shiny_spark = False
                 choose_btn.action = None
             return
-        if R.rouge_hero in {"Surprise"}:
+        if R.rouge_hero in {"Surprise", "Witch"}:
             if cn_name == "随机":
                 choose_btn.update_image("res/ui/button/chosen.png", "res/ui/button/chosen.png")
                 choose_btn.shiny_spark = False

+ 681 - 7
game/ui/menu/component.py

@@ -1,6 +1,11 @@
-import pygame
 import random
+import pygame
+from datetime import datetime
+from math import ceil
+import pygame.freetype as freetype
+
 from game.sound import sound_player
+import game.const.game as G
 
 
 # hk4e_zh_cn12 = pygame.font.Font(r"res\font\hk4e_zh-cn.ttf", 12)
@@ -15,7 +20,10 @@ def get_font(font_name, size, font_type='sys', bold=False):
         if font_type == 'sys':
             font_dict[(font_name, size, bold)] = pygame.font.SysFont(font_name, size, bold=bold)
         else:
-            font_dict[(font_name, size, bold)] = pygame.font.Font(f"res\\font\\{font_name}", size)
+            try:
+                font_dict[(font_name, size, bold)] = pygame.font.Font(f"res\\font\\{font_name}", size)
+            except Exception as e:
+                font_dict[(font_name, size, bold)] = freetype.Font(f"{G.GAME_PATH}\\res\\font\\{font_name}", size)
         load_font = font_dict.get((font_name, size, bold), None)
     return load_font
 
@@ -202,16 +210,18 @@ class PygameButton:
         self._render()
 
 
-class PygameButtonBackIMG():
+class PygameButtonBackIMG:
     """
     一个仅使用图片作为按钮的类,不含文字渲染,图片本身包含文字。
     - default_img_path: 默认状态下的背景图路径
     - hover_img_path: 悬停状态下的背景图路径
     """
-    def __init__(self, menu, screen, relx, rely,
-                 default_img_path, hover_img_path,
-                 action=None, hover_in_action=None, hover_out_action=None,
-                 anchor='center', shiny_spark=True):
+    def __init__(
+        self, menu, screen, relx, rely,
+        default_img_path, hover_img_path,
+        action=None, hover_in_action=None, hover_out_action=None,
+        anchor='center', shiny_spark=True
+    ):
         self.menu = menu
         self.screen = screen
         # 加载按钮图片
@@ -267,6 +277,12 @@ class PygameButtonBackIMG():
         elif event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
             if self.hovered and self.action:
                 self.action()
+        if self.bg_rect.collidepoint(pygame.mouse.get_pos()):
+            self.hovered = True
+            if self.hover_in_action:
+                self.hover_in_action()
+            elif self.hover_out_action:
+                self.hover_out_action()
 
     def update_image(self, new_default, new_hover):
         self.default_img = pygame.image.load(new_default).convert_alpha()
@@ -434,6 +450,171 @@ class PygameButtonBackIMGRoll:
         self.current_index = self.options.index(option)
 
 
+class PygameButtonBackIMGGuideBookRoll:
+    def __init__(
+        self,
+        menu,
+        screen,
+        relx,
+        rely,
+        default_img_path,
+        options,
+        action=None,
+        roll_action=None,
+        hover_in_action=None,
+        hover_out_action=None,
+        anchor='center',
+        font_name="Microsoft JhengHei",
+        font_size=30,
+        small_scale=0.7,
+        small_alpha=100,
+        color=(255, 255, 255),
+        shiny_spark=True,
+        related_button=None,
+        notify_action=None,
+        diction=None
+    ):
+        self.menu = menu
+        self.screen = screen
+        self.relx = relx
+        self.rely = rely
+        self.anchor = anchor
+        self.action = action
+        self.hovered = False
+        self.hover_in_action = hover_in_action
+        self.hover_out_action = hover_out_action
+        self.roll_action = roll_action
+        self.shiny_spark = shiny_spark
+        if related_button is None:
+            self.related_button = []
+        else:
+            self.related_button = related_button
+        if notify_action is None:
+            self.notify_action = []
+        else:
+            self.notify_action = notify_action
+        if diction is None:
+            self.diction = dict()
+        else:
+            self.diction = diction
+
+        # 加载背景图
+        self.default_img = pygame.image.load(default_img_path).convert_alpha()
+        self.width, self.height = self.default_img.get_size()
+
+        # 设置选项列表
+        self.options = options
+        self.current_index = 0
+
+        # 字体与文字效果
+        self.font = get_font(font_name, font_size, font_type='local', bold=True)
+        self.small_font = get_font(font_name, int(font_size * small_scale), font_type='local', bold=True)
+        # self.font = pygame.font.SysFont(font_name, font_size, bold=True)
+        # self.small_font = pygame.font.SysFont(font_name, int(font_size * small_scale), bold=True)
+        self.color = color
+        self.small_alpha = small_alpha
+
+        # 算出按钮在屏幕上的位置和区域
+        sw, sh = self.screen.get_size()
+        x = int(sw * self.relx)
+        y = int(sh * self.rely)
+        self.x, self.y = x, y
+        if self.anchor == 'center':
+            topleft = (x - self.width // 2, y - self.height // 2)
+        else:
+            topleft = (x, y)
+        self.bg_rect = pygame.Rect(topleft[0], topleft[1], self.width, self.height)
+
+        # 用于粒子效果
+        self.spawn_timer = 0
+
+    def draw(self):
+        # 绘制背景图
+        img = self.default_img
+        self.screen.blit(img, self.bg_rect.topleft)
+
+        # 粒子效果
+        if self.shiny_spark:
+            if getattr(self, 'hovered', False):
+                self.spawn_timer += 1
+                if self.spawn_timer >= 10:
+                    self.spawn_timer = 0
+                    for _ in range(10):
+                        self.menu.particles.append(ButtonParticle(self.x, self.y))
+
+        # 绘制滚动文字:上一个、当前、下一个
+        count = len(self.options)
+        if count:
+            # 中心文字
+            text = self.diction[self.options[self.current_index]]["name"]
+            surf = self.font.render(text, True, self.color)
+            rect = surf.get_rect(center=(self.x, self.y))
+            self.screen.blit(surf, rect)
+
+            # 上一个
+            prev_i = (self.current_index - 1) % count
+            prev_text = self.diction[self.options[prev_i]]["name"]
+            prev_s = self.small_font.render(prev_text, True, self.color)
+            prev_s.set_alpha(self.small_alpha)
+            offset = self.font.get_height() * 1.5
+            prev_rect = prev_s.get_rect(center=(self.x, self.y - offset))
+            self.screen.blit(prev_s, prev_rect)
+
+            # 下一个
+            next_i = (self.current_index + 1) % count
+            next_text = self.diction[self.options[next_i]]["name"]
+            next_s = self.small_font.render(next_text, True, self.color)
+            next_s.set_alpha(self.small_alpha)
+            next_rect = next_s.get_rect(center=(self.x, self.y + offset))
+            self.screen.blit(next_s, next_rect)
+
+    def handle_event(self, event):
+        # 鼠标移动:检测悬停
+        if event.type == pygame.MOUSEMOTION:
+            was = getattr(self, 'hovered', False)
+            now = self.bg_rect.collidepoint(event.pos)
+            self.hovered = now
+            if not was and now and self.hover_in_action:
+                self.hover_in_action()
+            elif was and not now and self.hover_out_action:
+                self.hover_out_action()
+
+        # 鼠标滚轮:滚动切换文字
+        elif event.type == pygame.MOUSEBUTTONDOWN:
+            if self.bg_rect.collidepoint(event.pos):
+                # 滚轮向上(按钮4)
+                if event.button == 4:
+                    self.roll_up()
+                # 滚轮向下(按钮5)
+                elif event.button == 5:
+                    self.roll_down()
+                # 左键点击
+                elif event.button == 1 and self.action and getattr(self, 'hovered', False):
+                    self.action()
+
+    def roll_up(self):
+        self.current_index = (self.current_index - 1) % len(self.options)
+        sound_player.play("turn")
+        if self.roll_action:
+            self.roll_action(self.options[self.current_index])
+        for i, observer in enumerate(self.related_button):
+            self.notify_action[i](observer)
+
+    def roll_down(self):
+        self.current_index = (self.current_index + 1) % len(self.options)
+        sound_player.play("turn")
+        if self.roll_action:
+            self.roll_action(self.options[self.current_index])
+        for i, observer in enumerate(self.related_button):
+            self.notify_action[i](observer)
+
+    def get_current_text(self):
+        return self.options[self.current_index]
+
+    def set_current_text(self, option):
+        self.current_index = self.options.index(option)
+
+
 class Particle:
     def __init__(self, x, y):
         self.x = x
@@ -556,5 +737,498 @@ class PygameIMG:
         # self.default_img = pygame.image.load(new_default).convert_alpha()
         self.draw()
 
+    def update_image_and_reallocate_position(self, new_default, rx, ry):
+        self.default_img = new_default
+        self.reallocate_position(rx, ry)
+        self.draw()
+
+    def reallocate_position(self, rx, ry):
+        self.width, self.height = self.default_img.get_size()
+        sw, sh = self.screen.get_size()
+        x = int(sw * rx)
+        y = int(sh * ry)
+        self.x, self.y = x, y
+        if self.anchor == 'center':
+            topleft = (x - self.width//2, y - self.height//2)
+        else:
+            topleft = (x, y)
+        self.bg_rect = pygame.Rect(topleft[0], topleft[1], self.width, self.height)
+
     def handle_event(self, event):
         pass
+
+
+class PygameTaskBoard:
+    PAGE_SIZE = 5
+    TIME_FMT = "%Y-%m-%d"
+
+    def __init__(
+        self,
+        menu,
+        screen,
+        relx,
+        rely,
+        default_img_path,
+        options=None,                    # 兼容旧签名,现已不使用
+        action=None,                     # def action(task_id, record): ...
+        roll_action=None,
+        hover_in_action=None,
+        hover_out_action=None,
+        anchor='center',
+        font_name="hk4e_zh-cn.ttf",
+        font_size=30,
+        small_scale=0.7,
+        small_alpha=100,
+        color=(15, 15, 15),
+        shiny_spark=True,
+        related_button=None,
+        notify_action=None,
+        tasks_dict=None,                    # 新增:任务字典(必填)
+        title_map=None,                     # 可选:{task_id: "任务标题"},优先覆盖
+        bar_color_fg=(92, 196, 120),        # 进度条前景
+        bar_color_bg=(60, 60, 60),          # 进度条背景
+        row_color=(230, 230, 230),          # 行文字颜色
+        row_color_disabled=(160, 160, 160),
+        row_color_done=(160, 220, 160),
+        row_hl_color=(255, 240, 180),       # 高亮行底色
+        row_gap=6,
+        padding=(24, 30, 24, 50),           # 左、上、右、下 内边距(为底部页码留空间)
+        show_grid=False,                    # 调试用:显示行框线
+    ):
+        self.menu = menu
+        self.screen = screen
+        self.relx = relx
+        self.rely = rely
+        self.anchor = anchor
+        self.action = action
+        self.roll_action = roll_action
+        self.hover_in_action = hover_in_action
+        self.hover_out_action = hover_out_action
+        self.shiny_spark = shiny_spark
+        self.related_button = related_button or []
+        self.notify_action = notify_action or []
+        self.color = color
+        self.small_alpha = small_alpha
+
+        # 背景图
+        self.default_img = pygame.image.load(default_img_path).convert_alpha()
+        self.width, self.height = self.default_img.get_size()
+
+        # 定位与面板矩形
+        sw, sh = self.screen.get_size()
+        x = int(sw * self.relx)
+        y = int(sh * self.rely)
+        self.x, self.y = x, y
+        if self.anchor == 'center':
+            topleft = (x - self.width // 2, y - self.height // 2)
+        else:
+            topleft = (x, y)
+        self.bg_rect = pygame.Rect(topleft[0], topleft[1], self.width, self.height)
+
+        # 字体
+        if font_name == "hk4e_zh-cn.ttf":
+            self.font = get_font(font_name, font_size, font_type="local", bold=True)
+            self.small_font = get_font(font_name, int(font_size * small_scale), font_type="local", bold=True)
+        else:
+            self.font = get_font(font_name, font_size, bold=True)
+            self.small_font = get_font(font_name, int(font_size * small_scale), bold=True)
+
+        # 渲染参数
+        self.padding = padding
+        self.row_gap = row_gap
+        self.show_grid = show_grid
+        self.row_color = row_color
+        self.row_color_disabled = row_color_disabled
+        self.row_color_done = row_color_done
+        self.bar_color_fg = bar_color_fg
+        self.bar_color_bg = bar_color_bg
+        self.row_hl_color = row_hl_color
+
+        # 数据
+        self._title_map = title_map or {}
+        self._raw_tasks = tasks_dict or {}   # 原始输入
+        self._rows = []                      # 归一化后的行对象列表
+        self._pages = []                     # 按7条分页后的二维数组(存索引)
+        self._page_idx = 0
+        self._sel_row_idx = 0               # 当前页内的选中行 [0..len(page)-1]
+        self.hovered = False
+        self._normalize_and_paginate()
+
+    def set_tasks(self, tasks_dict, title_map=None):
+        """外部更新任务数据后调用。"""
+        self._raw_tasks = tasks_dict or {}
+        if title_map is not None:
+            self._title_map = title_map
+        self._normalize_and_paginate()
+
+    def _normalize_and_paginate(self):
+        """把传入的任务字典规整为内部行结构,并按7条分页。"""
+        self._rows = []
+        for task_id in sorted(self._raw_tasks.keys()):  # 稳定排序(可换成自定义顺序)
+            rec = self._raw_tasks[task_id] or {}
+            target = int(rec.get("target", 0))
+            progress = int(rec.get("progress", 0))
+            status = bool(rec.get("status", False))
+            reward_raw = rec.get('reward', 0)
+            if type(reward_raw) == int:
+                reward = f"{reward_raw}角色经验"
+            else:
+                reward = reward_raw
+            ft = rec.get("finish_time", None)
+            title = rec.get("title", self._title_map.get(task_id, f"任务{task_id}"))
+
+            # finish_time 统一成 datetime 或 None
+            ft_dt = None
+            if isinstance(ft, datetime):
+                ft_dt = ft
+            elif isinstance(ft, str):
+                # 常见两种尝试:完整时间 / 仅日期
+                for fmt in (self.TIME_FMT, "%Y-%m-%d", "%Y/%m/%d %H:%M", "%Y/%m/%d"):
+                    try:
+                        ft_dt = datetime.strptime(ft, fmt)
+                        break
+                    except Exception as e:
+                        print(e)
+
+            # 自动从 progress/target 推导进行中/未开始;status=True 为已完成优先
+            if not status:
+                status = (0 < target <= progress)
+
+            self._rows.append({
+                "task_id": task_id,
+                "title": title,
+                "target": target,
+                "progress": progress,
+                "status": status,
+                "reward": reward,
+                "finish_time": ft_dt,
+            })
+
+        # 分页(把索引按7条切分)
+        n = len(self._rows)
+        total_pages = max(1, ceil(n / self.PAGE_SIZE))
+        self._pages = []
+        for p in range(total_pages):
+            start = p * self.PAGE_SIZE
+            end = min(n, start + self.PAGE_SIZE)
+            self._pages.append(list(range(start, end)))
+
+        # 修正页与选中行
+        self._page_idx = min(self._page_idx, len(self._pages) - 1)
+        self._sel_row_idx = min(self._sel_row_idx, max(0, len(self._pages[self._page_idx]) - 1)) if self._pages else 0
+
+    def _page_count(self):
+        return max(1, len(self._pages))
+
+    def _current_indices(self):
+        if not self._pages:
+            return []
+        return self._pages[self._page_idx]
+
+    def _current_rows(self):
+        return [self._rows[i] for i in self._current_indices()]
+
+    def draw(self):
+        # 背景
+        self.screen.blit(self.default_img, self.bg_rect.topleft)
+
+        # 面板内部可用区域(去掉 padding)
+        L, T, R, B = self.padding
+        inner = pygame.Rect(
+            self.bg_rect.left + L,
+            self.bg_rect.top + T,
+            self.bg_rect.width - L - R,
+            self.bg_rect.height - T - B
+        )
+
+        # 空提示
+        if not self._rows:
+            tip = self.font.render("暂无任务", True, self.row_color_disabled)
+            tip_rect = tip.get_rect(center=inner.center)
+            self.screen.blit(tip, tip_rect)
+            # 底部页码仍然绘制 1/1
+            self._draw_page_indicator()
+            return
+
+        # 行高分配
+        # visible_count = max(1, min(self.PAGE_SIZE, len(self._current_indices())))
+        visible_count = self.PAGE_SIZE
+        row_height = inner.height // visible_count
+        y_cursor = inner.top
+
+        # 逐行绘制
+        for i, row_idx in enumerate(self._current_indices()):
+            row = self._rows[row_idx]
+            r = pygame.Rect(inner.left, y_cursor, inner.width, row_height - self.row_gap)
+
+            # 高亮选中行底色
+            if i == self._sel_row_idx:
+                s = pygame.Surface((r.width, r.height), pygame.SRCALPHA)
+                s.fill((*self.row_hl_color, 90))  # 半透明
+                self.screen.blit(s, (r.left, r.top))
+
+            # 任务文字(标题 + 进度 + 状态)
+            title = row["title"]
+            progress = row["progress"]
+            target = row["target"]
+            status = row["status"]
+            reward = row["reward"]
+            ft = row["finish_time"]
+
+            # 左侧主行文字(标题)
+            title_surf = self.font.render(str(title), True, self.row_color_done if status else self.row_color)
+            title_rect = title_surf.get_rect(midleft=(r.left + 10, r.centery - 17))
+            self.screen.blit(title_surf, title_rect)
+
+            # 右侧进度文本
+            prog_txt = f"{min(progress, target)}/{target}" if target > 0 else f"{progress}"
+            prog_color = self.row_color_done if status else (self.row_color if progress > 0 else self.row_color_disabled)
+            prog_surf = self.small_font.render(prog_txt, True, prog_color)
+            prog_rect = prog_surf.get_rect(topright=(r.right - 10, r.top + 6))
+            self.screen.blit(prog_surf, prog_rect)
+
+            # 奖励
+            reward_surf = self.small_font.render(reward, True, (127, 35, 127))
+            reward_rect = reward_surf.get_rect(topright=(r.right - 10, r.top + 25))
+            self.screen.blit(reward_surf, reward_rect)
+
+            # 进度条
+            bar_w = int(r.width * 0.55)
+            bar_h = 12
+            bar_x = r.left + 10
+            bar_y = r.bottom - 18
+            pygame.draw.rect(self.screen, self.bar_color_bg, (bar_x, bar_y, bar_w, bar_h), border_radius=6)
+            ratio = 1.0 if (target <= 0 and status) else (0.0 if target <= 0 else max(0.0, min(1.0, progress / max(1, target))))
+            fill_w = int(bar_w * ratio)
+            if fill_w > 0:
+                if status:
+                    pygame.draw.rect(self.screen, (90, 145, 54), (bar_x, bar_y, fill_w, bar_h), border_radius=6)
+                else:
+                    pygame.draw.rect(self.screen, self.bar_color_fg, (bar_x, bar_y, fill_w, bar_h), border_radius=6)
+
+            # 状态 + 完成时间(如果已完成)
+            status_txt = "已完成" if status else ("进行中" if progress > 0 else "未开始")
+            # if status and ft is not None:
+            #     status_txt += f"  {ft.strftime(self.TIME_FMT)}"
+            st_surf = self.small_font.render(status_txt, True, prog_color)
+            st_rect = st_surf.get_rect(bottomright=(r.right - 10, r.bottom - 4))
+            self.screen.blit(st_surf, st_rect)
+
+            # 调试网格
+            if self.show_grid:
+                pygame.draw.rect(self.screen, (80, 80, 80), r, width=1, border_radius=4)
+
+            y_cursor += row_height
+
+        # 底部页码
+        self._draw_page_indicator()
+
+    def _draw_page_indicator(self):
+        page_str = f"{self._page_idx + 1}/{self._page_count()}"
+        s = self.font.render(page_str, True, self.color)
+        # 底部中间(背景矩形下边距内)
+        _, _, _, B = self.padding
+        pos = (self.bg_rect.centerx, self.bg_rect.bottom - B // 2)
+        rect = s.get_rect(center=pos)
+        self.screen.blit(s, rect)
+
+    def handle_event(self, event):
+        if event.type == pygame.MOUSEMOTION:
+            was = self.hovered
+            now = self.bg_rect.collidepoint(event.pos)
+            self.hovered = now
+            if not was and now and self.hover_in_action:
+                self.hover_in_action()
+            elif was and not now and self.hover_out_action:
+                self.hover_out_action()
+
+        elif event.type == pygame.MOUSEBUTTONDOWN:
+            if not self.bg_rect.collidepoint(event.pos):
+                return
+
+            # 计算点击的是哪一行(用于行点击)
+            clicked_row_local = self._hit_test_row(event.pos)
+
+            # 滚轮
+            if event.button in (4, 5):  # 4=up, 5=down
+                mods = pygame.key.get_mods()
+                shift = bool(mods & pygame.KMOD_SHIFT)
+                if shift:  # 翻页
+                    if event.button == 4:
+                        self.prev_page()
+                    else:
+                        self.next_page()
+                else:      # 移动选中行
+                    if event.button == 4:
+                        self.move_selection(-1)
+                    else:
+                        self.move_selection(+1)
+                sound_player.play("turn")
+                self._notify_related()
+                return
+
+            # 左键:行点击-> action
+            if event.button == 1 and clicked_row_local is not None:
+                row = self._row_at_current(clicked_row_local)
+                if row and self.action:
+                    self.action(row["task_id"], row)
+
+        elif event.type == pygame.KEYDOWN:
+            if not self.hovered:
+                return
+            if event.key == pygame.K_UP:
+                self.move_selection(-1)
+                sound_player.play("turn")
+                self._notify_related()
+            elif event.key == pygame.K_DOWN:
+                self.move_selection(+1)
+                sound_player.play("turn")
+                self._notify_related()
+            elif event.key == pygame.K_LEFT:
+                self.prev_page()
+                sound_player.play("turn")
+                self._notify_related()
+            elif event.key == pygame.K_RIGHT:
+                self.next_page()
+                sound_player.play("turn")
+                self._notify_related()
+            elif event.key == pygame.K_HOME:
+                self.set_page(0)
+                sound_player.play("turn")
+                self._notify_related()
+            elif event.key == pygame.K_END:
+                self.set_page(self._page_count() - 1)
+                sound_player.play("turn")
+                self._notify_related()
+            elif event.key in (pygame.K_RETURN, pygame.K_SPACE):
+                # 回车/空格:对选中行触发 action
+                row = self._row_at_current(self._sel_row_idx)
+                if row and self.action:
+                    self.action(row["task_id"], row)
+
+    def _notify_related(self):
+        for i, observer in enumerate(self.related_button):
+            if i < len(self.notify_action) and callable(self.notify_action[i]):
+                self.notify_action[i](observer)
+
+    def _hit_test_row(self, pos):
+        """返回当前页内[0..n-1]的行号,或 None。"""
+        if not self._rows or not self._current_indices():
+            return None
+        L, T, R, B = self.padding
+        inner = pygame.Rect(
+            self.bg_rect.left + L,
+            self.bg_rect.top + T,
+            self.bg_rect.width - L - R,
+            self.bg_rect.height - T - B
+        )
+        if not inner.collidepoint(pos):
+            return None
+        visible_count = max(1, min(self.PAGE_SIZE, len(self._current_indices())))
+        row_height = inner.height // visible_count
+        rel_y = pos[1] - inner.top
+        idx = int(rel_y // row_height)
+        if 0 <= idx < visible_count:
+            return idx
+        return None
+
+    def _row_at_current(self, local_idx):
+        """取当前页 local_idx 对应的行对象。"""
+        inds = self._current_indices()
+        if not inds:
+            return None
+        if not (0 <= local_idx < len(inds)):
+            return None
+        return self._rows[inds[local_idx]]
+
+    def move_selection(self, delta):
+        inds = self._current_indices()
+        if not inds:
+            return
+        self._sel_row_idx = (self._sel_row_idx + delta) % len(inds)
+        if self.roll_action:
+            self.roll_action(self._page_idx, self._sel_row_idx)
+
+    def set_page(self, page_idx):
+        if not self._pages:
+            self._page_idx = 0
+            self._sel_row_idx = 0
+            return
+        page_idx = max(0, min(page_idx, len(self._pages) - 1))
+        if page_idx != self._page_idx:
+            self._page_idx = page_idx
+            # 页切换后,保持选中行号在有效范围内
+            self._sel_row_idx = min(self._sel_row_idx, len(self._pages[self._page_idx]) - 1)
+            if self.roll_action:
+                self.roll_action(self._page_idx, self._sel_row_idx)
+
+    def next_page(self):
+        if self._pages:
+            self.set_page((self._page_idx + 1) % len(self._pages))
+            sound_player.play("turn")
+
+    def prev_page(self):
+        if self._pages:
+            self.set_page((self._page_idx - 1) % len(self._pages))
+            sound_player.play("turn")
+
+    def update_progress(self, task_id, delta):
+        """累加进度;若达到 target 自动置为完成并记录完成时间。"""
+        for row in self._rows:
+            if row["task_id"] == task_id:
+                row["progress"] = max(0, row["progress"] + int(delta))
+                tgt = max(0, row["target"])
+                if 0 < tgt <= row["progress"]:
+                    row["progress"] = tgt
+                    row["status"] = True
+                    if row["finish_time"] is None:
+                        row["finish_time"] = datetime.now()
+                break
+
+    def set_progress(self, task_id, value):
+        for row in self._rows:
+            if row["task_id"] == task_id:
+                row["progress"] = max(0, int(value))
+                tgt = max(0, row["target"])
+                if 0 < tgt <= row["progress"]:
+                    row["progress"] = tgt
+                    row["status"] = True
+                    if row["finish_time"] is None:
+                        row["finish_time"] = datetime.now()
+                else:
+                    # 低于target时把完成状态复位
+                    if row["status"]:
+                        row["status"] = False
+                        row["finish_time"] = None
+                break
+
+    def mark_done(self, task_id, done=True, finish_time=None):
+        for row in self._rows:
+            if row["task_id"] == task_id:
+                row["status"] = bool(done)
+                if done:
+                    row["finish_time"] = finish_time if isinstance(finish_time, datetime) else (datetime.now() if finish_time is None else row["finish_time"])
+                    # 同步进度到target
+                    if row["target"] > 0:
+                        row["progress"] = row["target"]
+                else:
+                    row["finish_time"] = None
+                break
+
+    def get_selection(self):
+        """返回当前选中 (task_id, record) 或 None。"""
+        row = self._row_at_current(self._sel_row_idx)
+        if row:
+            return row["task_id"], row
+        return None
+
+
+
+
+
+
+
+
+
+
+

+ 99 - 0
game/ui/menu/guide_menu.py

@@ -0,0 +1,99 @@
+import json
+import os
+from game.const import game as G
+from game.const import window as W
+from game.const import rouge as R
+from datetime import datetime
+
+from game.ui.menu.component import PygameButton, PygameButtonBackIMG, Particle, PygameTaskBoard
+from game.const.task import daily_task, weekly_task, monthly_task, single_task
+from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data
+
+current_folder_path = os.getcwd()
+
+first_class = f" 游戏说明 \n" \
+              f"\n 常规情况下一局游戏由3个主题组成(隐藏主题额外计算), " \
+              f"\n 每个主题有5层关卡, 每个关卡中有不同的房间. " \
+              f"\n 玩家需要探索房间, 至少完成起点与终点房间后可进入下一层. " \
+              f"\n 每一层关卡间可以额外根据玩家英雄成长值选择一定增益. " \
+              f"\n 关卡中不同房间可能有不同的事件, " \
+              f"\n 地图中的怪物也分为普通怪,精英怪和首领. " \
+              f"\n 随着进入更深主题,更高层关卡, 出现的怪物也会更强. " \
+              f"\n 击败越强的怪物所获得的经验或糖币也越多. " \
+              f"\n 玩家也可以尝试完成委托里的任务进行升级. " \
+              f"\n 玩家等级越高, 则对应的技能,属性等都会明显提升. " \
+              f"\n 若未使用道具或扫荡完所有区域, 还可获得更大的胜利 . " \
+              f"\n <房间类型介绍>请见下一页"
+room_intro = f" 房间类型介绍 \n" \
+             f"\n 战斗区: 消灭所有出现的怪物即可, 是游戏的主要环节. " \
+             f"\n 命运区: 接触命运的谕示, 获得随机增益或惩罚. " \
+             f"\n 挑衅区: 挑衅对手并击败强力敌人以获得更多奖励. " \
+             f"\n 商店区: 消耗糖币购买自己想要的商品或加成. " \
+             f"\n 赌场区: 糖币太多了也不妨来这里进行消遣, 有机会获得大奖. " \
+             f"\n 银行区: 缺钱了可以来这里贷款, 但有借不还会遭到严厉惩罚. " \
+             f"\n 修炼区: 若想继续提升技能等级突破上限可以找宗师拜师学艺. " \
+              f"\n <游戏背景>请见下一页"
+introduction = f" 游戏背景 \n" \
+    f"\n 魔王艾登的核心在绝望与野心中凝结, 化作无尽魔力的漩涡." \
+    f"\n 它撕裂了天地的脉络, 扯碎了时间的秩序. " \
+    f"\n 你被卷入这股狂乱的时空洪流之中," \
+    f"\n 四周是破碎的光影与回响——" \
+    f"\n 旧日的故人与熟悉的景象宛若河流般在眼前交替闪现," \
+    f"\n 转瞬即逝却又触手可及. " \
+    f"\n 在这里, 过去与现在交叠, 未来的幻影亦一同涌现." \
+    f"\n 时光不再是直线, 而是无数层叠的镜面, 交织成无可逃遁的迷宫." \
+    f"\n 你在其中漂泊, 既是见证者,也是探索者." \
+    f"\n 混乱的乱流, 反倒揭开了世界最深处的面纱." \
+    f"\n 若能在这片时空交错之境中看清真相," \
+    f"\n 或许你将触及存在的根源, 窥见那不可言说的本质." \
+    f"\n <wiki官网>请见下一页"
+guide_text = f"\n\n\n\n wiki官网(远洋服务器可能需科学上网) " \
+            f"\n http://qqtwiki.free.nf/" \
+            f"\n 首页导航->肉鸽->肉鸽教程->版本角色推荐" \
+            f"\n 基础探险请练习QQTPVE新手教程" \
+            f"\n 或bilibili搜索QQTRogue."
+
+pages = [first_class, room_intro, introduction, guide_text]
+
+
+class GuidePage:
+    def __init__(self):
+        self.screen = W.MENU
+        self.pages = pages
+        self.total_page = len(self.pages)
+        self.page = 0
+
+    def forward(self):
+        self.page = max(0, self.page - 1)
+        self.screen.buttons.clear()
+        self.draw()
+
+    def backward(self):
+        self.page = min(self.total_page - 1, self.page + 1)
+        self.screen.buttons.clear()
+        self.draw()
+
+    def draw(self):
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, self.pages[self.page], 0.5, 0.42, 18, "#2a2a2a",
+                fg_color=(215, 220, 217), anchor="center", is_bold=True, fix_shape=(520, 400), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21),
+                background=self.screen
+            )
+        )
+        self.screen.buttons.append(
+            PygameButtonBackIMG(
+                self.screen, self.screen.screen, 0.66, 0.85, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.refresh, anchor='center'
+            )
+        )
+        if self.page != 0:
+            self.screen.buttons.append(PygameButtonBackIMG(
+                self.screen, self.screen.screen, 0.12, 0.42, "res/ui/button/left.png", "res/ui/button/left_press.png", action=self.forward, anchor='center', shiny_spark=False)
+            )
+        if self.page != self.total_page - 1:
+            self.screen.buttons.append(PygameButtonBackIMG(
+                self.screen, self.screen.screen, 0.88, 0.42, "res/ui/button/right.png", "res/ui/button/right_press.png", action=self.backward, anchor='center', shiny_spark=False)
+            )
+
+

+ 260 - 0
game/ui/menu/handbook_menu.py

@@ -0,0 +1,260 @@
+import json
+import os
+import pygame
+
+from game.const import game as G
+from game.const import window as W
+from game.const import rouge as R
+from datetime import datetime
+
+from game.ui.menu.component import PygameButton, PygameButtonBackIMG, Particle, PygameTaskBoard, PygameButtonBackIMGRoll, PygameIMG, PygameButtonBackIMGGuideBookRoll
+from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data
+
+current_folder_path = os.getcwd()
+content = load_json(f"{G.GAME_PATH}/game/handbook/content.json")
+theme_dic = {
+    "Field": {"cn": "", "path": "L1_Field"},
+    "Mo1": {"cn": "", "path": "L1_Mo1"},
+    "Park": {"cn": "", "path": "L1_Park"},
+    "Sea": {"cn": "", "path": "L1_Sea"},
+    "Castle": {"cn": "", "path": "L2_Castle"},
+    "Forest": {"cn": "", "path": "L2_Forest"},
+    "Glacier": {"cn": "", "path": "L2_Glacier"},
+    "Library": {"cn": "", "path": "L2_Library"},
+    "Gobi": {"cn": "", "path": "L3_Gobi"},
+    "Lab": {"cn": "", "path": "L3_Lab"},
+    "Mine": {"cn": "", "path": "L3_Mine"},
+    "Destiny": {"cn": "", "path": "L4_Destiny"},
+    "Eden": {"cn": "", "path": "L4_Eden"},
+    "Skyland": {"cn": "", "path": "L4_Skyland"},
+    "Wavend": {"cn": "", "path": "L4_Wavend"},
+}
+mon_type_dic = {"normal": "普通", "elite": "精英", "boss": "首领"}
+monster_dictonary = dict()
+for theme, mons in content.items():
+    monster_dictonary[theme] = dict()
+    theme_path = theme_dic[theme]['path']
+    for mon in mons:
+        try:
+            mon_json = load_json(f"{G.GAME_PATH}/game/handbook/{theme_path}/{mon}.json")
+            character = load_json(f"{G.GAME_PATH}/game/frame/character/{mon_json['character']}.json")["D"]["Cloth"]["IMG"][0]
+            monster_dictonary[theme][mon] = {
+                "name": mon_json.get("chs_name", "???"),
+                "character": pygame.image.load(f"res/img/cloth/{character}").convert_alpha(),
+                "type": mon_type_dic[mon_json.get("type", "normal")],
+                "blood": mon_json.get("blood", 0),
+                "speed": mon_json.get("speed", "???"),
+                "contact": mon_json.get("contact", 0),
+                "defense": mon_json.get("defense", 0),
+                "sight": mon_json.get("resent_dist", "???"),
+                "info": mon_json.get("info", "???"),
+                "strategy": mon_json.get("strategy", "???")
+            }
+        except Exception as e:
+            print(e)
+            monster_dictonary[theme][mon] = {
+                "name": "???",
+                "character": pygame.image.load(f"res/img/cloth/null.png").convert_alpha(),
+                "type": "normal",
+                "blood": 0,
+                "speed": "???",
+                "contact": 0,
+                "defense": 0,
+                "sight": "???",
+                "info": "???",
+                "strategy": "???"
+            }
+
+
+class HandbookPage:
+
+    def __init__(self):
+        self.current_theme = "Mo1"
+        self.current_monster = "MoFaBingShuang"
+        self.screen = W.MENU
+
+    def draw(self):
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, "魔法王国", 0.2, 0.25, 24, "#2a2a2a", fg_color=(215,220,217), action=lambda: self.draw_monster(theme="Mo1"), anchor="center", is_bold=True, fix_shape=(120,34), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen
+            )
+        )
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, "静涛海原", 0.4, 0.25, 24, "#2a2a2a", fg_color=(215,220,217), action=lambda: self.draw_monster(theme="Sea"), anchor="center", is_bold=True, fix_shape=(120,34), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen
+            )
+        )
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, "废铁乐园", 0.6, 0.25, 24, "#2a2a2a", fg_color=(215,220,217), action=lambda: self.draw_monster(theme="Park"), anchor="center", is_bold=True, fix_shape=(120,34), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen
+            )
+        )
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, "絮语森林", 0.8, 0.25, 24, "#2a2a2a", fg_color=(215,220,217), action=lambda: self.draw_monster(theme="Field"), anchor="center", is_bold=True, fix_shape=(120,34), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen
+            )
+        )
+
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, "魔法古堡", 0.2, 0.35, 24, "#2a2a2a", fg_color=(215,220,217), action=lambda: self.draw_monster(theme="Castle"), anchor="center", is_bold=True, fix_shape=(120,34), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen
+            )
+        )
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, "永东寒原", 0.4, 0.35, 24, "#2a2a2a", fg_color=(215,220,217), action=lambda: self.draw_monster(theme="Glacier"), anchor="center", is_bold=True, fix_shape=(120,34), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen
+            )
+        )
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, "迷雾古林", 0.6, 0.35, 24, "#2a2a2a", fg_color=(215,220,217), action=lambda: self.draw_monster(theme="Forest"), anchor="center", is_bold=True, fix_shape=(120,34), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen
+            )
+        )
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, "猩红书阁", 0.8, 0.35, 24, "#2a2a2a", fg_color=(215,220,217), action=lambda: self.draw_monster(theme="Library"), anchor="center", is_bold=True, fix_shape=(120,34), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen
+            )
+        )
+
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, "熔岩深矿", 0.3, 0.45, 24, "#2a2a2a", fg_color=(215,220,217), action=lambda: self.draw_monster(theme="Mine"), anchor="center", is_bold=True, fix_shape=(120,34), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen
+            )
+        )
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, "赤砂遗迹", 0.5, 0.45, 24, "#2a2a2a", fg_color=(215,220,217), action=lambda: self.draw_monster(theme="Gobi"), anchor="center", is_bold=True, fix_shape=(120,34), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen
+            )
+        )
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, "械城之心", 0.7, 0.45, 24, "#2a2a2a", fg_color=(215,220,217), action=lambda: self.draw_monster(theme="Lab"), anchor="center", is_bold=True, fix_shape=(120,34), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen
+            )
+        )
+
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, "枯朽荒原", 0.2, 0.55, 24, "#2a2a2a", fg_color=(215,220,217), action=lambda: self.draw_monster(theme="Eden"), anchor="center", is_bold=True, fix_shape=(120,34), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen
+            )
+        )
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, "上古遗迹", 0.4, 0.55, 24, "#2a2a2a", fg_color=(215,220,217), action=lambda: self.draw_monster(theme="Destiny"), anchor="center", is_bold=True, fix_shape=(120,34), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen
+            )
+        )
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, "渊海神殿", 0.6, 0.55, 24, "#2a2a2a", fg_color=(215,220,217), action=lambda: self.draw_monster(theme="Wavend"), anchor="center", is_bold=True, fix_shape=(120,34), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen
+            )
+        )
+        self.screen.buttons.append(
+            PygameButton(
+                self.screen.screen, "空岛圣殿", 0.8, 0.55, 24, "#2a2a2a", fg_color=(215,220,217), action=lambda: self.draw_monster(theme="Skyland"), anchor="center", is_bold=True, fix_shape=(120,34), bg_alpha=159,
+                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen
+            )
+        )
+
+        # 返回主界面
+        self.screen.buttons.append(PygameButtonBackIMG(
+            self.screen, self.screen.screen, 0.66, 0.72, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.open_setting, anchor='center')
+        )
+
+    def draw_monster(self, theme=None):
+        self.current_theme = theme
+        monsters = content.get(theme, ["零零零零零", "壹壹壹壹壹", "贰贰贰贰贰", "叁叁叁叁叁", "捌捌捌捌捌"])
+        self.current_monster = monsters[0]
+        self.screen.buttons.clear()
+        # ================================= 信息展示 =================================
+        info_button = PygameButton(
+            self.screen.screen, "", 0.68, 0.49, 18, "#2a2a2a",
+            fg_color=(215,220,217), action=None,
+            anchor="center", is_bold=True, fix_shape=(340,480), bg_alpha=159,
+            frosted_glass=True, blur_radius=8, glass_alpha=167, glass_surf_color=(41,34,21), background=self.screen
+        )
+        # ================================= 图片 =================================
+        img_button = PygameButtonBackIMG(
+            self.screen, self.screen.screen, 0.25, 0.25, "res/ui/button/guide_book.png", "res/ui/button/guide_book.png",
+            action=None, anchor='center', shiny_spark=False
+        )
+        monster_img = monster_dictonary[self.current_theme][self.current_monster]["character"]
+        img = PygameIMG(self.screen, self.screen.screen, 0.25, 0.25, py_img=monster_img, anchor='center')
+        # ================================= 展示框 =================================
+        cy = 0.6
+        cx = 0.25
+        button_blank = 0.13
+        roll_button = PygameButtonBackIMGGuideBookRoll(
+            self.screen, self.screen.screen, cx, cy, "res/ui/button/cursor_board.png", monsters,
+            action=None, roll_action=None, hover_in_action=None, hover_out_action=None,
+            anchor='center', font_name="hk4e_zh-cn.ttf", font_size=22, small_scale=0.7, small_alpha=159, color=(0, 0, 0), shiny_spark=False,
+            related_button=[info_button, img],
+            notify_action=[lambda x: monster_update_notify(roll_button, x, self.current_monster, self.current_theme), lambda _: monster_img_update(roll_button, img, theme)],
+            diction=monster_dictonary[self.current_theme]
+        )
+        # ================================= 初始化 =================================
+        roll_button.set_current_text(self.current_monster)
+        monster_update_notify(roll_button, info_button, self.current_monster, self.current_theme)
+        # ================================= 添加按钮 =================================
+        self.screen.buttons.append(info_button)
+        self.screen.buttons.append(roll_button)
+        self.screen.buttons.append(img_button)
+        self.screen.buttons.append(img)
+        # ================================= 上翻页 =================================
+        self.screen.buttons.append(PygameButtonBackIMG(
+            self.screen, self.screen.screen, cx, cy-button_blank, "res/ui/button/up.png", "res/ui/button/up_press.png", action=roll_button.roll_up, anchor='center', shiny_spark=False)
+        )
+        # ================================= 下翻页 =================================
+        self.screen.buttons.append(PygameButtonBackIMG(
+            self.screen, self.screen.screen, cx, cy+button_blank, "res/ui/button/down.png", "res/ui/button/down_press.png", action=roll_button.roll_down, anchor='center', shiny_spark=False)
+        )
+        # ================================= 返回上一级 =================================
+        self.screen.buttons.append(PygameButtonBackIMG(
+            self.screen, self.screen.screen, 0.25, 0.85, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.clear_and_draw, anchor='center')
+        )
+
+    def choose_monster(self, roll_btn: PygameButtonBackIMGGuideBookRoll, info_button, choose_btn, theme: str):
+        cn_name = roll_btn.get_current_text()
+        # current = bomb_cn[cn_name]
+        current = str(cn_name)
+        self.current_monster = current
+        R.bomb_skin = current
+        roll_btn.set_current_text(current)
+        monster_update_notify(roll_btn, info_button, self.current_monster, theme)
+
+    def clear_and_draw(self):
+        self.screen.buttons.clear()
+        self.draw()
+
+
+def monster_update_notify(board: PygameButtonBackIMGGuideBookRoll, observer: PygameButton, chosen, theme: str):
+    name = board.get_current_text()
+    new = f"\n {monster_dictonary[theme][name]['name']} \n <{monster_dictonary[theme][name]['type']}> \n\n " \
+          f"血量: {monster_dictonary[theme][name]['blood']}, 速度: {monster_dictonary[theme][name]['speed']} \n " \
+          f"碰撞: {monster_dictonary[theme][name]['contact']}, 防御: {monster_dictonary[theme][name]['defense']}, 视野: {monster_dictonary[theme][name]['sight']} \n\n " \
+          f"{monster_dictonary[theme][name]['info']} \n\n {monster_dictonary[theme][name]['strategy']}"
+    observer.set_text(new)
+
+
+def monster_img_update(board: PygameButtonBackIMGGuideBookRoll, img: PygameIMG, theme: str):
+    name = board.get_current_text()
+    monster_img = monster_dictonary[theme][name]["character"]
+    img.update_image_and_reallocate_position(monster_img, 0.25, 0.25)
+    # img.update_image(monster_img)
+
+
+
+
+

+ 4 - 2
game/ui/menu/record_menu.py

@@ -71,8 +71,10 @@ class RecordPage:
         )
 
         # 返回主界面
-        self.screen.buttons.append(PygameButtonBackIMG(
-            self.screen, self.screen.screen, 0.66, 0.82, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.refresh, anchor='center')
+        self.screen.buttons.append(
+            PygameButtonBackIMG(
+                self.screen, self.screen.screen, 0.66, 0.82, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.refresh, anchor='center'
+            )
         )
 
 

+ 12 - 54
game/ui/menu/skin_menu.py

@@ -136,13 +136,24 @@ class SkinPage:
         )
         # 藏宝阁
         self.screen.buttons.append(PygameButtonBackIMG(
-            self.screen, self.screen.screen, 0.5, 0.45, "res/ui/button/treasure.png", "res/ui/button/treasure_press.png", action=self.draw_treasure, anchor='center')
+            self.screen, self.screen.screen, 0.35, 0.45, "res/ui/button/treasure.png", "res/ui/button/treasure_press.png", action=self.draw_treasure, anchor='center')
+        )
+        # 图鉴
+        self.screen.buttons.append(PygameButtonBackIMG(
+            self.screen, self.screen.screen, 0.65, 0.45, "res/ui/button/handbook.png", "res/ui/button/handbook_press.png", action=self.draw_handbook, anchor='center')
         )
         # 返回主界面
         self.screen.buttons.append(PygameButtonBackIMG(
             self.screen, self.screen.screen, 0.5, 0.6, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.refresh, anchor='center')
         )
 
+    def draw_handbook(self):
+        self.screen.buttons.clear()
+        from game.ui.menu.handbook_menu import HandbookPage
+        page = HandbookPage()
+        page.draw()
+        del page
+
     def draw_cursor(self):
         self.screen.buttons.clear()
         self.load_achievements_data()
@@ -247,59 +258,6 @@ class SkinPage:
             self.screen, self.screen.screen, 0.66, 0.72, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.open_setting, anchor='center')
         )
 
-    """
-        self.hero_dic= {"Fox": "小倩", "Boboli": "波波丽", "Naruto_old": "火影", "Asha": "阿莎", "Maria": "玛莉亚", "Surprise": "???"}
-        self.diff_dic = {"Easy": "简单", "Normal": "困难", "Hell": "炼狱", "Hell+": "炼狱+"}
-        
-
-        if self.current_bomb == "bomb1":
-            self.button_bomb = tk.Button(master, text= "(当前选择) \n 糖泡-经典皮肤", bg="#C68E17", font=("Microsoft YaHei", 20))
-            self.button_bomb.place(relx=0.7, rely=0.15, anchor='w')
-        elif self.current_bomb == "bomb60":
-            self.button_bomb = tk.Button(master, text= "(当前选择) \n 糖泡-命运(伤害+50)", bg="#C68E17", font=("Microsoft YaHei", 20))
-            self.button_bomb.place(relx=0.7, rely=0.15, anchor='w')
-        elif self.current_bomb == "bomb1436":
-            self.button_bomb = tk.Button(master, text= "(当前选择) \n 糖泡-深林(生命+150)", bg="#C68E17", font=("Microsoft YaHei", 20))
-            self.button_bomb.place(relx=0.7, rely=0.15, anchor='w')
-
-        self.button100 = tk.Button(master, text= "▶糖泡-经典皮肤", command=self.choose_bomb1, bg="#A23BEC", font=("Microsoft YaHei", 12))
-        self.button100.place(relx=0.5, rely=0.08, anchor='w')
-        if has_bomb60:
-            self.button160 = tk.Button(master, text= "▶糖泡-命运(伤害+50)", command=self.choose_bomb60, bg="#A23BEC", font=("Microsoft YaHei", 12))
-            self.button160.place(relx=0.5, rely=0.17, anchor='w')
-        else:
-            self.button160 = tk.Button(master, text= "(暂未获得) \n 糖泡-命运(伤害+50)", bg="#C6AEC7", font=("Microsoft YaHei", 12))
-            self.button160.place(relx=0.5, rely=0.17, anchor='w')
-        if has_bomb1436:
-            self.button1436 = tk.Button(master, text= "▶糖泡-深林(生命+150)", command=self.choose_bomb1436, bg="#A23BEC", font=("Microsoft YaHei", 12))
-            self.button1436.place(relx=0.5, rely=0.26, anchor='w')
-        else:
-            self.button1436 = tk.Button(master, text= "(暂未获得) \n 糖泡-深林(生命+150)", bg="#C6AEC7", font=("Microsoft YaHei", 12))
-            self.button1436.place(relx=0.5, rely=0.26, anchor='w')
-
-
-    def choose_bomb1(self):
-        self.current_bomb = "bomb1"
-        R.bomb_skin = "bomb1"
-        self.rougeOB_other_data['Bomb_Skin'] = "bomb1"
-        save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
-        self.button_bomb.config(text = "(当前选择) \n 糖泡-经典皮肤")
-
-    def choose_bomb60(self):
-        self.current_bomb = "bomb60"
-        R.bomb_skin = "bomb60"
-        self.rougeOB_other_data['Bomb_Skin'] = "bomb60"
-        save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
-        self.button_bomb.config(text = "(当前选择) \n 糖泡-命运(伤害+50)")
-
-    def choose_bomb1436(self):
-        self.current_bomb = "bomb1436"
-        R.bomb_skin = "bomb1436"
-        self.rougeOB_other_data['Bomb_Skin'] = "bomb1436"
-        save_encrypt_single_rouge_file(self.rougeOB_other_data, "rougeOBOther")
-        self.button_bomb.config(text = "(当前选择) \n 糖泡-深林(生命+150)")
-    """
-
     def choose_cursor(self, roll_btn: PygameButtonBackIMGRoll, info_button, choose_btn):
         cn_name = roll_btn.get_current_text()
         current = cursor_cn[cn_name]

+ 65 - 104
game/ui/menu/task_menu.py

@@ -1,11 +1,13 @@
-from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data
 import json
 import os
 from game.const import game as G
 from game.const import window as W
 from game.const import rouge as R
 from datetime import datetime
-from game.ui.menu.component import PygameButton, PygameButtonBackIMG, Particle
+
+from game.ui.menu.component import PygameButton, PygameButtonBackIMG, Particle, PygameTaskBoard
+from game.const.task import daily_task, weekly_task, monthly_task, single_task
+from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data
 
 current_folder_path = os.getcwd()
 
@@ -13,110 +15,26 @@ current_folder_path = os.getcwd()
 class TaskPage:
     def __init__(self):
         self.screen = W.MENU
-        self.now = datetime.now()
-        self.year = "1970"
-        self.month = "1"
-        self.day = "1"
-        user_documents_folder = os.path.expanduser("~\\Documents")  # 获取用户的"文档"文件夹路径
-        qqtpve_folder = os.path.join(user_documents_folder, "QQTPVE")  # 构建QQTPVE文件夹路径
-        os.makedirs(qqtpve_folder, exist_ok=True)  # 确保QQTPVE文件夹存在,如果不存在则创建
-        self.rouge_task_file_path = os.path.join(qqtpve_folder, "rougeOB_task.rougedata")  # 构建任务文件路径
-        self.rougeOB_task_data = {}
-        self.init_task()
-
-    def init_task(self):
-        # 第一次打开
-        if not os.path.exists(self.rouge_task_file_path):
-            self.rougeOB_task_data = {
-                "1":  {"task": "击杀5只命运维系者", "reward": "800经验", "process": 0, "finish": 5, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "2":  {"task": "击杀3只渊烬龙王", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "3":  {"task": "到达3-1十次", "reward": "800经验", "process": 0, "finish": 10, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "4":  {"task": "击杀5只因果阅律者", "reward": "800经验", "process": 0, "finish": 5, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "5":  {"task": "完成20次挑衅敌人", "reward": "800经验", "process": 0, "finish": 20, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "6":  {"task": "使用小倩到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "7":  {"task": "使用波波丽到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "8":  {"task": "使用火影到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "9":  {"task": "使用阿莎到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "10": {"task": "使用玛莉亚到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "11": {"task": "到达4-1一次", "reward": "800经验", "process": 0, "finish": 1, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "12": {"task": "累积使用20次复活卡", "reward": "800经验", "process": 0, "finish": 20, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "today": {"task": "进行一盘游戏并到达2-1", "reward": "50经验", "process": 0, "finish": 1, "last_finish": "1970-1-1", "reward_exp": 50, "hero": "Fox", "rewarded": True}
-            }
-            save_encrypt_single_rouge_file(self.rougeOB_task_data, "rougeOB_task")
-        # 正常打开
-        else:
-            self.rougeOB_task_data = load_rouge_data(self.rouge_task_file_path)
-
-        # 格式化年月日
-        year = self.now.strftime("%Y")
-        month = self.now.strftime("%m")
-        day = self.now.strftime("%d")
-        # 移除月份和日期的前导零(如果有)
-        month = month.lstrip("0")
-        day = day.lstrip("0")
-        self.year = str(year)
-        self.month = str(month)
-        self.day = str(day)
-
-        if int(self.rougeOB_task_data[str(month)]["last_finish"]) < int(year):
-            self.rougeOB_task_data[str(month)]["process"] = 0
-            self.rougeOB_task_data[str(month)]["last_finish"] = year
-            self.rougeOB_task_data[str(month)]["rewarded"] = False
-        if self.rougeOB_task_data["today"]["last_finish"] != year + "-" + month + "-" + day:
-            self.rougeOB_task_data["today"]["process"] = 0
-            self.rougeOB_task_data["today"]["last_finish"] = year + "-" + month + "-" + day
-            self.rougeOB_task_data["today"]["rewarded"] = False
-        save_encrypt_single_rouge_file(self.rougeOB_task_data, "rougeOB_task")
 
     def draw(self):
-        """
-        # ============================================= 月常任务 =============================================
-        if self.rougeOB_task_data[self.month]["process"] < self.rougeOB_task_data[self.month]["finish"]:
-            # 若还未完成
-            text = f"○月度征召\n{self.rougeOB_task_data[self.month]['task']} \n酬谢: {self.rougeOB_task_data[self.month]['reward']}\n进度: {self.rougeOB_task_data[self.month]['process']}/{self.rougeOB_task_data[self.month]['finish']}"
-            self.screen.buttons.append(
-                PygameButton(self.screen.screen, text, 0.3, 0.35, 18, "#2a2a2a",
-                             fg_color=(215,220,217), anchor="center", is_bold=True, fix_shape=(280,160), bg_alpha=159,
-                             frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen)
-            )
-        else:
-            text = f"○月度征召\n{self.rougeOB_task_data[self.month]['task']} \n酬谢: {self.rougeOB_task_data[self.month]['reward']}\n\n by {R.hero_name[self.rougeOB_task_data['today']['hero']]}"
-            self.screen.buttons.append(
-                PygameButton(self.screen.screen, text, 0.3, 0.35, 18, "#2a2a2a",
-                             fg_color=(215,220,217), anchor="center", is_bold=True, fix_shape=(280,160), bg_alpha=159,
-                             frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen)
-            )
-            self.screen.buttons.append(PygameButtonBackIMG(
-                self.screen, self.screen.screen, 0.3, 0.41, "res/ui/button/task_finish.png", "res/ui/button/task_finish.png", anchor='center')
-            )
-
-        # ============================================= 日常任务 =============================================
-        print(self.rougeOB_task_data["today"]["process"], self.rougeOB_task_data["today"]["finish"])
-        if self.rougeOB_task_data["today"]["process"] < self.rougeOB_task_data["today"]["finish"]:
-            # 若还未完成
-            text = f"○日常委托\n{self.rougeOB_task_data['today']['task']} \n酬谢: {self.rougeOB_task_data['today']['reward']}\n进度: {self.rougeOB_task_data['today']['process']}/{self.rougeOB_task_data['today']['finish']}"
-            self.screen.buttons.append(
-                PygameButton(self.screen.screen, text, 0.7, 0.35, 18, "#2a2a2a",
-                             fg_color=(215,220,217), anchor="center", is_bold=True, fix_shape=(280,160), bg_alpha=159,
-                             frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen)
-            )
-        else:
-            text = f"○日常委托\n{self.rougeOB_task_data['today']['task']} \n酬谢: {self.rougeOB_task_data['today']['reward']}\n\n by {R.hero_name[self.rougeOB_task_data['today']['hero']]}"
-            self.screen.buttons.append(
-                PygameButton(self.screen.screen, text, 0.7, 0.35, 18, "#2a2a2a",
-                             fg_color=(215,220,217), anchor="center", is_bold=True, fix_shape=(280,160), bg_alpha=159,
-                             frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen)
-            )
-            self.screen.buttons.append(PygameButtonBackIMG(
-                self.screen, self.screen.screen, 0.7, 0.41, "res/ui/button/task_finish.png", "res/ui/button/task_finish.png", anchor='center')
-            )
-        """
-        text = f"\n\n任务系统升级中.."
-        self.screen.buttons.append(
-            PygameButton(self.screen.screen, text, 0.5, 0.35, 18, "#2a2a2a",
-                         fg_color=(215,220,217), anchor="center", is_bold=True, fix_shape=(280,160), bg_alpha=159,
-                         frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21),
-                         background=self.screen)
+        # 日常任务
+        self.screen.buttons.append(PygameButtonBackIMG(
+            self.screen, self.screen.screen, 0.5, 0.25, "res/ui/button/task_daily.png", "res/ui/button/task_daily_press.png", action=self.draw_daily, anchor='center')
+        )
+
+        # 周常任务
+        self.screen.buttons.append(PygameButtonBackIMG(
+            self.screen, self.screen.screen, 0.35, 0.4, "res/ui/button/task_weekly.png", "res/ui/button/task_weekly_press.png", action=self.draw_weekly, anchor='center')
+        )
+
+        # 月常任务
+        self.screen.buttons.append(PygameButtonBackIMG(
+            self.screen, self.screen.screen, 0.65, 0.4, "res/ui/button/task_monthly.png", "res/ui/button/task_monthly_press.png", action=self.draw_monthly, anchor='center')
+        )
+
+        # 常驻任务
+        self.screen.buttons.append(PygameButtonBackIMG(
+            self.screen, self.screen.screen, 0.5, 0.55, "res/ui/button/task_single.png", "res/ui/button/task_single_press.png", action=self.draw_single, anchor='center')
         )
 
         # 返回主界面
@@ -124,3 +42,46 @@ class TaskPage:
             self.screen, self.screen.screen, 0.66, 0.72, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.refresh, anchor='center')
         )
 
+    def draw_daily(self):
+        self.draw_task_page(daily_task)
+
+    def draw_weekly(self):
+        self.draw_task_page(weekly_task)
+
+    def draw_monthly(self):
+        self.draw_task_page(monthly_task)
+
+    def draw_single(self):
+        self.draw_task_page(single_task)
+
+    def draw_task_page(self, task_dic):
+        self.screen.buttons.clear()
+        board = PygameTaskBoard(
+            menu=self.screen,
+            screen=self.screen.screen,
+            relx=0.5, rely=0.42,
+            font_name="hk4e_zh-cn.ttf",
+            font_size=18,
+            small_scale=0.8,
+            default_img_path="res/ui/button/task_board.png",
+            action=None,
+            anchor='center',
+            tasks_dict=task_dic,
+            bar_color_fg=(129, 89, 146),
+            row_color=(53, 26, 2),
+            row_color_disabled=(53, 26, 2),
+            row_color_done=(32, 67, 42),
+            padding=(26, 30, 26, 50)
+        )
+        self.screen.buttons.append(board)
+        self.screen.buttons.append(PygameButtonBackIMG(
+            self.screen, self.screen.screen, 0.12, 0.4, "res/ui/button/left.png", "res/ui/button/left_press.png", action=board.prev_page, anchor='center', shiny_spark=False)
+        )
+        self.screen.buttons.append(PygameButtonBackIMG(
+            self.screen, self.screen.screen, 0.88, 0.4, "res/ui/button/right.png", "res/ui/button/right_press.png", action=board.next_page, anchor='center', shiny_spark=False)
+        )
+        self.screen.buttons.append(PygameButtonBackIMG(
+            self.screen, self.screen.screen, 0.66, 0.86, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.open_task, anchor='center')
+        )
+
+

+ 22 - 81
launcher.py

@@ -19,6 +19,8 @@ from game.algo import utils as util
 from game.algo import rougeGen as RG
 from game.const import window as W, color as C, game as G
 from game.const import rouge as R
+from game.const.rouge import current_lv
+from game.const.task import read_task_json
 from game.music import music_loader
 from game.sound import sound_player
 from game.ui.menu.component import PygameButton, PygameButtonBackIMG, Particle, PygameIMG
@@ -27,15 +29,6 @@ from game.utils import local_data_manager as DM
 current_folder_path = os.getcwd()
 
 
-def current_lv(lv):
-    lv_list = R.lv_list
-    if lv >= sum(lv_list):
-        return "--"
-    for k in range(0, 14):
-        if sum(lv_list[:k]) <= lv < sum(lv_list[:k + 1]):
-            return str(sum(lv_list[:k + 1]) - lv)
-
-
 def check_rouge_ob_data(data):
     hero_data_dic = {
         "Fox":   {"exp": 0, "lv": 1}, "Boboli":   {"exp": 0, "lv": 1}, "Naruto_old":    {"exp": 0, "lv": 1},
@@ -119,66 +112,6 @@ class Menu:
         else:
             R.bomb_skin = rougeOB_other_data['Bomb_Skin']
 
-        # 第一次打开
-        if not os.path.exists(rouge_task_file_path):
-            rougeOB_task_data = {
-                "1": {"task": "击杀5只命运维系者", "reward": "800经验", "process": 0, "finish": 5, "last_finish": 1970,
-                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "2": {"task": "击杀3只渊烬龙王", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970,
-                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "3": {"task": "到达3-1十次", "reward": "800经验", "process": 0, "finish": 10, "last_finish": 1970,
-                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "4": {"task": "击杀5只因果阅律者", "reward": "800经验", "process": 0, "finish": 5, "last_finish": 1970,
-                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "5": {"task": "完成20次挑衅敌人", "reward": "800经验", "process": 0, "finish": 20, "last_finish": 1970,
-                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "6": {"task": "使用小倩到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970,
-                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "7": {"task": "使用波波丽到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970,
-                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "8": {"task": "使用火影到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970,
-                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "9": {"task": "使用阿莎到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970,
-                      "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "10": {"task": "使用玛莉亚到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970,
-                       "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "11": {"task": "到达4-1一次", "reward": "800经验", "process": 0, "finish": 1, "last_finish": 1970,
-                       "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "12": {"task": "累积使用20次复活卡", "reward": "800经验", "process": 0, "finish": 20, "last_finish": 1970,
-                       "reward_exp": 800, "hero": "Fox", "rewarded": True},
-                "today": {"task": "进行一盘游戏并到达2-1", "reward": "50经验", "process": 0, "finish": 1,
-                          "last_finish": "1970-1-1", "reward_exp": 50, "hero": "Fox", "rewarded": True}}
-            save_encrypt_single_rouge_file(rougeOB_task_data, "rougeOB_task")
-        # 正常打开
-        else:
-            rougeOB_task_data = load_rouge_data(rouge_task_file_path)
-
-        now = datetime.now()
-        # 格式化年月日
-        year = now.strftime("%Y")
-        month = now.strftime("%m")
-        day = now.strftime("%d")
-        # 移除月份和日期的前导零(如果有)
-        month = month.lstrip("0")
-        day = day.lstrip("0")
-        R.today_datetime["year"] = int(year)
-        R.today_datetime["month"] = int(month)
-        R.today_datetime["day"] = int(day)
-        try:
-            if len(rougeOB_task_data[str(month)]["last_finish"]) > 4:  # 防一手格式错误
-                rougeOB_task_data[str(month)]["last_finish"] = rougeOB_task_data[str(month)]["last_finish"][0:4]
-        except Exception as e:
-            print(e)
-        if int(rougeOB_task_data[str(month)]["last_finish"]) < int(year):
-            rougeOB_task_data[str(month)]["process"] = 0
-            rougeOB_task_data[str(month)]["last_finish"] = year
-            rougeOB_task_data[str(month)]["rewarded"] = False
-        if rougeOB_task_data["today"]["last_finish"] != year + "-" + month + "-" + day:
-            rougeOB_task_data["today"]["process"] = 0
-            rougeOB_task_data["today"]["last_finish"] = year + "-" + month + "-" + day
-            rougeOB_task_data["today"]["rewarded"] = False
-        save_encrypt_single_rouge_file(rougeOB_task_data, "rougeOB_task")
-
         # 第一次打开
         if not os.path.exists(rouge_file_path):
             rougeOB_data = {
@@ -200,6 +133,9 @@ class Menu:
             rougeOB_data = load_rouge_data(rouge_file_path)
         print(f"local rougeOB_data: {rougeOB_data}")
 
+        # task
+        read_task_json()
+
         # =========================================================================================
         if not G.IS_ONLINE:
             is_online = util.load_online_config()
@@ -288,6 +224,8 @@ class Menu:
         self.buttons.append(PygameButtonBackIMG(self, self.screen, 0.78, 0.26, "res/ui/button/thanks.png", "res/ui/button/thanks_press.png", action=self._open_thanks, anchor='center'))
         # 探险指南
         self.buttons.append(PygameButtonBackIMG(self, self.screen, 0.78, 0.58, "res/ui/button/help.png", "res/ui/button/help_press.png", action=self._open_help, anchor='center'))
+        # 酷比网络
+        self.buttons.append(PygameButtonBackIMG(self, self.screen, 0.22, 0.74, "res/ui/button/online.png", "res/ui/button/online_press.png", action=self._open_online, anchor='center'))
 
     def refresh(self):
         """ 外部接口 """
@@ -301,6 +239,9 @@ class Menu:
     def open_setting(self):
         self._open_setting()
 
+    def open_task(self):
+        self._open_task()
+
     # 各个按钮动作方法
     def _start_game(self):
         self.buttons.clear()
@@ -406,18 +347,13 @@ class Menu:
 
     def _open_help(self):
         self.buttons.clear()
-        text = f"\n wiki官网 " \
-               f"\n http://qqtwiki.free.nf/" \
-               f"\n 基础探险请练习QQTPVE新手教程"
-        self.buttons.append(
-            PygameButton(
-                self.screen, text, 0.5, 0.35, 18, "#2a2a2a",
-                fg_color=(215,220,217), anchor="center", is_bold=True, fix_shape=(480,240), bg_alpha=159,
-                frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21),
-                background=self
-            )
-        )
-        self.buttons.append(PygameButtonBackIMG(self, self.screen, 0.66, 0.72, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self._create_buttons, anchor='center'))
+        from game.ui.menu.guide_menu import GuidePage
+        page = GuidePage()
+        page.draw()
+        del page
+
+    def _open_online(self):
+        util.kubi_online()
 
     def run(self):
         clock = pygame.time.Clock()
@@ -522,6 +458,11 @@ class Menu:
         R.random_dmg = last_data["random_dmg"]
         R.show_cursor = last_data["show_cursor"]
         R.last_item = last_data["items"]
+        G.ITEM = last_data["item_use_num"]
+        G.ALL_CLEAR = last_data["is_all_clear"]
+        R.last_pass_theme_num = last_data["last_pass_theme_num"]
+        R.coin_borrow = last_data["coin_borrow"]
+        R.has_loan = last_data["has_loan"]
         if os.path.exists(os.path.join(os.path.expanduser("~\\Documents"), "QQTPVE", "rougeOBLastGame.rougedata")):
             os.remove(os.path.join(os.path.expanduser("~\\Documents"), "QQTPVE", "rougeOBLastGame.rougedata"))
             print("已读取,清除数据!!!!!!!!!!!!!")