diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-06-27 20:56:05 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-06-27 20:56:05 +0200 |
commit | 2384dff0de2858e8c97fa7b18634aca0ec4f5a8e (patch) | |
tree | 5706dc414b2f32669277af7098376c4b8786b405 /src/melee2.c | |
parent | bcbdb77ad85255f788b2fb37a13d100428f883b1 (diff) |
Remove ALLOW_FEAR preprocessor define
Remove duplicate fear-handling code while we're at it
Diffstat (limited to 'src/melee2.c')
-rw-r--r-- | src/melee2.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/melee2.c b/src/melee2.c index 5443a214..91be521d 100644 --- a/src/melee2.c +++ b/src/melee2.c @@ -166,7 +166,21 @@ bool_ mon_take_hit_mon(int s_idx, int m_idx, int dam, bool_ *fear, cptr note) } -#ifdef ALLOW_FEAR + /* Apply fear */ + mon_handle_fear(m_ptr, dam, fear); + + /* Not dead yet */ + return (FALSE); +} + + +void mon_handle_fear(monster_type *m_ptr, int dam, bool_ *fear) +{ + monster_race *r_ptr = NULL; + + assert(m_ptr != NULL); + + r_ptr = race_inf(m_ptr); /* Mega-Hack -- Pain cancels fear */ if (m_ptr->monfear && (dam > 0)) @@ -200,9 +214,9 @@ bool_ mon_take_hit_mon(int s_idx, int m_idx, int dam, bool_ *fear, cptr note) percentage = (100L * m_ptr->hp) / m_ptr->maxhp; /* - * Run (sometimes) if at 10% or less of max hit points, - * or (usually) when hit for half its current hit points - */ + * Run (sometimes) if at 10% or less of max hit points, + * or (usually) when hit for half its current hit points + */ if (((percentage <= 10) && (rand_int(10) < percentage)) || ((dam >= m_ptr->hp) && (rand_int(100) < 80))) { @@ -215,17 +229,9 @@ bool_ mon_take_hit_mon(int s_idx, int m_idx, int dam, bool_ *fear, cptr note) 20 : ((11 - percentage) * 5))); } } - -#endif /* ALLOW_FEAR */ - - /* Not dead yet */ - return (FALSE); } - - - /* * And now for Intelligent monster attacks (including spells). * |