diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-04-05 20:55:25 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-04-07 15:28:25 +0200 |
commit | c92f7bf932d6e36c1aecd704a2a69d742ef7748d (patch) | |
tree | fbcc218187413a4e734d54de12194e53a9f00224 /src | |
parent | bfa8fa32382c89259dbf4f9301b316b7e0239344 (diff) |
Lua: Remove HOOK_GF_EXEC and HOOK_GF_COLOR
Diffstat (limited to 'src')
-rw-r--r-- | src/defines.h | 7 | ||||
-rw-r--r-- | src/spells.pkg | 11 | ||||
-rw-r--r-- | src/spells1.c | 149 | ||||
-rw-r--r-- | src/util.pkg | 156 |
4 files changed, 98 insertions, 225 deletions
diff --git a/src/defines.h b/src/defines.h index 1569012b..e0851fd4 100644 --- a/src/defines.h +++ b/src/defines.h @@ -2674,7 +2674,10 @@ #define GF_TRAP_DEMONSOUL 108 #define GF_ATTACK 109 #define GF_CHARM_UNMOVING 110 -#define MAX_GF 111 +#define GF_INSTA_DEATH 111 +#define GF_ELEMENTAL_WALL 112 +#define GF_ELEMENTAL_GROWTH 113 +#define MAX_GF 114 /* * Some things which induce learning @@ -4488,8 +4491,6 @@ #define HOOK_EAT 55 #define HOOK_DIE 56 #define HOOK_CALC_HP 57 -#define HOOK_GF_COLOR 58 -#define HOOK_GF_EXEC 59 #define HOOK_CALC_MANA 60 #define HOOK_LOAD_END 61 #define HOOK_RECALL 62 diff --git a/src/spells.pkg b/src/spells.pkg index cbbc2dc5..5575d0f4 100644 --- a/src/spells.pkg +++ b/src/spells.pkg @@ -340,8 +340,17 @@ typedef unsigned int u32b; /** @def GF_CHARM_UNMOVING */ #define GF_CHARM_UNMOVING 110 +/** @def GF_INSTA_DEATH */ +#define GF_INSTA_DEATH 111 + +/** @def GF_ELEMENTAL_WALL */ +#define GF_ELEMENTAL_WALL 112 + +/** @def GF_ELEMENTAL_GROWTH */ +#define GF_ELEMENTAL_GROWTH 113 + /** @def MAX_GF */ -#define MAX_GF 111 +#define MAX_GF 114 /** @} */ /** @name Spell Projection Flags diff --git a/src/spells1.c b/src/spells1.c index 9bfc6fe2..e99bbc23 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -939,6 +939,36 @@ void recall_player(int d, int f) } +/* + * Check the gods + */ +static void project_check_gods(int typ) +{ + if (p_ptr->pgod == get_god_VARDA()) + { + if ((typ == GF_LITE) || (typ == GF_LITE_WEAK)) + { + /* Raise piety for using lite */ + set_grace(p_ptr->grace + 1); + } + } + + if (p_ptr->pgod == get_god_ULMO()) + { + if ((typ == GF_FIRE) || + (typ == GF_HELL_FIRE) || + (typ == GF_HOLY_FIRE) || + (typ == GF_LAVA_FLOW) || + (typ == GF_METEOR) || + (typ == GF_NUKE) || + (typ == GF_PLASMA)) + { + /* Reduce piety for using any kind of fire magic */ + set_grace(p_ptr->grace - 5); + } + } +} + /* * Get a legal "multi-hued" color for drawing "spells" @@ -988,12 +1018,6 @@ static byte mh_attr(int max) */ byte spell_color(int type) { - /* Hooks! */ - if (process_hooks_ret(HOOK_GF_COLOR, "d", "(d,d)", type, streq(ANGBAND_GRAF, "new"))) - { - return process_hooks_return[0].num; - } - /* Check if A.B.'s new graphics should be used (rr9) */ if (streq(ANGBAND_GRAF, "new")) { @@ -1075,6 +1099,11 @@ byte spell_color(int type) case GF_TELEKINESIS: case GF_DOMINATION: return (0x09); + case GF_INSTA_DEATH: + return 0; + case GF_ELEMENTAL_WALL: + case GF_ELEMENTAL_GROWTH: + return 0; } } @@ -1161,6 +1190,11 @@ byte spell_color(int type) case GF_TELEKINESIS: case GF_DOMINATION: return (randint(3) != 1 ? TERM_L_BLUE : TERM_WHITE); + case GF_INSTA_DEATH: + return TERM_DARK; + case GF_ELEMENTAL_WALL: + case GF_ELEMENTAL_GROWTH: + return TERM_GREEN; } } @@ -2975,6 +3009,9 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ) /* Remember if the grid is with the LoS of player */ seen = player_can_see_bold(y, x); + /* Check gods */ + project_check_gods(typ); + /* Analyze the type */ switch (typ) { @@ -3793,14 +3830,19 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ) obvious = TRUE; break; } - default: + + case GF_ELEMENTAL_WALL: { - /* Hooks! */ - if (process_hooks_ret(HOOK_GF_EXEC, "dd", "(s,d,d,d,d,d,d)", "grid", who, typ, dam, r, y, x)) - { - obvious = process_hooks_return[0].num; - flag = process_hooks_return[1].num; + if ((p_ptr->py != y) || (p_ptr->px != x)) { + exec_lua(format("geomancy_random_wall(%d,%d);", y, x)); } + + break; + } + + case GF_ELEMENTAL_GROWTH: + { + exec_lua(format("geomancy_random_floor(%d, %d)", y, x)); break; } } @@ -3879,6 +3921,8 @@ static bool_ project_o(int who, int r, int y, int x, int dam, int typ) /* Reduce damage by distance */ dam = (dam + r) / (r + 1); + /* Check new gods. */ + project_check_gods(typ); /* Scan all objects in the grid */ for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) @@ -4173,15 +4217,7 @@ static bool_ project_o(int who, int r, int y, int x, int dam, int typ) break; } default: - { - /* Hooks! */ - if (process_hooks_ret(HOOK_GF_EXEC, "dd", "(s,d,d,d,d,d,d,O)", "object", who, typ, dam, r, y, x, o_ptr)) - { - obvious = process_hooks_return[0].num; - do_kill = process_hooks_return[1].num; - } - break; - } + break; } @@ -4385,6 +4421,9 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) dam = (dam + r) / (r + 1); + /* Check gods */ + project_check_gods(typ); + /* Get the monster name (BEFORE polymorphing) */ monster_desc(m_name, m_ptr, 0); @@ -4484,14 +4523,13 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) if (r_ptr->flags3 & RF3_HURT_LITE) get_angry = TRUE; break; - default: - /* Hooks! */ - if (process_hooks_ret(HOOK_GF_EXEC, "d", "(s,d,d,d,d,d,d,M)", "angry", who, typ, dam, r, y, x, m_ptr)) - { - get_angry = process_hooks_return[0].num; - } - else - get_angry = TRUE; + case GF_INSTA_DEATH: + get_angry = TRUE; + break; + case GF_ELEMENTAL_GROWTH: + case GF_ELEMENTAL_WALL: + get_angry = FALSE; + break; } /* Now anger it if appropriate */ @@ -6746,36 +6784,25 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) break; } - /* Default */ - default: + case GF_INSTA_DEATH: { - /* Hooks! */ - if (process_hooks_ret(HOOK_GF_EXEC, "dddddddddss", "(s,d,d,d,d,d,d,M)", "monster", who, typ, dam, r, y, x, m_ptr)) - { - obvious = process_hooks_return[0].num; - dam = process_hooks_return[1].num; - do_stun = process_hooks_return[2].num; - do_fear = process_hooks_return[3].num; - do_conf = process_hooks_return[4].num; - do_dist = process_hooks_return[5].num; - do_pois = process_hooks_return[6].num; - do_cut = process_hooks_return[7].num; - do_poly = process_hooks_return[8].num; - if (process_hooks_return[9].str != NULL) - note = process_hooks_return[9].str; - if (process_hooks_return[10].str != NULL) - note_dies = process_hooks_return[10].str; - } - else - { - /* Irrelevant */ + if (magik(95) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags3 & RF3_UNDEAD) && !(r_ptr->flags3 & RF3_NONLIVING)) { + /* Kill outright, but reduce exp. */ + m_ptr->level = m_ptr->level / 3; + dam = 32535; /* Should be enough */ + note = " faints."; + note_dies = " is sucked out of life."; + } else { + /* No effect */ skipped = TRUE; - - /* No damage */ - dam = 0; } + break; } + + default: + skipped = TRUE; + break; } @@ -8018,17 +8045,9 @@ static bool_ project_p(int who, int r, int y, int x, int dam, int typ, int a_rad /* Default */ default: { - /* Hooks! */ - if (process_hooks_ret(HOOK_GF_EXEC, "dd", "(s,d,d,d,d,d,d)", "player", who, typ, dam, r, y, x)) - { - obvious = process_hooks_return[0].num; - dam = process_hooks_return[1].num; - } - else - { - /* No damage */ - dam = 0; - } + /* No damage */ + dam = 0; + break; } } diff --git a/src/util.pkg b/src/util.pkg index 183a28f2..50f69e79 100644 --- a/src/util.pkg +++ b/src/util.pkg @@ -713,162 +713,6 @@ typedef unsigned int u32b; */ #define HOOK_CALC_HP 57 -/** @def HOOK_GF_COLOR - * @brief Set color for spell. - * @param Number type \n type of spell. - * @brief Type - * @param Number file \n if this is 0 use ANGBAND_GRAF, otherwise use "new". - * @brief File - * @return Boolean \n TRUE if hook sets a color, otherwise FALSE. - * @return Number color \n The color for the spell. - * @note - * If the hook returns TRUE, spell_color() returns the hook's color, otherwise - * the function continues. - * @note (see file spells1.c) - */ -#define HOOK_GF_COLOR 58 - -/** @def HOOK_GF_EXEC - * @brief A spell to damage terrain features.\n - * @param String target \n "grid" to indicate spell damages terrain. - * @brief Target - * @param Number who \n the source of the spell. - * @brief Source - * @param Number type \n the type of spell. - * @brief Type - * @param Number dam \n the number of hit points of damage. - * @brief Damage - * @param Number r \n the radius of the spell. - * @brief Radius - * @param Number y \n the y-coordinate of the target. - * @brief Y-coordinate - * @param Number x \n the x-coordinate of the target. - * @brief X-coordinate - * @return Boolean \n TRUE if spell was cast, otherwise FALSE. - * @return Number obvious \n TRUE if the player notices the spell, otherwise - * FALSE. - * @return Number flag \n TRUE if the player is affected, otherwise FALSE. - * @note - * If the hook returns TRUE, the hook sets the "obvious" and "flag" fields. - * @note (see file spells1.c) - */ -/** @def HOOK_GF_EXEC - * @brief A spell to damage objects.\n - * @param String target \n "object" to indicate spell damages objects. - * @brief Target - * @param Number who \n the source of the spell. - * @brief Source - * @param Number type \n the type of spell. - * @brief Type - * @param Number dam \n the number of hit points of damage. - * @brief Damage - * @param Number r \n the radius of the spell. - * @brief Radius - * @param Number y \n the y-coordinate of the target. - * @brief Y-coordinate - * @param Number x \n the x-coordinate of the target. - * @brief X-coordinate - * @param Object o_ptr \n the object which is the target of the spell. - * @brief Object - * @return Boolean \n TRUE if spell was cast, otherwise FALSE. - * @return Number obvious \n TRUE if the player notices the spell, otherwise - * FALSE. - * @return Number flag \n TRUE if the player is affected, otherwise FALSE. - * @note - * If the hook returns TRUE, the hook sets the "obvious" and "do_kill" fields. - * @note (see file spells1.c) - */ -/** @def HOOK_GF_EXEC - * @brief A spell to damage monsters.\n - * @param String target \n "angry" to indicate spell angers a friend. - * @brief Target - * @param Number who \n the source of the spell. - * @brief Source - * @param Number type \n the type of spell. - * @brief Type - * @param Number dam \n the number of hit points of damage. - * @brief Damage - * @param Number r \n the radius of the spell. - * @brief Radius - * @param Number y \n the y-coordinate of the target. - * @brief Y-coordinate - * @param Number x \n the x-coordinate of the target. - * @brief X-coordinate - * @param Monster m_ptr \n the monster which is the target of the spell. - * @brief Monster - * @return Boolean \n TRUE if spell was cast, otherwise FALSE. - * @return Number get_angry \n TRUE if the monster gets angry, otherwise FALSE. - * @note - * If the hook returns TRUE, the hook sets the "get_angry" field. - * @note (see file spells1.c) - */ -/** @def HOOK_GF_EXEC - * @brief A spell to damage monsters.\n - * @param String target \n "monster" to indicate spell damages monsters. - * @brief Target - * @param Number who \n the source of the spell. - * @brief Source - * @param Number type \n the type of spell. - * @brief Type - * @param Number dam \n the number of hit points of damage. - * @brief Damage - * @param Number r \n the radius of the spell. - * @brief Radius - * @param Number y \n the y-coordinate of the target. - * @brief Y-coordinate - * @param Number x \n the x-coordinate of the target. - * @brief X-coordinate - * @param Monster m_ptr \n the monster which is the target of the spell. - * @brief Monster - * @return Boolean \n TRUE if spell was cast, otherwise FALSE. - * @return Number obvious \n TRUE if the player notices the spell, otherwise - * FALSE. - * @return Number dam \n The damage the monster takes. - * @return Number do_stun \n TRUE if the monster is stunned, otherwise FALSE. - * @return Number do_fear \n TRUE if the monster is frightened, otherwise - * FALSE. - * @return Number do_conf \n TRUE if the monster is confused, otherwise FALSE. - * @return Number do_dist \n TRUE if the monster is disturbed, otherwise FALSE. - * @return Number do_pois \n TRUE if the monster is poisoned, otherwise FALSE. - * @return Number do_cut \n TRUE if the monster is wounded, otherwise FALSE. - * @return Number do_poly \n TRUE if the monster is polymorphed, otherwise - * FALSE. - * @return String note \n The message displayed if the monster if affected. - * @return String note_dies \n The message displayed if the monster dies. - * @note - * If the hook returns TRUE, the hook sets the "obvious", "dam", "do_stun", - * "do_fear", "do_conf", "do_dist", "do_pois", "do_cut", "do_poly", "note", - * and "note dies" fields, otherwise the spell has no effect and does no - * damage. - * @note (see file spells1.c) - */ -/** @def HOOK_GF_EXEC - * @brief A spell to damage the player.\n - * @param String target \n "player" to indicate spell damages the player. - * @brief Target - * @param Number who \n the source of the spell. - * @brief Source - * @param Number type \n the type of spell. - * @brief Type - * @param Number dam \n the number of hit points of damage. - * @brief Damage - * @param Number r \n the radius of the spell. - * @brief Radius - * @param Number y \n the y-coordinate of the target. - * @brief Y-coordinate - * @param Number x \n the x-coordinate of the target. - * @brief X-coordinate - * @return Boolean \n TRUE if spell was cast, otherwise FALSE. - * @return Number obvious \n TRUE if the player notices the spell, otherwise - * FALSE. - * @return Number dam \n The damage the player takes. - * @note - * If the hook returns TRUE, the hook sets the "obvious" and "dam" fields, - * otherwise there is no damage. - * @note (see file spells1.c) - */ -#define HOOK_GF_EXEC 59 - /** @def HOOK_CALC_MANA * @brief Recalculate player SP (spell points).\n * @param Number msp \n the player's new maximum spell points. |