Advertisement
Guest User

Untitled

a guest
Sep 4th, 2011
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.64 KB | None | 0 0
  1. #######################
  2. # IOOD trap (mumra)
  3.  
  4. {{
  5.  
  6. -- Generates an orb at the x,y aimed at targetx,targety (precise, not like spell)
  7. -- power is normally HD * 6 for monster spell version, or spell power for player spell
  8. -- So, 180 is equiv to a HD 30 pan lord
  9. function orb_generate(x, y, targetx, targety, power)
  10.   local orb = dgn.create_monster(x, y, 'orb of destruction')
  11.  
  12.   -- Set x, y, velocity
  13.   x = x - 0.5
  14.   y = y - 0.5  
  15.   targetx = targetx - 0.5
  16.   targety = targety - 0.5
  17.   orb.set_prop("iood_x",x)
  18.   orb.set_prop("iood_y",y)
  19.   orb.set_prop("iood_vx",targetx - x)
  20.   orb.set_prop("iood_vy",targety - y)
  21.   orb.set_prop("iood_pow",power)
  22.  
  23.   -- Other misc properties (needs some review and testing)
  24.   orb.set_prop("iood_kc",2)  -- enum KC_OTHER
  25.   orb.set_prop("iood_caster","an orb trap") -- relevant, I think, for cause of death text
  26.  
  27.   -- Normally holds the monster id; shouldn't cause an error, but could try setting to -1 if it does
  28.   -- orb.set_prop("iood_mid",-1)
  29.  
  30. end
  31.  
  32. -- TODO: Avoid enemies triggering it (altho allow summons)
  33. function callback.orb_grate_trap_stepped(data, triggerable, triggerer, marker, ev)
  34.   local x, y = marker:pos()
  35.   local p = dgn.find_marker_positions_by_prop("orb_grate", 1)[1]
  36.   if (p ~= nil) then
  37.     if (dgn.mons_at(p.x, p.y) ~= nil or p == you.pos()) then
  38.       if (you.see_cell(x, y)) then
  39.         crawl.mpr("A part of the floor depresses, but nothing seems to happen.")
  40.         return
  41.       end
  42.     end
  43.     dgn.grid(p.x, p.y, "iron_grate")
  44.     if (you.see_cell(p.x, p.y)) then
  45.       crawl.mpr("An iron grate slams shut!")
  46.     end
  47.   end
  48.   -- Remove the trap (remove following line for repeatable)
  49.   dgn.grid(x, y, "floor")
  50.  
  51.   for slave in iter.slave_iterator("orb_spawn", 1) do
  52.     local target = dgn.find_marker_positions_by_prop("orb_target",1)[1]
  53.  
  54. -- Very high power; might want to change this (or read it from a property on the marker)
  55.     orb_generate(slave.x, slave.y, target.x,target.y, 180)
  56.   end
  57. end
  58. }}
  59.  
  60. ######################################
  61. # Simple orb corridor
  62. # by mumra
  63. # Based on my simple boulder corridor
  64. #
  65. NAME:   orb_corridor_run
  66. DEPTH:  Vault,Crypt,D:15-27
  67. ORIENT: float
  68. KFEAT: ^ = pressure plate trap
  69. KITEM: ^ = *
  70. {{
  71. local tm = TriggerableFunction:new{func="callback.orb_grate_trap_stepped",
  72.                                    repeated=true}
  73. tm:add_triggerer(DgnTriggerer:new{type="pressure_plate"})
  74. lua_marker('^', tm)
  75. lua_marker(',', props_marker { orb_grate=1 })
  76. lua_marker('A', props_marker { orb_spawn=1 })
  77. lua_marker('B', props_marker { orb_target=1 })
  78. }}
  79. KFEAT: AB=floor
  80. MAP
  81. xxxxxxxxxxxxxxxxxx
  82. xA..^............B@
  83. xxx,xxxxxxxxxxxxxx
  84.    @
  85. ENDMAP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement