Use stored counter to count boss farming times to run

This commit is contained in:
katze 2024-03-09 15:12:11 +08:00
parent 76c8f9eda6
commit f5bc0d0ce1
13 changed files with 32 additions and 42 deletions

View File

@ -194,8 +194,7 @@
"UseImmersifier": true,
"DoubleEvent": true,
"UseStamina": false,
"WeeklyFarming": false,
"WeeklyFarmingCount": 0
"WeeklyFarming": false
},
"RogueBlessing": {
"PresetBlessingFilter": "preset",

View File

@ -1427,10 +1427,6 @@
"WeeklyFarming": {
"type": "checkbox",
"value": false
},
"WeeklyFarmingCount": {
"type": "input",
"value": 0
}
},
"RogueBlessing": {

View File

@ -238,7 +238,6 @@ RogueWorld:
DoubleEvent: true
UseStamina: false
WeeklyFarming: false
WeeklyFarmingCount: 0
RogueBlessing:
PresetBlessingFilter:

View File

@ -134,7 +134,6 @@ class GeneratedConfig:
RogueWorld_DoubleEvent = True
RogueWorld_UseStamina = False
RogueWorld_WeeklyFarming = False
RogueWorld_WeeklyFarmingCount = 0
# Group `RogueBlessing`
RogueBlessing_PresetBlessingFilter = 'preset' # preset, custom

View File

@ -943,11 +943,7 @@
},
"WeeklyFarming": {
"name": "Boss Material Farming",
"help": "Not stop after point reward is full; farm the boss 33 times (i.e., 11 Simulated Universe) instead to obtain trace materials"
},
"WeeklyFarmingCount": {
"name": "Material Attempts Remaining This Week: X",
"help": "Resets every Monday"
"help": "Do not stop after point reward is full; farm the boss 100 times instead to obtain trace materials"
}
},
"RogueBlessing": {

View File

@ -943,11 +943,7 @@
},
"WeeklyFarming": {
"name": "Recolección de Materiales de Jefes",
"help": "No detenerse después de que los puntos semanales estén llenos, farmear al jefe 33 veces (es decir, 11 simulaciones cósmicas) para obtener materiales de rastro"
},
"WeeklyFarmingCount": {
"name": "Intentos de Material Restantes Esta Semana: X",
"help": "Se reinicia cada lunes"
"help": "No detenerse después de que los puntos semanales estén llenos, farmear al jefe 100 veces para obtener materiales de rastro"
}
},
"RogueBlessing": {

View File

@ -943,11 +943,7 @@
},
"WeeklyFarming": {
"name": "ボス素材を収集",
"help": "週間ポイントが満点に達しても停止せず、33回のボスつまり11回の模擬宇宙を収集して軌跡素材を入手"
},
"WeeklyFarmingCount": {
"name": "今週の素材が残りX回",
"help": "毎週月曜日にリセット"
"help": "週間ポイントが満点に達しても停止せず、100回のボスをファームして軌跡素材を入手"
}
},
"RogueBlessing": {

View File

@ -943,11 +943,7 @@
},
"WeeklyFarming": {
"name": "刷取Boss材料",
"help": "每周积分满后不停止刷取33次Boss即11次模拟宇宙以获取形迹材料"
},
"WeeklyFarmingCount": {
"name": "本周材料剩余X次",
"help": "每周一重置"
"help": "每周积分满后不停止刷取100次Boss以获取形迹材料"
}
},
"RogueBlessing": {

View File

@ -943,11 +943,7 @@
},
"WeeklyFarming": {
"name": "刷取Boss材料",
"help": "每週積分滿後不停止刷取33次Boss即11次模擬宇宙以獲取形跡材料"
},
"WeeklyFarmingCount": {
"name": "本週材料剩餘X次",
"help": "每週一重置"
"help": "每週積分滿後不停止刷取100次Boss以獲取形跡材料"
}
},
"RogueBlessing": {

View File

@ -205,7 +205,20 @@ class StoredImmersifier(StoredCounter):
class StoredSimulatedUniverse(StoredCounter, StoredExpiredAtMonday0400):
pass
FIXED_DEFAULT = 100
FarmingCounter = FIXED_DEFAULT
def farm_dec(self, value=1):
self.FarmingCounter -= value
def farm_reset(self,):
self.FarmingCounter = self.FIXED_DEFAULT
def farm_not_full(self) -> bool:
return self.FarmingCounter > 0
def farm_get_remain(self) -> int:
return self.FarmingCounter
class StoredAssignment(StoredCounter):

View File

@ -348,14 +348,16 @@ class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonUI):
return
if self.config.stored.SimulatedUniverse.is_expired():
# Expired, do rogue and reset weekly farming count
self.config.RogueWorld_WeeklyFarmingCount = 11
# Expired, do rogue and reset farming counter
self.config.stored.SimulatedUniverse.farm_reset()
elif self.config.stored.SimulatedUniverse.is_full():
if self.config.RogueWorld_UseImmersifier and self.config.stored.Immersifier.value > 0:
logger.info(
'Reached weekly point limit but still have immersifiers left, continue to use them')
elif self.config.RogueWorld_WeeklyFarming and self.config.RogueWorld_WeeklyFarmingCount > 0:
elif self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverse.farm_not_full():
logger.attr(
"Farming Counter", self.config.stored.SimulatedUniverse.farm_get_remain())
logger.info(
'Reached weekly point limit but still continue to farm materials')
else:

View File

@ -28,11 +28,6 @@ class Rogue(RouteLoader, RogueEntry):
self.rogue_run()
self.rogue_reward_claim()
# runs when one rogue run finishes (do not handle whether the last rogue run finished or failed due to one who use this feature has less chance of failure -- would be better if check boss battle result instead of rogue result, but this version also works), and decreases rogue farming count by 1
if self.config.RogueWorld_WeeklyFarming and self.config.RogueWorld_WeeklyFarmingCount > 0:
self.config.RogueWorld_WeeklyFarmingCount -= 1
logger.attr("WeeklyFarmingCount",
self.config.RogueWorld_WeeklyFarmingCount)
return True
def run(self):

View File

@ -170,6 +170,13 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent, RogueReward):
pass
result = super().clear_enemy(*waypoints)
# runs when one elite battle finishes (do not handle whether battle succeeded or failed), and decreases rogue farming count by 1
if self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverse.farm_not_full():
self.config.stored.SimulatedUniverse.farm_dec()
logger.info(
f"Cleared elite boss, decrease farming count by 1, now {self.config.stored.SimulatedUniverse.FarmingCounter}")
return result
def _domain_event_expected_end(self):