Skip to content

Commit c148b00

Browse files
committed
Merge pull request #34 from codebroken/beta
Beta
2 parents 5aed785 + 7467660 commit c148b00

8 files changed

Lines changed: 43 additions & 25 deletions

File tree

BrokenBot.au3

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
#pragma compile(Icon, "BrokenBot.org\images\icons\brokenbot.ico")
44
#pragma compile(FileDescription, BrokenBot.org - Clash of Clans Bot)
55
#pragma compile(ProductName, BrokenBot.org - Clash of Clans Bot)
6-
#pragma compile(ProductVersion, 2.5.8)
7-
#pragma compile(FileVersion, 2.5.8)
6+
#pragma compile(ProductVersion, 2.6.0)
7+
#pragma compile(FileVersion, 2.6.0)
88

99
#include <GUIConstants.au3>
1010

11-
$sBotVersion = "2.5.8"
11+
$sBotVersion = "2.6.0"
1212
$sBotTitle = "BrokenBot.org - Break FREE - v" & $sBotVersion
1313

1414
If FileExists (@ScriptDir & "\.developer") Then

BrokenBot.exe

0 Bytes
Binary file not shown.

COCBot/functions/Other/RedLineDeploy.au3

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,13 @@ Func RedLineDeploy($x, $y, $times = 1, $speed = 0, $CenteredOn = 1, $BufferDist
148148
EndIf
149149
If $times <> 1 Then
150150
For $i = 0 To ($times - 1)
151-
ControlClick($Title, "", "", "left", "1", $AimX, $AimY)
151+
ControlClick($Title, "", "", "left", "1", Random($AimX-2, $AimX +2, 1), Random($AimY-2, $AimY +2, 1))
152152
_GDIPlus_GraphicsDrawEllipse($Buffer, $AimX - 2, $AimY - 2, 4, 4, $Pen)
153-
If _Sleep($speed, False) Then ExitLoop
153+
If _Sleep(Standard_SetSleep(0), False) Then Return
154154
Next
155155
Else
156156
ControlClick($Title, "", "", "left", "1", $AimX, $AimY)
157+
If _Sleep(Standard_SetSleep(0), False) Then Return
157158
_GDIPlus_GraphicsDrawEllipse($Buffer, $AimX - 2, $AimY - 2, 4, 4, $Pen)
158159
EndIf
159160
EndFunc ;==>RedLineDeploy

COCBot/functions/Strategies/Standard/Attack.au3

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
Func Standard_SetSleep($type)
55
Switch $type
66
Case 0
7-
$delay = ($icmbUnitDelay + 1) * 20
7+
$delay = ($icmbUnitDelay + 1) * 5 ;Random Gaussian is always positive, compensate for that
88
$delay = _Random_Gaussian($delay, $delay/3.1)
99
Case 1
10-
$delay = ($icmbWaveDelay + 1) * 200
10+
$delay = ($icmbWaveDelay + 1) * 50
1111
$delay = _Random_Gaussian($delay, $delay/3.1)
1212
EndSwitch
13-
If $delay < 20 Then $delay = 20
13+
If $delay < 1 Then $delay = 1
1414
Return $delay
1515
EndFunc ;==>Standard_SetSleep
1616

@@ -29,6 +29,7 @@ Func Standard_DropOnEdge($troop, $edge, $number, $slotsPerEdge = 0, $edge2 = -1,
2929
$BufferDist = GUICtrlRead($sldAcc) + 10
3030
$BufferDist = $BufferDist + _Random_Gaussian(20, 8)
3131
If $BufferDist < (GUICtrlRead($sldAcc) + 10) Then $BufferDist = GUICtrlRead($sldAcc) + 10
32+
$htimer = TimerInit()
3233
Switch $troop
3334
Case $eBarbarian
3435
$Pen = $pBarbarian
@@ -42,9 +43,8 @@ Func Standard_DropOnEdge($troop, $edge, $number, $slotsPerEdge = 0, $edge2 = -1,
4243
$Pen = $pWallB
4344
EndSwitch
4445
If $number = 0 Then Return
45-
If _Sleep(100) Then Return
4646
SelectDropTroupe($troop) ;Select Troop
47-
If _Sleep(200) Then Return
47+
If _Sleep(100) Then Return
4848
If $slotsPerEdge = 0 Or $number < $slotsPerEdge Then $slotsPerEdge = $number
4949
If $number = 1 Or $slotsPerEdge = 1 Then ; Drop on a random point per edge => centered on the middle
5050
$Clickx = Round(_Random_Gaussian(((($Edge[4][0]-$Edge[0][0])/2)+$Edge[0][0]), (($Edge[4][0]-$Edge[0][0])/7)))
@@ -61,7 +61,9 @@ Func Standard_DropOnEdge($troop, $edge, $number, $slotsPerEdge = 0, $edge2 = -1,
6161
$Clickx = Round(_Random_Gaussian(((($Edge[4][0]-$Edge[0][0])/3)+$Edge[0][0]), (($Edge[4][0]-$Edge[0][0])/10)))
6262
$Clicky = Round((($Edge[4][1] - $Edge[0][1]) / ($Edge[4][0] - $Edge[0][0])) * ($Clickx - $Edge[0][0])) + $Edge[0][1]
6363
Click($Clickx, $Clicky, $half, 0, $Center, $BufferDist)
64-
If _Sleep(Standard_SetSleep(0)) Then Return
64+
If GUICtrlRead($sldAcc) < 100 Then
65+
If _Sleep(Standard_SetSleep(0)) Then Return
66+
EndIf
6567
$Clickx = Round(_Random_Gaussian(((($Edge[4][0]-$Edge[0][0])*2/3)+$Edge[0][0]), (($Edge[4][0]-$Edge[0][0])/10)))
6668
$Clicky = Round((($Edge[4][1] - $Edge[0][1]) / ($Edge[4][0] - $Edge[0][0])) * ($Clickx - $Edge[0][0])) + $Edge[0][1]
6769
Click($Clickx, $Clicky, $number - $half, 0, $Center, $BufferDist)
@@ -70,12 +72,18 @@ Func Standard_DropOnEdge($troop, $edge, $number, $slotsPerEdge = 0, $edge2 = -1,
7072
$Clickx = Round(_Random_Gaussian(((($Edge2[4][0]-$Edge2[0][0])/3)+$Edge2[0][0]), (($Edge2[4][0]-$Edge2[0][0])/10)))
7173
$Clicky = Round((($Edge2[4][1] - $Edge2[0][1]) / ($Edge2[4][0] - $Edge2[0][0])) * ($Clickx - $Edge2[0][0])) + $Edge2[0][1]
7274
Click($Clickx, $Clicky, $half, 0, $Center, $BufferDist)
73-
If _Sleep(Standard_SetSleep(0)) Then Return
75+
If GUICtrlRead($sldAcc) < 100 Then
76+
If _Sleep(Standard_SetSleep(0)) Then Return
77+
EndIf
7478
$Clickx = Round(_Random_Gaussian(((($Edge2[4][0]-$Edge2[0][0])*2/3)+$Edge2[0][0]), (($Edge2[4][0]-$Edge2[0][0])/10)))
7579
$Clicky = Round((($Edge2[4][1] - $Edge2[0][1]) / ($Edge2[4][0] - $Edge2[0][0])) * ($Clickx - $Edge2[0][0])) + $Edge2[0][1]
7680
Click($Clickx, $Clicky, $number - $half, 0, $Center, $BufferDist)
7781
EndIf
7882
Else
83+
If ($slotsPerEdge = $number) And ($slotsPerEdge > 10) Then
84+
$slotsPerEdge = Int($number/Random(1.8, 2.8))
85+
If $slotsPerEdge < 9 then $slotsPerEdge = Random(9, 11, 1)
86+
EndIf
7987
Local $minX = $edge[0][0]
8088
Local $maxX = $edge[4][0]
8189
Local $minY = $edge[0][1]
@@ -88,11 +96,7 @@ Func Standard_DropOnEdge($troop, $edge, $number, $slotsPerEdge = 0, $edge2 = -1,
8896
EndIf
8997
Local $nbTroopsGoneDec = 0
9098
Local $nbTroopsGoneRound = 0
91-
If $edge2 <> -1 Then
92-
Local $nbtroopPerRound = $number / ($slotsPerEdge * 2)
93-
Else
94-
Local $nbTroopPerRound = $number / $slotsPerEdge
95-
EndIf
99+
Local $nbTroopPerRound = $number / $slotsPerEdge
96100
For $i = 0 To $slotsPerEdge - 1
97101
$nbTroopsGoneDec += $nbTroopPerRound
98102
Local $posX = $minX + (($maxX - $minX) * $i) / ($slotsPerEdge - 1)
@@ -101,11 +105,17 @@ Func Standard_DropOnEdge($troop, $edge, $number, $slotsPerEdge = 0, $edge2 = -1,
101105
$posX = Round(_Random_Gaussian($posX, 3))
102106
$posY = Round(_Random_Gaussian($posY, 3))
103107
Click($posX, $posY, Ceiling($nbTroopsGoneDec - $nbTroopsGoneRound), 0, $Center, $BufferDist)
108+
SetLog(TimerDiff($htimer))
104109
$nbTroopsGoneRound += Ceiling($nbTroopsGoneDec - $nbTroopsGoneRound)
105-
If _Sleep(Standard_SetSleep(0)) Then Return
110+
If GUICtrlRead($sldAcc) < 100 Then
111+
If _Sleep(Standard_SetSleep(0)) Then Return
112+
EndIf
106113
Next
107114
If $edge2 <> -1 Then
108115
If _Sleep(Standard_SetSleep(1)) Then Return
116+
Local $nbTroopsGoneDec = 0
117+
Local $nbTroopsGoneRound = 0
118+
Local $nbTroopPerRound = $number / $slotsPerEdge
109119
For $i = 0 To $slotsPerEdge - 1
110120
$nbTroopsGoneDec += $nbTroopPerRound
111121
Local $posX2 = $maxX2 - (($maxX2 - $minX2) * $i) / ($slotsPerEdge - 1)
@@ -114,8 +124,11 @@ Func Standard_DropOnEdge($troop, $edge, $number, $slotsPerEdge = 0, $edge2 = -1,
114124
$posX2 = Round(_Random_Gaussian($posX2, 3))
115125
$posY2 = Round(_Random_Gaussian($posY2, 3))
116126
Click($posX2, $posY2, Ceiling($nbTroopsGoneDec - $nbTroopsGoneRound), 0, $Center, $BufferDist)
127+
SetLog(TimerDiff($htimer))
117128
$nbTroopsGoneRound += Ceiling($nbTroopsGoneDec - $nbTroopsGoneRound)
118-
If _Sleep(Standard_SetSleep(0)) Then Return
129+
If GUICtrlRead($sldAcc) < 100 Then
130+
If _Sleep(Standard_SetSleep(0)) Then Return
131+
EndIf
119132
Next
120133
EndIf
121134
EndIf
@@ -598,13 +611,13 @@ Func Standard_Attack($AttackMethod = 1)
598611
If $KingWasHere Then
599612
If GUICtrlRead($txtKingSkill) = 0 Then
600613
_CaptureRegion()
601-
If checkHealth($King) Or (TimerDiff($hHeroTimer) / 1000) > 60 Then
614+
If (checkHealth($King) Or (TimerDiff($hHeroTimer) / 1000) > 60) And Not $KingGone Then
602615
SetLog(GetLangText("msgActivateKing"), $COLOR_AQUA)
603616
SelectDropTroupe($King)
604617
$KingGone = True
605618
EndIf
606619
Else
607-
If (TimerDiff($hHeroTimer) / 1000) > Number(GUICtrlRead($txtKingSkill)) Then
620+
If ((TimerDiff($hHeroTimer) / 1000) > Number(GUICtrlRead($txtKingSkill))) And Not $KingGone Then
608621
SetLog(GetLangText("msgActivateKing"), $COLOR_BLUE)
609622
SelectDropTroupe($King)
610623
$KingGone = True
@@ -614,13 +627,13 @@ Func Standard_Attack($AttackMethod = 1)
614627
If $QueenWasHere Then
615628
If GUICtrlRead($txtQueenSkill) = 0 Then
616629
_CaptureRegion()
617-
If checkHealth($Queen) Or (TimerDiff($hHeroTimer) / 1000) > 60 Then
630+
If (checkHealth($Queen) Or (TimerDiff($hHeroTimer) / 1000) > 60) And Not $QueenGone Then
618631
SetLog(GetLangText("msgActivateQueen"), $COLOR_AQUA)
619632
SelectDropTroupe($Queen)
620633
$QueenGone = True
621634
EndIf
622635
Else
623-
If (TimerDiff($hHeroTimer) / 1000) > Number(GUICtrlRead($txtQueenSkill)) Then
636+
If ((TimerDiff($hHeroTimer) / 1000) > Number(GUICtrlRead($txtQueenSkill))) And Not $QueenGone Then
624637
SetLog(GetLangText("msgActivateQueen"), $COLOR_BLUE)
625638
SelectDropTroupe($Queen)
626639
$QueenGone = True

COCBot/functions/Strategies/Standard/ReadyCheck.au3

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Func Standard_ReadyCheck($TimeSinceNewTroop)
55
$FirstStart = True
66
SetLog(GetLangText("msgAppearsStuck"))
77
$stuckCount +=1
8-
ElseIf $stuckCount = 3
8+
ElseIf $stuckCount = 3 Then
99
SetLog(GetLangText("msgSevereStuck"))
1010
$stuckCount += 1
1111
EndIf

COCBot/functions/Village/MainLoop.au3

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ Func Idle($Plugin) ;Sequence that runs until Full Army
122122
$prevCamp = $CurCamp
123123
$hTroopTimer = TimerInit()
124124
EndIf
125+
If $CurCamp = 0 or $CurCamp = "" Then $hTroopTimer = TimerInit() ; Not a good fix, but will stop errors for people whose troop size can't be read for now
125126
$TimeSinceTroop = TimerDiff($hTroopTimer) / 1000
126127
SetLog(GetLangText("msgTimeIdle") & Floor(Floor($TimeIdle / 60) / 60) & GetLangText("msgTimeIdleHours")& Floor(Mod(Floor($TimeIdle / 60), 60)) & GetLangText("msgTimeIdleMin") & Floor(Mod($TimeIdle, 60)) & GetLangText("msgTimeIdleSec"), $COLOR_ORANGE)
127128
If _Sleep(30000) Then ExitLoop

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# BrokenBot.org - Clash of Clans Bot
2-
Latest version: 2.5.9
2+
Latest version: 2.6.0
33

44
## Community
55
Forums available for discussion at: http://brokenbot.org/

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Change Log:
22

3+
### v2.6.0
4+
* Much faster troop deployment. Might not want to do 1/1 anymore
5+
* Temporary fix for those whose camp numbers can't be read. Unfortunately this may reintroduce a problem where training gets stuck for those people. If you have this issue please temporarily use barracks training mode until this can be fully fixed.
36
### v2.5.9
47
* Emergency fix for occasional crash
58

0 commit comments

Comments
 (0)