44Func 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
1515EndFunc ; ==>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
0 commit comments