summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-06-10 05:22:10 +0200
committerBardur Arantsson <bardur@scientician.net>2012-06-10 05:22:10 +0200
commite8a7753c88541e45a1b9d1b80be2ad227b179e20 (patch)
tree86c27bce5845ad78d3ce526f5c8090d4ad797064
parent83d2d89462f4b03419019e23d73665f0472b687b (diff)
Lua: Move Vampire corruption handling to C
-rw-r--r--lib/mods/theme/scpt/init.lua3
-rw-r--r--lib/mods/theme/scpt/player.lua16
-rw-r--r--lib/scpt/init.lua3
-rw-r--r--lib/scpt/player.lua15
-rw-r--r--src/birth.c7
5 files changed, 7 insertions, 37 deletions
diff --git a/lib/mods/theme/scpt/init.lua b/lib/mods/theme/scpt/init.lua
index 8cd2094a..64d2cabc 100644
--- a/lib/mods/theme/scpt/init.lua
+++ b/lib/mods/theme/scpt/init.lua
@@ -2,9 +2,6 @@
-- This file is loaded at the initialisation of ToME
--
--- Load the class specific stuff
-tome_dofile("player.lua")
-
-- Add the schools of magic
schools_init()
school_spells_init()
diff --git a/lib/mods/theme/scpt/player.lua b/lib/mods/theme/scpt/player.lua
deleted file mode 100644
index e2920642..00000000
--- a/lib/mods/theme/scpt/player.lua
+++ /dev/null
@@ -1,16 +0,0 @@
-------------------------------------------------------------------------------
------------------------ Hook to create birth objects -------------------------
-------------------------------------------------------------------------------
-function __birth_hook_objects()
-
- -- Start the undeads, as undeads with the corruptions
- if get_subrace_name() == "Vampire" then
- player_gain_corruption(CORRUPT_VAMPIRE_TEETH)
- player_gain_corruption(CORRUPT_VAMPIRE_STRENGTH)
- player_gain_corruption(CORRUPT_VAMPIRE_VAMPIRE)
- end
-
-end
-
--- Register in the hook list
-add_hook_script(HOOK_BIRTH_OBJECTS, "__birth_hook_objects", "__birth_hook_objects")
diff --git a/lib/scpt/init.lua b/lib/scpt/init.lua
index d27ce23c..8434f6dd 100644
--- a/lib/scpt/init.lua
+++ b/lib/scpt/init.lua
@@ -2,9 +2,6 @@
-- This file is loaded at the initialisation of ToME
--
--- Load the class specific stuff
-tome_dofile("player.lua")
-
-- Add the schools of magic
schools_init()
school_spells_init()
diff --git a/lib/scpt/player.lua b/lib/scpt/player.lua
deleted file mode 100644
index 1c8da791..00000000
--- a/lib/scpt/player.lua
+++ /dev/null
@@ -1,15 +0,0 @@
-------------------------------------------------------------------------------
------------------------ Hook to create birth objects -------------------------
-------------------------------------------------------------------------------
-function __birth_hook_objects()
-
- -- Start the undeads, as undeads with the corruptions
- if get_subrace_name() == "Vampire" then
- player_gain_corruption(CORRUPT_VAMPIRE_TEETH)
- player_gain_corruption(CORRUPT_VAMPIRE_STRENGTH)
- player_gain_corruption(CORRUPT_VAMPIRE_VAMPIRE)
- end
-end
-
--- Register in the hook list
-add_hook_script(HOOK_BIRTH_OBJECTS, "__birth_hook_objects", "__birth_hook_objects")
diff --git a/src/birth.c b/src/birth.c
index 41abe3ad..4734a189 100644
--- a/src/birth.c
+++ b/src/birth.c
@@ -1246,6 +1246,13 @@ static void player_outfit(void)
identify_pack_fully();
}
+ if (streq(rmp_ptr->title + rmp_name, "Vampire"))
+ {
+ player_gain_corruption(CORRUPT_VAMPIRE_TEETH);
+ player_gain_corruption(CORRUPT_VAMPIRE_STRENGTH);
+ player_gain_corruption(CORRUPT_VAMPIRE_VAMPIRE);
+ }
+
process_hooks(HOOK_BIRTH_OBJECTS, "()");
meta_inertia_control_hook_birth_objects();