From ac2d8a787a2345333e83227e9ab83b281a75d645 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Tue, 10 Apr 2012 21:36:59 +0200 Subject: Lua: Gods: Move Ulmo's HOOK_MONSTER_DEATH to C --- lib/mods/theme/scpt/gods_new.lua | 45 --------------------------------- src/xtra2.c | 54 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 45 deletions(-) diff --git a/lib/mods/theme/scpt/gods_new.lua b/lib/mods/theme/scpt/gods_new.lua index 1256932a..1ce90ce4 100644 --- a/lib/mods/theme/scpt/gods_new.lua +++ b/lib/mods/theme/scpt/gods_new.lua @@ -39,51 +39,6 @@ GOD_ULMO = add_god }, ["hooks"] = { - [HOOK_MONSTER_DEATH] = function(m_idx) - if (player.pgod == GOD_ULMO) then - m_ptr = monster(m_idx) - if - (m_ptr.r_idx == test_monster_name("Swordfish")) or - (m_ptr.r_idx == test_monster_name("Barracuda")) or - (m_ptr.r_idx == test_monster_name("Globefish")) or - (m_ptr.r_idx == test_monster_name("Aquatic bear")) or - (m_ptr.r_idx == test_monster_name("Pike")) or - (m_ptr.r_idx == test_monster_name("Electric eel")) or - (m_ptr.r_idx == test_monster_name("Giant crayfish")) or - (m_ptr.r_idx == test_monster_name("Mermaid")) or - (m_ptr.r_idx == test_monster_name("Leviathan")) or - (m_ptr.r_idx == test_monster_name("Box jellyfish")) or - (m_ptr.r_idx == test_monster_name("Giant piranha")) or - (m_ptr.r_idx == test_monster_name("Piranha")) or - (m_ptr.r_idx == test_monster_name("Ocean naga")) or - (m_ptr.r_idx == test_monster_name("Whale")) or - (m_ptr.r_idx == test_monster_name("Octopus")) or - (m_ptr.r_idx == test_monster_name("Giant octopus")) or - (m_ptr.r_idx == test_monster_name("Drowned soul")) or - (m_ptr.r_idx == test_monster_name("Tiger shark")) or - (m_ptr.r_idx == test_monster_name("Hammerhead shark")) or - (m_ptr.r_idx == test_monster_name("Great white shark")) or - (m_ptr.r_idx == test_monster_name("White shark")) or - (m_ptr.r_idx == test_monster_name("Stargazer")) or - (m_ptr.r_idx == test_monster_name("Flounder")) or - (m_ptr.r_idx == test_monster_name("Giant turtle")) or - (m_ptr.r_idx == test_monster_name("Killer whale")) or - (m_ptr.r_idx == test_monster_name("Water naga")) or - (m_ptr.r_idx == test_monster_name("Behemoth")) then - -- He doesn't like it if you kill these monsters - set_grace(player.grace - 20) - end - if - (m_ptr.r_idx == test_monster_name("Seahorse")) or - (m_ptr.r_idx == test_monster_name("Aquatic elven warrior")) or - (m_ptr.r_idx == test_monster_name("Aquatic elven mage")) or - (m_ptr.r_idx == test_monster_name("Wavelord")) or - (m_ptr.r_idx == test_monster_name("The Watcher in the Water")) then - -- These monsters earn higher penalties - set_grace(player.grace - 500) - end - end - end, }, } diff --git a/src/xtra2.c b/src/xtra2.c index 5a9d8cb6..8d1f1867 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -2385,6 +2385,60 @@ static void monster_death_gods(int m_idx, monster_type *m_ptr) inc_piety(GOD_ALL, -500); } } + + if (p_ptr->pgod == GOD_ULMO) + { + /* He doesn't like it if you kill these monsters */ + cptr MINOR_RACES[] = { + "Swordfish", + "Barracuda", + "Globefish", + "Aquatic bear", + "Pike", + "Electric eel", + "Giant crayfish", + "Mermaid", + "Leviathan", + "Box jellyfish", + "Giant piranha", + "Piranha", + "Ocean naga", + "Whale", + "Octopus", + "Giant octopus", + "Drowned soul", + "Tiger shark", + "Hammerhead shark", + "Great white shark", + "White shark", + "Stargazer", + "Flounder", + "Giant turtle", + "Killer whale", + "Water naga", + "Behemoth", + NULL, + }; + /* These monsters earn higher penalties */ + cptr MAJOR_RACES[] = { + "Seahorse", + "Aquatic elven warrior", + "Aquatic elven mage", + "Wavelord", + "The Watcher in the Water", + NULL, + }; + + if (monster_race_in_list_p(m_ptr, MINOR_RACES)) + { + inc_piety(GOD_ALL, -20); + } + + if (monster_race_in_list_p(m_ptr, MAJOR_RACES)) + { + inc_piety(GOD_ALL, -500); + } + } } /* -- cgit v1.2.3