# 2.11BSD#431 - /usr/src/new/PORT/dungeon/dso4.F

       1: C ROBADV-- STEAL WINNER'S VALUABLES
       2: C
       3: C COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142
       4: C ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED
       5: C WRITTEN BY R. M. SUPNIK
       6: C
       7: C DECLARATIONS
       8: C
       9:         INTEGER FUNCTION ROBADV(ADV,NR,NC,NA)
      10:         IMPLICIT INTEGER (A-Z)
      11: #include "objects.h"
      12: #include "oflags.h"
      13: C
      14:         ROBADV=0
      15: C						!COUNT OBJECTS
      16:         DO 100 I=1,OLNT
      17:           IF((OADV(I).NE.ADV).OR.(OTVAL(I).LE.0).OR.
      18: &               (and(OFLAG2(I),SCRDBT).NE.0)) GO TO 100
      19:           CALL NEWSTA(I,0,NR,NC,NA)
      20: C						!STEAL OBJECT
      21:           ROBADV=ROBADV+1
      22: 100     CONTINUE
      23:         RETURN
      24:         END
      25: C ROBRM-- STEAL ROOM VALUABLES
      26: C
      27: C DECLARATIONS
      28: C
      29:         INTEGER FUNCTION ROBRM(RM,PR,NR,NC,NA)
      30:         IMPLICIT INTEGER (A-Z)
      31:         LOGICAL PROB,QHERE
      32: #include "objects.h"
      33: #include "oflags.h"
      34: C
      35:         ROBRM=0
      36: C						!COUNT OBJECTS
      37:         DO 100 I=1,OLNT
      38: C						!LOOP ON OBJECTS.
      39:           IF(.NOT. QHERE(I,RM)) GO TO 100
      40:           IF((OTVAL(I).LE.0).OR.(and(OFLAG2(I),SCRDBT).NE.0).OR.
      41: &               (and(OFLAG1(I),VISIBT).EQ.0).OR.(.NOT.PROB(PR,PR)))
      42: &               GO TO 50
      43:           CALL NEWSTA(I,0,NR,NC,NA)
      44:           ROBRM=ROBRM+1
      45:           OFLAG2(I)=or(OFLAG2(I),TCHBT)
      46:           GO TO 100
      47: 50        IF(and(OFLAG2(I),ACTRBT).NE.0)
      48: &               ROBRM=ROBRM+ROBADV(OACTOR(I),NR,NC,NA)
      49: 100     CONTINUE
      50:         RETURN
      51:         END
      52: C WINNIN-- SEE IF VILLAIN IS WINNING
      53: C
      54: C DECLARATIONS
      55: C
      56:         LOGICAL FUNCTION WINNIN(VL,HR)
      57:         IMPLICIT INTEGER (A-Z)
      58:         LOGICAL PROB
      59: #include "objects.h"
      60: C
      61:         VS=OCAPAC(VL)
      62: C						!VILLAIN STRENGTH
      63:         PS=VS-FIGHTS(HR,.TRUE.)
      64: C						!HIS MARGIN OVER HERO
      65:         WINNIN=PROB(90,100)
      66:         IF(PS.GT.3) RETURN
      67: C						!+3... 90% WINNING
      68:         WINNIN=PROB(75,85)
      69:         IF(PS.GT.0) RETURN
      70: C						!>0... 75% WINNING
      71:         WINNIN=PROB(50,30)
      72:         IF(PS.EQ.0) RETURN
      73: C						!=0... 50% WINNING
      74:         WINNIN=PROB(25,25)
      75:         IF(VS.GT.1) RETURN
      76: C						!ANY VILLAIN STRENGTH.
      77:         WINNIN=PROB(10,0)
      78:         RETURN
      79:         END
      80: C FIGHTS-- COMPUTE FIGHT STRENGTH
      81: C
      82: C DECLARATIONS
      83: C
      84:         INTEGER FUNCTION FIGHTS(H,FLG)
      85:         IMPLICIT INTEGER (A-Z)
      86:         LOGICAL FLG
      87: C
      88: C GAME STATE
      89: C
      90: #include "state.h"
      91: #include "advers.h"
      92: C
      93: C FUNCTIONS AND DATA
      94: C
      95:         DATA SMAX/7/,SMIN/2/
      96: C
      97:         FIGHTS=SMIN+((((SMAX-SMIN)*ASCORE(H))+(MXSCOR/2))/MXSCOR)
      98:         IF(FLG) FIGHTS=FIGHTS+ASTREN(H)
      99:         RETURN
     100:         END
     101: C VILSTR-	COMPUTE VILLAIN STRENGTH
     102: C
     103: C DECLARATIONS
     104: C
     105:         INTEGER FUNCTION VILSTR(V)
     106:         IMPLICIT INTEGER (A-Z)
     107: #include "parser.h"
     108: #include "objects.h"
     109: #include "oflags.h"
     110: #include "oindex.h"
     111: #include "villians.h"
     112: #include "flags.h"
     113: C VILSTR, PAGE 2
     114: C
     115:         VILSTR=OCAPAC(V)
     116:         IF(VILSTR.LE.0) RETURN
     117:         IF((V.NE.THIEF).OR..NOT.THFENF) GO TO 100
     118:         THFENF=.FALSE.
     119: C						!THIEF UNENGROSSED.
     120:         VILSTR=MIN0(VILSTR,2)
     121: C						!NO BETTER THAN 2.
     122: C
     123: 100     DO 200 I=1,VLNT
     124: C						!SEE IF  BEST WEAPON.
     125:           IF((VILLNS(I).EQ.V).AND.(PRSI.EQ.VBEST(I)))
     126: &               VILSTR=MAX0(1,VILSTR-1)
     127: 200     CONTINUE
     128:         RETURN
     129:         END

Last modified: 1988-10-21 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 628 |