-
Notifications
You must be signed in to change notification settings - Fork 833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opt: add emotion control for GemsFarming #3649
base: dev
Are you sure you want to change the base?
Conversation
abc91da
to
845feee
Compare
d112f3d
to
4742357
Compare
scanner = ShipScanner(level=(max_level, max_level), emotion=(10, 150), | ||
fleet=self.fleet_to_attack, status='free') | ||
scanner = ShipScanner(level=(max_level, max_level), emotion=(self.emotion_lower_bound, 150), | ||
fleet=[0, self.fleet_to_attack], status='free') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里这么改是为了将两次scan减少为一次,不知道是否有必要
@@ -174,6 +261,10 @@ def _ship_change_confirm(self, button): | |||
self.dock_sort_method_dsc_set() | |||
self.dock_select_confirm(check_button=page_fleet.check_button) | |||
|
|||
@property | |||
def emotion_lower_bound(self): | |||
return 3 + EMOTION_LIMIT + self.campaign._map_battle * 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里+3是为了防止心情计算值比显示值低,导致更换过程不换船之后再打一把又换,浪费时间
我测下来心情计算值相比显示值(或者说真实值?)的差别在[-2, 2]内,理论应该是[-3, 2],因为我观察到有一次reduce的更新是118-119-117,而显示值是118(118-116-118)
@@ -20,6 +24,79 @@ | |||
from module.ui.page import page_fleet | |||
|
|||
SIM_VALUE = 0.92 | |||
EMOTION_LIMIT = 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+2是处理像2-4这种经常需要多打一战的情况
有个问题,心情每六分钟更新一次是解包得到的还是观察得到的?我有时候观察到后宅的心情在57,03,09而不是54,00, 06更新,不知道是因为显示有误还是什么原因? |
module/campaign/gems_farming.py
Outdated
class GemsEmotion(Emotion): | ||
|
||
def __init__(self, config, fleet_index): | ||
self.config = config | ||
self.fleet_index = fleet_index - 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要完全复用 Emotion 类,不要复写
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
起码要重载这几个:
FleetEmotion.update
:(1级后排)不放后宅心情介于119-150的计算Emotion.check_reduce
:不delay task,且ScriptEnd
在CampaignRun.run
中被捕获Emotion.wait
:计算错了导致红脸不要等待直接撤退
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LmeSzinc 这里不重载Emotion.check_reduce的话要怎么捕获呢,CampaignRun.run已经把ScriptError的错误给catch走了
ship = self.get_common_rarity_dd() | ||
if ship: | ||
self._ship_change_confirm(max(ship, key=lambda s: s.emotion).button) | ||
ships = self.get_common_rarity_dd() | ||
if ships: | ||
ship = max(ships, key=lambda s: s.emotion) | ||
self._new_emotion_value = min(ship.emotion, self._new_emotion_value) | ||
self._ship_change_confirm(ship.button) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
换完船就写入配置文件
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我想了一下,可能还是前后排都换完再写比较好(原本实现也存在问题)。考虑这样的情况:后排更换成功但前排更换失败,任务将会推迟,再次进行时不会先换船而是直接出击,应使用旧的心情值
327c53e
to
6f29e9e
Compare
6f29e9e
to
501dcd4
Compare
501dcd4
to
8d993a8
Compare
8d993a8
to
d1b488e
Compare
给紧急委托加上心情控制,减少因红脸弹窗导致的撤退。在GUI上不会新增任何选项。
补充:#3610