diff options
-rw-r--r-- | lib/mods/theme/scpt/s_aule.lua | 157 | ||||
-rw-r--r-- | src/externs.h | 14 | ||||
-rw-r--r-- | src/spells.pkg | 14 | ||||
-rw-r--r-- | src/spells3.c | 213 |
4 files changed, 250 insertions, 148 deletions
diff --git a/lib/mods/theme/scpt/s_aule.lua b/lib/mods/theme/scpt/s_aule.lua index d3ca4733..75a121b1 100644 --- a/lib/mods/theme/scpt/s_aule.lua +++ b/lib/mods/theme/scpt/s_aule.lua @@ -13,27 +13,8 @@ AULE_FIREBRAND = add_spell ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - local type, rad - local level = get_level(AULE_FIREBRAND) - type = GF_FIRE - - if (get_level(AULE_FIREBRAND) > 30) then - type = GF_HOLY_FIRE - end - - rad = 0 - if (level >= 15) then - rad = 1 - end - return set_project(level + randint(20), - type, 4 + level, rad, - bor(PROJECT_STOP, PROJECT_KILL)) - end, - ["info"] = function() - local level = get_level(AULE_FIREBRAND) - return "dur "..(level).."+d20 dam "..(4 + level).."/blow" - end, + ["spell"] = function() return aule_firebrand_spell() end, + ["info"] = function() return aule_firebrand_info() end, ["desc"] = { "Imbues your melee weapon with fire to deal more damage", "At level 15 it spreads over a 1 radius zone around your target", @@ -52,58 +33,8 @@ AULE_ENCHANT_WEAPON = add_spell ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - local level = get_level(AULE_ENCHANT_WEAPON) - local num_h, num_d, num_p - - local ret, item, obj - - num_h = 1 + randint(level/12) - num_d = 0 - num_p = 0 - if (level >= 5) then - num_d = 1 + randint(level/12) - end - if (level >= 45) then - num_p = 1 - end - --return enchant_spell(num_h, num_d, 0, num_p) - - ret, item = get_item("Which object do you want to enchant?", - "You have no objects to enchant.", - bor(USE_INVEN), - function (obj) - if obj.name1 > 0 then return FALSE end - if (obj.tval == TV_MSTAFF) then - return TRUE - elseif (obj.tval == TV_BOW) then - return TRUE - elseif (obj.tval == TV_HAFTED) then - return TRUE - elseif (obj.tval == TV_POLEARM) then - return TRUE - elseif (obj.tval == TV_SWORD) then - return TRUE - elseif (obj.tval == TV_AXE) then - return TRUE - end - return FALSE - end - ) - if ret == FALSE then return FALSE end - - obj = get_object(item) - - obj.to_h = obj.to_h + num_h - obj.to_d = obj.to_d + num_h - obj.pval = obj.pval + num_p - - return TRUE - - end, - ["info"] = function() - return "tries "..(1 + get_level(AULE_ENCHANT_WEAPON)/12) - end, + ["spell"] = function() return aule_enchant_weapon_spell() end, + ["info"] = function() return aule_enchant_weapon_info() end, ["desc"] = { "Tries to enchant a weapon to-hit", "At level 5 it also enchants to-dam", @@ -122,66 +53,8 @@ AULE_ENCHANT_ARMOUR = add_spell { ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - local level = get_level(AULE_ENCHANT_ARMOUR) - local num_h, num_d, num_a, num_p - local ret, item, obj - - num_a = 1 + randint(level/10) - num_h = 0 - num_d = 0 - num_p = 0 - if (level >= 20) then - num_h = 1 - num_d = 1 - end - if (level >= 40) then - num_p = 1 - end - --return enchant_spell(num_h, num_d, num_a, num_p) - - ret, item = get_item("Which object do you want to enchant?", - "You have no objects to enchant.", - bor(USE_INVEN), - function (obj) - if obj.name1 > 0 then return FALSE end - if (obj.tval == TV_BOOTS) then - return TRUE - elseif (obj.tval == TV_GLOVES) then - return TRUE - elseif (obj.tval == TV_HELM) then - return TRUE - elseif (obj.tval == TV_CROWN) then - return TRUE - elseif (obj.tval == TV_SHIELD) then - return TRUE - elseif (obj.tval == TV_CLOAK) then - return TRUE - elseif (obj.tval == TV_SOFT_ARMOR) then - return TRUE - elseif (obj.tval == TV_HARD_ARMOR) then - return TRUE - elseif (obj.tval == TV_DRAG_ARMOR) then - return TRUE - end - return FALSE - end - ) - if ret == FALSE then return FALSE end - - obj = get_object(item) - - obj.to_h = obj.to_h + num_h - obj.to_d = obj.to_d + num_h - obj.pval = obj.pval + num_p - obj.to_a = obj.to_a + num_h - - return TRUE - - end, - ["info"] = function() - return "tries "..(1 + get_level(AULE_ENCHANT_ARMOUR)/10) - end, + ["spell"] = function() return aule_enchant_armour_spell() end, + ["info"] = function() return aule_enchant_armour_info() end, ["desc"] = { "Tries to enchant a piece of armour", "At level 20 it also enchants to-hit and to-dam", @@ -201,22 +74,10 @@ AULE_CHILD = add_spell ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - local y, x, m_idx - - y, x = find_position(player.py, player.px) - m_idx = place_monster_one(y, x, test_monster_name("Dwarven warrior"), 0, FALSE, MSTATUS_FRIEND) - - if m_idx ~= 0 then - monster_set_level(m_idx, 20 + get_level(AULE_CHILD, 70, 0)) - return TRUE - end - end, - ["info"] = function() - return "level "..(20 + get_level(AULE_CHILD, 70)) - end, + ["spell"] = function() return aule_child_spell() end, + ["info"] = function() return aule_child_info() end, ["desc"] = { "Summons a levelled Dwarven warrior to help you battle the forces", "of Morgoth" } -}
\ No newline at end of file +} diff --git a/src/externs.h b/src/externs.h index e3ec6ba0..06e0ec76 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1841,6 +1841,20 @@ char *music_horns_of_ylmir_info(); bool_ *music_ambarkanta_spell(); char *music_ambarkanta_info(); +extern s32b AULE_FIREBRAND; +extern s32b AULE_ENCHANT_WEAPON; +extern s32b AULE_ENCHANT_ARMOUR; +extern s32b AULE_CHILD; + +bool_ *aule_firebrand_spell(); +char *aule_firebrand_info(); +bool_ *aule_enchant_weapon_spell(); +char *aule_enchant_weapon_info(); +bool_ *aule_enchant_armour_spell(); +char *aule_enchant_armour_info(); +bool_ *aule_child_spell(); +char *aule_child_info(); + /* randart.c */ extern int get_activation_power(void); extern void build_prob(cptr learn); diff --git a/src/spells.pkg b/src/spells.pkg index e032b220..ac17116b 100644 --- a/src/spells.pkg +++ b/src/spells.pkg @@ -2844,3 +2844,17 @@ char *music_horns_of_ylmir_info(); bool_ *music_ambarkanta_spell(); char *music_ambarkanta_info(); + +extern s32b AULE_FIREBRAND; +extern s32b AULE_ENCHANT_WEAPON; +extern s32b AULE_ENCHANT_ARMOUR; +extern s32b AULE_CHILD; + +bool_ *aule_firebrand_spell(); +char *aule_firebrand_info(); +bool_ *aule_enchant_weapon_spell(); +char *aule_enchant_weapon_info(); +bool_ *aule_enchant_armour_spell(); +char *aule_enchant_armour_info(); +bool_ *aule_child_spell(); +char *aule_child_info(); diff --git a/src/spells3.c b/src/spells3.c index 1cbe0d85..15f101de 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -147,6 +147,11 @@ s32b MUSIC_WIND; s32b MUSIC_YLMIR; s32b MUSIC_AMBARKANTA; +s32b AULE_FIREBRAND; +s32b AULE_ENCHANT_WEAPON; +s32b AULE_ENCHANT_ARMOUR; +s32b AULE_CHILD; + /* FIXME: Hackish workaround while we're still tied to Lua. This lets us return Lua's "nil" and a non-nil value (which is all the s_aux.lua @@ -4208,3 +4213,211 @@ char *music_ambarkanta_info() { return ""; } + +bool_ *aule_firebrand_spell() +{ + int rad = 0; + int type = GF_FIRE; + s32b level = get_level_s(AULE_FIREBRAND, 50); + + if (level > 30) + { + type = GF_HOLY_FIRE; + } + + if (level >= 15) + { + rad = 1; + } + + set_project(level + randint(20), + type, + 4 + level, + rad, + PROJECT_STOP | PROJECT_KILL); + return CAST; +} + +char *aule_firebrand_info() +{ + s32b level = get_level_s(AULE_FIREBRAND, 50); + static char buf[128]; + + sprintf(buf, + "dur " FMTs32b "+d20 dam " FMTs32b "/blow", + level, + 4 + level); + return buf; +} + +static bool_ aule_enchant_weapon_item_tester(object_type *o_ptr) +{ + if (o_ptr->name1 > 0) + { + return FALSE; + } + + switch (o_ptr->tval) + { + case TV_MSTAFF: + case TV_BOW: + case TV_HAFTED: + case TV_POLEARM: + case TV_SWORD: + case TV_AXE: + return TRUE; + + default: + return FALSE; + } +} + +bool_ *aule_enchant_weapon_spell() +{ + s32b level = get_level_s(AULE_ENCHANT_WEAPON, 50); + s16b num_h, num_d, num_p; + int item; + object_type *o_ptr = NULL; + + num_h = 1 + randint(level/12); + num_d = 0; + num_p = 0; + + if (level >= 5) + { + num_d = 1 + randint(level/12); + } + if (level >= 45) + { + num_p = 1; + } + + item_tester_hook = aule_enchant_weapon_item_tester; + if (!get_item(&item, + "Which object do you want to enchant?", + "You have no objects to enchant.", + USE_INVEN)) + { + return NO_CAST; + } + + o_ptr = get_object(item); + + o_ptr->to_h = o_ptr->to_h + num_h; + o_ptr->to_d = o_ptr->to_d + num_d; + o_ptr->pval = o_ptr->pval + num_p; + + return CAST; +} + +char *aule_enchant_weapon_info() +{ + static char buf[128]; + sprintf(buf, + "tries " FMTs32b, + 1 + get_level_s(AULE_ENCHANT_WEAPON, 50)/12); + return buf; +} + +bool_ aule_enchant_armor_item_tester(object_type *o_ptr) +{ + if (o_ptr->name1 > 0) + { + return FALSE; + } + + switch (o_ptr->tval) + { + case TV_BOOTS: + case TV_GLOVES: + case TV_HELM: + case TV_CROWN: + case TV_SHIELD: + case TV_CLOAK: + case TV_SOFT_ARMOR: + case TV_HARD_ARMOR: + case TV_DRAG_ARMOR: + return TRUE; + + default: + return FALSE; + } +} + +bool_ *aule_enchant_armour_spell() +{ + s32b level = get_level_s(AULE_ENCHANT_ARMOUR, 50); + s16b num_h, num_d, num_a, num_p; + int item; + object_type *o_ptr = NULL; + + num_a = 1 + randint(level/10); + num_h = 0; + num_d = 0; + num_p = 0; + if (level >= 20) + { + num_h = 1; + num_d = 1; + } + if (level >= 40) + { + num_p = 1; + } + + item_tester_hook = aule_enchant_armor_item_tester; + if (!get_item(&item, + "Which object do you want to enchant?", + "You have no objects to enchant.", + USE_INVEN)) + { + return NO_CAST; + } + + o_ptr = get_object(item); + + o_ptr->to_h = o_ptr->to_h + num_h; + o_ptr->to_d = o_ptr->to_d + num_d; + o_ptr->pval = o_ptr->pval + num_p; + o_ptr->to_a = o_ptr->to_a + num_a; + + return CAST; +} + +char *aule_enchant_armour_info() +{ + static char buf[128]; + sprintf(buf, + "tries " FMTs32b, + 1 + get_level_s(AULE_ENCHANT_ARMOUR, 50)/10); + return buf; +} + +bool_ *aule_child_spell() +{ + int y, x; + s16b m_idx; + + find_position(p_ptr->py, p_ptr->px, &y, &x); + m_idx = place_monster_one(y, x, test_monster_name("Dwarven warrior"), + 0, FALSE, MSTATUS_FRIEND); + + if (m_idx) + { + monster_set_level(m_idx, 20 + get_level(AULE_CHILD, 70, 0)); + return CAST; + } + else + { + return NO_CAST; + } +} + +char *aule_child_info() +{ + static char buf[128]; + sprintf(buf, + "level " FMTs32b, + 20 + get_level_s(AULE_CHILD, 70)); + return buf; +} |