Autofight 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. # Autofight
  2. if Formula = 0:Formula = 3
  3. $endurdin = {
  4. Ken = (musle[a] / 100) * Kus / 100
  5. if ken <= 0:ken = 1
  6. Kene = (musle[i] / 100) * Kuse / 100
  7. if kene <= 0:kene = 1
  8. KoefUder = rand(Uder * 20 / 100, Uder)
  9. KoefUderE = rand(Udere * 20 / 100, Udere)
  10. KoefBros = rand(Brosok * 20 / 100, Brosok)
  11. KoefBrosE = rand(Brosoke * 20 / 100, Brosoke)
  12. KoefProt = rand(Zash * 20 / 100, Zash)
  13. KoefProtE = rand(Zashe * 20 / 100, Zashe)
  14. }
  15. $uderdin = {
  16. Kus = 5
  17. Kuse = 10
  18. dynamic $endurdin
  19. endur -= ken
  20. endurE -= kene
  21. Aktiv = (strenW / 2) + agilW + rand(0, lustW) + KoefUder
  22. Aktiv = Aktiv * endur / endurMax
  23. Passiv = (((strenWE + (agilWE / 2)) * koefE) / 100) + rand (0, lustWE) + KoefProtE
  24. Passiv = Passiv * endurE / endurMaxE
  25. }
  26. $uderdinE = {
  27. Kus = 10
  28. Kuse = 5
  29. dynamic $endurdin
  30. endur -= ken
  31. endurE -= kene
  32. Aktiv = (strenWE / 2) + agilWE + rand(0, lustWE) + KoefUdere
  33. Aktiv = Aktiv * endurE / endurMaxE
  34. Passiv = (((strenW + (agilW / 2)) * koef) / 100) + rand(0, lustW) + KoefProt
  35. Passiv = Passiv * endur / endurMaxE
  36. }
  37. $brosdin = {
  38. Kus = 10
  39. Kuse = 10
  40. dynamic $endurdin
  41. endur -= ken
  42. endurE -= kene
  43. Aktiv = strenW + (agilW / 2) + rand(0, lustW) + KoefBros
  44. Aktiv = Aktiv * endur / endurMax
  45. Passiv = (((strenWE / 2) + agilWE) * koefE / 100) + rand(0, lustWE) + KoefProtE
  46. Passiv = Passiv * endurE / endurMaxE
  47. }
  48. $brosdinE = {
  49. Kus = 10
  50. Kuse = 10
  51. dynamic $endurdin
  52. endur -= ken
  53. endurE -= kene
  54. Aktiv = strenWE + (agilWE / 2) + rand(0, lustWE) + KoefBrosE
  55. Aktiv = Aktiv * endurE / endurMaxE
  56. Passiv = (((strenW / 2) + agilW) * koef / 100) + rand(0, lustW) + KoefProt
  57. Passiv = Passiv * endur / endurMax
  58. }
  59. point = 0
  60. pointE = 0
  61. $nameE = $nikname[i]
  62. $nameA = $nikname[a]
  63. strenW = musle[a] / 10
  64. strenWE = musle[i] / 10
  65. agilW = flex[a] / 10
  66. agilWE = flex[i] / 10
  67. lustMax = wipo[a]
  68. lustMaxE = wipo[i]
  69. lustW = lustMax
  70. lustWE = lustMaxe
  71. Brosok = Bteh[a] / 10
  72. BrosokE = Bteh[i] / 10
  73. Uder = Uteh[a] / 10
  74. Udere = Uteh[i] / 10
  75. Zash = Zteh[a] / 10
  76. Zashe = Zteh[i] / 10
  77. resultFight = 0
  78. endurMax = stamina[a] / 10
  79. endurMaxE = stamina[i] / 10
  80. endur = endurMax
  81. endurE = endurMaxE
  82. croonce = 0
  83. round = 1
  84. rMin = 8
  85. stoper = 0
  86. Ku = 0
  87. Kb = 0
  88. Kz = 0
  89. KuE =0
  90. KbE= 0
  91. KzE = 0
  92. if strenW > strenWE:
  93. point += 1
  94. lustW += 1
  95. crouch = 1
  96. elseif strenW < strenWE:
  97. pointE += 1
  98. lustWE += 1
  99. crouch = 0
  100. elseif strenW = strenWE:
  101. varrand = rand(0, 1)
  102. if varrand = 0:crouch = 1
  103. if varrand=1:crouch=0
  104. end
  105. :markFightCrouch
  106. stoper = 0
  107. if crouch = 1:
  108. enrand = rand(0, 1)
  109. arand = rand(0, 1)
  110. if arand = 0:
  111. endur -= 2
  112. if enrand = 0:
  113. pointE += 1
  114. jump 'markfight'
  115. elseif enrand = 1:
  116. point += 2
  117. endurE -= 1
  118. jump 'markfight1'
  119. end
  120. elseif arand = 1:
  121. endur -= 1
  122. if enrand = 0:
  123. point += 1
  124. jump 'markfight2'
  125. elseif enrand = 1:
  126. pointE += 1
  127. endurE -= 1
  128. jump 'markfight3'
  129. end
  130. end
  131. else
  132. enrand = rand(0, 1)
  133. arand = rand(0, 1)
  134. if arand = 0:
  135. if enrand = 0:
  136. point += 1
  137. endurE -= 2
  138. jump 'markfightE'
  139. elseif enrand = 1:
  140. pointE += 1
  141. endurE -= 1
  142. jump 'markfightE1'
  143. end
  144. elseif arand = 1:
  145. endur -= 1
  146. if enrand = 0:
  147. pointE += 2
  148. endurE -= 2
  149. jump 'markfightE2'
  150. elseif enrand = 1:
  151. point += 1
  152. endurE -= 1
  153. jump 'markfightE3'
  154. end
  155. end
  156. end
  157. :markfight
  158. koef = 100
  159. koefE = 90
  160. rMin -= 1
  161. stoper += 1
  162. if endur <= 0 or lustW <= 0:jump 'markSubLoss'
  163. if endurE <= 0 or lustWE <= 0:jump 'markSubWin'
  164. if stoper < 3:
  165. if rMin > 0:
  166. arand = rand(0, 1)
  167. if arand = 0:
  168. dynamic $uderdin
  169. if Aktiv > Passiv:
  170. point += 1
  171. Ku += 1
  172. stoper = 0
  173. jump 'markfight2'
  174. elseif Aktiv < Passiv:
  175. pointE += 1
  176. KzE += 1
  177. stoper = 0
  178. jump 'markfight3'
  179. elseif Aktiv = Passiv:
  180. jump 'markfight'
  181. end
  182. elseif arand = 1:
  183. dynamic $brosdin
  184. if Aktiv > Passiv:
  185. point += 2
  186. lustW += 1
  187. Kb += 1
  188. stoper = 0
  189. jump 'markfight1'
  190. elseif Aktiv < Passiv:
  191. pointE += 1
  192. KzE += 1
  193. stoper = 0
  194. jump 'markfight3'
  195. elseif Aktiv = Passiv:
  196. jump 'markfight'
  197. end
  198. end
  199. else
  200. jump 'markRoundEnd'
  201. end
  202. elseif stoper >= 3:
  203. pointE += 1
  204. jump 'markRoundStop'
  205. end
  206. :markfight1
  207. koef = 100
  208. koefE = 85
  209. rMin -= 1
  210. stoper += 1
  211. if endur <= 0 or lustW <= 0:jump 'markSubLoss'
  212. if endurE <= 0 or lustWE <= 0:jump 'markSubWin'
  213. if stoper < 3:
  214. if rMin > 0:
  215. dynamic $uderdin
  216. if Aktiv > Passiv:
  217. point += 1
  218. Ku += 1
  219. stoper = 0
  220. jump 'markfight2'
  221. elseif Aktiv < Passiv:
  222. pointE += 1
  223. KzE += 1
  224. stoper = 0
  225. jump 'markfight3'
  226. elseif Aktiv = Passiv:
  227. jump 'markfight1'
  228. end
  229. else
  230. jump 'markRoundEnd'
  231. end
  232. elseif stoper >= 3:
  233. pointE += 1
  234. jump 'markRoundStop'
  235. end
  236. :markfight2
  237. koef = 100
  238. koefE = 80
  239. lustE -= 1
  240. rMin -= 1
  241. stoper += 1
  242. if endur <= 0 or lustW <= 0:jump 'markSubLoss'
  243. if endurE <= 0 or lustWE <= 0:jump 'markSubWin'
  244. if stoper < 3:
  245. if rMin > 0:
  246. dynamic $uderdin
  247. endurE -= 2
  248. if Aktiv >= Passiv:
  249. point += 1
  250. lustWE -= 1
  251. Ku += 1
  252. jump 'markfight2'
  253. elseif Aktiv < Passiv:
  254. pointE += 1
  255. KzE += 1
  256. stoper = 0
  257. jump 'markfight3'
  258. end
  259. else
  260. jump 'markRoundEnd'
  261. end
  262. elseif stoper >= 3:
  263. point += 3
  264. jump 'markRoundStop'
  265. end
  266. :markfight3
  267. koef = 100
  268. koefE = 100
  269. rMin -= 1
  270. stoper += 1
  271. if endur <= 0 or lustW <= 0:jump 'markSubLoss'
  272. if endurE <= 0 or lustWE <= 0:jump 'markSubWin'
  273. if stoper < 3:
  274. if rMin > 0:
  275. arand = rand(0, 1)
  276. if arand = 0:
  277. dynamic $uderdin
  278. if Aktiv > Passiv:
  279. point += 1
  280. Ku += 1
  281. stoper = 0
  282. jump 'markfight2'
  283. elseif Aktiv <= Passiv:
  284. pointE += 1
  285. KzE += 1
  286. jump 'markRoundStop'
  287. end
  288. elseif arand = 1:
  289. dynamic $brosdin
  290. if Aktiv > Passiv:
  291. point += 2
  292. lustW += 1
  293. Kb += 1
  294. stoper = 0
  295. jump 'markfight1'
  296. elseif Aktiv <= Passiv:
  297. pointE += 1
  298. KzE += 1
  299. jump 'markRoundStop'
  300. end
  301. end
  302. else
  303. jump 'markRoundEnd'
  304. end
  305. elseif stoper >= 3:
  306. pointE += 1
  307. jump 'markRoundStop'
  308. end
  309. :markfightE
  310. koef = 90
  311. koefE = 100
  312. rMin -= 1
  313. stoper += 1
  314. if endur <= 0 or lustW <= 0:jump 'markSubLoss'
  315. if endurE <= 0 or lustWE <= 0:jump 'markSubWin'
  316. if stoper < 3:
  317. if rMin > 0:
  318. deystrand = rand(0, 1)
  319. if deystrand = 0:
  320. dynamic $uderdinE
  321. if Aktiv > Passiv:
  322. pointE += 1
  323. KuE += 1
  324. stoper = 0
  325. jump 'markfightE1'
  326. elseif Aktiv < Passiv:
  327. point += 1
  328. Kz += 1
  329. stoper = 0
  330. jump 'markfightE3'
  331. elseif Aktiv = Passiv:
  332. jump 'markfightE'
  333. end
  334. elseif deystrand = 1:
  335. dynamic $brosdinE
  336. if Aktiv > Passiv:
  337. pointE += 2
  338. lustWE += 1
  339. KbE += 1
  340. stoper = 0
  341. jump 'markfightE2'
  342. elseif Aktiv < Passiv:
  343. point += 1
  344. Kz += 1
  345. stoper = 0
  346. jump 'markfightE3'
  347. elseif Aktiv = Passiv:
  348. jump 'markfightE'
  349. end
  350. end
  351. else
  352. jump 'markRoundEnd'
  353. end
  354. elseif stoper >= 3:
  355. point += 1
  356. jump 'markRoundStop'
  357. end
  358. :markfightE1
  359. koef = 80
  360. koefE = 100
  361. lust -= 1
  362. rMin -= 1
  363. stoper += 1
  364. if endur <= 0 or lustW <= 0:jump 'markSubLoss'
  365. if endurE <= 0 or lustWE <= 0:jump 'markSubWin'
  366. if stoper < 3:
  367. if rMin > 0:
  368. dynamic $uderdinE
  369. endur -= 2
  370. if Aktiv >= Passiv:
  371. pointE += 1
  372. lustW -= 1
  373. KuE += 1
  374. jump 'markfightE1'
  375. elseif Aktiv < Passiv:
  376. point += 1
  377. Kz += 1
  378. stoper = 0
  379. jump 'markfightE3'
  380. end
  381. else
  382. jump 'markRoundEnd'
  383. end
  384. elseif stoper >= 3:
  385. pointE += 3
  386. jump 'markRoundStop'
  387. end
  388. :markfightE2
  389. koef = 85
  390. koefE = 100
  391. rMin -= 1
  392. stoper += 1
  393. if endur <= 0 or lustW <= 0:jump 'markSubLoss'
  394. if endurE <= 0 or lustWE <= 0:jump 'markSubWin'
  395. if stoper < 3:
  396. if rMin > 0:
  397. dynamic $uderdinE
  398. if Aktiv > Passiv:
  399. pointE += 1
  400. KuE += 1
  401. stoper = 0
  402. jump 'markfightE1'
  403. elseif Aktiv < Passiv:
  404. point += 1
  405. Kz += 1
  406. stoper = 0
  407. jump 'markfightE3'
  408. elseif Aktiv = Passiv:
  409. jump 'markfightE2'
  410. end
  411. else
  412. jump 'markRoundEnd'
  413. end
  414. elseif stoper >= 3:
  415. point += 1
  416. jump 'markRoundStop'
  417. end
  418. :markfightE3
  419. koef = 100
  420. koefE = 100
  421. rMin -= 1
  422. stoper += 1
  423. if endur <= 0 or lustW <= 0:jump 'markSubLoss'
  424. if endurE <= 0 or lustWE <= 0:jump 'markSubWin'
  425. if stoper < 3:
  426. if rMin > 0:
  427. deystrand = rand(0 ,1)
  428. if deystrand = 0:
  429. dynamic $uderdinE
  430. if Aktiv > Passiv:
  431. pointE += 1
  432. KuE += 1
  433. stoper = 0
  434. jump 'markfightE1'
  435. elseif Aktiv <= Passiv:
  436. point += 1
  437. Kz += 1
  438. jump 'markRoundStop'
  439. end
  440. elseif deystrand = 1:
  441. dynamic $brosdinE
  442. if Aktiv > Passiv:
  443. pointE += 2
  444. lustWE += 1
  445. KbE += 1
  446. stoper = 0
  447. jump 'markfightE2'
  448. elseif Aktiv <= Passiv:
  449. point += 1
  450. Kz += 1
  451. jump 'markRoundStop'
  452. end
  453. end
  454. else
  455. jump 'markRoundEnd'
  456. end
  457. elseif stoper >= 3:
  458. point += 1
  459. jump 'markRoundStop'
  460. end
  461. :markRoundStop
  462. stoper = 0
  463. if crouch = 1 and croonce = 0:crouch = 0 & croonce = 1
  464. if crouch = 0 and croonce = 0:crouch = 1 & croonce = 1
  465. croonce = 0
  466. jump 'markFightCrouch'
  467. :markSubWin
  468. resultFight = 0
  469. jump 'markEndFight'
  470. :markSubLoss
  471. resultFight = 4
  472. jump ' markEndFight'
  473. :markRoundEnd
  474. round += 1
  475. rMin = 8
  476. stoper = 0
  477. if round = Formula + 1:
  478. if point > pointE:
  479. resultFight = 1
  480. elseif point < pointE:
  481. resultFight=3
  482. elseif point = pointE:
  483. resultFight=2
  484. end
  485. jump 'markEndFight'
  486. elseif round < Formula + 1:
  487. endur += lustW * 25 / 100
  488. endurE += lustWE *25 / 100
  489. if crouch = 1 and croonce = 0:crouch = 0 & croonce = 1
  490. if crouch = 0 and croonce = 0:crouch = 1 & croonce = 1
  491. croonce = 0
  492. jump 'markFightCrouch'
  493. end
  494. :markEndFight
  495. if NoView = 0:'<<$nameA>> <<win[a]>>-<<loss[a]>>-<<draw[a]>> <<SubWin[a]>>/<<SubLoss[a]>>'
  496. if NoView = 0:'<<$nameE>> <<win[i]>>-<<loss[i]>>-<<draw[i]>> <<SubWin[i]>>/<<SubLoss[i]>>'
  497. if NoView = 0:'<<point>> points <<$nameA>> <<Ku>> Activism in the attacks retention, <<Kb>> Activism in the attacks throws, <<Kz>> successful defenses.'
  498. if NoView = 0:'<<pointE>> points <<$nameE>> <<KuE>> Activism in the attacks retention, <<KbE>> Activism in the attacks throws, <<KzE>> successful defenses.'
  499. if resultFight = 0:
  500. wipo[a] += 2
  501. wipo[i] -= 1
  502. rating[a] += 2
  503. rating[i] -= 5
  504. strand = rand(0, 2)
  505. if strand = 0:musle[a] += 10
  506. if strand = 1:flex[a] += 10
  507. if strand = 2:stamina[a] += 10
  508. tehrand = rand(0, 2)
  509. if tehrand = 0:Bteh[a] += 10
  510. if tehrand = 1:Uteh[a] += 10
  511. if tehrand = 2:Zteh[a] += 10
  512. if NoView = 0:'<b><<$nameA>> won surrender</b>'
  513. $spisok[a] += '<<$nameA>> <<win[a]>>-<<loss[a]>>-<<draw[a]>> <<SubWin[a]>>/<<SubLoss[a]>> vs <<$nameE>> <<win[i]>>-<<loss[i]>>-<<draw[i]>> <<SubWin[i]>>/<<SubLoss[i]>> <font color=green>wins by submission</font>'
  514. $spisok[i] += '<<$nameA>> <<win[a]>>-<<loss[a]>>-<<draw[a]>> <<SubWin[a]>>/<<SubLoss[a]>> vs <<$nameE>> <<win[i]>>-<<loss[i]>>-<<draw[i]>> <<SubWin[i]>>/<<SubLoss[i]>> <font color=red>defeat surrender</font>'
  515. win[a] += 1
  516. SubWin[a] += 1
  517. loss[i] += 1
  518. SubLoss[i] += 1
  519. elseif resultFight = 1:
  520. wipo[a] += 1
  521. rating[a] += 1
  522. rating[i] -= 3
  523. strand = rand(0, 2)
  524. if strand = 0:musle[a] += 10
  525. if strand = 1:flex[a] += 10
  526. if strand = 2:stamina[a] += 10
  527. tehrand = rand(0, 2)
  528. if tehrand = 0:Bteh[a] += 10
  529. if tehrand = 1:Uteh[a] += 10
  530. if tehrand = 2:Zteh[a] += 10
  531. if NoView = 0:'<b><<$nameA>> won</b>'
  532. $spisok[a] += '<<$nameA>> <<win[a]>>-<<loss[a]>>-<<draw[a]>> <<SubWin[a]>>/<<SubLoss[a]>> vs <<$nameE>> <<win[i]>>-<<loss[i]>>-<<draw[i]>> <<SubWin[i]>>/<<SubLoss[i]>> <font color=green>victory</font>'
  533. $spisok[i] += '<<$nameA>> <<win[a]>>-<<loss[a]>>-<<draw[a]>> <<SubWin[a]>>/<<SubLoss[a]>> vs <<$nameE>> <<win[i]>>-<<loss[i]>>-<<draw[i]>> <<SubWin[i]>>/<<SubLoss[i]>> <font color=red>defeat</font>'
  534. win[a] += 1
  535. loss[i] += 1
  536. elseif resultFight = 2:
  537. rating[a] -= 1
  538. rating[i] -= 1
  539. if NoView = 0:'<b>The result of the fight a draw</b>'
  540. $spisok[a] += '<<$nameA>> <<win[a]>>-<<loss[a]>>-<<draw[a]>> <<SubWin[a]>>/<<SubLoss[a]>> vs <<$nameE>> <<win[i]>>-<<loss[i]>>-<<draw[i]>> <<SubWin[i]>>/<<SubLoss[i]>> <font color=black>draw</font>'
  541. $spisok[i] += '<<$nameA>> <<win[a]>>-<<loss[a]>>-<<draw[a]>> <<SubWin[a]>>/<<SubLoss[a]>> vs <<$nameE>> <<win[i]>>-<<loss[i]>>-<<draw[i]>> <<SubWin[i]>>/<<SubLoss[i]>> <font color=black>draw</font>'
  542. draw[a] += 1
  543. draw[i] += 1
  544. elseif resultFight = 3:
  545. wipo[i] += 1
  546. rating[a] -= 3
  547. rating[i] += 1
  548. strand = rand(0, 2)
  549. if strand = 0:musle[i] += 10
  550. if strand = 1:flex[i] += 10
  551. if strand = 2:stamina[i] += 10
  552. tehrand = rand(0, 2)
  553. if tehrand = 0:Bteh[i] += 10
  554. if tehrand = 1:Uteh[i] += 10
  555. if tehrand = 2:Zteh[i] += 10
  556. if NoView = 0:'<b><<$nameE>> won</b>'
  557. $spisok[a] += '<<$nameA>> <<win[a]>>-<<loss[a]>>-<<draw[a]>> <<SubWin[a]>>/<<SubLoss[a]>> vs <<$nameE>> <<win[i]>>-<<loss[i]>>-<<draw[i]>> <<SubWin[i]>>/<<SubLoss[i]>> <font color=red>defeat</font>'
  558. $spisok[i] += '<<$nameA>> <<win[a]>>-<<loss[a]>>-<<draw[a]>> <<SubWin[a]>>/<<SubLoss[a]>> vs <<$nameE>> <<win[i]>>-<<loss[i]>>-<<draw[i]>> <<SubWin[i]>>/<<SubLoss[i]>> <font color=green>victory</font>'
  559. win[i] += 1
  560. loss[a] += 1
  561. elseif resultFight = 4:
  562. wipo[i] += 2
  563. wipo[a] -= 1
  564. rating[a] -= 5
  565. rating[i] += 2
  566. strand = rand(0, 2)
  567. if strand = 0:musle[i] += 10
  568. if strand = 1:flex[i] += 10
  569. if strand = 2:stamina[i] += 10
  570. tehrand = rand(0, 2)
  571. if tehrand = 0:Bteh[i] += 10
  572. if tehrand = 1:Uteh[i] += 10
  573. if tehrand = 2:Zteh[i] += 10
  574. if NoView = 0:'<b><<$nameE>> won surrender</b>'
  575. $spisok[a] += '<<$nameA>> <<win[a]>>-<<loss[a]>>-<<draw[a]>> <<SubWin[a]>>/<<SubLoss[a]>> vs <<$nameE>> <<win[i]>>-<<loss[i]>>-<<draw[i]>> <<SubWin[i]>>/<<SubLoss[i]>> <font color=red>defeat surrender</font>'
  576. $spisok[i] += '<<$nameA>> <<win[a]>>-<<loss[a]>>-<<draw[a]>> <<SubWin[a]>>/<<SubLoss[a]>> vs <<$nameE>> <<win[i]>>-<<loss[i]>>-<<draw[i]>> <<SubWin[i]>>/<<SubLoss[i]>> <font color=green>wins by submission</font>'
  577. win[i] += 1
  578. SubWin[i] += 1
  579. loss[a] += 1
  580. SubLoss[a] += 1
  581. end
  582. --- Autofight ---------------------------------