diff options
-rw-r--r-- | lib/mods/theme/scpt/s_divin.lua | 101 | ||||
-rw-r--r-- | lib/scpt/s_divin.lua | 101 | ||||
-rw-r--r-- | src/externs.h | 20 | ||||
-rw-r--r-- | src/spells.pkg | 23 | ||||
-rw-r--r-- | src/spells3.c | 163 |
5 files changed, 230 insertions, 178 deletions
diff --git a/lib/mods/theme/scpt/s_divin.lua b/lib/mods/theme/scpt/s_divin.lua index 60b0275f..e077f1f0 100644 --- a/lib/mods/theme/scpt/s_divin.lua +++ b/lib/mods/theme/scpt/s_divin.lua @@ -9,17 +9,8 @@ STARIDENTIFY = add_spell ["mana"] = 30, ["mana_max"] = 30, ["fail"] = 80, - ["spell"] = function() - if get_check("Cast on yourself?") == TRUE then - self_knowledge() - else - identify_fully() - end - return TRUE - end, - ["info"] = function() - return "" - end, + ["spell"] = function() return divination_greater_identify() end, + ["info"] = function() return divination_greater_identify_info() end, ["desc"] = { "Asks for an object and fully identify it, providing the full list of powers", "Cast at yourself it will reveal your powers" @@ -44,34 +35,8 @@ IDENTIFY = add_spell ["max_level"] = { 15, 40 }, }, }, - ["spell"] = function() - if get_level(IDENTIFY, 50) >= 27 then - local obvious - obvious = identify_pack() - obvious = is_obvious(fire_ball(GF_IDENTIFY, 0, 1, get_level(IDENTIFY, 3)), obvious) - if obvious == TRUE then - player.notice = bor(player.notice, PN_COMBINE, PN_REORDER) - end - return obvious - elseif get_level(IDENTIFY, 50) >= 17 then - local obvious - obvious = identify_pack() - obvious = is_obvious(fire_ball(GF_IDENTIFY, 0, 1, 0), obvious) - if obvious == TRUE then - player.notice = bor(player.notice, PN_COMBINE, PN_REORDER) - end - return obvious - else - if ident_spell() == TRUE then return TRUE else return end - end - end, - ["info"] = function() - if get_level(IDENTIFY, 50) >= 27 then - return "rad "..(get_level(IDENTIFY, 3)) - else - return "" - end - end, + ["spell"] = function() return divination_identify() end, + ["info"] = function() return divination_identify_info() end, ["desc"] = { "Asks for an object and identifies it", "At level 17 it identifies all objects in the inventory", @@ -99,17 +64,8 @@ VISION = add_spell }, }, ["inertia"] = { 2, 200 }, - ["spell"] = function() - if get_level(VISION, 50) >= 25 then - wiz_lite_extra() - else - map_area() - end - return TRUE - end, - ["info"] = function() - return "" - end, + ["spell"] = function() return divination_vision() end, + ["info"] = function() return divination_vision_info() end, ["desc"] = { "Detects the layout of the surrounding area", "At level 25 it maps and lights the whole level", @@ -135,21 +91,8 @@ SENSEHIDDEN = add_spell }, }, ["inertia"] = { 1, 10 }, - ["spell"] = function() - local obvious = nil - obvious = detect_traps(15 + get_level(SENSEHIDDEN, 40, 0)) - if get_level(SENSEHIDDEN, 50) >= 15 then - obvious = is_obvious(set_tim_invis(10 + randint(20) + get_level(SENSEHIDDEN, 40)), obvious) - end - return obvious - end, - ["info"] = function() - if get_level(SENSEHIDDEN, 50) >= 15 then - return "rad "..(15 + get_level(SENSEHIDDEN, 40)).." dur "..(10 + get_level(SENSEHIDDEN, 40)).."+d20" - else - return "rad "..(15 + get_level(SENSEHIDDEN, 40)) - end - end, + ["spell"] = function() return divination_sense_hidden() end, + ["info"] = function() return divination_sense_hidden_info() end, ["desc"] = { "Detects the traps in a certain radius around you", "At level 15 it allows you to sense invisible for a while" @@ -175,15 +118,8 @@ REVEALWAYS = add_spell }, }, ["inertia"] = { 1, 10 }, - ["spell"] = function() - local obvious - obvious = detect_doors(10 + get_level(REVEALWAYS, 40, 0)) - obvious = is_obvious(detect_stairs(10 + get_level(REVEALWAYS, 40, 0)), obvious) - return obvious - end, - ["info"] = function() - return "rad "..(10 + get_level(REVEALWAYS, 40)) - end, + ["spell"] = function() return divination_reveal_ways() end, + ["info"] = function() return divination_reveal_ways_info() end, ["desc"] = { "Detects the doors/stairs/ways in a certain radius around you", } @@ -208,21 +144,8 @@ SENSEMONSTERS = add_spell }, }, ["inertia"] = { 1, 10 }, - ["spell"] = function() - local obvious - obvious = detect_monsters_normal(10 + get_level(SENSEMONSTERS, 40, 0)) - if get_level(SENSEMONSTERS, 50) >= 30 then - obvious = is_obvious(set_tim_esp(10 + randint(10) + get_level(SENSEMONSTERS, 20)), obvious) - end - return obvious - end, - ["info"] = function() - if get_level(SENSEMONSTERS, 50) >= 30 then - return "rad "..(10 + get_level(SENSEMONSTERS, 40)).." dur "..(10 + get_level(SENSEMONSTERS, 20)).."+d10" - else - return "rad "..(10 + get_level(SENSEMONSTERS, 40)) - end - end, + ["spell"] = function() return divination_sense_monsters() end, + ["info"] = function() return divination_sense_monsters_info() end, ["desc"] = { "Detects all monsters near you", "At level 30 it allows you to sense monster minds for a while" diff --git a/lib/scpt/s_divin.lua b/lib/scpt/s_divin.lua index 60b0275f..e077f1f0 100644 --- a/lib/scpt/s_divin.lua +++ b/lib/scpt/s_divin.lua @@ -9,17 +9,8 @@ STARIDENTIFY = add_spell ["mana"] = 30, ["mana_max"] = 30, ["fail"] = 80, - ["spell"] = function() - if get_check("Cast on yourself?") == TRUE then - self_knowledge() - else - identify_fully() - end - return TRUE - end, - ["info"] = function() - return "" - end, + ["spell"] = function() return divination_greater_identify() end, + ["info"] = function() return divination_greater_identify_info() end, ["desc"] = { "Asks for an object and fully identify it, providing the full list of powers", "Cast at yourself it will reveal your powers" @@ -44,34 +35,8 @@ IDENTIFY = add_spell ["max_level"] = { 15, 40 }, }, }, - ["spell"] = function() - if get_level(IDENTIFY, 50) >= 27 then - local obvious - obvious = identify_pack() - obvious = is_obvious(fire_ball(GF_IDENTIFY, 0, 1, get_level(IDENTIFY, 3)), obvious) - if obvious == TRUE then - player.notice = bor(player.notice, PN_COMBINE, PN_REORDER) - end - return obvious - elseif get_level(IDENTIFY, 50) >= 17 then - local obvious - obvious = identify_pack() - obvious = is_obvious(fire_ball(GF_IDENTIFY, 0, 1, 0), obvious) - if obvious == TRUE then - player.notice = bor(player.notice, PN_COMBINE, PN_REORDER) - end - return obvious - else - if ident_spell() == TRUE then return TRUE else return end - end - end, - ["info"] = function() - if get_level(IDENTIFY, 50) >= 27 then - return "rad "..(get_level(IDENTIFY, 3)) - else - return "" - end - end, + ["spell"] = function() return divination_identify() end, + ["info"] = function() return divination_identify_info() end, ["desc"] = { "Asks for an object and identifies it", "At level 17 it identifies all objects in the inventory", @@ -99,17 +64,8 @@ VISION = add_spell }, }, ["inertia"] = { 2, 200 }, - ["spell"] = function() - if get_level(VISION, 50) >= 25 then - wiz_lite_extra() - else - map_area() - end - return TRUE - end, - ["info"] = function() - return "" - end, + ["spell"] = function() return divination_vision() end, + ["info"] = function() return divination_vision_info() end, ["desc"] = { "Detects the layout of the surrounding area", "At level 25 it maps and lights the whole level", @@ -135,21 +91,8 @@ SENSEHIDDEN = add_spell }, }, ["inertia"] = { 1, 10 }, - ["spell"] = function() - local obvious = nil - obvious = detect_traps(15 + get_level(SENSEHIDDEN, 40, 0)) - if get_level(SENSEHIDDEN, 50) >= 15 then - obvious = is_obvious(set_tim_invis(10 + randint(20) + get_level(SENSEHIDDEN, 40)), obvious) - end - return obvious - end, - ["info"] = function() - if get_level(SENSEHIDDEN, 50) >= 15 then - return "rad "..(15 + get_level(SENSEHIDDEN, 40)).." dur "..(10 + get_level(SENSEHIDDEN, 40)).."+d20" - else - return "rad "..(15 + get_level(SENSEHIDDEN, 40)) - end - end, + ["spell"] = function() return divination_sense_hidden() end, + ["info"] = function() return divination_sense_hidden_info() end, ["desc"] = { "Detects the traps in a certain radius around you", "At level 15 it allows you to sense invisible for a while" @@ -175,15 +118,8 @@ REVEALWAYS = add_spell }, }, ["inertia"] = { 1, 10 }, - ["spell"] = function() - local obvious - obvious = detect_doors(10 + get_level(REVEALWAYS, 40, 0)) - obvious = is_obvious(detect_stairs(10 + get_level(REVEALWAYS, 40, 0)), obvious) - return obvious - end, - ["info"] = function() - return "rad "..(10 + get_level(REVEALWAYS, 40)) - end, + ["spell"] = function() return divination_reveal_ways() end, + ["info"] = function() return divination_reveal_ways_info() end, ["desc"] = { "Detects the doors/stairs/ways in a certain radius around you", } @@ -208,21 +144,8 @@ SENSEMONSTERS = add_spell }, }, ["inertia"] = { 1, 10 }, - ["spell"] = function() - local obvious - obvious = detect_monsters_normal(10 + get_level(SENSEMONSTERS, 40, 0)) - if get_level(SENSEMONSTERS, 50) >= 30 then - obvious = is_obvious(set_tim_esp(10 + randint(10) + get_level(SENSEMONSTERS, 20)), obvious) - end - return obvious - end, - ["info"] = function() - if get_level(SENSEMONSTERS, 50) >= 30 then - return "rad "..(10 + get_level(SENSEMONSTERS, 40)).." dur "..(10 + get_level(SENSEMONSTERS, 20)).."+d10" - else - return "rad "..(10 + get_level(SENSEMONSTERS, 40)) - end - end, + ["spell"] = function() return divination_sense_monsters() end, + ["info"] = function() return divination_sense_monsters_info() end, ["desc"] = { "Detects all monsters near you", "At level 30 it allows you to sense monster minds for a while" diff --git a/src/externs.h b/src/externs.h index a7fd0c42..168fd2ab 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1470,6 +1470,26 @@ char *demonology_discharge_minion_info(); bool_ *demonology_control_demon(); char *demonology_control_demon_info(); +extern s32b STARIDENTIFY; +extern s32b IDENTIFY; +extern s32b VISION; +extern s32b SENSEHIDDEN; +extern s32b REVEALWAYS; +extern s32b SENSEMONSTERS; + +bool_ *divination_greater_identify(); +char *divination_greater_identify_info(); +bool_ *divination_identify(); +char *divination_identify_info(); +bool_ *divination_vision(); +char *divination_vision_info(); +bool_ *divination_sense_hidden(); +char *divination_sense_hidden_info(); +bool_ *divination_reveal_ways(); +char *divination_reveal_ways_info(); +bool_ *divination_sense_monsters(); +char *divination_sense_monsters_info(); + /* randart.c */ extern int get_activation_power(void); extern void build_prob(cptr learn); diff --git a/src/spells.pkg b/src/spells.pkg index 040001ff..5cf18354 100644 --- a/src/spells.pkg +++ b/src/spells.pkg @@ -2499,3 +2499,26 @@ bool_ *demonology_discharge_minion(); char *demonology_discharge_minion_info(); bool_ *demonology_control_demon(); char *demonology_control_demon_info(); + +/* + * Divination + */ +extern s32b STARIDENTIFY; +extern s32b IDENTIFY; +extern s32b VISION; +extern s32b SENSEHIDDEN; +extern s32b REVEALWAYS; +extern s32b SENSEMONSTERS; + +bool_ *divination_greater_identify(); +char *divination_greater_identify_info(); +bool_ *divination_identify(); +char *divination_identify_info(); +bool_ *divination_vision(); +char *divination_vision_info(); +bool_ *divination_sense_hidden(); +char *divination_sense_hidden_info(); +bool_ *divination_reveal_ways(); +char *divination_reveal_ways_info(); +bool_ *divination_sense_monsters(); +char *divination_sense_monsters_info(); diff --git a/src/spells3.c b/src/spells3.c index 3e95c92d..086c6940 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -24,6 +24,13 @@ s32b DEMON_SUMMON; s32b DISCHARGE_MINION; s32b CONTROL_DEMON; +s32b STARIDENTIFY; +s32b IDENTIFY; +s32b VISION; +s32b SENSEHIDDEN; +s32b REVEALWAYS; +s32b SENSEMONSTERS; + /* FIXME: Hackish workaround while we're still tied to Lua. This lets us return Lua's "nil" and a non-nil value (which is all the s_aux.lua cares about). */ @@ -686,3 +693,159 @@ char *demonology_control_demon_info() (50 + get_level_s(CONTROL_DEMON, 250))); return buf; } + +bool_ *divination_greater_identify() +{ + if (get_check("Cast on yourself?")) + { + self_knowledge(NULL); + } + else + { + identify_fully(); + } + return CAST; +} + +char *divination_greater_identify_info() +{ + return ""; +} + +bool_ *divination_identify() +{ + if (get_level_s(IDENTIFY, 50) >= 27) + { + identify_pack(); + fire_ball(GF_IDENTIFY, 0, 1, get_level_s(IDENTIFY, 3)); + p_ptr->notice |= (PN_COMBINE | PN_REORDER); + return CAST; + } + else if (get_level_s(IDENTIFY, 50) >= 17) + { + identify_pack(); + fire_ball(GF_IDENTIFY, 0, 1, 0); + p_ptr->notice |= (PN_COMBINE | PN_REORDER); + return CAST; + } + else if (ident_spell() == TRUE) + { + return CAST; + } + else + { + return NO_CAST; + } +} + +char *divination_identify_info() +{ + static char buf[128]; + + if (get_level_s(IDENTIFY, 50) >= 27) + { + sprintf(buf, "rad %d", get_level_s(IDENTIFY, 3)); + return buf; + } + else + { + return ""; + } +} + +bool_ *divination_vision() +{ + if (get_level_s(VISION, 50) >= 25) + { + wiz_lite_extra(); + } + else + { + map_area(); + } + return CAST; + +} + +char *divination_vision_info() +{ + return ""; +} + +bool_ *divination_sense_hidden() +{ + detect_traps(15 + get_level(SENSEHIDDEN, 40, 0)); + if (get_level_s(SENSEHIDDEN, 50) >= 15) + { + set_tim_invis(10 + randint(20) + get_level_s(SENSEHIDDEN, 40)); + } + return CAST; +} + +char *divination_sense_hidden_info() +{ + static char buf[128]; + + if (get_level_s(SENSEHIDDEN, 50) >= 15) + { + sprintf(buf, + "rad %d dur %d+d20", + (15 + get_level_s(SENSEHIDDEN, 40)), + (10 + get_level_s(SENSEHIDDEN, 40))); + } + else + { + sprintf(buf, + "rad %d", + (15 + get_level_s(SENSEHIDDEN, 40))); + } + + return buf; +} + +bool_ *divination_reveal_ways() +{ + detect_doors(10 + get_level(REVEALWAYS, 40, 0)); + detect_stairs(10 + get_level(REVEALWAYS, 40, 0)); + return CAST; +} + +char *divination_reveal_ways_info() +{ + static char buf[128]; + sprintf(buf, + "rad %d", + (10 + get_level_s(REVEALWAYS, 40))); + return buf; +} + +bool_ *divination_sense_monsters() +{ + detect_monsters_normal(10 + get_level(SENSEMONSTERS, 40, 0)); + if (get_level_s(SENSEMONSTERS, 50) >= 30) + { + set_tim_esp(10 + randint(10) + get_level_s(SENSEMONSTERS, 20)); + } + return CAST; +} + +char *divination_sense_monsters_info() +{ + static char buf[128]; + + if (get_level_s(SENSEMONSTERS, 50) >= 30) + { + sprintf(buf, + "rad %d dur %d+d10", + (10 + get_level_s(SENSEMONSTERS, 40)), + (10 + get_level_s(SENSEMONSTERS, 20))); + } + else + { + sprintf(buf, + "rad %d", + (10 + get_level_s(SENSEMONSTERS, 40))); + } + + return buf; +} |