Source:Battle Royale

From Eamon Wiki
Jump to navigation Jump to search
This page is a verbatim reproduction of original source material and should not be edited except for maintenance.
Description

The Applesoft BASIC source code of the Eamon utility program Battle Royale.

Source

Eamon Utilities III

Date

c. 1984

Author

John Nelson

License

The use of this item is permitted on the grounds that it's free or in the public domain.

0  REM     BATTLE ROYALE
2  REM     BY JOHN NELSON
3  REM 
4  REM  THIS PROGRAM WILL STAGE A GIANTIC MONSTER BATTLE OR A CONTEST BETWEEN ANY EAMON MONSTERS YOU SELECT.
10 D$ =  CHR$ (4): TEXT : DIM MN$(100),MD%(100,10),CW%(100)
20  PRINT D$"OPEN MONSTER.MASTER,L384": PRINT D$"READ MONSTER.MASTER,R0": INPUT NM: PRINT D$
100  REM  >>> MAIN ROUTINE
110  HOME : PRINT  SPC( 12);"BATTLE ROYALE": PRINT : PRINT  SPC( 11)"BY JOHN NELSON": PRINT : PRINT 
120  PRINT "SELECT ACTION:": PRINT "  1. SELECT MONSTERS FOR A BATTLE": PRINT "  2. PREDICT THE OUTCOME OF A BATTLE": PRINT "  3. WAGE A BATTLE": PRINT "  4. QUIT"
140  PRINT "INPUT YOUR CHOICE (1-4):";
150  GET A$: IF  VAL (A$) < 1 OR  VAL (A$) > 4 THEN 150
160  PRINT 
180  ON  VAL (A$) GOTO 10000,20000,30000,40000
10000  REM  >>> SELECT FIGHTERS
10010  HOME : PRINT  SPC( 11);"MONSTER SELECTION": PRINT : INPUT "SELECT MONSTER BY # OR NAME:";X$
10020  IF  LEFT$ (X$,1) = "#" THEN X$ =  MID$ (X$,2)
10030  IF  VAL (X$) > 0 AND  VAL (X$) <  = NM THEN R =  VAL (X$): GOTO 10100
10035  IF  VAL (X$) > NM THEN  PRINT : PRINT "THERE AREN'T THAT MANY FIGHTERS IN THE": PRINT "WORLD. TRY AGAIN.": PRINT : PRINT "(PRESS ANY KEY TO CONTINUE)";: GET A$: PRINT : GOTO 10000
10040  FOR R = 1 TO NM: PRINT D$"READ MONSTER.MASTER,R";R: INPUT NA$:
10050  IF NA$ <  > X$ THEN  NEXT : PRINT "I CAN'T FIND THAT MONSTER."
10060  INPUT MD$: PRINT D$
10070  HOME : PRINT NA$: PRINT : PRINT MD$: PRINT : PRINT "IS THIS THE RIGHT ONE?";
10080  GET RE$: IF RE$ <  > "Y" AND RE$ <  > "N" THEN 10080
10090  PRINT RE$: IF RE$ = "N" THEN NA$ = "": GOTO 10050
10100  REM  >>> READ A MONSTER
10105 M = M + 1
10110  PRINT D$"READ MONSTER.MASTER,R";R: INPUT MN$(M): INPUT MD$: INPUT MD%(M,1),X,MD%(M,2),X,X,X,MD%(M,4),MD%(M,5),X,MD%(M,6),MD%(M,7),MD%(M,8): PRINT D$
10120 MN$(M) = MN$(M) + "(" +  STR$ (R) + ")":MD%(M,2) = M - 1: IF M = 1 THEN MD%(M,2) = 2
10130 CW%(M) = MD%(M,1) + MD%(M,4) + (MD%(M,6) - 35) + (MD%(M,7) * MD%(M,8)) + (2 * MD%(M,5))
10140  IF CW% > CW%(M) THEN MD%(M,2) = PP
10150  IF CW% < CW%(M) THEN PP = M:CW% = CW%(M)
10190  PRINT MN$(M);" IS READY FOR BATTLE.": PRINT : PRINT "(PRESS ANY KEY TO CONTINUE)";: GET A$: PRINT : GOTO 100
11000 CW%(M) = MD%(M,1) + MD%(M,4) + (MD%(M,6) - 35) + (MD%(M,7) * MD%(M,8)) + (2 * MD%(M,5))
20000  REM  >>> PREDICT A FIGHT
20010  IF M = 0 THEN  PRINT : PRINT "THERE IS NO MATCH SCHEDULED. HOW CAN I": PRINT "POSSIBLY PICK A WINNER?": PRINT : PRINT "(PRESS ANY KEY TO CONTINUE)";: GET A$: PRINT : GOTO 100
20020  IF M = 1 THEN  PRINT : PRINT "I'LL TAKE ";MN$(M);" TO WIN HANDS DOWN.": PRINT : PRINT "(PRESS ANY KEY TO CONTINUE)": GET A$: PRINT : GOTO 100
20030 CW% = 0: FOR X = 1 TO M:CW%(X) = MD%(X,1) + MD%(X,4) + (MD%(X,6) - 35) + (MD%(X,7) * MD%(X,8)) + (2 * MD%(M,5))
20040  NEXT : FOR X = 1 TO M: IF CW%(X) > CW% THEN CW% = CW%(X):PP = X
20050  NEXT : PRINT : PRINT "I GUESS I'D HAVE TO PUT MY MONEY ON": PRINT MN$(PP);" TO WIN THIS ONE."
20060  FOR X = 1 TO M: IF X <  > PP AND  RND (1) > .65 THEN MD%(X,2) = PP
20070  NEXT 
21060  PRINT : PRINT "(PRESS ANY KEY TO CONTINUE)";: GET A$: PRINT : GOTO 100
30000  REM  >>> BATTLE ROUTINE
30010  IF M < 1 THEN  PRINT : PRINT "THERE IS NO ONE HERE TO FIGHT.": PRINT : PRINT "(PRESS ANY KEY TO CONTINUE)";: GET A$: PRINT : GOTO 100
30020  IF M = 1 THEN  PRINT MN$(1);" LOOKS UP AT YOU AND": PRINT "SAYS:": PRINT  CHR$ (34);"WELL, IF YOU THINK I'M GOING TO KILL ": PRINT "MYSELF, YOU'RE OUTTA YER BLOODY MIND!!"; CHR$ (34): PRINT : PRINT "(PRESS ANY KEY TO CONTINUE)";: GET A$: PRINT : GOTO 100
30024  SPEED= 150
30025  FOR X = 1 TO M:MD%(X,9) = 0:MD%(X,10) = 0: NEXT :MF = M
30030  FOR OF = 1 TO M: IF MD%(OF,10) THEN  NEXT : GOTO 30030
30035  IF MD%(MD%(OF,2),10) THEN MD%(OF,2) =  INT ( RND (1) * M + 1): GOTO 30035
30040 DF = MD%(OF,2): PRINT : PRINT MN$(OF);" ATTACKS ";MN$(DF);"!!"
30050 D = 0:HIT = 0:RAN =  INT ( RND (1) * 100 + 1): IF (RAN < 5 OR RAN < MD%(OF,6) - MD%(DF,4)) AND RAN < 96 THEN HIT = 1
30060  PRINT "  -- A "; MID$ ("MISS!HIT!!",HIT * 5 + 1,5): IF  NOT HIT THEN 33000
30070  FOR X = 1 TO MD%(OF,7):D = D +  INT ( RND (1) * MD%(OF,8) + 1): NEXT :D = D - MD%(DF,5): IF D > 0 THEN MD%(DF,9) = MD%(DF,9) + D
30072  IF D < 1 THEN  PRINT "  BLOW BOUNCES OFF ARMOUR!": GOTO 33000
30075  IF MD%(DF,9) > MD%(DF,1) THEN  PRINT MN$(DF);" IS DEAD!!!":MD%(DF,10) = 1: GOTO 32000
30080  ON  INT (MD%(DF,9) * 5 / MD%(DF,1) + 1) GOSUB 34100,34200,34300,34400,34500
30090  GOTO 33000
32000  REM  >>> DEFENDER DIES
32010 MD%(DF,10) = 1:MF = MF - 1: IF MF < 2 THEN 32900
32030  FOR X = 1 TO M: IF  NOT MD%(X,10) AND X <  > OF THEN MD%(OF,2) = X:MD%(OF,3) = 0:X = M + 1
32040  NEXT 
32090  GOTO 33000
32900  REM  >>> BATTLE IS OVER
32910  SPEED= 255: FOR X = 1 TO M: IF MD%(X,10) <  > 0 THEN  NEXT : PRINT "EVERYBODY LOST!!!!": END 
32920  PRINT MN$(X);" HAS WON!!!":W = X: GOSUB 35000
32940  PRINT : PRINT "(PRESS ANY KEY TO CONTINUE)";: GET A$: PRINT : GOTO 100
33000  REM  >>> BATTLE CONTIUES
33010  IF D > MD%(DF,3) THEN MD%(DF,3) = D:MD%(DF,2) = OF
33020  NEXT : GOTO 30030
34100  PRINT MN$(DF);" IS STILL IN GOOD SHAPE.": RETURN 
34200  PRINT MN$(DF);" IS LIGHTLY INJURED!": RETURN 
34300  PRINT MN$(DF);" IS INJURED!!": RETURN 
34400  PRINT MN$(DF);" IS SEVERELY INJURED!!": RETURN 
34500  PRINT MN$(DF);" IS CRITICALLY WOUNDED!!": RETURN 
35000  REM  >>> TOURNAMENT
35010  PRINT "DO YOU WANT A REMATCH? (Y/N):";
35020  GET A$: IF A$ <  > "Y" AND A$ <  > "N" THEN 35020
35030  PRINT : IF A$ = "Y" THEN  RETURN 
35040  PRINT "DO YOU WANT THE WINNER TO FIGHT AGAIN?": PRINT "(Y/N):"
35050  GET A$: IF A$ <  > "Y" AND A$ <  > "N" THEN 35050
35060  PRINT : IF A$ = "N" THEN M = 0: RETURN 
35070  FOR Y = 1 TO 8:MD%(1,Y) = MD%(W,Y): NEXT :M = 1
35090  RETURN 
40000  REM  >>> QUIT
40010  PRINT D$"CLOSE": END