################################################################################
# Magic Research serial vault by HangedMan.
# With reality being manipulated, warped, and adapted to random whims regularly,
# the study of some specific rather magically-attuned monsters
# might be of interest for further comprehension, or at least spellbook-writing.
#
# No dedicated casters, and almost no demons or dragons.
# The former already possess significant understanding of specific subjects,
# while the latter are mostly not particularly elementally attuned.
#
# Bring rEverything!
#
# Note:
# Schools covered: Fire, Ice, Air, Earth, Alchemy, Necromancy,
# Translocations, Summonings, Hexes.
# Schools not covered: Conjurations. Too little to work with right now.
# Other magic concepts might be interesting; additions are always welcome!

default-depth: Depths:1, Vaults, !Vaults:$, Elf, !Elf:$

{{
function init_research(e, disc)
  e.tags('serial_research')
  e.tags('no_monster_gen')
  e.tags('patrolling')
  e.weight('1')
  if you.in_branch("Elf") then
     e.kmons('0 = deep elf pyromancer / deep elf zephyrmancer / deep elf knight w:5 / deep elf archer w:5')
  else
     e.kmons('0 = arcanist w:5 / occultist w:5 / ogre mage / naga mage w:8 / deep elf pyromancer w:5 / deep elf zephyrmancer w:5')
  end
  e.kmask('@, = !no_monster_gen')
  e.shuffle('abcdefghi')
  e.subst('abcd = c')
  e.subst('efg = v')
  e.subst('hi = b')
  e.colour('v = white')
  e.tile('n = DNGN_TRANSPARENT_STONE_WHITE')
  e.kitem('D = randbook disc:' .. disc .. ' numspells:' ..
               4 + crawl.random2(2) .. ', star_item')
end
}}

NAME:   serial_magic_research
TAGS:   extra luniq_serial nolayout_encompass
CHANCE: 0.5%
{{
  local c = 4 + crawl.random2(3)
  hook("post_place", function()
    dgn.place_maps{tag="serial_research", count=c}
  end)
}}

################################################################################
NAME:    hangedman_research_pyrotechnics
MONS:    molten gargoyle, fire crab, lava snake, sun moth
KMONS:   D = will-o-the-wisp
COLOUR:  .01234D = red
FTILE:   .+01234D = floor_volcanic
SHUFFLE: 34
: init_research(_G, 'fire')
MAP
@'''@'''@
abcd+dcba
bllll..1b
c2..lll1c
d2l....ld
a.llll00a
b...4lllb
cl33...Dc
dcbadabcd
ENDMAP

NAME:   hangedman_research_thermodynamics
TAGS:   no_pool_fixup
MONS:   hydra simulacrum / fire dragon simulacrum / \
        bunyip simulacrum / snapping turtle simulacrum
MONS:   deep troll simulacrum / golden dragon simulacrum / \
        caustic shrike simulacrum / alligator snapping turtle simulacrum
MONS:   azure jelly
KMONS:  4D = ice statue
COLOUR: .01234D = white
FTILE:  .w+01234D = floor_ice
: init_research(_G, 'ice')
MAP
@'''@'''@
abcd+dcba
b01w.w10b
c2w1w1w2c
dw.w1w.wd
a.w.w.w.a
bwww2wwwb
cD3.w.34c
dcbadabcd
ENDMAP

NAME:   hangedman_research_electronics
MONS:   air elemental / raiju, lightning spire, spark wasp / shock serpent
COLOUR: .v0123D = cyan
FTILE:  .+v0123D = floor_rough_cyan
TILE:   v = dngn_metal_wall_cyan
: init_research(_G, 'air')
MAP
@'''@'''@
abcd+dcba
b3vv.vv3b
c21v.v12c
d.......d
a...v...a
b21...12b
c3v0D0v3c
dcbadabcd
ENDMAP

NAME:    hangedman_research_geology
MONS:    boulder beetle / catoblepas, crystal guardian, iron dragon
KMONS:   D = caustic shrike
COLOUR:  .x012345D = brown
FTILE:   .+x012345D = floor_pebble_brown
TILE:    x = wall_pebble_brown
: init_research(_G, 'earth')
MAP
@'''@'''@
abcd+dcba
b...x...b
c0x1.1x0c
d.2xxx2.d
a.xxDxx.a
b.x3.3x.b
cx..x..xc
dcbadabcd
ENDMAP

NAME:    hangedman_research_toxicology
MONS:    sea snake, mana viper, tarantella, death drake
KMONS:   5D = radroach
KITEM:   E = potion of degeneration ident:type / \
             potion of mutation ident:type
COLOUR:  .012345DE = lightgreen
FTILE:   .+n012345DE = floor_moss
SHUFFLE: 12, 34
: init_research(_G, 'alchemy')
MAP
@'''@'''@
abcd+dcba
b1n...n2b
c1n...n2c
dn+...+nd
a0nEEEn0a
b3nn+nn4b
c3n5D5n4c
dcbadabcd
ENDMAP

NAME:    hangedman_research_thanatology
MONS:    large abomination, place:Depths:$ skeleton
MONS:    ghost crab, place:Depths:$ simulacrum
KMONS:   D = bone dragon
MARKER:  % = lua:fog_machine { cloud_type = "black smoke", pow_min = 10, \
                pow_max = 20, delay = 40, size = 1, walk_dist = 0 }
COLOUR:  .012345D% = w:20 lightgrey / w:5 darkgrey
FTILE:   .+n012345D% = floor_tomb
SHUFFLE: 1234
: dgn.delayed_decay(_G, '%', 'ugly thing skeleton')
: init_research(_G, 'necromancy')
MAP
@'''@'''@
abcd+dcba
b11n.n22b
c1.n.n.2c
d0n...n0d
a.n.%.n.a
b3.n.n.4b
c33nDn44c
dcbadabcd
ENDMAP

NAME:   hangedman_research_quantum
MONS:   blink frog / jumping spider w:7, spatial vortex
KMONS:  D = eldritch tentacle
MARKER: D = lua:fog_machine { cloud_type = "translocational energy", \
            pow_min = 3, pow_max = 10, delay = 50, size = 1, walk_dist = 1 }
COLOUR: .012D = magenta
FTILE:  .n+012D = floor_demonic_red
: init_research(_G, 'translocation')
MAP
@'''@'''@
abcd+dcba
b.......b
c.......c
d.0nnn0.d
a.nn2nn.a
b+n121n+b
c.11D11.c
dcbadabcd
ENDMAP

NAME:    hangedman_research_convocations
MONS:    boggart, worldbinder
KMONS:   D = glowing orange brain
MARKER:  ' = lua:fog_machine { cloud_type = "purple smoke", pow_min = 4, \
                pow_max = 10, delay = 40, size = 2, walk_dist = 1 }
# Note: these colours are to match the Hellbinder wizlab.
COLOUR:  .'0123D = yellow
FTILE:   .'n+0123D = floor_pebble_lightred
SHUFFLE: 12
: init_research(_G, 'summoning')
MAP
@'''@'''@
abcd+dcba
b0.....0b
c+nnnnn+c
d...'...d
a'.1.1.'a
b.1nnn2.b
c2..D..2c
dcbadabcd
ENDMAP

NAME:   hangedman_research_probablistics
MONS:   eidolon, glass eye, great orb of eyes, sphinx
MARKER: V = lua:fog_machine { cloud_type = "seething chaos", pow_min = 3, \
                pow_max = 10, delay = 50, size = 1, walk_dist = 1 }
COLOUR: .01234D = blue
FTILE:  .Vn+01234D = floor_marble
: init_research(_G, 'hexes')
MAP
@'''@'''@
abcd+dcba
b....n4Db
c.V..n23c
d....n12d
a....n..a
b.V..n..b
c.....00c
dcbadabcd
ENDMAP
