home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #7 / amigamamagazinepolishissue1998.iso / rozrywka / rpg / amigamud / src / proving / chasm.m < prev    next >
Text File  |  1997-06-22  |  22KB  |  631 lines

  1. /*
  2.  * Amiga MUD
  3.  *
  4.  * Copyright (c) 1997 by Chris Gray
  5.  */
  6.  
  7. /*
  8.  * chasm.m - the chasm rooms area.
  9.  */
  10.  
  11. /* the vertical chimney */
  12.  
  13. define tp_proving tp_chasm CreateTable()$
  14. use tp_chasm
  15.  
  16. define tp_chasm r_chimneyTop CreateThing(r_provingCave)$
  17. SetupRoomP(r_chimneyTop, "at the top of a circular ramp",
  18.     "The ramp slopes steeply but negotiably around a 20 foot diameter "
  19.     "vertical chimney in the stone. The chimney ends not far overhead, but "
  20.     "extends downward out of sight. A narrow passage heads east.")$
  21. Connect(r_sewerCaveA2, r_chimneyTop, D_WEST)$
  22. Scenery(r_chimneyTop, "chimney;20,foot,diameter,vertical.ramp.passage")$
  23. define tp_chasm proc chimneyDrop(thing th)status:
  24.     thing me, here;
  25.     string name;
  26.  
  27.     me := Me();
  28.     name := FormatName(th@p_oName);
  29.     if th@p_oCarryer ~= nil and th@p_oCreator = me then
  30.     here := Here();
  31.     Print("You drop the " + name + " which slides off the ramp and "
  32.         "disappears down the chimney.\n");
  33.     if not me@p_pHidden and CanSee(here, me) then
  34.         OPrint(Capitalize(CharacterNameG(me)) +
  35.         AAn(" drops", name) +
  36.         " which slides off the ramp and disappears down the "
  37.         "chimney.\n");
  38.     fi;
  39.     ZapObject(th);
  40.     DelElement(me@p_pCarrying, th);
  41.     succeed
  42.     else
  43.     Print("You'd better not drop the " + name + " here!\n");
  44.     fail
  45.     fi
  46. corp;
  47. AddRoomDropChecker(r_chimneyTop, chimneyDrop, false)$
  48. r_chimneyTop@p_oListenString :=
  49.     "It is very quiet here, and no sound can be heard from the chimney."$
  50. r_chimneyTop@p_oSmellString :=
  51.     "The air is perhaps a bit less stale than normal here - there might be "
  52.     "a very slight breeze coming up out of the chimney."$
  53.  
  54. define tp_chasm r_chimneyMiddle CreateThing(r_provingCave)$
  55. SetupRoomP(r_chimneyMiddle, "on a ramp in a vertical chimney",
  56.     "The chimney ends just within sight overhead, but extends downward out of "
  57.     "sight. A tunnel heads west.")$
  58. Connect(r_chimneyTop, r_chimneyMiddle, D_DOWN)$
  59. Scenery(r_chimneyMiddle, "chimney;vertical.ramp.tunnel")$
  60. AddRoomDropChecker(r_chimneyMiddle, chimneyDrop, false)$
  61. r_chimneyMiddle@p_oSmellString :=
  62.     "The slight breeze seems to be coming from the tunnel."$
  63.  
  64. define tp_chasm r_chimneyBottom CreateThing(r_provingCave)$
  65. SetupRoomP(r_chimneyBottom, "on a ramp in a vertical chimney",
  66.     "The chimney extends up and down out of sight.")$
  67. Scenery(r_chimneyBottom, "chimney;vertical.ramp")$
  68. AddRoomDropChecker(r_chimneyBottom, chimneyDrop, false)$
  69. Connect(r_chimneyMiddle, r_chimneyBottom, D_DOWN)$
  70.  
  71. define tp_chasm p_pChimneyDepth CreateIntProp()$
  72.  
  73. define tp_chasm r_chimney CreateThing(r_tunnel)$
  74. SetupRoomDP(r_chimney, "on a ramp in a vertical chimney",
  75.     "The chimney extends up and down out of sight.")$
  76. Scenery(r_chimney, "chimney;vertical.ramp")$
  77. AddRoomDropChecker(r_chimney, chimneyDrop, false)$
  78. Connect(r_chimneyBottom, r_chimney, D_DOWN)$
  79. UniConnect(r_chimney, r_chimney, D_DOWN)$
  80. r_chimney@p_rNoMachines := true$
  81.  
  82. define tp_chasm proc chimneyDown()status:
  83.     thing me;
  84.  
  85.     me := Me();
  86.     me@p_pChimneyDepth := me@p_pChimneyDepth + 1;
  87.     LeaveRoomStuff(r_chimney, D_DOWN, MOVE_SPECIAL);
  88.     EnterRoomStuff(r_chimney, D_UP, MOVE_SPECIAL);
  89.     fail
  90. corp;
  91.  
  92. AddDownChecker(r_chimneyBottom, chimneyDown, false)$
  93. AddDownChecker(r_chimney, chimneyDown, false)$
  94.  
  95. define tp_chasm proc chimneyUp()status:
  96.     thing me;
  97.     int depth;
  98.  
  99.     me := Me();
  100.     depth := me@p_pChimneyDepth - 1;
  101.     if depth = 0 then
  102.     me -- p_pChimneyDepth;
  103.     LeaveRoomStuff(r_chimneyBottom, D_UP, MOVE_SPECIAL);
  104.     EnterRoomStuff(r_chimneyBottom, D_DOWN, MOVE_SPECIAL);
  105.     continue
  106.     else
  107.     me@p_pChimneyDepth := depth;
  108.     LeaveRoomStuff(r_chimney, D_UP, MOVE_SPECIAL);
  109.     EnterRoomStuff(r_chimney, D_DOWN, MOVE_SPECIAL);
  110.     fail
  111.     fi
  112. corp;
  113.  
  114. AddUpChecker(r_chimney, chimneyUp, false)$
  115.  
  116. define tp_chasm r_tunnelX1 CreateThing(r_provingCave)$
  117. SetupRoomP(r_tunnelX1, "in an east-west tunnel", "")$
  118. Connect(r_chimneyMiddle, r_tunnelX1, D_WEST)$
  119.  
  120. define tp_chasm r_tunnelX2 CreateThing(r_provingCave)$
  121. SetupRoomP(r_tunnelX2, "in an east-west tunnel",
  122.     "There is a faint greenish light coming from the west.")$
  123. Connect(r_tunnelX1, r_tunnelX2, D_WEST)$
  124.  
  125. define tp_chasm r_tunnelX3 CreateThing(r_provingCave)$
  126. SetupRoomP(r_tunnelX3, "in an east-west tunnel",
  127.     "There is a steady greenish light coming from the west.")$
  128. Connect(r_tunnelX2, r_tunnelX3, D_WEST)$
  129.  
  130. /* the chasm area */
  131.  
  132. define tp_chasm o_chasm CreateThing(nil)$
  133. FakeObject(o_chasm, nil, "chasm;deep",
  134.     "The chasm is a deep crack in the earth. It is so deep that you cannot "
  135.     "see the bottom, only blackness. The chasm is far too wide to jump "
  136.     "across.")$
  137.  
  138. define tp_chasm PR_CHASM1_ID NextEffectId()$
  139. define tp_chasm proc drawChasm1()void:
  140.  
  141.     if not KnowsEffect(nil, PR_CHASM1_ID) then
  142.     DefineEffect(nil, PR_CHASM1_ID);
  143.     GSetImage(nil, "Proving/chasm1");
  144.     IfFound(nil);
  145.         ShowCurrentImage();
  146.     Else(nil);
  147.         GSetPen(nil, C_DARK_GREY);
  148.         GAMove(nil, 0.0, 0.0);
  149.         GRectangle(nil, 0.5, 1.0, true);
  150.  
  151.         GSetPen(nil, C_LIGHT_GREY);
  152.         GPolygonStart(nil);
  153.         GAMove(nil, 0.499, 0.65);
  154.         GADraw(nil, 0.25, 0.65);
  155.         GADraw(nil, 0.0, 0.75);
  156.         GADraw(nil, 0.0, 0.45);
  157.         GADraw(nil, 0.219, 0.35);
  158.         GADraw(nil, 0.234, 0.0);
  159.         GADraw(nil, 0.266, 0.0);
  160.         GADraw(nil, 0.281, 0.35);
  161.         GADraw(nil, 0.484, 0.35);
  162.         GADraw(nil, 0.484, 0.555);
  163.         GADraw(nil, 0.499, 0.555);
  164.         GPolygonEnd(nil);
  165.  
  166.         GSetPen(nil, C_BLACK);
  167.         GPolygonStart(nil);
  168.         GAMove(nil, 0.484, 0.55);
  169.         GADraw(nil, 0.25, 0.55);
  170.         GADraw(nil, 0.0, 0.65);
  171.         GADraw(nil, 0.0, 0.55);
  172.         GADraw(nil, 0.25, 0.45);
  173.         GADraw(nil, 0.484, 0.45);
  174.         GPolygonEnd(nil);
  175.     Fi(nil);
  176.     EndEffect();
  177.     fi;
  178.     CallEffect(nil, PR_CHASM1_ID);
  179. corp;
  180.  
  181. define tp_chasm CHASM1_MAP_GROUP NextMapGroup()$
  182.  
  183. define tp_chasm r_chasmModel1 CreateThing(r_tunnel)$
  184. r_chasmModel1@p_rName := "on a ledge overlooking a chasm"$
  185. r_chasmModel1@p_rName1 := "Chasm"$
  186. r_chasmModel1@p_MapGroup := CHASM1_MAP_GROUP$
  187. r_chasmModel1@p_rDrawAction := drawChasm1$
  188. r_chasmModel1@p_rEnterRoomDraw := EnterRoomDraw$
  189. r_chasmModel1@p_rLeaveRoomDraw := LeaveRoomDraw$
  190. r_chasmModel1@p_oListenString :=
  191.     "You can hear water sounds coming up from the depths of the chasm, "
  192.     "but there is no way to tell what they are."$
  193. r_chasmModel1@p_oSmellString :=
  194.     "The large size of this chamber, in combination with the slight "
  195.     "airflow through it, combine to make it reasonably fresh."$
  196. Scenery(r_chasmModel1, "minerals;glowing.ledge.glow;green")$
  197. monsterSet4(r_chasmModel1)$
  198. SetThingStatus(r_chasmModel1, ts_readonly)$
  199.  
  200. define tp_chasm proc makeChasm1(string desc; fixed x, y)thing:
  201.     thing chasm;
  202.  
  203.     chasm := CreateThing(r_chasmModel1);
  204.     if desc ~= "" then
  205.     chasm@p_rDesc := desc;
  206.     fi;
  207.     chasm@p_rContents := CreateThingList();
  208.     chasm@p_rExits := CreateIntList();
  209.     chasm@p_rCursorX := x;
  210.     chasm@p_rCursorY := y;
  211.     AddTail(chasm@p_rContents, o_chasm);
  212.     SetThingStatus(chasm, ts_wizard);
  213.     chasm
  214. corp;
  215.  
  216. define tp_chasm r_chasm1 makeChasm1(
  217.     "You are at the east end of a large, narrow cave which is dominated by a "
  218.     "deep chasm running down the center. Glowing minerals in the ceiling of "
  219.     "the cave provide ample light. Narrow ledges on both sides of the chasm "
  220.     "give room for passage. You are on the south side of the chasm and there "
  221.     "is no visible way to get to the north side. The ledge continues to the "
  222.     "west, and a tunnel heads east.", 0.478, 0.6)$
  223. Connect(r_tunnelX3, r_chasm1, D_WEST)$
  224. Connect(r_tunnelX3, r_chasm1, D_EXIT)$
  225. Scenery(r_chasm1, "tunnel")$
  226.  
  227. define tp_chasm r_chasm2 makeChasm1(
  228.     "The cave bends slightly here, with the west end angling slightly to the "
  229.     "south. Across the chasm, you can see a deep crack leading north from the "
  230.     "ledge on that side.", 0.259, 0.6)$
  231. Connect(r_chasm1, r_chasm2, D_WEST)$
  232. Scenery(r_chasm2, "crack;deep")$
  233.  
  234. define tp_chasm r_chasm3 makeChasm1("", 0.019, 0.7)$
  235. Connect(r_chasm2, r_chasm3, D_WEST)$
  236.  
  237. define tp_chasm r_chasm4 makeChasm1(
  238.     "The ledge on this side of the chasm comes to an end here.", 0.471, 0.4)$
  239.  
  240. define tp_chasm r_chasm5 makeChasm1(
  241.     "A deep crack heads north from here.", 0.25, 0.4)$
  242. Connect(r_chasm4, r_chasm5, D_WEST)$
  243. Scenery(r_chasm5, "crack;deep")$
  244.  
  245. define tp_proving r_chasm6 makeChasm1(
  246.     "The crack comes to an end here in a solid rock wall. There is a sturdy "
  247.     "door in the rock, however.", 0.25, 0.04)$
  248. r_chasm6@p_rName := "deep in the crack"$
  249. Connect(r_chasm5, r_chasm6, D_NORTH)$
  250. Scenery(r_chasm6,
  251.     "crack;deep.wall;solid,rock.beam;massive,wooden.strap;thick,iron")$
  252. r_chasm6@p_rHintString := "The key is kept a fair ways away from here."$
  253.  
  254. define tp_chasm r_chasm7 makeChasm1("", 0.019, 0.49)$
  255. Connect(r_chasm5, r_chasm7, D_WEST)$
  256.  
  257. define tp_chasm PR_CHASM2_ID NextEffectId()$
  258. define tp_chasm proc drawChasm2()void:
  259.  
  260.     if not KnowsEffect(nil, PR_CHASM2_ID) then
  261.     DefineEffect(nil, PR_CHASM2_ID);
  262.     GSetImage(nil, "Proving/chasm2");
  263.     IfFound(nil);
  264.         ShowCurrentImage();
  265.     Else(nil);
  266.         GSetPen(nil, C_DARK_GREY);
  267.         GAMove(nil, 0.0, 0.0);
  268.         GRectangle(nil, 0.5, 1.0, true);
  269.  
  270.         GSetPen(nil, C_LIGHT_GREY);
  271.         GPolygonStart(nil);
  272.         GAMove(nil, 0.499, 0.75);
  273.         GADraw(nil, 0.25, 0.85);
  274.         GADraw(nil, 0.0, 0.85);
  275.         GADraw(nil, 0.0, 0.76);
  276.         GADraw(nil, 0.016, 0.76);
  277.         GADraw(nil, 0.016, 0.55);
  278.         GADraw(nil, 0.25, 0.55);
  279.         GADraw(nil, 0.499, 0.45);
  280.         GPolygonEnd(nil);
  281.  
  282.         GSetPen(nil, C_BLACK);
  283.         GPolygonStart(nil);
  284.         GAMove(nil, 0.499, 0.65);
  285.         GADraw(nil, 0.25, 0.75);
  286.         GADraw(nil, 0.0, 0.75);
  287.         GADraw(nil, 0.0, 0.65);
  288.         GADraw(nil, 0.25, 0.65);
  289.         GADraw(nil, 0.499, 0.55);
  290.         GPolygonEnd(nil);
  291.  
  292.         GSetPen(nil, C_MEDIUM_BROWN);
  293.         GAMove(nil, 0.109, 0.635);
  294.         GRectangle(nil, 0.03125, 0.14, true);
  295.         GSetPen(nil, C_BROWN);
  296.         GAMove(nil, 0.112, 0.635);
  297.         GRectangle(nil, 0.025, 0.14, true);
  298.     Fi(nil);
  299.     EndEffect();
  300.     fi;
  301.     CallEffect(nil, PR_CHASM2_ID);
  302. corp;
  303.  
  304. define tp_chasm CHASM2_MAP_GROUP NextMapGroup()$
  305.  
  306. define tp_chasm r_chasmModel2 CreateThing(r_tunnel)$
  307. r_chasmModel2@p_rName := "on a ledge overlooking a chasm"$
  308. r_chasmModel2@p_rName1 := "Chasm"$
  309. r_chasmModel2@p_MapGroup := CHASM2_MAP_GROUP$
  310. r_chasmModel2@p_rDrawAction := drawChasm2$
  311. r_chasmModel2@p_rEnterRoomDraw := EnterRoomDraw$
  312. r_chasmModel2@p_rLeaveRoomDraw := LeaveRoomDraw$
  313. r_chasmModel2@p_oListenString :=
  314.     "You can hear water sounds coming up from the depths of the chasm, "
  315.     "but there is no way to tell what they are."$
  316. r_chasmModel2@p_oSmellString :=
  317.     "The large size of this chamber, in combination with the slight "
  318.     "airflow through it, combine to make it reasonably fresh."$
  319. Scenery(r_chasmModel2, "minerals;glowing.ledge.glow;green")$
  320. monsterSet4(r_chasmModel2)$
  321. SetThingStatus(r_chasmModel2, ts_readonly)$
  322.  
  323. define tp_chasm proc makeChasm2(string desc; fixed x, y)thing:
  324.     thing chasm;
  325.  
  326.     chasm := CreateThing(r_chasmModel2);
  327.     if desc ~= "" then
  328.     chasm@p_rDesc := desc;
  329.     fi;
  330.     chasm@p_rContents := CreateThingList();
  331.     chasm@p_rExits := CreateIntList();
  332.     chasm@p_rCursorX := x;
  333.     chasm@p_rCursorY := y;
  334.     AddTail(chasm@p_rContents, o_chasm);
  335.     SetThingStatus(chasm, ts_wizard);
  336.     chasm
  337. corp;
  338.  
  339. define tp_chasm r_chasm8 makeChasm2("", 0.487, 0.71)$
  340. Connect(r_chasm3, r_chasm8, D_WEST)$
  341.  
  342. define tp_chasm r_chasm9 makeChasm2(
  343.     "The cave takes another slight bend here, with the west end now going "
  344.     "pretty well straight west. You can see a bridge over the chasm just to "
  345.     "the west of here.", 0.256, 0.8)$
  346. Connect(r_chasm8, r_chasm9, D_WEST)$
  347. Scenery(r_chasm9, "bridge")$
  348.  
  349. define tp_chasm r_chasm10 makeChasm2(
  350.     "There is a bridge heading north across the chasm here. There are also "
  351.     "a lot of bones lying around here, some of them quite fresh, and some of "
  352.     "them quite large.", 0.124, 0.81)$
  353. Connect(r_chasm9, r_chasm10, D_WEST)$
  354. Scenery(r_chasm10, "bones;quite,large,fresh")$
  355.  
  356. define tp_chasm o_bridge CreateThing(nil)$
  357. FakeObject(o_bridge, r_chasm10, "bridge;wooden",
  358.     "The bridge is built from wood and is fairly old, but it looks like it "
  359.     "should be able to support your weight.")$
  360. o_bridge@p_Image := "Proving/chasmBridge"$
  361.  
  362. define tp_chasm r_chasm11 makeChasm2(
  363.     "The ledge on the other side of the chasm ends at this point in the cave, "
  364.     "but the one on this side leads right up to a tunnel opening. You can "
  365.     "smell some bad smells coming out of the tunnel.", 0.016, 0.81)$
  366. Connect(r_chasm10, r_chasm11, D_WEST)$
  367. Scenery(r_chasm11, "tunnel.opening;tunnel")$
  368. r_chasm11@p_oSmellString :=
  369.     "The rank odour is quite strong. One component seems to be rotten meat, "
  370.     "and another unwashed bodies."$
  371.  
  372. define tp_chasm r_chasm12 makeChasm2("", 0.481, 0.5)$
  373. Connect(r_chasm7, r_chasm12, D_WEST)$
  374.  
  375. define tp_chasm r_chasm13 makeChasm2(
  376.     "The cave takes another slight bend here, with the west end now going "
  377.     "pretty well straight west. You can see a bridge over the chasm just to "
  378.     "the west of here.", 0.259, 0.59)$
  379. Connect(r_chasm12, r_chasm13, D_WEST)$
  380. Scenery(r_chasm13, "bridge")$
  381.  
  382. define tp_chasm r_chasm14 makeChasm2(
  383.     "There is a bridge heading south across the chasm here. There are also "
  384.     "a lot of bones lying around here, some of them quite fresh, and some of "
  385.     "them quite large.", 0.124, 0.59)$
  386. Connect(r_chasm13, r_chasm14, D_WEST)$
  387. AddTail(r_chasm14@p_rContents, o_bridge)$
  388. Scenery(r_chasm14, "bones;quite,large,fresh,old")$
  389.  
  390. define tp_chasm r_chasm15 makeChasm2(
  391.     "The ledge along this side of the chasm comes to an end here. You cannot "
  392.     "go any further to the west.", 0.03125, 0.59)$
  393. Connect(r_chasm14, r_chasm15, D_WEST)$
  394.  
  395. define tp_chasm r_bridge makeChasm2("", 0.124, 0.7)$
  396. r_bridge@p_rName := "on a bridge over a chasm"$
  397. RoomName(r_bridge, "Bridge", "")$
  398. Connect(r_chasm10, r_bridge, D_NORTH)$
  399. Connect(r_chasm14, r_bridge, D_SOUTH)$
  400. AddTail(r_bridge@p_rContents, o_bridge)$
  401.  
  402. ignore DeleteSymbol(tp_chasm, "makeChasm2")$
  403. ignore DeleteSymbol(tp_chasm, "makeChasm1")$
  404.  
  405. /* here for a while is the stuff for the guardian troll */
  406.  
  407. define tp_chasm TROLL_HITS 50$
  408. define tp_chasm p_mTrollActive CreateBoolProp()$
  409. define tp_chasm p_pPlayerTryCross CreateBoolProp()$
  410.  
  411. define tp_chasm proc trollBridgeStepOn()status:
  412.     Me()@p_pPlayerTryCross := true;
  413.     continue
  414. corp;
  415. AddNorthChecker(r_chasm10, trollBridgeStepOn, false)$
  416.  
  417. define tp_chasm proc guardianTrollStep()void:
  418.     int hits;
  419.     thing me, target;
  420.  
  421.     /* m_guardianTroll not defined yet! */
  422.     me := Me();
  423.     hits := me@p_pHitNow + 5;
  424.     if hits > TROLL_HITS then
  425.     hits := TROLL_HITS;
  426.     fi;
  427.     me@p_pHitNow := hits;
  428.     if me@p_mTrollActive then
  429.     target := me@p_pCurrentTarget;
  430.     if target ~= nil then
  431.         if AgentLocation(target) ~= r_bridge then
  432.         me -- p_pCurrentTarget;
  433.         if FindAgentWithFlag(r_bridge, p_pStandard) = nil then
  434.             /* nobody here - go back to bed */
  435.             me@p_mTrollActive := false;
  436.             SetAgentLocation(me, nil);
  437.         fi;
  438.         else
  439.         if Random(2) = 0 then
  440.             ignore MonsterHitPlayer(me, target, r_bridge);
  441.             PlayMonsterSound(me, nil);
  442.         else
  443.             MonsterAction(me);
  444.         fi;
  445.         fi;
  446.     else
  447.         if FindAgentWithFlag(r_bridge, p_pStandard) ~= nil then
  448.         /* someone here - dance for them */
  449.         MonsterAction(me);
  450.         else
  451.         me@p_mTrollActive := false;
  452.         SetAgentLocation(me, nil);
  453.         fi;
  454.     fi;
  455.     fi;
  456.     MonsterReschedule(me);
  457. corp;
  458.  
  459. define tp_chasm proc guardianTrollKill(thing thePlayer, troll)bool:
  460.  
  461.     Print("You have defeated the guardian troll! Nursing its wounds, it "
  462.     "climbs back under the bridge. You quickly take the opportunity to "
  463.     "dash the rest of the way across the bridge.\n");
  464.     OPrint(Capitalize(CharacterNameG(Me())) +
  465.     " has defeated the guardian troll!. "
  466.     "Nursing its wounds, it climbs back under the bridge.\n");
  467.     troll@p_mTrollActive := false;
  468.     troll -- p_pCurrentTarget;
  469.     ignore ForceAction(troll, DoUnShowIcon);
  470.     PlayMonsterSound(troll, thePlayer);
  471.     SetAgentLocation(troll, nil);
  472.     thePlayer -- p_pPlayerTryCross;
  473.     ignore EnterRoom(r_chasm14, D_NORTH, MOVE_NORMAL);
  474.     false
  475. corp;
  476.  
  477. /* want the PLAYER to cross the bridge, not the troll! */
  478.  
  479. define tp_chasm proc doCrossBridge()status:
  480.     ignore EnterRoom(r_chasm14, D_NORTH, MOVE_NORMAL);
  481.     continue
  482. corp;
  483.  
  484. /* called by ForceAction, so done by troll */
  485. define tp_chasm proc guardianTrollGivePre()status:
  486.     thing it, trueMe;
  487.     string name;
  488.  
  489.     trueMe := TrueMe();
  490.     it := It();
  491.     name := FormatName(it@p_oName);
  492.     if it@p_oCarryer ~= nil and it@p_oCreator = trueMe then
  493.     if MatchName(it@p_oName, "apple") ~= -1 then
  494.         /* troll is not too bright, any apple-ish thing is good enough! */
  495.         if trueMe@p_pPlayerTryCross then
  496.         SPrint(trueMe,
  497.             "The troll sniffs the apple and looks happy (or at "
  498.             "least as happy as a troll can look!). With an expression "
  499.             "something like delight, it takes a bite of the apple. "
  500.             "Seeing that it is preoccupied, you make a dash for the "
  501.             "far side. The troll notices and tries to stop you, "
  502.             "but you are able to duck under its arm and cross to "
  503.             "the other side. It turns and glares at you, but does "
  504.             "not pursue you.\n");
  505.         ABPrint(r_bridge, trueMe, trueMe,
  506.             Capitalize(CharacterNameG(trueMe)) +
  507.             " somehow gets past the troll and is "
  508.             "able to cross to the other side.\n");
  509.         trueMe -- p_pPlayerTryCross;
  510.         ignore ForceAction(trueMe, doCrossBridge);
  511.         else
  512.         SPrint(trueMe,
  513.           "The troll sniffs the apple and happily gobbles it down!\n");
  514.         fi;
  515.     else
  516.         SPrint(trueMe,
  517.         "The troll sniffs the " + name + " but isn't impressed. "
  518.         "It tosses the " + name + " over the side of the bridge.\n");
  519.         ABPrint(r_bridge, trueMe, trueMe,
  520.         "The troll tosses something over the side of the bridge.\n");
  521.     fi;
  522.     ZapObject(it);
  523.     DelElement(trueMe@p_pCarrying, it);
  524.     succeed
  525.     else
  526.     SPrint(trueMe,
  527.         "The troll sniffs the " + name + " but isn't impressed. " +
  528.         "It tosses the " + name + " back to you.\n");
  529.     fail
  530.     fi
  531. corp;
  532.  
  533. define tp_chasm m_guardianTroll CreateMonsterModel("troll,tro;guardian",
  534.     "The guardian troll is quite large, standing about 7 feet tall and nearly "
  535.     "that much around. It has small beady eyes, a piglike snout and huge "
  536.     "tusks. Its arms are like tree-trunks, and its fingers have knifelike "
  537.     "claws. The guardian troll isn't wearing any armour, but its scales and "
  538.     "skin look thick enough to ward off all but the best sword thrusts.",
  539.     nil, guardianTrollStep, TROLL_HITS, 4, 6, 7, 30, 0)$
  540. AddModelAction(m_guardianTroll, "bellows")$
  541. AddModelAction(m_guardianTroll, "raises its fists and roars")$
  542. AddModelAction(m_guardianTroll, "rumbles ominously")$
  543. AddModelAction(m_guardianTroll, "glares threateningly")$
  544. AddModelAction(m_guardianTroll, "grins nastily")$
  545. AddModelAction(m_guardianTroll, "beckons encouragingly")$
  546. AddModelAction(m_guardianTroll, "rubs its hands expectantly")$
  547. AddModelAction(m_guardianTroll,
  548.     "frowns slightly and mutters \"You doctor? Keep away doctor!\"")$
  549. m_guardianTroll@p_mTrollActive := false$
  550. m_guardianTroll@p_mKillAction := guardianTrollKill$
  551. m_guardianTroll@p_pGivePre := guardianTrollGivePre$
  552. m_guardianTroll@p_Image := "Characters/guardianTroll"$
  553. m_guardianTroll@p_mSound := "guardianTroll"$
  554. SetupMachine(m_guardianTroll)$
  555. CreateMachine(m_guardianTroll@p_pName, m_guardianTroll, nil,
  556.           DummyMonsterInit)$
  557. ignore SetMachineActive(m_guardianTroll, guardianTrollStep)$
  558.  
  559. define tp_chasm proc trollBridgeCross()status:
  560.  
  561.     if Me()@p_pPlayerTryCross then
  562.     if m_guardianTroll@p_mTrollActive then
  563.         Print("The guardian troll blocks your path.\n");
  564.     else
  565.         m_guardianTroll@p_mTrollActive := true;
  566.         Print("As you try to walk the rest of the way across the bridge, "
  567.         "there is a roar from somewhere underneath, and the "
  568.         "guardian troll quickly climbs out and blocks your way "
  569.         "across the bridge.\n");
  570.         /* could be someone crossing back and standing here */
  571.         OPrint("There is a roar from underneath the bridge, and the "
  572.         "guardian troll climbs out and confronts " +
  573.         CharacterNameG(Me()) + ".\n");
  574.         SetAgentLocation(m_guardianTroll, r_bridge);
  575.         ignore ForceAction(m_guardianTroll, DoShowIcon);
  576.     fi;
  577.     PlayMonsterSound(m_guardianTroll, Me());
  578.     fail
  579.     else
  580.     if m_guardianTroll@p_mTrollActive then
  581.         Print("Luckily, the guardian troll is occupied and doesn't "
  582.         "notice you messing around behind its back!\n");
  583.     fi;
  584.     continue
  585.     fi
  586. corp;
  587. AddNorthChecker(r_bridge, trollBridgeCross, false)$
  588.  
  589. define tp_chasm proc bridgeClimb()void:
  590.     if m_guardianTroll@p_mTrollActive then
  591.     Print("There is no way the troll is going to let you climb down into "
  592.         "its hidey-hole!\n");
  593.     else
  594.     Print("Climbing down into the hidey-hole of a troll is not a "
  595.         "good idea!\n");
  596.     fi;
  597. corp;
  598. AddSpecialCommand(r_bridge, "climb", bridgeClimb)$
  599.  
  600. define tp_chasm r_trollRoom CreateThing(r_provingCave)$
  601. SetupRoomP(r_trollRoom, "in a squalid cave",
  602.     "This cave is quite large and is clearly home to a large number of "
  603.     "trolls. There are piles of bones and half-eaten meat everywhere, along "
  604.     "with other refuse not to be mentioned. The exit to the east admits a "
  605.     "steady green glow.")$
  606. r_trollRoom@p_rDark := false$    /* override r_provingCave */
  607. Connect(r_chasm11, r_trollRoom, D_WEST)$
  608. Connect(r_chasm11, r_trollRoom, D_ENTER)$
  609. Scenery(r_trollRoom,
  610.   "cave.bone;piles,pile,of.pile.meat;half-eaten,half,eaten.refuse.glow;green")$
  611. r_trollRoom@p_oSmellString := "WHEW! The stink is indescribable!"$
  612. r_trollRoom@p_rLastVisit := Time()$
  613. r_trollRoom@p_Image := "Proving/trollRoom"$
  614.  
  615. define tp_chasm proc trollEnter(thing room)void:
  616.     thing me;
  617.     int now, i;
  618.  
  619.     now := Time();
  620.     me := Me();
  621.     if me@p_pStandard and now - r_trollRoom@p_rLastVisit >= 300 then
  622.     r_trollRoom@p_rLastVisit := now;
  623.     for i from 0 upto Random(4) + 3 do
  624.         ignore CreateMonster(me, m_largeTroll, r_trollRoom);
  625.     od;
  626.     fi;
  627. corp;
  628. AddAnyEnterAction(r_trollRoom, trollEnter, false)$
  629.  
  630. unuse tp_chasm
  631.