diff options
-rw-r--r-- | lib/mods/theme/scpt/s_tempo.lua | 69 | ||||
-rw-r--r-- | lib/scpt/s_tempo.lua | 69 | ||||
-rw-r--r-- | src/externs.h | 14 | ||||
-rw-r--r-- | src/spells.pkg | 14 | ||||
-rw-r--r-- | src/spells3.c | 152 |
5 files changed, 196 insertions, 122 deletions
diff --git a/lib/mods/theme/scpt/s_tempo.lua b/lib/mods/theme/scpt/s_tempo.lua index d3d2fbb5..76026745 100644 --- a/lib/mods/theme/scpt/s_tempo.lua +++ b/lib/mods/theme/scpt/s_tempo.lua @@ -19,32 +19,8 @@ MAGELOCK = add_spell ["max_level"] = { 15, 45 }, }, }, - ["spell"] = function() - if get_level(MAGELOCK, 50) >= 30 then - local ret, x, y, c_ptr - - if get_level(MAGELOCK, 50) >= 40 then - ret, x, y = tgt_pt() - if ret == FALSE then return end - if cave_is(cave(y, x), FF1_FLOOR) == FALSE or cave_is(cave(y, x), FF1_PERMANENT) == TRUE or los(player.py, player.px, y, x) == FALSE then - msg_print("You cannot place it there.") - return TRUE - end - else - y = player.py - x = player.px - end - cave_set_feat(y, x, 3) - return TRUE - else - ret, dir = get_aim_dir() - if ret == FALSE then return end - return wizard_lock(dir) - end - end, - ["info"] = function() - return "" - end, + ["spell"] = function() return tempo_magelock() end, + ["info"] = function() return tempo_magelock_info() end, ["desc"] = { "Magically locks a door", "At level 30 it creates a glyph of warding", @@ -70,24 +46,8 @@ SLOWMONSTER = add_spell ["max_level"] = { 20, 50 }, }, }, - ["spell"] = function() - local ret, dir - - ret, dir = get_aim_dir() - if ret == FALSE then return end - if get_level(SLOWMONSTER, 50) >= 20 then - return fire_ball(GF_OLD_SLOW, dir, 40 + get_level(SLOWMONSTER, 160), 1) - else - return fire_bolt(GF_OLD_SLOW, dir, 40 + get_level(SLOWMONSTER, 160)) - end - end, - ["info"] = function() - if get_level(SLOWMONSTER, 50) >= 20 then - return "power "..(40 + get_level(SLOWMONSTER, 160)).." rad 1" - else - return "power "..(40 + get_level(SLOWMONSTER, 160)) - end - end, + ["spell"] = function() return tempo_slow_monster() end, + ["info"] = function() return tempo_slow_monster_info() end, ["desc"] = { "Magically slows down the passing of time around a monster", "At level 20 it affects a zone" @@ -113,12 +73,8 @@ ESSENCESPEED = add_spell }, }, ["inertia"] = { 5, 20 }, - ["spell"] = function() - if player.fast == 0 then return set_fast(10 + randint(10) + get_level(ESSENCESPEED, 50), 5 + get_level(ESSENCESPEED, 20)) end - end, - ["info"] = function() - return "dur "..(10 + get_level(ESSENCESPEED, 50)).."+d10 speed "..(5 + get_level(ESSENCESPEED, 20)) - end, + ["spell"] = function() return tempo_essence_of_speed() end, + ["info"] = function() return tempo_essence_of_speed_info() end, ["desc"] = { "Magically decreases the passing of time around you, making you move faster with", "respect to the rest of the universe." @@ -144,17 +100,8 @@ BANISHMENT = add_spell }, }, ["inertia"] = { 5, 50 }, - ["spell"] = function() - local obvious - obvious = project_los(GF_AWAY_ALL, 40 + get_level(BANISHMENT, 160)) - if get_level(BANISHMENT, 50) >= 15 then - obvious = is_obvious(project_los(GF_STASIS, 20 + get_level(BANISHMENT, 120)), obvious) - end - return obvious - end, - ["info"] = function() - return "power "..(40 + get_level(BANISHMENT, 160)) - end, + ["spell"] = function() return tempo_banishment() end, + ["info"] = function() return tempo_banishment_info() end, ["desc"] = { "Disrupts the space/time continuum in your area and teleports all monsters away.", "At level 15 it may also lock them in a time bubble for a while." diff --git a/lib/scpt/s_tempo.lua b/lib/scpt/s_tempo.lua index d3d2fbb5..76026745 100644 --- a/lib/scpt/s_tempo.lua +++ b/lib/scpt/s_tempo.lua @@ -19,32 +19,8 @@ MAGELOCK = add_spell ["max_level"] = { 15, 45 }, }, }, - ["spell"] = function() - if get_level(MAGELOCK, 50) >= 30 then - local ret, x, y, c_ptr - - if get_level(MAGELOCK, 50) >= 40 then - ret, x, y = tgt_pt() - if ret == FALSE then return end - if cave_is(cave(y, x), FF1_FLOOR) == FALSE or cave_is(cave(y, x), FF1_PERMANENT) == TRUE or los(player.py, player.px, y, x) == FALSE then - msg_print("You cannot place it there.") - return TRUE - end - else - y = player.py - x = player.px - end - cave_set_feat(y, x, 3) - return TRUE - else - ret, dir = get_aim_dir() - if ret == FALSE then return end - return wizard_lock(dir) - end - end, - ["info"] = function() - return "" - end, + ["spell"] = function() return tempo_magelock() end, + ["info"] = function() return tempo_magelock_info() end, ["desc"] = { "Magically locks a door", "At level 30 it creates a glyph of warding", @@ -70,24 +46,8 @@ SLOWMONSTER = add_spell ["max_level"] = { 20, 50 }, }, }, - ["spell"] = function() - local ret, dir - - ret, dir = get_aim_dir() - if ret == FALSE then return end - if get_level(SLOWMONSTER, 50) >= 20 then - return fire_ball(GF_OLD_SLOW, dir, 40 + get_level(SLOWMONSTER, 160), 1) - else - return fire_bolt(GF_OLD_SLOW, dir, 40 + get_level(SLOWMONSTER, 160)) - end - end, - ["info"] = function() - if get_level(SLOWMONSTER, 50) >= 20 then - return "power "..(40 + get_level(SLOWMONSTER, 160)).." rad 1" - else - return "power "..(40 + get_level(SLOWMONSTER, 160)) - end - end, + ["spell"] = function() return tempo_slow_monster() end, + ["info"] = function() return tempo_slow_monster_info() end, ["desc"] = { "Magically slows down the passing of time around a monster", "At level 20 it affects a zone" @@ -113,12 +73,8 @@ ESSENCESPEED = add_spell }, }, ["inertia"] = { 5, 20 }, - ["spell"] = function() - if player.fast == 0 then return set_fast(10 + randint(10) + get_level(ESSENCESPEED, 50), 5 + get_level(ESSENCESPEED, 20)) end - end, - ["info"] = function() - return "dur "..(10 + get_level(ESSENCESPEED, 50)).."+d10 speed "..(5 + get_level(ESSENCESPEED, 20)) - end, + ["spell"] = function() return tempo_essence_of_speed() end, + ["info"] = function() return tempo_essence_of_speed_info() end, ["desc"] = { "Magically decreases the passing of time around you, making you move faster with", "respect to the rest of the universe." @@ -144,17 +100,8 @@ BANISHMENT = add_spell }, }, ["inertia"] = { 5, 50 }, - ["spell"] = function() - local obvious - obvious = project_los(GF_AWAY_ALL, 40 + get_level(BANISHMENT, 160)) - if get_level(BANISHMENT, 50) >= 15 then - obvious = is_obvious(project_los(GF_STASIS, 20 + get_level(BANISHMENT, 120)), obvious) - end - return obvious - end, - ["info"] = function() - return "power "..(40 + get_level(BANISHMENT, 160)) - end, + ["spell"] = function() return tempo_banishment() end, + ["info"] = function() return tempo_banishment_info() end, ["desc"] = { "Disrupts the space/time continuum in your area and teleports all monsters away.", "At level 15 it may also lock them in a time bubble for a while." diff --git a/src/externs.h b/src/externs.h index fdcc1562..6db58e36 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1641,6 +1641,20 @@ char *mind_armor_of_fear_info(); bool_ *mind_stun(); char *mind_stun_info(); +extern s32b MAGELOCK; +extern s32b SLOWMONSTER; +extern s32b ESSENCESPEED; +extern s32b BANISHMENT; + +bool_ *tempo_magelock(); +char *tempo_magelock_info(); +bool_ *tempo_slow_monster(); +char *tempo_slow_monster_info(); +bool_ *tempo_essence_of_speed(); +char *tempo_essence_of_speed_info(); +bool_ *tempo_banishment(); +char *tempo_banishment_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 ca88202e..eeae6e7d 100644 --- a/src/spells.pkg +++ b/src/spells.pkg @@ -2646,3 +2646,17 @@ bool_ *mind_armor_of_fear(); char *mind_armor_of_fear_info(); bool_ *mind_stun(); char *mind_stun_info(); + +extern s32b MAGELOCK; +extern s32b SLOWMONSTER; +extern s32b ESSENCESPEED; +extern s32b BANISHMENT; + +bool_ *tempo_magelock(); +char *tempo_magelock_info(); +bool_ *tempo_slow_monster(); +char *tempo_slow_monster_info(); +bool_ *tempo_essence_of_speed(); +char *tempo_essence_of_speed_info(); +bool_ *tempo_banishment(); +char *tempo_banishment_info(); diff --git a/src/spells3.c b/src/spells3.c index 3c038772..9cca482a 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -85,6 +85,11 @@ s32b CONFUSE; s32b ARMOROFFEAR; s32b STUN; +s32b MAGELOCK; +s32b SLOWMONSTER; +s32b ESSENCESPEED; +s32b BANISHMENT; + /* 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 @@ -2624,3 +2629,150 @@ char *mind_stun_info() mind_stun_power()); return buf; } + +bool_ *tempo_magelock() +{ + if (get_level_s(MAGELOCK, 50) >= 30) + { + int x,y; + + if (get_level_s(MAGELOCK, 50) >= 40) + { + cave_type *c_ptr = NULL; + + if (!tgt_pt(&x, &y)) + { + return NO_CAST; + } + + c_ptr = &cave[y][x]; + + if ((!(f_info[c_ptr->feat].flags1 | FF1_FLOOR)) || + (f_info[c_ptr->feat].flags1 | FF1_PERMANENT) || + (!los(p_ptr->py, p_ptr->px, y, x))) + { + msg_print("You cannot place it there."); + return NO_CAST; + } + } else { + y = p_ptr->py; + x = p_ptr->px; + } + cave_set_feat(y, x, 3); + return CAST; + } else { + int dir; + if (!get_aim_dir(&dir)) + { + return NO_CAST; + } + wizard_lock(dir); + return CAST; + } +} + +char *tempo_magelock_info() +{ + return ""; +} + +static s32b tempo_slow_monster_power() +{ + return 40 + get_level_s(SLOWMONSTER, 160); +} + +bool_ *tempo_slow_monster() +{ + int dir; + s32b pwr; + + if (!get_aim_dir(&dir)) + { + return NO_CAST; + } + + pwr = tempo_slow_monster_power(); + if (get_level_s(SLOWMONSTER, 50) >= 20) + { + fire_ball(GF_OLD_SLOW, dir, pwr, 1); + } + else + { + fire_bolt(GF_OLD_SLOW, dir, pwr); + } + + return CAST; +} + +char *tempo_slow_monster_info() +{ + static char buf[128]; + s32b pwr = tempo_slow_monster_power(); + + if (get_level_s(SLOWMONSTER, 50) >= 20) + { + sprintf(buf, "power " FMTs32b " rad 1", pwr); + } + else + { + sprintf(buf, "power " FMTs32b, pwr); + } + return buf; +} + +static s32b tempo_essence_of_speed_base_duration() +{ + return 10 + get_level_s(ESSENCESPEED, 50); +} + +static s32b tempo_essence_of_speed_bonus() +{ + return 5 + get_level_s(ESSENCESPEED, 20); +} + +bool_ *tempo_essence_of_speed() +{ + if (p_ptr->fast == 0) + { + set_fast(randint(10) + tempo_essence_of_speed_base_duration(), + tempo_essence_of_speed_bonus()); + } + return CAST; +} + +char *tempo_essence_of_speed_info() +{ + static char buf[128]; + sprintf(buf, + "dur " FMTs32b "+d10 speed " FMTs32b, + tempo_essence_of_speed_base_duration(), + tempo_essence_of_speed_bonus()); + return buf; +} + +static s32b tempo_banishment_power() +{ + return 40 + get_level_s(BANISHMENT, 160); +} + +bool_ *tempo_banishment() +{ + s32b pwr = tempo_banishment_power(); + + project_hack(GF_AWAY_ALL, pwr); + if (get_level_s(BANISHMENT, 50) >= 15) + { + project_hack(GF_STASIS, 20 + get_level_s(BANISHMENT, 120)); + } + + return CAST; +} + +char *tempo_banishment_info() +{ + static char buf[128]; + sprintf(buf, + "power " FMTs32b, + tempo_banishment_power()); + return buf; +} |