Skip to content

Commit

Permalink
#184 取消临时变量保存配置
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorReid committed Feb 25, 2024
1 parent 1071d25 commit ee0d554
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/sr/app/trailblaze_power/trailblaze_power_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def __init__(self, ctx: Context):
self.power: Optional[int] = None # 剩余开拓力
self.qty: Optional[int] = None # 沉浸器数量
self.last_challenge_point: Optional[SurvivalIndexMission] = None
self.config = ctx.tp_config

def _init_before_execute(self):
super()._init_before_execute()
Expand All @@ -77,8 +76,8 @@ def _check_task(self) -> OperationOneRoundResult:
判断下一个是什么副本
:return:
"""
self.config.check_plan_finished()
plan: Optional[TrailblazePowerPlanItem] = self.config.next_plan_item
self.ctx.tp_config.check_plan_finished()
plan: Optional[TrailblazePowerPlanItem] = self.ctx.tp_config.next_plan_item

if plan is None:
return Operation.round_success()
Expand Down Expand Up @@ -117,7 +116,7 @@ def _challenge_normal_task(self) -> OperationOneRoundResult:
挑战普通副本
:return:
"""
plan: Optional[TrailblazePowerPlanItem] = self.config.next_plan_item
plan: Optional[TrailblazePowerPlanItem] = self.ctx.tp_config.next_plan_item
point: Optional[SurvivalIndexMission] = SurvivalIndexMissionEnum.get_by_unique_id(plan['mission_id'])
run_times: int = self.power // point.power
if run_times == 0:
Expand Down Expand Up @@ -146,9 +145,9 @@ def _on_normal_task_success(self, finished_times: int, use_power: int):
"""
log.info('挑战成功 完成次数 %d 使用体力 %d', finished_times, use_power)
self.power -= use_power
plan: Optional[TrailblazePowerPlanItem] = self.config.next_plan_item
plan: Optional[TrailblazePowerPlanItem] = self.ctx.tp_config.next_plan_item
plan['run_times'] += finished_times
self.config.save()
self.ctx.tp_config.save()

def _esc(self) -> OperationOneRoundResult:
op = OpenPhoneMenu(self.ctx)
Expand Down Expand Up @@ -197,7 +196,7 @@ def _get_sim_uni_power_and_qty(self, screen: MatLike) -> Tuple[int, int]:
return power, qty

def _challenge_sim_uni(self) -> OperationOneRoundResult:
plan: Optional[TrailblazePowerPlanItem] = self.config.next_plan_item
plan: Optional[TrailblazePowerPlanItem] = self.ctx.tp_config.next_plan_item
point: Optional[SurvivalIndexMission] = SurvivalIndexMissionEnum.get_by_unique_id(plan['mission_id'])
run_times: int = self.power // point.power + self.qty
if run_times == 0:
Expand All @@ -222,9 +221,9 @@ def _on_sim_uni_get_reward(self, use_power: int, user_qty: int):
:return:
"""
log.info('获取沉浸奖励 使用体力 %d 使用沉浸器 %d', use_power, user_qty)
plan: Optional[TrailblazePowerPlanItem] = self.config.next_plan_item
plan: Optional[TrailblazePowerPlanItem] = self.ctx.tp_config.next_plan_item
plan['run_times'] += 1
self.config.save()
self.ctx.tp_config.save()

self.power -= use_power
self.qty -= user_qty

0 comments on commit ee0d554

Please sign in to comment.