From 1c856b0918c3fcd4f3b8aca1ea1961779900f59d Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Tue, 21 Sep 2010 16:31:17 +0000 Subject: [PATCH] Added belts and related egos git-svn-id: http://svn.net-core.org/repos/t-engine4@1276 51575b47-30f0-44d4-a5cc-537603b46e54 --- .../engine/interface/ActorInventory.lua | 6 +- game/modules/tome/data/birth/descriptors.lua | 12 +++- .../tome/data/general/objects/egos/belt.lua | 68 +++++++++++++++++++ .../data/general/objects/leather-belt.lua | 50 ++++++++++++++ .../tome/data/general/objects/objects.lua | 1 + .../tome/data/general/objects/potions.lua | 1 + .../tome/data/general/objects/scrolls.lua | 1 + game/modules/tome/load.lua | 1 + 8 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 game/modules/tome/data/general/objects/egos/belt.lua create mode 100644 game/modules/tome/data/general/objects/leather-belt.lua diff --git a/game/engines/default/engine/interface/ActorInventory.lua b/game/engines/default/engine/interface/ActorInventory.lua index 0fbdca3f73..79c326bc4c 100644 --- a/game/engines/default/engine/interface/ActorInventory.lua +++ b/game/engines/default/engine/interface/ActorInventory.lua @@ -308,7 +308,11 @@ function _M:wearObject(o, replace, vocal) if vocal then game.logSeen(self, "%s is not wearable.", o:getName{do_color=true}) end return false end - print("wear slot", inven) + if not self.inven[inven] then + if vocal then game.logSeen(self, "%s can not wear %s.", self.name, o:getName{do_color=true}) end + return false + end + local ok, err = self:canWearObject(o) if not ok then if vocal then game.logSeen(self, "%s can not wear: %s (%s).", self.name:capitalize(), o:getName{do_color=true}, err) end diff --git a/game/modules/tome/data/birth/descriptors.lua b/game/modules/tome/data/birth/descriptors.lua index 1e1aaa2186..0e7951dc3e 100644 --- a/game/modules/tome/data/birth/descriptors.lua +++ b/game/modules/tome/data/birth/descriptors.lua @@ -41,7 +41,7 @@ newBirthDescriptor{ }, talents = {}, experience = 1.0, - body = { INVEN = 1000, QS_MAINHAND = 1, QS_OFFHAND = 1, MAINHAND = 1, OFFHAND = 1, FINGER = 2, NECK = 1, LITE = 1, BODY = 1, HEAD = 1, CLOAK = 1, HANDS = 1, FEET = 1, TOOL = 1, QUIVER = 1, MOUNT = 1 }, + body = { INVEN = 1000, QS_MAINHAND = 1, QS_OFFHAND = 1, MAINHAND = 1, OFFHAND = 1, FINGER = 2, NECK = 1, LITE = 1, BODY = 1, HEAD = 1, CLOAK = 1, HANDS = 1, BELT = 1, FEET = 1, TOOL = 1, QUIVER = 1, MOUNT = 1 }, copy = { -- Mages are unheard of at first, nobody but them regenerates mana @@ -59,6 +59,16 @@ newBirthDescriptor{ {type="potion", subtype="potion", name="potion of lesser healing", ego_chance=-1000}, {type="potion", subtype="potion", name="potion of cure poison", ego_chance=-1000}, {type="potion", subtype="potion", name="potion of cure poison", ego_chance=-1000}, + {type="armor", subtype="belt", ego_chance=1000}, + {type="armor", subtype="belt", ego_chance=1000}, + {type="armor", subtype="belt", ego_chance=1000}, + {type="armor", subtype="belt", ego_chance=1000}, + {type="armor", subtype="belt", ego_chance=1000}, + {type="armor", subtype="belt", ego_chance=1000}, + {type="armor", subtype="belt", ego_chance=1000}, + {type="armor", subtype="belt", ego_chance=1000}, + {type="armor", subtype="belt", ego_chance=1000}, + {type="armor", subtype="belt", ego_chance=1000}, }, resolvers.generic(function(e) e.hotkey[9] = {"inventory", "potion of lesser healing"} diff --git a/game/modules/tome/data/general/objects/egos/belt.lua b/game/modules/tome/data/general/objects/egos/belt.lua new file mode 100644 index 0000000000..bffae87380 --- /dev/null +++ b/game/modules/tome/data/general/objects/egos/belt.lua @@ -0,0 +1,68 @@ +-- ToME - Tales of Middle-Earth +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org +local Stats = require "engine.interface.ActorStats" +local DamageType = require "engine.DamageType" + +load("/data/general/objects/egos/charged-defensive.lua") + +newEntity{ + name = " of carrying", suffix=true, instant_resolve=true, + level_range = {1, 50}, + rarity = 5, + cost = 6, + wielder = { + max_encumber = resolvers.mbonus_material(50, 10, function(e, v) return v * 0.4, v end), + }, +} + +newEntity{ + name = " of shielding", suffix=true, instant_resolve=true, + level_range = {20, 50}, + rarity = 10, + cost = 40, + wielder = { + combat_def = resolvers.mbonus_material(10, 5, function(e, v) return v * 1, v end), + }, + max_power = 120, power_regen = 1, + use_power = { name = "create a temporary shield that absorbs damage", power = 100, use = function(self, who) + local power = 100 + who:getMag(120) + who:setEffect(who.EFF_DAMAGE_SHIELD, 10, {power=power}) + game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true}) + end} +} + +newEntity{ + name = "slotted ", prefix=true, instant_resolve=true, + level_range = {1, 50}, + rarity = 1, + cost = 6, + belt_slots = resolvers.mbonus_material(6, 3, function(e, v) return v * 1 end), + on_wear = function(self, who) + who.inven[who.INVEN_INBELT] = {max=self.belt_slots, worn=false, id=who.INVEN_INBELT} + end, + on_cantakeoff = function(self, who) + if #who:getInven(who.INVEN_INBELT) > 0 then + game.logPlayer(who, "You can not remove %s while it still carries items.", self:getName{do_color=true}) + return false + end + end, + on_takeoff = function(self, who) + who.inven[who.INVEN_INBELT] = nil + end, +} diff --git a/game/modules/tome/data/general/objects/leather-belt.lua b/game/modules/tome/data/general/objects/leather-belt.lua new file mode 100644 index 0000000000..c28abf8a11 --- /dev/null +++ b/game/modules/tome/data/general/objects/leather-belt.lua @@ -0,0 +1,50 @@ +-- ToME - Tales of Middle-Earth +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +newEntity{ + define_as = "BASE_LEATHER_BELT", + slot = "BELT", + type = "armor", subtype="belt", + display = "(", color=colors.UMBER, image = resolvers.image_material("belt", "leather"), + encumber = 1, + rarity = 6, + desc = [[A belt that goes around your waist.]], + egos = "/data/general/objects/egos/belt.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) }, +} + +newEntity{ base = "BASE_LEATHER_BELT", + name = "rough leather belt", + level_range = {1, 20}, + cost = 1, + material_level = 1, +} + +newEntity{ base = "BASE_LEATHER_BELT", + name = "hardened leather belt", + level_range = {20, 40}, + cost = 2, + material_level = 3, +} + +newEntity{ base = "BASE_LEATHER_BELT", + name = "drakeskin leather belt", + level_range = {40, 50}, + cost = 4, + material_level = 5, +} diff --git a/game/modules/tome/data/general/objects/objects.lua b/game/modules/tome/data/general/objects/objects.lua index 0db04ab412..6438d416ed 100644 --- a/game/modules/tome/data/general/objects/objects.lua +++ b/game/modules/tome/data/general/objects/objects.lua @@ -71,6 +71,7 @@ loadIfNot("/data/general/objects/heavy-boots.lua") loadIfNot("/data/general/objects/gloves.lua") loadIfNot("/data/general/objects/gauntlets.lua") loadIfNot("/data/general/objects/cloak.lua") +loadIfNot("/data/general/objects/leather-belt.lua") -- Mounts loadIfNot("/data/general/objects/mounts.lua") diff --git a/game/modules/tome/data/general/objects/potions.lua b/game/modules/tome/data/general/objects/potions.lua index 6815536f58..20f513f83f 100644 --- a/game/modules/tome/data/general/objects/potions.lua +++ b/game/modules/tome/data/general/objects/potions.lua @@ -19,6 +19,7 @@ newEntity{ define_as = "BASE_POTION", + slot = "INBELT", type = "potion", subtype="potion", unided_name = "potion", id_by_type = true, display = "!", color=colors.WHITE, image="object/potion-0x0.png", diff --git a/game/modules/tome/data/general/objects/scrolls.lua b/game/modules/tome/data/general/objects/scrolls.lua index b41b96e52a..4d7f0269ca 100644 --- a/game/modules/tome/data/general/objects/scrolls.lua +++ b/game/modules/tome/data/general/objects/scrolls.lua @@ -19,6 +19,7 @@ newEntity{ define_as = "BASE_SCROLL", + slot = "INBELT", type = "scroll", subtype="scroll", unided_name = "scroll", id_by_type = true, display = "?", color=colors.WHITE, image="object/scroll.png", diff --git a/game/modules/tome/load.lua b/game/modules/tome/load.lua index 343b048d1d..3ed0de1854 100644 --- a/game/modules/tome/load.lua +++ b/game/modules/tome/load.lua @@ -73,6 +73,7 @@ ActorInventory:defineInventory("BELT", "Around waist", true, "Belts are worn aro ActorInventory:defineInventory("HANDS", "On hands", true, "Various gloves can be worn on your hands.") ActorInventory:defineInventory("FEET", "On feet", true, "Sandals or boots can be worn on your feet.") ActorInventory:defineInventory("TOOL", "Tool", true, "This is your readied tool, always available immediately.") +ActorInventory:defineInventory("INBELT", "In your belt", true, "Put small objects in your belt.") ActorInventory:defineInventory("QUIVER", "Quiver", true, "Your readied ammo.") ActorInventory:defineInventory("MOUNT", "Mount", false, "Your mount.") -- GitLab