summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-06-09 21:55:59 +0200
committerBardur Arantsson <bardur@scientician.net>2012-06-09 22:04:00 +0200
commit83d2d89462f4b03419019e23d73665f0472b687b (patch)
tree6baa45bcde273c3c93f3f68587c25c39ba94e2ff /src
parentf586b932a44f06bc17336cd8332bec43f17d3d88 (diff)
Lua: Move "Smeagol takes RoI" code to C
Diffstat (limited to 'src')
-rw-r--r--src/modules.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/modules.c b/src/modules.c
index 6b476fd2..552bc876 100644
--- a/src/modules.c
+++ b/src/modules.c
@@ -564,6 +564,27 @@ static bool_ hobbit_food(void *data, void *in_, void *out)
}
}
+static bool_ smeagol_ring(void *data, void *in_, void *out)
+{
+ hook_give_in *in = (hook_give_in *) in_;
+ monster_type *m_ptr = &m_list[in->m_idx];
+ object_type *o_ptr = get_object(in->item);
+
+ if ((m_ptr->r_idx == test_monster_name("Smeagol")) &&
+ (o_ptr->tval == TV_RING))
+ {
+ cmsg_print(TERM_YELLOW, "'MY... PRECIOUSSSSS!!!'");
+
+ inc_stack_size_ex(in->item, -1, OPTIMIZE, NO_DESCRIBE);
+
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+}
+
void init_hooks_module()
{
/*
@@ -596,6 +617,11 @@ void init_hooks_module()
"hobbit_food",
NULL);
+ add_hook_new(HOOK_GIVE,
+ smeagol_ring,
+ "smeagol_ring",
+ NULL);
+
break;
}