diff options
-rw-r--r-- | lib/mods/theme/scpt/s_ulmo.lua | 78 | ||||
-rw-r--r-- | src/externs.h | 14 | ||||
-rw-r--r-- | src/spells.pkg | 14 | ||||
-rw-r--r-- | src/spells3.c | 163 |
4 files changed, 199 insertions, 70 deletions
diff --git a/lib/mods/theme/scpt/s_ulmo.lua b/lib/mods/theme/scpt/s_ulmo.lua index 81f5f739..02661ca3 100644 --- a/lib/mods/theme/scpt/s_ulmo.lua +++ b/lib/mods/theme/scpt/s_ulmo.lua @@ -2,10 +2,6 @@ BOOK_ULMO = 65 -function get_belegaer_damage() - return get_level(ULMO_BELEGAER, 10), 3 + get_level(ULMO_BELEGAER, 35) -end - -- "Song of Belegaer" copied from Geyser ULMO_BELEGAER = add_spell { @@ -18,17 +14,8 @@ ULMO_BELEGAER = add_spell ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - local ret, dir - ret, dir = get_aim_dir() - if ret == FALSE then return end - return fire_bolt_or_beam(2 * get_level(ULMO_BELEGAER, 85), GF_WATER, dir, damroll(get_belegaer_damage())) - end, - ["info"] = function() - local n, d - n, d = get_belegaer_damage() - return "dam "..n.."d"..d - end, + ["spell"] = function() return ulmo_song_of_belegaer_spell() end, + ["info"] = function() return ulmo_song_of_belegaer_info() end, ["desc"] = { "Channels the power of the Great Sea into your fingertips.", @@ -48,28 +35,8 @@ ULMO_DRAUGHT_ULMONAN = add_spell ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - local level = get_level(ULMO_DRAUGHT_ULMONAN, 50) - local obvious = hp_player(5 * level) - obvious = is_obvious(set_poisoned(0), obvious) - obvious = is_obvious(set_cut(0), obvious) - obvious = is_obvious(set_stun(0), obvious) - obvious = is_obvious(set_blind(0), obvious) - if level >= 10 then - obvious = is_obvious(do_res_stat(A_STR, TRUE), obvious) - obvious = is_obvious(do_res_stat(A_CON, TRUE), obvious) - obvious = is_obvious(do_res_stat(A_DEX, TRUE), obvious) - end - if level >= 20 then - obvious = is_obvious(set_parasite(0, 0), obvious) - obvious = is_obvious(set_mimic(0, 0, 0), obvious) - end - return obvious - end, - ["info"] = function() - local level = get_level(ULMO_DRAUGHT_ULMONAN, 50) - return "cure "..(5 * level) - end, + ["spell"] = function() return ulmo_draught_of_ulmonan_spell() end, + ["info"] = function() return ulmo_draught_of_ulmonan_info() end, ["desc"] = { "Fills you with a draught with powerful curing effects,", "prepared by Ulmo himself.", @@ -92,24 +59,8 @@ ULMO_CALL_ULUMURI = add_spell ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - local y, x, m_idx - local summons = - { - test_monster_name("Water spirit"), - test_monster_name("Water elemental"), - } - y, x = find_position(player.py, player.px) - m_idx = place_monster_one(y, x, summons[rand_range(1, 2)], 0, FALSE, MSTATUS_FRIEND) - if m_idx ~= 0 then - monster_set_level(m_idx, 30 + get_level(ULMO_CALL_ULUMURI, 70, 0)) - return TRUE - end - end, - - ["info"] = function() - return "level "..(get_level(ULMO_CALL_ULUMURI, 70)) - end, + ["spell"] = function() return ulmo_call_of_the_ulumuri_spell() end, + ["info"] = function() return ulmo_call_of_the_ulumuri_info() end, ["desc"] = { "Summons a leveled water spirit or elemental", "to fight for you", @@ -129,21 +80,8 @@ ULMO_WRATH = add_spell ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - local ret, dir, type - if (get_level(ULMO_WRATH, 50) >= 30) then - type = GF_WAVE - else - type = GF_WATER - end - ret, dir = get_aim_dir() - if ret == FALSE then return end - fire_wall(type, dir, 40 + get_level(ULMO_WRATH, 150), 10 + get_level(ULMO_WRATH, 14)) - return TRUE - end, - ["info"] = function() - return "dam "..(40 + get_level(ULMO_WRATH, 150)).." dur "..(10 + get_level(ULMO_WRATH, 14)) - end, + ["spell"] = function() return ulmo_wrath_of_ulmo_spell() end, + ["info"] = function() return ulmo_wrath_of_ulmo_info() end, ["desc"] = { "Conjures up a sea storm.", "At level 30 it turns into a more forceful storm." diff --git a/src/externs.h b/src/externs.h index 233f7ea3..ac9bd360 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1868,6 +1868,20 @@ char *mandos_tale_of_doom_info(); bool_ *mandos_call_to_the_halls_spell(); char *mandos_call_to_the_halls_info(); +extern s32b ULMO_BELEGAER; +extern s32b ULMO_DRAUGHT_ULMONAN; +extern s32b ULMO_CALL_ULUMURI; +extern s32b ULMO_WRATH; + +bool_ *ulmo_song_of_belegaer_spell(); +char *ulmo_song_of_belegaer_info(); +bool_ *ulmo_draught_of_ulmonan_spell(); +char *ulmo_draught_of_ulmonan_info(); +bool_ *ulmo_call_of_the_ulumuri_spell(); +char *ulmo_call_of_the_ulumuri_info(); +bool_ *ulmo_wrath_of_ulmo_spell(); +char *ulmo_wrath_of_ulmo_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 1b253e12..7ec49906 100644 --- a/src/spells.pkg +++ b/src/spells.pkg @@ -2872,3 +2872,17 @@ bool_ *mandos_tale_of_doom_spell(); char *mandos_tale_of_doom_info(); bool_ *mandos_call_to_the_halls_spell(); char *mandos_call_to_the_halls_info(); + +extern s32b ULMO_BELEGAER; +extern s32b ULMO_DRAUGHT_ULMONAN; +extern s32b ULMO_CALL_ULUMURI; +extern s32b ULMO_WRATH; + +bool_ *ulmo_song_of_belegaer_spell(); +char *ulmo_song_of_belegaer_info(); +bool_ *ulmo_draught_of_ulmonan_spell(); +char *ulmo_draught_of_ulmonan_info(); +bool_ *ulmo_call_of_the_ulumuri_spell(); +char *ulmo_call_of_the_ulumuri_info(); +bool_ *ulmo_wrath_of_ulmo_spell(); +char *ulmo_wrath_of_ulmo_info(); diff --git a/src/spells3.c b/src/spells3.c index 355d94e4..cf9632b7 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -157,6 +157,11 @@ s32b MANDOS_SPIRIT_FEANTURI = -1; s32b MANDOS_TALE_DOOM = -1; s32b MANDOS_CALL_HALLS = -1; +s32b ULMO_BELEGAER; +s32b ULMO_DRAUGHT_ULMONAN; +s32b ULMO_CALL_ULUMURI; +s32b ULMO_WRATH; + /* 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 @@ -4544,3 +4549,161 @@ char *mandos_call_to_the_halls_info() call_to_the_halls_mlev()); return buf; } + +static void get_belegaer_damage(int *dice, int *sides) +{ + *dice = get_level_s(ULMO_BELEGAER, 10); + *sides = 3 + get_level_s(ULMO_BELEGAER, 35); +} + +bool_ *ulmo_song_of_belegaer_spell() +{ + int dir, dice, sides; + + if (!get_aim_dir(&dir)) + { + return NO_CAST; + } + + get_belegaer_damage(&dice, &sides); + fire_bolt_or_beam(2 * get_level_s(ULMO_BELEGAER, 85), + GF_WATER, + dir, + damroll(dice, sides)); + return CAST; +} + +char *ulmo_song_of_belegaer_info() +{ + static char buf[128]; + int dice, sides; + + get_belegaer_damage(&dice, &sides); + sprintf(buf, + "dam %dd%d", + dice, + sides); + return buf; +} + +int draught_of_ulmonan_hp() +{ + return 5 * get_level_s(ULMO_DRAUGHT_ULMONAN, 50); +} + +bool_ *ulmo_draught_of_ulmonan_spell() +{ + s32b level = get_level_s(ULMO_DRAUGHT_ULMONAN, 50); + + hp_player(draught_of_ulmonan_hp()); + + set_poisoned(0); + set_cut(0); + set_stun(0); + set_blind(0); + + if (level >= 10) + { + do_res_stat(A_STR, TRUE); + do_res_stat(A_CON, TRUE); + do_res_stat(A_DEX, TRUE); + } + + if (level >= 20) + { + set_parasite(0, 0); + set_mimic(0, 0, 0); + } + + return CAST; +} + +char *ulmo_draught_of_ulmonan_info() +{ + static char buf[128]; + sprintf(buf, + "cure %d", + draught_of_ulmonan_hp()); + return buf; +} + +static int call_of_the_ulumuri_mlev() +{ + return 30 + get_level(ULMO_CALL_ULUMURI, 70, 0); +} + +bool_ *ulmo_call_of_the_ulumuri_spell() +{ +#define N_SUMMONS 2 + int x,y; + s16b m_idx, r_idx; + s16b summons[N_SUMMONS] = { + test_monster_name("Water spirit"), + test_monster_name("Water elemental") + }; + + r_idx = summons[rand_int(N_SUMMONS)]; + assert(r_idx >= 0); + + find_position(p_ptr->py, p_ptr->px, &y, &x); + + m_idx = place_monster_one(y, x, r_idx, 0, FALSE, MSTATUS_FRIEND); + if (m_idx) + { + monster_set_level(m_idx, call_of_the_ulumuri_mlev()); + return CAST; + } + + return NO_CAST; +#undef N_SUMMONS +} + +char *ulmo_call_of_the_ulumuri_info() +{ + static char buf[128]; + sprintf(buf, + "level %d", + call_of_the_ulumuri_mlev()); + return buf; +} + +static int wrath_of_ulmo_damage() +{ + return 40 + get_level_s(ULMO_WRATH, 150); +} + +static int wrath_of_ulmo_duration() +{ + return 10 + get_level_s(ULMO_WRATH, 14); +} + +bool_ *ulmo_wrath_of_ulmo_spell() +{ + int dir, type = GF_WATER; + + if (get_level_s(ULMO_WRATH, 50) >= 30) + { + type = GF_WAVE; + } + + if (!get_aim_dir(&dir)) + { + return NO_CAST; + } + + fire_wall(type, + dir, + wrath_of_ulmo_damage(), + wrath_of_ulmo_duration()); + return CAST; +} + +char *ulmo_wrath_of_ulmo_info() +{ + static char buf[128]; + sprintf(buf, + "dam %d dur %d", + wrath_of_ulmo_damage(), + wrath_of_ulmo_duration()); + return buf; +} |