@@ -22,6 +22,8 @@ class UnitController(Module):
2222 auto_unique1_slot : bool = True
2323 to_max_level : bool = True
2424 use_raw_ore : bool = True
25+
26+ E = 100_000_000
2527
2628 skill_name = {
2729 eSkillLocationCategory .UNION_BURST_SKILL : "UB" ,
@@ -962,3 +964,79 @@ async def do_task(self, client: pcrclient):
962964
963965 if summary :
964966 self ._warn (f"将购买记忆碎片:\n " + '\n ' .join (summary ))
967+
968+
969+ @description (
970+ "批量角色突破,只使用角色碎片进行突破"
971+ "\n 忽略盈余:默认只有在角色碎片完全盈余的条件下才可以进行突破,开启后可忽略盈余检查"
972+ "\n 保留Mana下限:妈的钱包+现有Mana小于该值时停止突破"
973+ )
974+ @name ("角色突破" )
975+ @unitlist ("unit_exceed_units" , "角色" )
976+ @booltype ("unit_exceed_ignore_memory" , "忽略盈余" , False )
977+ @inttype ("unit_exceed_mana_keep" , "保留Mana下限(亿)" , 10 , range (1000 ))
978+ @default (False )
979+ class unit_exceed (UnitController ):
980+ async def do_task (self , client : pcrclient ):
981+ self .client = client
982+ unit_list = self .get_config ("unit_exceed_units" )
983+ ignore_memory = self .get_config ("unit_exceed_ignore_memory" )
984+ minimum_mana_keep = self .get_config ("unit_exceed_mana_keep" )
985+
986+ for unit_id in unit_list :
987+ self .unit_id = int (unit_id )
988+ if self .unit_id not in self .client .data .unit :
989+ self ._warn (f"未解锁角色{ self .unit_name } " )
990+ continue
991+
992+ if self .unit .exceed_stage :
993+ self ._warn (f"{ self .unit_name } 已突破,无需突破" )
994+ continue
995+
996+ if self .unit .unit_rarity < 5 :
997+ self ._warn (f"{ self .unit_name } 不是5星角色,无法突破" )
998+ continue
999+
1000+ client = self .client
1001+ token = (eInventoryType .Item , self .memory_id )
1002+ all_memory_demand = client .data .get_unit_memory_demand (self .unit_id )
1003+ exceed_memory_demand = db .exceed_level_unit_required [unit_id ].consume_num_1
1004+ exceed_mana_demand = db .exceed_level_unit_required [unit_id ].consume_num_2
1005+ memory_inventory = client .data .get_inventory (token )
1006+ all_memory_gap = all_memory_demand - memory_inventory
1007+
1008+ if not ignore_memory and all_memory_gap > 0 :
1009+ self ._warn (
1010+ f"{ self .unit_name } 记忆碎片总需求{ all_memory_demand } ,库存{ memory_inventory } ,不满足突破条件"
1011+ )
1012+ continue
1013+
1014+ if exceed_memory_demand > memory_inventory :
1015+ self ._warn (
1016+ f"{ self .unit_name } 突破所需记忆碎片{ exceed_memory_demand } ,库存{ memory_inventory } ,不满足突破条件"
1017+ )
1018+ continue
1019+
1020+ mana_keep = self .client .data .get_mana (include_bank = True )
1021+ if (mana_keep - exceed_mana_demand ) < minimum_mana_keep * 100000000 :
1022+ raise AbortError (
1023+ f"{ self .unit_name } 突破所需Mana{ exceed_mana_demand / self .E } 亿,"
1024+ f"当前Mana{ round (mana_keep / self .E , 2 )} 亿,"
1025+ f"设置的保留Mana下限{ minimum_mana_keep } 亿,不满足突破条件"
1026+ )
1027+
1028+ await self .client .prepare_mana (exceed_mana_demand )
1029+
1030+ await client .unit_exceed_level_limit (
1031+ unit_id = self .unit_id ,
1032+ exceed_stage = 1 ,
1033+ cost_item_list = [
1034+ InventoryInfoPost (
1035+ type = db .zmana [0 ], id = db .zmana [1 ], count = exceed_mana_demand
1036+ ),
1037+ InventoryInfoPost (
1038+ type = token [0 ], id = token [1 ], count = exceed_memory_demand
1039+ ),
1040+ ],
1041+ )
1042+ self ._log (f"{ self .unit_name } 突破成功" )
0 commit comments