diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/externs.h | 1 | ||||
-rw-r--r-- | src/lua_bind.c | 40 | ||||
-rw-r--r-- | src/spells.pkg | 21 |
3 files changed, 0 insertions, 62 deletions
diff --git a/src/externs.h b/src/externs.h index 46a4cf2b..b041f960 100644 --- a/src/externs.h +++ b/src/externs.h @@ -2369,7 +2369,6 @@ extern void init_hooks_module(); extern s16b can_spell_random(s16b spell_idx); extern magic_power *grab_magic_power(magic_power *m_ptr, int num); extern bool_ get_magic_power(int *sn, magic_power *powers, int max_powers, void (*power_info)(char *p, int power), int plev, int cast_stat); -extern bool_ lua_spell_success(magic_power *spell, int stat, char *oups_fct); extern object_type *new_object(void); extern void end_object(object_type *o_ptr); diff --git a/src/lua_bind.c b/src/lua_bind.c index 5a3806d8..adf0dd1e 100644 --- a/src/lua_bind.c +++ b/src/lua_bind.c @@ -27,46 +27,6 @@ magic_power *grab_magic_power(magic_power *m_ptr, int num) return (&m_ptr[num]); } -bool_ lua_spell_success(magic_power *spell, int stat, char *oups_fct) -{ - int chance; - int minfail = 0; - - /* Spell failure chance */ - chance = spell->fail; - - /* Reduce failure rate by "effective" level adjustment */ - chance -= 3 * (p_ptr->lev - spell->min_lev); - - /* Reduce failure rate by INT/WIS adjustment */ - chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[stat]] - 1); - - /* Not enough mana to cast */ - if (spell->mana_cost > p_ptr->csp) - { - chance += 5 * (spell->mana_cost - p_ptr->csp); - } - - /* Extract the minimum failure rate */ - minfail = adj_mag_fail[p_ptr->stat_ind[stat]]; - - /* Failure rate */ - chance = clamp_failure_chance(chance, minfail); - - /* Failed spell */ - if (rand_int(100) < chance) - { - if (flush_failure) flush(); - msg_format("You failed to concentrate hard enough!"); - sound(SOUND_FAIL); - - if (oups_fct != NULL) - exec_lua(format("%s(%d)", oups_fct, chance)); - return (FALSE); - } - return (TRUE); -} - /* * Create objects */ diff --git a/src/spells.pkg b/src/spells.pkg index 7385accc..26d7abab 100644 --- a/src/spells.pkg +++ b/src/spells.pkg @@ -2126,27 +2126,6 @@ struct magic_power */ extern magic_power *grab_magic_power @ get_magic_power(magic_power *m_ptr, int num); -/** @fn magic_power_sucess(magic_power *spell, int stat, char *oups_fct=NULL); - * @dgonly - * @brief Determine if using a magic power succeeds.\n - * @param *spell magic_power \n Spell is the magic power the player is using. - * @brief Power (spell) - * @param stat Number \n stat is the required casting statistic (INT or WIS). - * @brief Casting statistic - * @param *oups_fct String \n oups_fct is the message displayed when the power - * fails. - * @brief Fail message - * @return Boolean \n TRUE if spell succeeds, otherwise FALSE. - * @note - * The chance of using a power is adjusted for player magic skill, casting - * statistic, player mana points, and stunning. There is always at least a - * 5% chance the power works.\n\n - * Note: do not call this function.\n - * By order of DG. - * @note (see file lua_bind.c) - */ -extern bool lua_spell_success @ magic_power_sucess(magic_power *spell, int stat, char *oups_fct=NULL); - extern s16b can_spell_random(s16b spell_idx); /* Schools */ |