      SUBROUTINE EPULSE                                                 1638

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

C     ...PULSIVE BEAMS.                                                 1661
2400  EFP(1)=0.                                                         1662
      CALL CHEKDG(6,IR)                                                 1663
      IF(IR.EQ.1)GO TO 2490                                             1664
      IF(ETR(2).NE.1.)GO TO 2450                                        1665
C     ...COMPUTER CALCULATES STRENGTH TO PULL IN G.                     1666
      IF(IGH.NE.0)GO TO 2402                                            1667
      WRITE(6,2401)LETR(5)                                              1668
2401  FORMAT(' NO ',A1,' IN QUADRANT')                                  1669
      PNRGY=0.                                                          1670
      WRITE(6,2403)                                                     1671
2403  FORMAT(' PULSIVE BEAMS TURNED OFF')                               1672
      GO TO 2500                                                        1673
2402  DELV=(GHOST(1)-XQE)**2+(GHOST(2)-YQE)**2                          1674
      DELV=DELV/DISTGT*PTRGH                                            1675
      ENERGY=ENERGY-DELV                                                1676
      WRITE(6,2407)LETR(5),IGH,GHOST(1),GHOST(2)                        1677
2407  FORMAT(' PULSIVE BEAMS LOCKED ON ',A1,I1, ' AT ',F4.1,',',F4.1)   1678
      IF(ENERGY.LE.0.)CALL RATING(2)                                    1679
      IF(DEFL.NE.0.)GO TO 2410                                          1680
      WRITE(6,2404)                                                     1681
2404  FORMAT(' DOCKED WITH GHOSTSHIP!')                                 1682
C     ...PART OF ENERGY MAY BE LOST DUE TO PHASER HITS.                 1683
      ENERGY=ENERGY+GHOST(11)+GHOST(13)-GHOST(3)                        1684
      ITORP=ITORP+GHOST(12)                                             1685
      ITRMEN(1)=ITRMEN(1)+ITRMEN(20)                                    1686
      ITRMEN(20)=0                                                      1687
      WRITE(6,2405)ENERGY,ITORP                                         1688
2405  FORMAT(' ENERGY = ',F8.2,' TORPEDOS - ',I2)                       1689
      IGH=0                                                             1690
      GO TO 2500                                                        1691
C     ...SHELDS NOT DOWN IMPLIES COLLISION.                             1692
2410  WRITE(6,2153)LETR(2),LETR(5)                                      1693
2153  FORMAT(1X,A1,' COLLISION WITH ',A1)                               1694
      WRITE(6,2154)                                                     1695
2154  FORMAT(' SHIELDS DESTROYED')                                      1696
      CALL DLETE(5,0)                                                   1697
      CALL DAMAGE(0,DEFL)                                               1698
      GO TO 2500                                                        1699
C     ...LOCK ON NEAREST K FOR R BEAMS.                                 1700
2450  ETR(1)=0.                                                         1701
      IF(KLNGNS.NE.0)GO TO 2460                                         1702
2455  WRITE(6,2401)LETR(3)                                              1703
      WRITE(6,2403)                                                     1704
      PNRGY=0.                                                          1705
      ETR(1)=0.                                                         1706
      GO TO 2500                                                        1707
2460  PNRGY=0.                                                          1708
      JJ=-ETR(2)                                                        1709
      IF(XKL(JJ,1).EQ.0.)GO TO 2455                                     1710
      DELV=(XQE-XKL(JJ,1))**2+(YQE-XKL(JJ,2))**2                        1711
      WRITE(6,2407)LETR(3),JJ,XKL(JJ,1),XKL(JJ,2)                       1712
      ENERGY=ENERGY-ETR(3)                                              1713
      IF(ENERGY.LE.0.)CALL RATING(2)                                    1714
      DELV=DISTKR/DELV*ETR(3)/PRKLN                                     1715
C     ...MOVE K. REDUCE SPEED ACCORDINGLY.                              1716
      CALL GETBRG(DELTA,XQE,XKL(JJ,1),YQE,XKL(JJ,2),VPX,VPY)            1717
      VPX=COSD(DELTA)*DELV                                              1718
      VPY=SIND(DELTA)*DELV                                              1719
      DELTA=ABS(DELV)/VRKL                                              1720
      XKL(JJ,1)=XKL(JJ,1)+VPX                                           1721
      XKL(JJ,2)=XKL(JJ,2)+VPY                                           1722
      XKL(JJ,3)=XKL(JJ,3)-DELTA                                         1723
      IF(XKL(JJ,3).LT.0.)XKL(JJ,3)=0.                                   1724
C     ...CHECK IF FORCED OUT OF QUADRANT.                               1725
      CALL KLQ(JJ,IR)                                                   1726
      IF(IR.GE.1)GO TO 2500                                             1727
C     ...PRINT APPROPRIATE MESSAGE.                                     1728
      WRITE(6,2471)LETR(3),JJ,(XKL(JJ,KK),KK=1,4)                       1729
2471  FORMAT(1X,A1,I1,' MOVED TO ',F4.1,',',F4.1,' SPEED: ',F5.3,       1730
     1             ' BEARING: ',F4.0)                                   1731
      GO TO 2500                                                        1732
C     ...UBIQUITOUS DAMAGE CONTROL.                                     1733
2490  PNRGY=0.                                                          1734
2500  ETR(1)=0.                                                         1735
      RETURN                                                            1736
      END                                                               1737
