Play Live Overview Routines Objects Global Vars Properties
"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.

<ROUTINE I-SWORD ("AUX" (DEM <INT I-SWORD>) (NG 0) P T L)
<COND (<IN? ,SWORD ,ADVENTURER>
<COND (<AND <==? ,HERE ,CLIFF> <NOT ,MAN-GONE>> <SET NG 1>)
(<AND <==? ,HERE ,CLIFF-LEDGE> ,MAN-FLAG> <SET NG 1>)
(<INFESTED? ,HERE> <SET NG 2>)
(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 (<EQUAL? .L ,UEXIT ,CEXIT ,DEXIT>
<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>)>>

The glow level. Set by I-SWORD.

See this note, however.

<GLOBAL SWORD-STATE 0>
<ROUTINE INFESTED? (R "AUX" (F <FIRST? .R>))
<REPEAT ()
<COND (<NOT .F> <RETURN <>>)
(<AND <FSET? .F ,VILLAIN> <NOT <FSET? .F ,INVISIBLE>>>
<RETURN .F>)
(<NOT <SET F <NEXT? .F>>> <RETURN <>>)>>>