diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-04-05 20:12:21 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-04-07 15:28:25 +0200 |
commit | 2bd0f18da7dbccd650d8a83aa457d5190f4ce1bc (patch) | |
tree | cb248715a89b2af50a5ee27cfb9a862322df331a /src | |
parent | 6548c6fb76232f4502d0856e04f169394deb6093 (diff) |
Lua: Move HOOK_CALC_BONUS code for gods to C
Diffstat (limited to 'src')
-rw-r--r-- | src/externs.h | 1 | ||||
-rw-r--r-- | src/loadsave.c | 1 | ||||
-rw-r--r-- | src/player.pkg | 5 | ||||
-rw-r--r-- | src/variable.c | 5 | ||||
-rw-r--r-- | src/xtra1.c | 69 |
5 files changed, 81 insertions, 0 deletions
diff --git a/src/externs.h b/src/externs.h index 4f8def3a..6821fd30 100644 --- a/src/externs.h +++ b/src/externs.h @@ -602,6 +602,7 @@ extern s32b DUNGEON_ASTRAL_WILD_Y; extern deity_type *deity_info; extern s32b max_gods; extern timer_type *gl_timers; +extern s16b tim_precognition; extern const char *get_version_string(); /* plots.c */ diff --git a/src/loadsave.c b/src/loadsave.c index 5d43d79a..58a0931b 100644 --- a/src/loadsave.c +++ b/src/loadsave.c @@ -512,6 +512,7 @@ static bool_ do_extra(int flag) do_s16b(&p_ptr->blessed, flag); do_s16b(&p_ptr->control, flag); do_byte(&p_ptr->control_dir, flag); + do_s16b(&tim_precognition, flag); do_s16b(&p_ptr->tim_thunder, flag); do_s16b(&p_ptr->tim_thunder_p1, flag); do_s16b(&p_ptr->tim_thunder_p2, flag); diff --git a/src/player.pkg b/src/player.pkg index dfdced26..b2f46506 100644 --- a/src/player.pkg +++ b/src/player.pkg @@ -2622,6 +2622,11 @@ extern void apply_flags(u32b f1, u32b f2, u32b f3, u32b f4, u32b f5, u32b esp, s #define SHIELD_FEAR 0x0008 /** @} */ +/** + * Timered precognition + */ +extern s16b tim_precognition; + /** @fn set_tim_thunder(int v, int p1, int p2) * @brief Player has timed thunderstorm.\n diff --git a/src/variable.c b/src/variable.c index 9ed084b4..5b1afc3b 100644 --- a/src/variable.c +++ b/src/variable.c @@ -1592,6 +1592,11 @@ s32b max_gods = MAX_GODS_INIT; */ timer_type *gl_timers = NULL; +/* + * Timered precognition. + */ +s16b tim_precognition = 0; + /** * Get the version string. */ diff --git a/src/xtra1.c b/src/xtra1.c index c708f3f9..e39c2fad 100644 --- a/src/xtra1.c +++ b/src/xtra1.c @@ -2424,6 +2424,69 @@ void calc_gods() if (p_ptr->grace > 15000) p_ptr->stat_add[A_STR] += 1; if (p_ptr->grace > 20000) p_ptr->stat_add[A_STR] += 1; } + + /* Aule provides to-hit/damage bonuses and fire resistance */ + GOD(get_god_AULE()) + { + if (p_ptr->grace > 0) + { + int bonus; + /* Resist fire, not shown on the character screen (?) */ + if (p_ptr->grace > 5000) + { + p_ptr->resist_fire = TRUE; + } + + bonus = p_ptr->grace / 5000; + if (bonus > 5) + { + bonus = 5; + } + + p_ptr->to_h = p_ptr->to_h + bonus; + p_ptr->dis_to_h = p_ptr->dis_to_h + bonus; + p_ptr->to_d = p_ptr->to_d + bonus; + p_ptr->dis_to_d = p_ptr->dis_to_d + bonus; + } + } + + /* Mandos provides nether resistance and, while praying, + nether immunity and prevents teleportation. */ + GOD(get_god_MANDOS()) + { + p_ptr->resist_neth = TRUE; + + if ((p_ptr->grace > 10000) && + (p_ptr->praying == TRUE)) + { + p_ptr->resist_continuum = TRUE; + } + + if ((p_ptr->grace > 20000) && + (p_ptr->praying == TRUE)) + { + p_ptr->immune_neth = TRUE; + } + } + + /* Ulmo provides water breath and, while praying can + provide poison resistance and magic breath. */ + GOD(get_god_ULMO()) + { + p_ptr->water_breath = TRUE; + + if ((p_ptr->grace > 1000) && + (p_ptr->praying == TRUE)) + { + p_ptr->resist_pois = TRUE; + } + + if ((p_ptr->grace > 15000) && + (p_ptr->praying == TRUE)) + { + p_ptr->magical_breath = TRUE; + } + } } /* Apply flags */ @@ -3151,6 +3214,12 @@ void calc_bonuses(bool_ silent) p_ptr->dis_to_a += 100; } + /* Temporary precognition */ + if (tim_precognition > 0) + { + apply_flags(0, 0, 0, TR4_PRECOGNITION, 0, 0, 0, 0, 0, 0, 0); + } + /* Breath */ if (p_ptr->tim_water_breath) { |