1: C TROLLP-	TROLL FUNCTION
   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:         LOGICAL FUNCTION TROLLP(ARG)
  10:         IMPLICIT INTEGER (A-Z)
  11:         LOGICAL QHERE,PROB
  12: #include "parser.h"
  13: #include "gamestate.h"
  14: #include "objects.h"
  15: #include "oflags.h"
  16: #include "oindex.h"
  17: #include "verbs.h"
  18: #include "flags.h"
  19: C TROLLP, PAGE 2
  20: C
  21:         TROLLP=.TRUE.
  22: C						!ASSUME WINS.
  23:         IF(PRSA.NE.FIGHTW) GO TO 1100
  24: C						!FIGHT?
  25:         IF(OCAN(AXE).EQ.TROLL) GO TO 10
  26: C						!GOT AXE?  NOTHING.
  27:         I=433
  28: C						!ASSUME CANT GET.
  29:         IF(.NOT.QHERE(AXE,HERE)) GO TO 1050
  30: C						!HERE?
  31:         I=434
  32: C						!YES, RECOVER.
  33:         CALL NEWSTA(AXE,0,0,TROLL,0)
  34: 1050    IF(QHERE(TROLL,HERE)) CALL RSPEAK(I)
  35: C						!IF PLAYER HERE.
  36:         RETURN
  37: C
  38: 1100    IF(PRSA.NE.DEADXW) GO TO 1200
  39: C						!DEAD?
  40:         TROLLF=.TRUE.
  41: C						!PERMIT EXITS.
  42:         RETURN
  43: C
  44: 1200    IF(PRSA.NE.OUTXW) GO TO 1300
  45: C						!OUT?
  46:         TROLLF=.TRUE.
  47: C						!PERMIT EXITS.
  48:         OFLAG1(AXE)=and(OFLAG1(AXE), not(VISIBT))
  49:         ODESC1(TROLL)=435
  50: C						!TROLL OUT.
  51:         RETURN
  52: C
  53: 1300    IF(PRSA.NE.INXW) GO TO 1400
  54: C						!WAKE UP?
  55:         TROLLF=.FALSE.
  56: C						!FORBID EXITS.
  57:         OFLAG1(AXE)=or(OFLAG1(AXE),VISIBT)
  58:         ODESC1(TROLL)=436
  59: C						!TROLL IN.
  60:         IF(QHERE(TROLL,HERE)) CALL RSPEAK(437)
  61:         RETURN
  62: C
  63: 1400    IF(PRSA.NE.FRSTQW) GO TO 1500
  64: C						!FIRST ENCOUNTER?
  65:         TROLLP=PROB(33,66)
  66: C						!33% TRUE UNLESS BADLK.
  67:         RETURN
  68: C
  69: 1500    IF((PRSA.NE.MOVEW).AND.(PRSA.NE.TAKEW).AND.(PRSA.NE.MUNGW)
  70: &               .AND.(PRSA.NE.THROWW).AND.(PRSA.NE.GIVEW)) GO TO 2000
  71:         IF(OCAPAC(TROLL).GE.0) GO TO 1550
  72: C						!TROLL OUT?
  73:         OCAPAC(TROLL)=-OCAPAC(TROLL)
  74: C						!YES, WAKE HIM.
  75:         OFLAG1(AXE)=or(OFLAG1(AXE),VISIBT)
  76:         TROLLF=.FALSE.
  77:         ODESC1(TROLL)=436
  78:         CALL RSPEAK(437)
  79: C
  80: 1550    IF((PRSA.NE.TAKEW).AND.(PRSA.NE.MOVEW)) GO TO 1600
  81:         CALL RSPEAK(438)
  82: C						!JOKE.
  83:         RETURN
  84: C
  85: 1600    IF(PRSA.NE.MUNGW) GO TO 1700
  86: C						!MUNG?
  87:         CALL RSPEAK(439)
  88: C						!JOKE.
  89:         RETURN
  90: C
  91: 1700    IF(PRSO.EQ.0) GO TO 10
  92: C						!NO OBJECT?
  93:         I=440
  94: C						!ASSUME THROW.
  95:         IF(PRSA.EQ.GIVEW) I=441
  96: C						!GIVE?
  97:         CALL RSPSUB(I,ODESC2(PRSO))
  98: C						!TROLL TAKES.
  99:         IF(PRSO.EQ.KNIFE) GO TO 1900
 100: C						!OBJ KNIFE?
 101:         CALL NEWSTA(PRSO,442,0,0,0)
 102: C						!NO, EATS IT.
 103:         RETURN
 104: C
 105: 1900    CALL RSPEAK(443)
 106: C						!KNIFE, THROWS IT BACK
 107:         OFLAG2(TROLL)=or(OFLAG2(TROLL),FITEBT)
 108:         RETURN
 109: C
 110: 2000    IF(.NOT.TROLLF.OR.(PRSA.NE.HELLOW)) GO TO 10
 111:         CALL RSPEAK(366)
 112: C						!TROLL OUT.
 113:         RETURN
 114: C
 115: 10      TROLLP=.FALSE.
 116: C						!COULDNT HANDLE IT.
 117:         RETURN
 118:         END
 119: C CYCLOP-	CYCLOPS FUNCTION
 120: C
 121: C DECLARATIONS
 122: C
 123:         LOGICAL FUNCTION CYCLOP(ARG)
 124:         IMPLICIT INTEGER (A-Z)
 125: #include "parser.h"
 126: #include "gamestate.h"
 127: #include "objects.h"
 128: #include "oflags.h"
 129: #include "oindex.h"
 130: #include "verbs.h"
 131: #include "flags.h"
 132: C CYCLOP, PAGE 2
 133: C
 134:         CYCLOP=.TRUE.
 135: C						!ASSUME WINS.
 136:         IF(.NOT.CYCLOF) GO TO 100
 137: C						!ASLEEP?
 138:         IF((PRSA.NE.ALARMW).AND.(PRSA.NE.MUNGW).AND.(PRSA.NE.HELLOW).AND.
 139: &               (PRSA.NE.BURNW).AND.(PRSA.NE.KILLW).AND.(PRSA.NE.ATTACW))
 140: &                GO TO 10
 141:         CYCLOF=.FALSE.
 142: C						!WAKE CYCLOPS.
 143:         CALL RSPEAK(187)
 144: C						!DESCRIBE.
 145:         RVCYC=IABS(RVCYC)
 146:         OFLAG2(CYCLO)=and(or(OFLAG2(CYCLO),FITEBT),not(SLEPBT))
 147:         RETURN
 148: C
 149: 100     IF((PRSA.EQ.FIGHTW).OR.(PRSA.EQ.FRSTQW)) GO TO 10
 150:         IF(IABS(RVCYC).LE.5) GO TO 200
 151: C						!ANNOYED TOO MUCH?
 152:         RVCYC=0
 153: C						!RESTART COUNT.
 154:         CALL JIGSUP(188)
 155: C						!YES, EATS PLAYER.
 156:         RETURN
 157: C
 158: 200     IF(PRSA.NE.GIVEW) GO TO 500
 159: C						!GIVE?
 160:         IF((PRSO.NE.FOOD).OR.(RVCYC.LT.0)) GO TO 300
 161: C						!FOOD WHEN HUNGRY?
 162:         CALL NEWSTA(FOOD,189,0,0,0)
 163: C						!EATS PEPPERS.
 164:         RVCYC=MIN0(-1,-RVCYC)
 165: C						!GETS THIRSTY.
 166:         RETURN
 167: C
 168: 300     IF(PRSO.NE.WATER) GO TO 400
 169: C						!DRINK WHEN THIRSTY?
 170:         IF(RVCYC.GE.0) GO TO 350
 171:         CALL NEWSTA(PRSO,190,0,0,0)
 172: C						!DRINKS AND
 173:         CYCLOF=.TRUE.
 174: C						!FALLS ASLEEP.
 175:         OFLAG2(CYCLO)=and(or(OFLAG2(CYCLO),SLEPBT),not(FITEBT))
 176:         RETURN
 177: C
 178: 350     CALL RSPEAK(191)
 179: C						!NOT THIRSTY.
 180: 10      CYCLOP=.FALSE.
 181: C						!FAILS.
 182:         RETURN
 183: C
 184: 400     I=192
 185: C						!ASSUME INEDIBLE.
 186:         IF(PRSO.EQ.GARLI) I=193
 187: C						!GARLIC IS JOKE.
 188: 450     CALL RSPEAK(I)
 189: C						!DISDAIN IT.
 190:         IF(RVCYC.LT.0) RVCYC=RVCYC-1
 191:         IF(RVCYC.GE.0) RVCYC=RVCYC+1
 192:         IF(.NOT.CYCLOF) CALL RSPEAK(193+IABS(RVCYC))
 193:         RETURN
 194: C
 195: 500     I=0
 196: C						!ASSUME NOT HANDLED.
 197:         IF(PRSA.EQ.HELLOW) GO TO 450
 198: C						!HELLO IS NO GO.
 199:         IF((PRSA.EQ.THROWW).OR.(PRSA.EQ.MUNGW)) I=200+RND(2)
 200:         IF(PRSA.EQ.TAKEW) I=202
 201:         IF(PRSA.EQ.TIEW) I=203
 202:         IF(I) 10,10,450
 203: C						!SEE IF HANDLED.
 204: C
 205:         END
 206: C THIEFP-	THIEF FUNCTION
 207: C
 208: C DECLARATIONS
 209: C
 210:         LOGICAL FUNCTION THIEFP(ARG)
 211:         IMPLICIT INTEGER (A-Z)
 212:         LOGICAL QHERE,PROB
 213: #include "parser.h"
 214: #include "gamestate.h"
 215: C
 216: C ROOMS
 217: #include "rindex.h"
 218: #include "objects.h"
 219: #include "oflags.h"
 220: #include "oindex.h"
 221: #include "clock.h"
 222: 
 223: #include "villians.h"
 224: #include "verbs.h"
 225: #include "flags.h"
 226: C THIEFP, PAGE 2
 227: C
 228:         THIEFP=.TRUE.
 229: C						!ASSUME WINS.
 230:         IF(PRSA.NE.FIGHTW) GO TO 100
 231: C						!FIGHT?
 232:         IF(OCAN(STILL).EQ.THIEF) GO TO 10
 233: C						!GOT STILLETTO?  F.
 234:         IF(QHERE(STILL,THFPOS)) GO TO 50
 235: C						!CAN HE RECOVER IT?
 236:         CALL NEWSTA(THIEF,0,0,0,0)
 237: C						!NO, VANISH.
 238:         IF(QHERE(THIEF,HERE)) CALL RSPEAK(498)
 239: C						!IF HERO, TELL.
 240:         RETURN
 241: C
 242: 50      CALL NEWSTA(STILL,0,0,THIEF,0)
 243: C						!YES, RECOVER.
 244:         IF(QHERE(THIEF,HERE)) CALL RSPEAK(499)
 245: C						!IF HERO, TELL.
 246:         RETURN
 247: C
 248: 100     IF(PRSA.NE.DEADXW) GO TO 200
 249: C						!DEAD?
 250:         THFACT=.FALSE.
 251: C						!DISABLE DEMON.
 252:         OFLAG1(CHALI)=or(OFLAG1(CHALI),TAKEBT)
 253:         J=0
 254:         DO 125 I=1,OLNT
 255: C						!CARRYING ANYTHING?
 256: 125       IF(OADV(I).EQ.-THIEF) J=500
 257:         CALL RSPEAK(J)
 258: C						!TELL IF BOOTY REAPPEARS.
 259: C
 260:         J=501
 261:         DO 150 I=1,OLNT
 262: C						!LOOP.
 263:           IF((I.EQ.CHALI).OR.(I.EQ.THIEF).OR.(HERE.NE.TREAS)
 264: &               .OR. .NOT.QHERE(I,HERE)) GO TO 135
 265:           OFLAG1(I)=or(OFLAG1(I),VISIBT)
 266:           CALL RSPSUB(J,ODESC2(I))
 267: C						!DESCRIBE.
 268:           J=502
 269:           GO TO 150
 270: C
 271: 135       IF(OADV(I).EQ.-THIEF) CALL NEWSTA(I,0,HERE,0,0)
 272: 150     CONTINUE
 273:         RETURN
 274: C
 275: 200     IF(PRSA.NE.FRSTQW) GO TO 250
 276: C						!FIRST ENCOUNTER?
 277:         THIEFP=PROB(20,75)
 278:         RETURN
 279: C
 280: 250     IF((PRSA.NE.HELLOW).OR.(ODESC1(THIEF).NE.504))
 281: &               GO TO 300
 282:         CALL RSPEAK(626)
 283:         RETURN
 284: C
 285: 300     IF(PRSA.NE.OUTXW) GO TO 400
 286: C						!OUT?
 287:         THFACT=.FALSE.
 288: C						!DISABLE DEMON.
 289:         ODESC1(THIEF)=504
 290: C						!CHANGE DESCRIPTION.
 291:         OFLAG1(STILL)=and(OFLAG1(STILL),not(VISIBT))
 292:         OFLAG1(CHALI)=or(OFLAG1(CHALI),TAKEBT)
 293:         RETURN
 294: C
 295: 400     IF(PRSA.NE.INXW) GO TO 500
 296: C						!IN?
 297:         IF(QHERE(THIEF,HERE)) CALL RSPEAK(505)
 298: C						!CAN HERO SEE?
 299:         THFACT=.TRUE.
 300: C						!ENABLE DEMON.
 301:         ODESC1(THIEF)=503
 302: C						!CHANGE DESCRIPTION.
 303:         OFLAG1(STILL)=or(OFLAG1(STILL),VISIBT)
 304:         IF((HERE.EQ.TREAS).AND.QHERE(CHALI,HERE))
 305: &               OFLAG1(CHALI)=and(OFLAG1(CHALI),not(TAKEBT))
 306:         RETURN
 307: C
 308: 500     IF(PRSA.NE.TAKEW) GO TO 600
 309: C						!TAKE?
 310:         CALL RSPEAK(506)
 311: C						!JOKE.
 312:         RETURN
 313: C
 314: 600     IF((PRSA.NE.THROWW).OR.(PRSO.NE.KNIFE).OR.
 315: &               (and(OFLAG2(THIEF),FITEBT).NE.0)) GO TO 700
 316:         IF(PROB(10)) GO TO 650
 317: C						!THREW KNIFE, 10%?
 318:         CALL RSPEAK(507)
 319: C						!NO, JUST MAKES
 320:         OFLAG2(THIEF)=or(OFLAG2(THIEF),FITEBT)
 321:         RETURN
 322: C
 323: 650     J=508
 324: C						!THIEF DROPS STUFF.
 325:         DO 675 I=1,OLNT
 326:           IF(OADV(I).NE.-THIEF) GO TO 675
 327: C						!THIEF CARRYING?
 328:           J=509
 329:           CALL NEWSTA(I,0,HERE,0,0)
 330: 675     CONTINUE
 331:         CALL NEWSTA(THIEF,J,0,0,0)
 332: C						!THIEF VANISHES.
 333:         RETURN
 334: C
 335: 700     IF(((PRSA.NE.THROWW).AND.(PRSA.NE.GIVEW)).OR.(PRSO.EQ.0).OR.
 336: &               (PRSO.EQ.THIEF)) GO TO 10
 337:         IF(OCAPAC(THIEF).GE.0) GO TO 750
 338: C						!WAKE HIM UP.
 339:         OCAPAC(THIEF)=-OCAPAC(THIEF)
 340:         THFACT=.TRUE.
 341:         OFLAG1(STILL)=or(OFLAG1(STILL),VISIBT)
 342:         ODESC1(THIEF)=503
 343:         CALL RSPEAK(510)
 344: C
 345: 750     IF((PRSO.NE.BRICK).OR.(OCAN(FUSE).NE.BRICK).OR.
 346: &               (CTICK(CEVFUS).EQ.0)) GO TO 800
 347:         CALL RSPEAK(511)
 348: C						!THIEF REFUSES BOMB.
 349:         RETURN
 350: C
 351: 800     CALL NEWSTA(PRSO,0,0,0,-THIEF)
 352: C						!THIEF TAKES GIFT.
 353:         IF(OTVAL(PRSO).GT.0) GO TO 900
 354: C						!A TREASURE?
 355:         CALL RSPSUB(512,ODESC2(PRSO))
 356:         RETURN
 357: C
 358: 900     CALL RSPSUB(627,ODESC2(PRSO))
 359: C						!THIEF ENGROSSED.
 360:         THFENF=.TRUE.
 361:         RETURN
 362: C
 363: 10      THIEFP=.FALSE.
 364:         RETURN
 365:         END
Last modified: 1988-10-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2054
Valid CSS Valid XHTML 1.0 Strict