Skip to content
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

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

Air111
Copy link
Contributor

@Air111 Air111 commented Apr 16, 2024

给紧急委托加上心情控制,减少因红脸弹窗导致的撤退。在GUI上不会新增任何选项。

补充:#3610

@Air111 Air111 marked this pull request as draft April 16, 2024 18:56
@Air111 Air111 marked this pull request as ready for review April 17, 2024 05:44
@Air111 Air111 force-pushed the gems_farming_emotion branch 3 times, most recently from abc91da to 845feee Compare April 17, 2024 08:51
@Air111 Air111 marked this pull request as draft April 17, 2024 13:16
@Air111 Air111 marked this pull request as ready for review April 17, 2024 14:13
@Air111 Air111 marked this pull request as draft April 19, 2024 16:46
@Air111 Air111 force-pushed the gems_farming_emotion branch 2 times, most recently from d112f3d to 4742357 Compare April 23, 2024 12:39
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')
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+2是处理像2-4这种经常需要多打一战的情况

@Air111
Copy link
Contributor Author

Air111 commented Apr 23, 2024

有个问题,心情每六分钟更新一次是解包得到的还是观察得到的?我有时候观察到后宅的心情在57,03,09而不是54,00, 06更新,不知道是因为显示有误还是什么原因?

@Air111 Air111 marked this pull request as ready for review April 23, 2024 13:35
Comment on lines 51 to 55
class GemsEmotion(Emotion):

def __init__(self, config, fleet_index):
self.config = config
self.fleet_index = fleet_index - 1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要完全复用 Emotion 类,不要复写

Copy link
Contributor Author

@Air111 Air111 May 18, 2024

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,且ScriptEndCampaignRun.run中被捕获
  • Emotion.wait:计算错了导致红脸不要等待直接撤退

Copy link
Contributor

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走了

Comment on lines -355 to +429
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)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

换完船就写入配置文件

Copy link
Contributor Author

@Air111 Air111 May 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我想了一下,可能还是前后排都换完再写比较好(原本实现也存在问题)。考虑这样的情况:后排更换成功但前排更换失败,任务将会推迟,再次进行时不会先换船而是直接出击,应使用旧的心情值

@Air111 Air111 force-pushed the gems_farming_emotion branch 2 times, most recently from 327c53e to 6f29e9e Compare May 26, 2024 10:08
@Air111
Copy link
Contributor Author

Air111 commented Jun 3, 2024

如何隐藏选项又不被覆盖又不使用type: stored(与仪表盘冲突)?能不能加个type叫saved之类的,或者允许我把心情设置中的心情值显示出来?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants