mrmin123 / kancolle-auto

Kantai Collection (Kancolle) bot/automation tool - DEPERECATED - see kcauto-kai:
https://github.com/mrmin123/kcauto-kai
54 stars 22 forks source link

Script continuing to next node even with critical damage (resolved; please upgrade!) #322

Closed waicool20 closed 7 years ago

waicool20 commented 7 years ago

Environment details

Issue

Ok so good thing I noticed this before any girls sunk, but the script is continuing the sortie even when it detects a critically damaged ship.

Console log

[2017-02-25 20:29:14] Spinning compass!
[log] CLICK on L(781,264)@S(0)[0,0 1920x1080] (522 msec)
[2017-02-25 20:29:24] Selecting fleet formation!
[log] CLICK on L(385,331)@S(0)[0,0 1920x1080] (522 msec)
[2017-02-25 20:30:11] Checking fleet condition...
[2017-02-25 20:30:13] Light damage: 0; moderate damage: 0; critical damage: 1
[log] CLICK on L(717,162)@S(0)[0,0 1920x1080] (522 msec)
[2017-02-25 20:30:21] Continuing on to next node...
[log] CLICK on L(347,331)@S(0)[0,0 1920x1080] (521 msec)
[log] CLICK on L(708,426)@S(0)[0,0 1920x1080] (521 msec)
[2017-02-25 20:30:33] Selecting fleet formation!
[2017-02-25 20:31:48] Declining night battle!
[log] CLICK on L(361,320)@S(0)[0,0 1920x1080] (522 msec)
[log] CLICK on L(307,496)@S(0)[0,0 1920x1080] (522 msec)
[2017-02-25 20:32:03] Checking fleet condition...
[2017-02-25 20:32:05] Light damage: 0; moderate damage: 1; critical damage: 1
[log] CLICK on L(670,207)@S(0)[0,0 1920x1080] (522 msec)
[2017-02-25 20:32:15] Continuing on to next node...
[log] CLICK on L(397,297)@S(0)[0,0 1920x1080] (522 msec)
[log] CLICK on L(642,277)@S(0)[0,0 1920x1080] (521 msec)
[2017-02-25 20:32:26] Selecting fleet formation!
[log] CLICK on L(401,259)@S(0)[0,0 1920x1080] (522 msec)
[2017-02-25 20:33:07] Checking fleet condition...
[2017-02-25 20:33:07] Light damage: 1; moderate damage: 1; critical damage: 1
[log] CLICK on L(671,443)@S(0)[0,0 1920x1080] (521 msec)
[2017-02-25 20:33:15] Continuing on to next node...
[log] CLICK on L(378,335)@S(0)[0,0 1920x1080] (522 msec)
[log] CLICK on L(467,459)@S(0)[0,0 1920x1080] (521 msec)
[2017-02-25 20:33:26] Spinning compass!
[log] CLICK on L(692,422)@S(0)[0,0 1920x1080] (524 msec)
[2017-02-25 20:33:37] Selecting fleet formation!
[log] CLICK on L(664,450)@S(0)[0,0 1920x1080] (522 msec)
[2017-02-25 20:34:43] Checking fleet condition...
[2017-02-25 20:34:43] Light damage: 1; moderate damage: 1; critical damage: 1

Relevant config snippet (if applicable)

[Expeditions]
Enabled = true
Fleet2 = 38
Fleet3 = 2
Fleet4 = 9998

[Combat]
Enabled = true
FleetComp = 1
Area = E
Subarea = 1-1
CombinedFleet = false
Nodes = 5
NodeSelects = 
Formations = diamond, line_abreast, double_line, line_abreast
NightBattles = false, false, true, true
RetreatLimit = 2
RepairLimit = 0
RepairTimeLimit = 0100
CheckFatigue = true
PortCheck = true
MedalStop = false
LastNodePush = true

[LBAS]
Enabled = true
EnabledGroups = 1
Group1Nodes = _node_lbas_E-1-B_1, _node_lbas_E-1-I_1_cleared
Group2Nodes = 
Group3Nodes = 
waicool20 commented 7 years ago

I found the related code snippet, lines 310-318 in combat.py:

                if self.count_damage_above_limit('retreat') > 0 or self.damage_counts[2] > 0:
                    if self.last_node_push:
                        # Unless the PushLastNode flag is set, then push!
                        pass
                    else:
                        log_warning("Ship(s) in condition at or below retreat threshold! Ceasing sortie!")
                        wait_and_click(self.kc_region, 'combat_retreat.png', 30)
                        sortie_underway = False
                        return (continue_combat, True)

Basically I believe if self.last_node_push: needs an extra check to see if it really is the last node, otherwise retreat.

So as you can see the script saw that the ship was critically damage for the first 3 nodes!!!! (That's some damn RNG I must say, lucky ship) But since last_node_push was enabled, the script continued, even though it wasn't actually the last node.

mrmin123 commented 7 years ago

Ooh that's a bad one...

mrmin123 commented 7 years ago

Should have been resolved as of ef2f095. I also made it that even if by mistake (user or otherwise) the script pushes into a combat node, it won't push any further.

Leaving open for a bit for visibility.

Thanks for the report @waicool20