366 lines
10 KiB
Plaintext
366 lines
10 KiB
Plaintext
"SUBTITLE MELEE"
|
||
|
||
"melee actions (object functions for villains called with these"
|
||
|
||
<CONSTANT F-DEAD 2> ;"mistah kurtz, he dead."
|
||
<CONSTANT F-FIRST? 5> ;"strike first?"
|
||
|
||
\
|
||
|
||
"blow results"
|
||
|
||
<CONSTANT MISSED 1> ;"attacker misses"
|
||
<CONSTANT KILLED 3> ;"defender dead"
|
||
<CONSTANT LIGHT-WOUND 4> ;"defender lightly wounded"
|
||
<CONSTANT SERIOUS-WOUND 5> ;"defender seriously wounded"
|
||
<CONSTANT STAGGER 6> ;"defender staggered (miss turn)"
|
||
<CONSTANT LOSE-WEAPON 7> ;"defender loses weapon"
|
||
<CONSTANT HESITATE 8> ;"hesitates (miss on free swing)"
|
||
<CONSTANT SITTING-DUCK 9> ;"sitting duck (crunch!)"
|
||
|
||
"tables of melee results"
|
||
|
||
<GLOBAL DEF1
|
||
<TABLE
|
||
MISSED MISSED MISSED MISSED
|
||
STAGGER STAGGER
|
||
STAGGER STAGGER
|
||
KILLED KILLED KILLED KILLED KILLED>>
|
||
|
||
<GLOBAL DEF2A
|
||
<TABLE
|
||
MISSED MISSED MISSED MISSED MISSED
|
||
STAGGER STAGGER
|
||
LIGHT-WOUND LIGHT-WOUND
|
||
KILLED>>
|
||
|
||
<GLOBAL DEF2B
|
||
<TABLE
|
||
MISSED MISSED MISSED
|
||
STAGGER STAGGER
|
||
LIGHT-WOUND LIGHT-WOUND LIGHT-WOUND
|
||
KILLED
|
||
KILLED KILLED KILLED>>
|
||
|
||
<GLOBAL DEF3A
|
||
<TABLE
|
||
MISSED MISSED MISSED MISSED MISSED
|
||
STAGGER STAGGER
|
||
LIGHT-WOUND LIGHT-WOUND
|
||
SERIOUS-WOUND SERIOUS-WOUND>>
|
||
|
||
<GLOBAL DEF3B
|
||
<TABLE
|
||
MISSED MISSED MISSED
|
||
STAGGER STAGGER
|
||
LIGHT-WOUND LIGHT-WOUND LIGHT-WOUND
|
||
SERIOUS-WOUND SERIOUS-WOUND SERIOUS-WOUND>>
|
||
|
||
<GLOBAL DEF3C
|
||
<TABLE
|
||
MISSED
|
||
STAGGER STAGGER
|
||
LIGHT-WOUND LIGHT-WOUND LIGHT-WOUND LIGHT-WOUND
|
||
SERIOUS-WOUND SERIOUS-WOUND SERIOUS-WOUND>>
|
||
|
||
<GLOBAL DEF1-RES
|
||
<TABLE DEF1
|
||
0 ;<REST ,DEF1 2>
|
||
0 ;<REST ,DEF1 4>>>
|
||
|
||
<GLOBAL DEF2-RES
|
||
<TABLE DEF2A
|
||
DEF2B
|
||
0; <REST ,DEF2B 2>
|
||
0; <REST ,DEF2B 4>>>
|
||
|
||
<GLOBAL DEF3-RES
|
||
<TABLE DEF3A
|
||
0 ;<REST ,DEF3A 2>
|
||
DEF3B
|
||
0 ;<REST ,DEF3B 2>
|
||
DEF3C>>
|
||
|
||
\
|
||
|
||
"useful constants"
|
||
|
||
<CONSTANT STRENGTH-MAX 7>
|
||
<CONSTANT STRENGTH-MIN 2>
|
||
<CONSTANT CURE-WAIT 30>
|
||
|
||
"each table entry is:"
|
||
|
||
<CONSTANT V-VILLAIN 0> ;"villain"
|
||
<CONSTANT V-BEST 1> ;"best weapon"
|
||
<CONSTANT V-BEST-ADV 2> ;"advantage it confers"
|
||
<CONSTANT V-PROB 3> ;"prob of waking if unconscious"
|
||
<CONSTANT V-MSGS 4> ;"messages for that villain"
|
||
|
||
<GLOBAL VILLAINS
|
||
<LTABLE <TABLE TROLL SWORD 1 0 TROLL-MELEE>
|
||
<TABLE THIEF KNIFE 1 0 THIEF-MELEE>>>
|
||
|
||
\
|
||
|
||
"I-FIGHT moved to DEMONS"
|
||
|
||
<ROUTINE DO-FIGHT (LEN "AUX" CNT RES O OO (OUT <>))
|
||
<REPEAT ()
|
||
<SET CNT 0>
|
||
<REPEAT ()
|
||
<SET CNT <+ .CNT 1>>
|
||
<COND (<==? .CNT .LEN>
|
||
<SET RES T>
|
||
<RETURN T>)>
|
||
<SET OO <GET ,VILLAINS .CNT>>
|
||
<SET O <GET .OO ,V-VILLAIN>>
|
||
<COND (<NOT <FSET? .O ,FIGHTBIT>>)
|
||
(<NOT <SET RES
|
||
<VILLAIN-BLOW
|
||
.OO
|
||
.OUT>>>
|
||
<SET RES <>>
|
||
<RETURN>)
|
||
(<==? .RES ,UNCONSCIOUS>
|
||
<SET OUT <+ 1 <RANDOM 3>>>)>>
|
||
<COND (.RES
|
||
<COND (<NOT .OUT> <RETURN>)
|
||
(T
|
||
<SET OUT <- .OUT 1>>
|
||
<COND (<0? .OUT> <RETURN>)>)>)
|
||
(ELSE <RETURN>)>>>
|
||
|
||
\
|
||
|
||
"takes a remark, defender, and good-guy's weapon"
|
||
|
||
<ROUTINE REMARK (REMARK D W "AUX" (LEN <GET .REMARK 0>) (CNT 0) STR)
|
||
#DECL ((A D) OBJECT (W) <OR OBJECT FALSE> (LEN CNT) FIX
|
||
(STR) <OR FIX STRING>)
|
||
<REPEAT ()
|
||
<COND (<G? <SET CNT <+ .CNT 1>> .LEN> <RETURN>)>
|
||
<SET STR <GET .REMARK .CNT>>
|
||
<COND (<==? .STR ,F-WEP> <PRINTD .W>)
|
||
(<==? .STR ,F-DEF> <PRINTD .D>)
|
||
(ELSE <PRINT .STR>)>>
|
||
<CRLF>>
|
||
|
||
"Strength of the player is a basic value (S) adjusted by his P?STRENGTH
|
||
property, which is normally 0"
|
||
|
||
<ROUTINE FIGHT-STRENGTH ("OPTIONAL" (ADJUST? T) "AUX" S)
|
||
#DECL ((HERO) ADV (S SMAX SMIN VALUE) FIX (ADJUST?) <OR ATOM FALSE>)
|
||
<SET S
|
||
<+ ,STRENGTH-MIN
|
||
</ ,SCORE
|
||
</ ,SCORE-MAX
|
||
<- ,STRENGTH-MAX ,STRENGTH-MIN>>>>>
|
||
<COND (.ADJUST? <+ .S <GETP ,WINNER ,P?STRENGTH>>)(ELSE .S)>>
|
||
|
||
<ROUTINE VILLAIN-STRENGTH (OO
|
||
"AUX" (VILLAIN <GET .OO ,V-VILLAIN>)
|
||
OD TMP)
|
||
#DECL ((VILLAIN) OBJECT (WV) <OR FALSE VECTOR>
|
||
(OD VALUE) FIX)
|
||
<SET OD <GETP .VILLAIN ,P?STRENGTH>>
|
||
<COND (<NOT <L? .OD 0>>
|
||
<COND (<AND <==? .VILLAIN ,THIEF> ,THIEF-ENGROSSED>
|
||
<COND (<G? .OD 2> <SET OD 2>)>
|
||
<SETG THIEF-ENGROSSED <>>)>
|
||
<COND (<AND ,PRSI
|
||
<FSET? ,PRSI ,WEAPONBIT>
|
||
<==? <GET .OO ,V-BEST> ,PRSI>>
|
||
<SET TMP <- .OD <GET .OO ,V-BEST-ADV>>>
|
||
<COND (<L? .TMP 1> <SET TMP 1>)>
|
||
<SET OD .TMP>)>)>
|
||
.OD>
|
||
|
||
"find a weapon (if any) in possession of argument"
|
||
|
||
<ROUTINE FIND-WEAPON (O "AUX" W)
|
||
<SET W <FIRST? .O>>
|
||
<COND (<NOT .W>
|
||
<RFALSE>)>
|
||
<REPEAT ()
|
||
<COND (<FSET? .W ,WEAPONBIT> <RETURN .W>)
|
||
(<NOT <SET W <NEXT? .W>>> <RETURN <>>)>>>
|
||
|
||
\
|
||
|
||
<ROUTINE VILLAIN-BLOW (OO OUT?
|
||
"AUX" (VILLAIN <GET .OO ,V-VILLAIN>)
|
||
(REMARKS <GET .OO ,V-MSGS>)
|
||
DWEAPON ATT DEF OA OD TBL RES NWEAPON)
|
||
<FCLEAR ,WINNER ,STAGGERED>
|
||
<COND (<FSET? .VILLAIN ,STAGGERED>
|
||
<TELL "The " D .VILLAIN
|
||
" slowly regains his feet." CR>
|
||
<FCLEAR .VILLAIN ,STAGGERED>
|
||
<RTRUE>)>
|
||
<SET OA <SET ATT <VILLAIN-STRENGTH .OO>>>
|
||
<COND (<NOT <G? <SET DEF <FIGHT-STRENGTH>> 0>> <RTRUE>)>
|
||
<SET OD <FIGHT-STRENGTH <>>>
|
||
<SET DWEAPON <FIND-WEAPON ,WINNER>>
|
||
<COND (<L? .DEF 0> <SET RES ,KILLED>)
|
||
(ELSE
|
||
<COND (<1? .DEF>
|
||
<COND (<G? .ATT 2> <SET ATT 3>)>
|
||
<SET TBL <GET ,DEF1-RES <- .ATT 1>>>)
|
||
(<==? .DEF 2>
|
||
<COND (<G? .ATT 3> <SET ATT 4>)>
|
||
<SET TBL <GET ,DEF2-RES <- .ATT 1>>>)
|
||
(<G? .DEF 2>
|
||
<SET ATT <- .ATT .DEF>>
|
||
<COND (<L? .ATT -1> <SET ATT -2>)
|
||
(<G? .ATT 1> <SET ATT 2>)>
|
||
<SET TBL <GET ,DEF3-RES <+ .ATT 2>>>)>
|
||
<SET RES <GET .TBL <- <RANDOM 9> 1>>>
|
||
<REMARK
|
||
<PICK-ONE <GET .REMARKS <- .RES 1>>>
|
||
,WINNER
|
||
.DWEAPON>)>
|
||
<COND (<OR <==? .RES ,MISSED> <==? .RES ,HESITATE>>)
|
||
(<OR <==? .RES ,KILLED> <==? .RES ,SITTING-DUCK>> <SET DEF 0>)
|
||
(<==? .RES ,LIGHT-WOUND>
|
||
<SET DEF <- .DEF 1>>
|
||
<COND (<L? .DEF 0> <SET DEF 0>)>
|
||
<COND (<G? ,LOAD-ALLOWED 50>
|
||
<SETG LOAD-ALLOWED <- ,LOAD-ALLOWED 10>>)>)
|
||
(<==? .RES ,SERIOUS-WOUND>
|
||
<SET DEF <- .DEF 2>>
|
||
<COND (<L? .DEF 0> <SET DEF 0>)>
|
||
<COND (<G? ,LOAD-ALLOWED 50>
|
||
<SETG LOAD-ALLOWED <- ,LOAD-ALLOWED 20>>)>)
|
||
(<==? .RES ,STAGGER> <FSET ,WINNER ,STAGGERED>)>
|
||
<WINNER-RESULT .DEF .RES .OD>>
|
||
|
||
<ROUTINE HERO-BLOW ("AUX" OO VILLAIN DWEAPON ATT DEF (CNT 0)
|
||
OA OD TBL RES NWEAPON (LEN <GET ,VILLAINS 0>))
|
||
#DECL ((VILLAIN) OBJECT (NWEAPON) <OR OBJECT FALSE>
|
||
(RES OA OD ATT DEF FIX) FIX (HERO?) <OR ATOM FALSE>)
|
||
<REPEAT ()
|
||
<SET CNT <+ .CNT 1>>
|
||
<COND (<==? .CNT .LEN> <RETURN>)>
|
||
<SET OO <GET ,VILLAINS .CNT>>
|
||
<COND (<==? <GET .OO ,V-VILLAIN> ,PRSO>
|
||
<RETURN>)>>
|
||
<FSET ,PRSO ,FIGHTBIT>
|
||
<COND (<FSET? ,WINNER ,STAGGERED>
|
||
<TELL
|
||
"You are still recovering from that last blow, so your attack is
|
||
ineffective." CR>
|
||
<FCLEAR ,WINNER ,STAGGERED>
|
||
<RTRUE>)>
|
||
<SET ATT <FIGHT-STRENGTH>>
|
||
<COND (<L? .ATT 1> <SET ATT 1>)>
|
||
<SET OA .ATT>
|
||
<SET VILLAIN <GET .OO ,V-VILLAIN>>
|
||
<COND (<0? <SET OD <SET DEF <VILLAIN-STRENGTH .OO>>>>
|
||
<COND (<==? ,PRSO ,WINNER>
|
||
<RETURN <JIGS-UP
|
||
"Well, you really did it that time. Is suicide painless?">>)>
|
||
<TELL "Attacking the " D .VILLAIN " is pointless." CR>
|
||
<RTRUE>)>
|
||
<SET DWEAPON <FIND-WEAPON .VILLAIN>>
|
||
<COND (<1? .DEF>
|
||
<COND (<G? .ATT 2> <SET ATT 3>)>
|
||
<SET TBL <GET ,DEF1-RES <- .ATT 1>>>)
|
||
(<==? .DEF 2>
|
||
<COND (<G? .ATT 3> <SET ATT 4>)>
|
||
<SET TBL <GET ,DEF2-RES <- .ATT 1>>>)
|
||
(<G? .DEF 2>
|
||
<SET ATT <- .ATT .DEF>>
|
||
<COND (<L? .ATT -1> <SET ATT -2>)
|
||
(<G? .ATT 1> <SET ATT 2>)>
|
||
<SET TBL <GET ,DEF3-RES <+ .ATT 2>>>)>
|
||
<SET RES <GET .TBL <- <RANDOM 9> 1>>>
|
||
<COND (<==? .RES 2> <SET RES 1>)>
|
||
<REMARK
|
||
<PICK-ONE <GET ,HERO-MELEE <- .RES 1>>>
|
||
,PRSO
|
||
,PRSI>
|
||
<COND (<EQUAL? .RES ,MISSED ,HESITATE>)
|
||
(<EQUAL? .RES ,KILLED ,SITTING-DUCK> <SET DEF 0>)
|
||
(<==? .RES ,LIGHT-WOUND>
|
||
<SET DEF <- .DEF 1>>
|
||
<COND (<L? .DEF 0> <SET DEF 0>)>)
|
||
(<==? .RES ,SERIOUS-WOUND>
|
||
<SET DEF <- .DEF 2>>
|
||
<COND (<L? .DEF 0> <SET DEF 0>)>)
|
||
(<==? .RES ,STAGGER> <FSET ,PRSO ,STAGGERED>)>
|
||
<VILLAIN-RESULT ,PRSO .DEF .RES>>
|
||
|
||
\
|
||
|
||
<ROUTINE WINNER-RESULT (DEF RES OD)
|
||
<PUTP ,WINNER
|
||
,P?STRENGTH
|
||
<COND (<0? .DEF> -10000)(ELSE <- .DEF .OD>)>>
|
||
<COND (<L? <- .DEF .OD> 0>
|
||
<ENABLE <QUEUE I-CURE ,CURE-WAIT>>)>
|
||
<COND (<NOT <G? <FIGHT-STRENGTH> 0>>
|
||
<PUTP ,WINNER ,P?STRENGTH <+ 1 <- <FIGHT-STRENGTH <>>>>>
|
||
<JIGS-UP
|
||
"It appears that that last blow was too much for you. I'm afraid you
|
||
are dead.">
|
||
<>)
|
||
(ELSE .RES)>>
|
||
|
||
<ROUTINE VILLAIN-RESULT (VILLAIN DEF RES)
|
||
<PUTP .VILLAIN ,P?STRENGTH .DEF>
|
||
<COND (<0? .DEF>
|
||
<FCLEAR .VILLAIN ,FIGHTBIT>
|
||
<TELL
|
||
"Almost as soon as the " D .VILLAIN " breathes his last breath, a cloud
|
||
of sinister black fog envelops him, and when the fog lifts, his carcass
|
||
and weapon have disappeared." CR>
|
||
<REMOVE .VILLAIN>
|
||
<APPLY <GETP .VILLAIN ,P?ACTION> ,F-DEAD>
|
||
.RES)
|
||
(ELSE .RES)>>
|
||
|
||
\
|
||
|
||
<ROUTINE WINNING? (V "AUX" VS PS)
|
||
#DECL ((V) OBJECT (VS PS) FIX)
|
||
<SET VS <GETP .V ,P?STRENGTH>>
|
||
<SET PS <- .VS <FIGHT-STRENGTH>>>
|
||
<COND (<G? .PS 3> <PROB 90>)
|
||
(<G? .PS 0> <PROB 75>)
|
||
(<0? .PS> <PROB 50>)
|
||
(<G? .VS 1> <PROB 25>)
|
||
(ELSE <PROB 10>)>>
|
||
|
||
<ROUTINE I-CURE ("AUX" (S <GETP ,WINNER ,P?STRENGTH>))
|
||
#DECL ((S) FIX)
|
||
<COND (<G? .S 0> <SET S 0> <PUTP ,WINNER ,P?STRENGTH .S>)
|
||
(<L? .S 0> <SET S <+ .S 1>> <PUTP ,WINNER ,P?STRENGTH .S>)>
|
||
<COND (<L? .S 0>
|
||
<COND (<L? ,LOAD-ALLOWED ,LOAD-MAX>
|
||
<SETG LOAD-ALLOWED <+ ,LOAD-ALLOWED 10>>)>
|
||
<ENABLE <QUEUE I-CURE ,CURE-WAIT>>)
|
||
(ELSE
|
||
<SETG LOAD-ALLOWED ,LOAD-MAX>
|
||
<DISABLE <INT I-CURE>>)>>
|
||
|
||
<ROUTINE V-DIAGNOSE ("AUX" (MS <FIGHT-STRENGTH <>>)
|
||
(WD <GETP ,WINNER ,P?STRENGTH>) (RS <+ .MS .WD>))
|
||
#DECL ((MS WD RS) FIX)
|
||
<COND (<0? <GET <INT I-CURE> ,C-ENABLED?>> <SET WD 0>)
|
||
(ELSE <SET WD <- .WD>>)>
|
||
<COND (<0? .WD> <TELL "You are in perfect health.">)
|
||
(T
|
||
<TELL "You have wounds which will be cured in ">
|
||
<PRINTN
|
||
<+ <* ,CURE-WAIT <- .WD 1>>
|
||
<GET <INT I-CURE> ,C-TICK>>>
|
||
<TELL " moves." CR>)>
|
||
<CRLF>
|
||
<COND (<0? .RS> <TELL "You are at death's door.">)
|
||
(<1? .RS> <TELL "You can be killed by one more wound.">)
|
||
(<==? .RS 2> <TELL "You can be killed by a serious wound.">)
|
||
(<==? .RS 3> <TELL "You can survive one serious wound.">)
|
||
(<G? .RS 3> <TELL "You are still strong.">)>
|
||
<CRLF>>
|