
      SUBROUTINE FIGHT                                                  1738

c	include 'tcommon.for'
	%include tcommon.for

C     ...COMBAT ON BOARD K OR R.                                        1764
      DO 100    I=2,18                                                  1765
      IF(ITRMEN(I).EQ.0)GO TO 100                                       1766
      IF(I.GT.10)GO TO 50                                               1767
C     ...KLINGON.                                                       1768
      J=I-1                                                             1769
      IF(J.GT.KLNGNS)GO TO 90                                           1770
      IF(XKL(J,1).EQ.0.)GO TO 100                                       1771
      IF(ICNTL(I).EQ.1)GO TO 100                                        1772
      IF(XKL(J,9).LE.0.)STOP                                            1773
      ODDS=SQRT(ITRMEN(I)/XKL(J,9))                                     1774
      KILLK=ODDS*CODDS*ITRMEN(I)                                        1775
      KILLK=KILLK+SIGN(RAN(IZZ)*SQRT(FLOAT(KILLK)),.5-RAN(IZZ))         1776
      IF(KILLK.LE.0)KILLK=1                                             1777
      KILLE=1./ODDS*DODDS*XKL(J,9)                                      1778
      KILLE=KILLE+SIGN(RAN(IZZ)*SQRT(FLOAT(KILLE)),.5-RAN(IZZ))         1779
      IF(KILLE.LE.0)KILLE=1                                             1780
      IF(KILLE.GT.ITRMEN(I))KILLE=ITRMEN(I)                             1781
      IF(KILLK.GT.XKL(J,9))KILLK=XKL(J,9)                               1782
      WRITE(6,1)LETR(3),J,XKL(J,1),XKL(J,2),KILLK,KILLE                 1783
1     FORMAT(' FIGHTING ON ',A1,I1,' AT ',F4.1,',',F4.1/' ENEMY LOSSES: 1784
     1',I4,      ' ENTERPRISE LOSSES: ',I4)                             1785
      ITRMEN(I)=ITRMEN(I)-KILLE                                         1786
      ITKL(I-1)=ITKL(I-1)+KILLE                                         1787
      JTKL(I-1)=JTKL(I-1)+KILLK                                         1788
      XKL(J,9)=XKL(J,9)-KILLK                                           1789
      IF(XKL(J,9).GT.0.)GO TO 100                                       1790
      WRITE(6,2)LETR(3),J                                               1791
2     FORMAT(1X,A1,I1,' CAPTURED!')                                     1792
      ICNTL(I)=1                                                        1793
      WRITE(6,3)ITKL(I-1),JTKL(I-1)                                     1794
3     FORMAT(' TROOPS KILLED: ',I3,' ENEMY KILLED: ',I3)                1795
      ITKL(I-1)=0                                                       1796
      JTKL(I-1)=0                                                       1797
      XKL(J,5)=0.                                                       1798
      XKL(J,8)=0.                                                       1799
      GO TO 100                                                         1800
C     ...ROMULAN.                                                       1801
50    J=I-10                                                            1802
      IF(J.GT.NROM)GO TO 90                                             1803
      IF(XROM(J,1).EQ.0.)GO TO 100                                      1804
      IF(ICNTL(I).EQ.1)GO TO 100                                        1805
      IF(CREWR(J).LE.0.)STOP                                            1806
      ODDS=SQRT(ITRMEN(I)/CREWR(J))                                     1807
      KILLR=ODDS*EODDS*ITRMEN(I)                                        1808
      KILLR=KILLR+SIGN(RAN(IZZ)*SQRT(FLOAT(KILLR)),.5-RAN(IZZ))         1809
      IF(KILLR.LE.0)KILLR=0                                             1810
      KILLE=1./ODDS*FODDS*CREWR(J)                                      1811
      KILLE=KILLE+SIGN(RAN(IZZ)*SQRT(FLOAT(KILLE)),.5-RAN(IZZ))         1812
      IF(KILLE.LE.0)KILLE=1                                             1813
      IF(KILLE.GT.ITRMEN(I))KILLE=ITRMEN(I)                             1814
      IF(KILLR.GT.CREWR(J))KILLR=CREWR(J)                               1815
      WRITE(6,1)LETR(4),J,XROM(J,1),XROM(J,2),KILLR,KILLE               1816
      ITKL(I-1)=ITKL(I-1)+KILLE                                         1817
      JTKL(I-1)=JTKL(I-1)+KILLR                                         1818
      ITRMEN(I)=ITRMEN(I)-KILLE                                         1819
      CREWR(J)=CREWR(J)-KILLR                                           1820
      IF(CREWR(J).GT.0.)GO TO 100                                       1821
      WRITE(6,2)LETR(4),J                                               1822
      ICNTL(I)=1                                                        1823
      WRITE(6,3)ITKL(I-1),JTKL(I-1)                                     1824
      ITKL(I-1)=0                                                       1825
      JTKL(I-1)=0                                                       1826
      XROM(J,4)=0.                                                      1827
      IF(J.NE.1.OR.ICLOAK.NE.2)GO TO 100                                1828
      SDAYS=RAN(IZZ)*XTIME*.1                                           1829
      SDAYS=SDAYS+SIGN(RAN(IZZ)*SDAYS*.3,.5-RAN(IZZ))                   1830
      WRITE(6,4)SDAYS                                                   1831
4     FORMAT(' CLOAKING DEVICE CAPTURED!'/' YOU MAY USE IT FOR ',      F1832
     15.2,' STARDAYS BEFORE THE ENEMY CATCHES ON.')                     1833
      ICLOAK=-SDAYS*100.                                                1834
      GO TO 100                                                         1835
C     ...VESSEL NO LONGER EXISTS.                                       1836
90    ITRMEN(I)=0                                                       1837
100   CONTINUE                                                          1838
      RETURN                                                            1839
      END                                                               1840
