diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-05-12 13:09:43 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-05-12 14:36:15 +0200 |
commit | 363eb2f7405a66b496641d77aaa0b8a3d6c63384 (patch) | |
tree | 0618af279a988c863026feccb72c1e6221f645b8 /src | |
parent | 0f3e84929038eeff1135bd7462347be64ac9fc71 (diff) |
Lua: Move "Water" spell functions to C
Diffstat (limited to 'src')
-rw-r--r-- | src/externs.h | 17 | ||||
-rw-r--r-- | src/spells.pkg | 17 | ||||
-rw-r--r-- | src/spells3.c | 195 |
3 files changed, 229 insertions, 0 deletions
diff --git a/src/externs.h b/src/externs.h index 4395848e..20567d99 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1682,6 +1682,23 @@ char *udun_wraithform_info(); bool_ *udun_flame_of_udun(); char *udun_flame_of_udun_info(); +extern s32b TIDALWAVE; +extern s32b ICESTORM; +extern s32b ENTPOTION; +extern s32b VAPOR; +extern s32b GEYSER; + +bool_ *water_tidal_wave(); +char *water_tidal_wave_info(); +bool_ *water_ice_storm(); +char *water_ice_storm_info(); +bool_ *water_ent_potion(); +char *water_ent_potion_info(); +bool_ *water_vapor(); +char *water_vapor_info(); +bool_ *water_geyser(); +char *water_geyser_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 034f2cd4..779a63d4 100644 --- a/src/spells.pkg +++ b/src/spells.pkg @@ -2685,3 +2685,20 @@ bool_ *udun_wraithform(); char *udun_wraithform_info(); bool_ *udun_flame_of_udun(); char *udun_flame_of_udun_info(); + +extern s32b TIDALWAVE; +extern s32b ICESTORM; +extern s32b ENTPOTION; +extern s32b VAPOR; +extern s32b GEYSER; + +bool_ *water_tidal_wave(); +char *water_tidal_wave_info(); +bool_ *water_ice_storm(); +char *water_ice_storm_info(); +bool_ *water_ent_potion(); +char *water_ent_potion_info(); +bool_ *water_vapor(); +char *water_vapor_info(); +bool_ *water_geyser(); +char *water_geyser_info(); diff --git a/src/spells3.c b/src/spells3.c index 39517b5e..7fa9d728 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -99,6 +99,12 @@ s32b GENOCIDE; s32b WRAITHFORM; s32b FLAMEOFUDUN; +s32b TIDALWAVE; +s32b ICESTORM; +s32b ENTPOTION; +s32b VAPOR; +s32b GEYSER; + /* 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 @@ -2987,3 +2993,192 @@ char *udun_flame_of_udun_info() return buf; } +static int tidal_wave_damage() +{ + return 40 + get_level_s(TIDALWAVE, 200); +} + +static int tidal_wave_duration() +{ + return 6 + get_level_s(TIDALWAVE, 10); +} + +bool_ *water_tidal_wave() +{ + fire_wave(GF_WAVE, + 0, + tidal_wave_damage(), + 0, + tidal_wave_duration(), + EFF_WAVE); + return CAST; +} + +char *water_tidal_wave_info() +{ + static char buf[128]; + sprintf(buf, + "dam %d dur %d", + tidal_wave_damage(), + tidal_wave_duration()); + return buf; +} + +static int water_ice_storm_damage() +{ + return 80 + get_level_s(ICESTORM, 200); +} + +static int water_ice_storm_radius() +{ + return 1 + get_level(ICESTORM, 3, 0); +} + +static int water_ice_storm_duration() +{ + return 20 + get_level_s(ICESTORM, 70); +} + +bool_ *water_ice_storm() +{ + int type = GF_COLD; + + if (get_level_s(ICESTORM, 50) >= 10) + { + type = GF_ICE; + } + + fire_wave(type, + 0, + water_ice_storm_damage(), + water_ice_storm_radius(), + water_ice_storm_duration(), + EFF_STORM); + + return CAST; +} + +char *water_ice_storm_info() +{ + static char buf[128]; + sprintf(buf, + "dam %d rad %d dur %d", + water_ice_storm_damage(), + water_ice_storm_radius(), + water_ice_storm_duration()); + return buf; +} + +static int water_ent_potion_base_duration() +{ + return 25 + get_level_s(ENTPOTION, 40);; +} + +bool_ *water_ent_potion() +{ + set_food(PY_FOOD_MAX - 1); + msg_print("The Ent's Potion fills your stomach."); + + if (get_level_s(ENTPOTION, 50) >= 5) + { + set_afraid(0); + } + if (get_level_s(ENTPOTION, 50) >= 12) + { + set_hero(p_ptr->hero + randint(25) + water_ent_potion_base_duration()); + } + + return CAST; +} + +char *water_ent_potion_info() +{ + if (get_level_s(ENTPOTION, 50) >= 12) + { + static char buf[128]; + sprintf(buf, + "dur %d+d25", + water_ent_potion_base_duration()); + return buf; + } + else + { + return ""; + } +} + +static int water_vapor_damage() +{ + return 3 + get_level_s(VAPOR, 20); +} + +static int water_vapor_radius() +{ + return 3 + get_level(VAPOR, 9, 0); +} + +static int water_vapor_duration() +{ + return 5; +} + +bool_ *water_vapor() +{ + fire_cloud(GF_WATER, + 0, + water_vapor_damage(), + water_vapor_radius(), + water_vapor_duration()); + return CAST; +} + +char *water_vapor_info() +{ + static char buf[128]; + sprintf(buf, + "dam %d rad %d dur %d", + water_vapor_damage(), + water_vapor_radius(), + water_vapor_duration()); + return buf; +} + +static void get_geyser_damage(int *dice, int *sides) +{ + assert(dice != NULL); + assert(sides != NULL); + + *dice = get_level_s(GEYSER, 10); + *sides = 3 + get_level_s(GEYSER, 35); +} + +bool_ *water_geyser() +{ + int dir, dice, sides; + + if (!get_aim_dir(&dir)) + { + return NO_CAST; + } + + get_geyser_damage(&dice, &sides); + fire_bolt_or_beam(2 * get_level_s(GEYSER, 85), + GF_WATER, + dir, + damroll(dice, sides)); + return CAST; +} + +char *water_geyser_info() +{ + static char buf[128]; + int dice, sides; + + get_geyser_damage(&dice, &sides); + + sprintf(buf, + "dam %dd%d", + dice, + sides); + return buf; +} |