Merge pull request #361 from Schwarze-Katze/master

Add feature of material farming in task RogueWorld
This commit is contained in:
LmeSzinc 2024-04-14 21:42:29 +08:00 committed by GitHub
commit 6c56f5e286
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 121 additions and 6 deletions

View File

@ -199,7 +199,9 @@
"DomainStrategy": "combat",
"UseImmersifier": true,
"DoubleEvent": true,
"UseStamina": false
"UseStamina": false,
"WeeklyFarming": false,
"SimulatedUniverseElite": {}
},
"RogueBlessing": {
"PresetBlessingFilter": "preset",

View File

@ -1470,6 +1470,16 @@
"UseStamina": {
"type": "checkbox",
"value": false
},
"WeeklyFarming": {
"type": "checkbox",
"value": false
},
"SimulatedUniverseElite": {
"type": "stored",
"value": {},
"display": "hide",
"stored": "StoredSimulatedUniverseElite"
}
},
"RogueBlessing": {

View File

@ -258,6 +258,9 @@ RogueWorld:
UseImmersifier: true
DoubleEvent: true
UseStamina: false
WeeklyFarming: false
SimulatedUniverseElite:
stored: StoredSimulatedUniverseElite
RogueBlessing:
PresetBlessingFilter:

View File

@ -293,5 +293,18 @@
},
"order": 0,
"color": "#777777"
},
"SimulatedUniverseElite": {
"name": "SimulatedUniverseElite",
"path": "Rogue.RogueWorld.SimulatedUniverseElite",
"i18n": "RogueWorld.SimulatedUniverseElite.name",
"stored": "StoredSimulatedUniverseElite",
"attrs": {
"time": "2020-01-01 00:00:00",
"total": 0,
"value": 100
},
"order": 0,
"color": "#777777"
}
}

View File

@ -139,6 +139,8 @@ class GeneratedConfig:
RogueWorld_UseImmersifier = True
RogueWorld_DoubleEvent = True
RogueWorld_UseStamina = False
RogueWorld_WeeklyFarming = False
RogueWorld_SimulatedUniverseElite = {}
# Group `RogueBlessing`
RogueBlessing_PresetBlessingFilter = 'preset' # preset, custom

View File

@ -973,6 +973,14 @@
"UseStamina": {
"name": "Farm Planers Using Trailblase Power",
"help": "Task \"Dungeon\" will no longer run, and all trailblaze power will be used first to claim immersion rewards, except for double events."
},
"WeeklyFarming": {
"name": "Boss Material Farming",
"help": "Do not stop after point reward is full; farm the boss 100 times instead to obtain trace materials"
},
"SimulatedUniverseElite": {
"name": "RogueWorld.SimulatedUniverseElite.name",
"help": "RogueWorld.SimulatedUniverseElite.help"
}
},
"RogueBlessing": {

View File

@ -973,6 +973,14 @@
"UseStamina": {
"name": "Reclamar de planers mediante poder trazacaminos",
"help": "La tarea de mazmorra ya no se ejecutará y todo el poder trazacaminos se usará primero para reclamar recompensas de inmersión, excepto para eventos dobles"
},
"WeeklyFarming": {
"name": "Recolección de Materiales de Jefes",
"help": "No detenerse después de que los puntos semanales estén llenos, farmear al jefe 100 veces para obtener materiales de rastro"
},
"SimulatedUniverseElite": {
"name": "RogueWorld.SimulatedUniverseElite.name",
"help": "RogueWorld.SimulatedUniverseElite.help"
}
},
"RogueBlessing": {

View File

@ -973,6 +973,14 @@
"UseStamina": {
"name": "RogueWorld.UseStamina.name",
"help": "RogueWorld.UseStamina.help"
},
"WeeklyFarming": {
"name": "ボス素材を収集",
"help": "週間ポイントが満点に達しても停止せず、100回のボスをファームして軌跡素材を入手"
},
"SimulatedUniverseElite": {
"name": "RogueWorld.SimulatedUniverseElite.name",
"help": "RogueWorld.SimulatedUniverseElite.help"
}
},
"RogueBlessing": {

View File

@ -973,6 +973,14 @@
"UseStamina": {
"name": "使用开拓力刷内圈遗器",
"help": "每日副本任务将不再打本,所有开拓力将优先被用于领取浸器奖励,双倍活动时除外"
},
"WeeklyFarming": {
"name": "刷取Boss材料",
"help": "每周积分满后不停止刷取100次Boss以获取形迹材料"
},
"SimulatedUniverseElite": {
"name": "剩余Boss材料掉落次数",
"help": "RogueWorld.SimulatedUniverseElite.help"
}
},
"RogueBlessing": {

View File

@ -973,6 +973,14 @@
"UseStamina": {
"name": "用開拓力農遺器",
"help": "每日副本任務將不再打本,所有開拓力將優先被用於領取浸器獎勵,雙倍活動時除外"
},
"WeeklyFarming": {
"name": "刷取Boss材料",
"help": "每週積分滿後不停止刷取100次Boss以獲取形跡材料"
},
"SimulatedUniverseElite": {
"name": "RogueWorld.SimulatedUniverseElite.name",
"help": "RogueWorld.SimulatedUniverseElite.help"
}
},
"RogueBlessing": {

View File

@ -208,6 +208,30 @@ class StoredSimulatedUniverse(StoredCounter, StoredExpiredAtMonday0400):
pass
class StoredSimulatedUniverseElite(StoredCounter, StoredExpiredAtMonday0400):
# These variables are used in Rogue Farming feature.
# Times of boss drop chance per week. In current version of StarRail, this value is 100.
FIXED_DEFAULT = 100
# Times left to farm. Resets to 100 every Monday 04:00, and decreases each time the elite boss is cleared.
value = FIXED_DEFAULT
def farm_dec(self, delta = 1):
self.value -= delta
if self.value < 0:
self.value = 0
def farm_reset(self):
self.value = self.FIXED_DEFAULT
def farm_not_complete(self) -> bool:
return self.value > 0
def farm_get_remain(self) -> int:
return self.value
class StoredAssignment(StoredCounter):
pass

View File

@ -20,6 +20,7 @@ from module.config.stored.classes import (
StoredImmersifier,
StoredInt,
StoredSimulatedUniverse,
StoredSimulatedUniverseElite,
StoredTrailblazePower,
)
@ -50,3 +51,4 @@ class StoredGenerated:
Assignment = StoredAssignment("Assignment.Assignment.Assignment")
Credit = StoredInt("DataUpdate.ItemStorage.Credit")
StallerJade = StoredInt("DataUpdate.ItemStorage.StallerJade")
SimulatedUniverseElite = StoredSimulatedUniverseElite("Rogue.RogueWorld.SimulatedUniverseElite")

View File

@ -386,7 +386,7 @@ class MapControl(Combat, AimDetectorMixin):
end_point = waypoints[-1]
end_point.expected_end.append('item')
self.goto(*waypoints)
return self.goto(*waypoints)
def clear_enemy(self, *waypoints):
"""
@ -403,7 +403,7 @@ class MapControl(Combat, AimDetectorMixin):
end_point = waypoints[-1]
end_point.expected_end.append('enemy')
self.goto(*waypoints)
return self.goto(*waypoints)
if __name__ == '__main__':

View File

@ -332,7 +332,8 @@ class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonUI):
"""
logger.info(f'RogueWorld_UseImmersifier={self.config.RogueWorld_UseImmersifier}, '
f'RogueWorld_UseStamina={self.config.RogueWorld_UseStamina}, '
f'RogueWorld_DoubleEvent={self.config.RogueWorld_DoubleEvent}'
f'RogueWorld_DoubleEvent={self.config.RogueWorld_DoubleEvent}, '
f'RogueWorld_WeeklyFarming={self.config.RogueWorld_WeeklyFarming}, '
f'RogueDebug_DebugMode={self.config.RogueDebug_DebugMode}')
# This shouldn't happen
if self.config.RogueWorld_UseStamina and not self.config.RogueWorld_UseImmersifier:
@ -345,13 +346,23 @@ class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonUI):
if self.config.RogueDebug_DebugMode:
# Always run
return
if self.config.stored.SimulatedUniverseElite.is_expired():
# Expired, reset farming counter
self.config.stored.SimulatedUniverseElite.farm_reset()
if self.config.stored.SimulatedUniverse.is_expired():
# Expired, do rogue
pass
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')
logger.info(
'Reached weekly point limit but still have immersifiers left, continue to use them')
elif self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverseElite.farm_not_complete():
logger.info(
'Reached weekly point limit but still continue to farm materials')
logger.attr(
"Farming Counter", self.config.stored.SimulatedUniverseElite.farm_get_remain())
else:
raise RogueReachedWeeklyPointLimit
else:

View File

@ -170,6 +170,14 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent, RogueReward):
pass
result = super().clear_enemy(*waypoints)
# logger.attr("result",result)
if 'enemy' in result:
# runs when one elite battle finishes, and decreases rogue farming count by 1
if self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverseElite.farm_not_complete():
self.config.stored.SimulatedUniverseElite.farm_dec()
logger.info(
f"Cleared elite boss, decreasing farming count by 1, now {self.config.stored.SimulatedUniverseElite.farm_get_remain()}")
return result
def _domain_event_expected_end(self):