Advertisement
Guest User

Untitled

a guest
Aug 29th, 2011
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. ##############################################################################
  2. # Trap: shadow creatures
  3. # Summons level-appropriate shadow creatures
  4. ##############################################################################
  5.  
  6. {{
  7. function callback.shadow_creatures_trap_stepped(data, triggerable, triggerer, marker, ev)
  8. if data.triggered == true then
  9. return
  10. end
  11. local x, y = marker:pos()
  12. if not you.see_cell(x, y) then
  13. -- pretend the monster avoided it
  14. return
  15. end
  16. local shadows = 0
  17. for p in iter.rect_iterator(dgn.point(x-4, y-4), dgn.point(x+4, y+4)) do
  18. -- 80 squares iterated and a one-in-ten chance means on average 6 shadows
  19. if (dgn.mons_at(p.x, p.y) == nil and p ~= you.pos() and dgn.is_passable(p.x, p.y) and you.see_cell(p.x, p.y) and crawl.one_chance_in(10)) then
  20. if (dgn.create_monster(p.x, p.y, "generate_awake " .. data.monster .. " dur:5 sum:shadow_creatures")) then
  21. shadows = shadows + 1
  22. end
  23. end
  24. end
  25. if (shadows > 0) then
  26. crawl.mpr("Wisps of shadow whirl around you...")
  27. data.triggered = true
  28. -- remove the trap
  29. dgn.grid(x, y, "floor")
  30. else
  31. crawl.mpr("Nothing happens...")
  32. end
  33. end
  34. }}
  35.  
  36. #############################################
  37. # Shadow creatures: dungeon
  38. #
  39. NAME: shadow_creatures_trap_dungeon
  40. DEPTH: D:3-27
  41. TAGS: allow_dup extra luniq_shadow_creatures_trap
  42. WEIGHT: 100
  43. KFEAT: ^ = pressure plate trap
  44. {{
  45. local tm = TriggerableFunction:new{func="callback.shadow_creatures_trap_stepped",
  46. repeated=true,
  47. data={triggered=false,monster="kobold"} }
  48. tm:add_triggerer(DgnTriggerer:new{type="pressure_plate"})
  49. lua_marker('^', tm)
  50. }}
  51. MAP
  52. A..
  53. .^.
  54. ...
  55. ENDMAP
  56. #############################################
  57. # Shadow creatures: Zot
  58. #
  59. NAME: shadow_creatures_trap_zot
  60. DEPTH: Zot:1-4
  61. TAGS: allow_dup extra luniq_shadow_creatures_trap
  62. WEIGHT: 100
  63. KFEAT: ^ = pressure plate trap
  64. {{
  65. local tm = TriggerableFunction:new{func="callback.shadow_creatures_trap_stepped",
  66. repeated=true,
  67. data={triggered=false,monster="draconian"} }
  68. tm:add_triggerer(DgnTriggerer:new{type="pressure_plate"})
  69. lua_marker('^', tm)
  70. }}
  71. MAP
  72. A..
  73. .^.
  74. ...
  75. ENDMAP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement