diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-04-10 20:58:10 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-04-10 20:58:10 +0200 |
commit | 2a7627098fd014fc7b835e67cf37a3b615dbf5c4 (patch) | |
tree | fe24c76483484d81d039c5b73e5c57ce4b0e0f3d /src | |
parent | b34352dcd834057993a5e4c146b5b61cca41da15 (diff) |
Lua: Gods: Move Aule's HOOK_SACRIFICE_GOD to C
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd2.c | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -4574,6 +4574,43 @@ static bool_ item_tester_hook_sacrifiable(object_type *o_ptr) } /* + * Is item eligible for sacrifice to Aule? + */ +static bool_ item_tester_hook_sacrifice_aule(object_type *o_ptr) +{ + /* perhaps restrict this only to metal armour and weapons */ + return (o_ptr->found == OBJ_FOUND_SELFMADE); +} + +/* + * Handle sacrifices to Aule + */ +static void do_cmd_sacrifice_aule() +{ + int item; + + item_tester_hook = item_tester_hook_sacrifice_aule; + if (!get_item(&item, + "Sacrifice which item? ", + "You have nothing to sacrifice.", + USE_INVEN)) + { + return; + } + + /* Increase piety by the value of the item / 10. */ + { + object_type *o_ptr = get_object(item); + s32b delta = object_value(o_ptr) / 10; + + inc_piety(GOD_ALL, delta); + } + + /* Destroy the object */ + inc_stack_size(item, -1); +} + +/* * Handle sacrifices. * Grace is increased by value of sacrifice. */ @@ -4666,6 +4703,10 @@ void do_cmd_sacrifice(void) inc_stack_size(item, -1); } } + else if (p_ptr->pgod == GOD_AULE) + { + do_cmd_sacrifice_aule(); + } else { process_hooks(HOOK_SACRIFICE_GOD, "()", ""); |