"SWORD demon"
This routine runs every turn that you are carrying the SWORD. It checks adjacent rooms for enemies and displays the “sword is glowing” message.
The sword’s glow level is stored in the SWORD-STATE variable.
See this note, however.
<COND (<IN? ,SWORD ,ADVENTURER>
(<AND <==? ,HERE ,CLIFF-LEDGE> ,MAN-FLAG> <SET NG 1>)
(ELSE
<SET P 0>
<REPEAT ()
<COND (<0? <SET P <NEXTP ,HERE .P>>>
<RETURN>)
(<NOT <L? .P ,LOW-DIRECTION>>
<SET T <GETPT ,HERE .P>>
<SET L <PTSIZE .T>>
<COND (<INFESTED? <GETB .T 0>>
<SET NG 1>
<RETURN>)>)>)>>)>
<COND (<==? .NG ,SWORD-STATE> <RFALSE>)
(<==? .NG 2>
<TELL "Your sword has begun to glow very brightly." CR>)
(<1? .NG>
<TELL "Your sword is glowing with a faint blue glow."
CR>)
(<0? .NG>
<TELL "Your sword is no longer glowing." CR>)>
<SETG SWORD-STATE .NG>
<RTRUE>)
(ELSE <DISABLE .DEM> <RFALSE>)>>
<ROUTINE INFESTED? (R "AUX" (F <FIRST? .R>))
<REPEAT ()
<COND (<NOT .F> <RETURN <>>)
<RETURN .F>)
(<NOT <SET F <NEXT? .F>>> <RETURN <>>)>>>