diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index 8fa7d597c9c4363a9e606be2be13b8326898b1a5..2ee898e4506aa770615250febf35eb460a1eedcc 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -1071,7 +1071,7 @@ function _M:addedToLevel(level, x, y) -- Find an actor with that filter local m = game.zone:makeEntity(game.level, "actor", filter) if m and m:canMove(x, y) then game.zone:addEntity(game.level, m, "actor", x, y) - else m:removed() end + elseif m then m:removed() end end end self.make_escort = nil diff --git a/game/modules/tome/data/chats/gates-of-morning-welcome.lua b/game/modules/tome/data/chats/gates-of-morning-welcome.lua index 5206001b721b9f96ec43afc159381c18dae18f48..d7166c4edf2fc4899650cc0e796aa84ba4894f96 100644 --- a/game/modules/tome/data/chats/gates-of-morning-welcome.lua +++ b/game/modules/tome/data/chats/gates-of-morning-welcome.lua @@ -42,7 +42,7 @@ newChat{ id="orcs", text = [[Orcs! Ah! Well then this is your lucky day, this whole continent is filled with Orcs. They have united themselves as the Orc Pride and rumours speak of some powerful masters. They roam the lands freely, ever assaulting us. @playername@ you are welcome to the Gates of Morning, should you prove to be trustful. -There is a cavern full of spiders just to he north, we can not stand against both them and the Orc Pride. +There is a cavern full of spiders just to the north, we can not stand against both them and the Orc Pride. Please go there and destroy the source of infestation.]], answers = { {"I will my Lady.", action=function(npc, player) player:grantQuest("spydric-infestation") end}, diff --git a/game/modules/tome/data/damage_types.lua b/game/modules/tome/data/damage_types.lua index 53006de31fbaad81ec1a06bf0f2cc23380947f6a..c2c5799239a08bb047eefba52f8012c5beee3c9c 100644 --- a/game/modules/tome/data/damage_types.lua +++ b/game/modules/tome/data/damage_types.lua @@ -82,7 +82,7 @@ local function tryDestroy(who, inven, dam, destroy_prop, proof_prop, msg) local o = inven[i] if o[destroy_prop] and not o[proof_prop] then for j, test in ipairs(o[destroy_prop]) do - if realdam >= test[1] and rng.percent(test[2]) then + if dam >= test[1] and rng.percent(test[2]) then game.logPlayer(who, msg, o:getName{do_color=true, no_count=true}) local obj = who:removeObject(inven, i) obj:removed() diff --git a/game/modules/tome/data/general/grids/mountain.lua b/game/modules/tome/data/general/grids/mountain.lua index 106e650be25d26c9cae3055dc56e0bafdf3f13fb..3141d9a7d587e86ce8d6a0ac4d33ee7dcf5abe8b 100644 --- a/game/modules/tome/data/general/grids/mountain.lua +++ b/game/modules/tome/data/general/grids/mountain.lua @@ -31,6 +31,7 @@ newEntity{ can_pass = {pass_wall=1}, does_block_move = true, block_sight = true, + air_level = -20, dig = "ROCKY_GROUND", } diff --git a/game/modules/tome/data/general/npcs/ant.lua b/game/modules/tome/data/general/npcs/ant.lua index b576f225892783ad5baa3ff26c63d0c2f8904e3f..151907359df10c5c58f31b258a036c89757bc892 100644 --- a/game/modules/tome/data/general/npcs/ant.lua +++ b/game/modules/tome/data/general/npcs/ant.lua @@ -134,7 +134,7 @@ newEntity{ base = "BASE_NPC_ANT", } newEntity{ base = "BASE_NPC_ANT", - name = "giant acid ant", color=colors.BLACK, + name = "giant acid ant", color=colors.DARK_GREY, desc = "It's a large black ant. Its porous skin oozes acid.", level_range = {15, 50}, exp_worth = 1, rarity = 4, diff --git a/game/modules/tome/data/general/npcs/jelly.lua b/game/modules/tome/data/general/npcs/jelly.lua index f1a605e7b1be0fa850a75b6b1c84754c82e7befb..aed477c045f96ce9d087ff9009cd3974ab713c4e 100644 --- a/game/modules/tome/data/general/npcs/jelly.lua +++ b/game/modules/tome/data/general/npcs/jelly.lua @@ -88,7 +88,7 @@ newEntity{ base = "BASE_NPC_JELLY", } newEntity{ base = "BASE_NPC_JELLY", - name = "black jelly", color=colors.BLACK, + name = "black jelly", color=colors.DARK_GREY, desc = "A strange black blob on the dungeon floor.", level_range = {1, 25}, exp_worth = 1, rarity = 4, diff --git a/game/modules/tome/data/general/npcs/snow-giant.lua b/game/modules/tome/data/general/npcs/snow-giant.lua new file mode 100644 index 0000000000000000000000000000000000000000..24ad5f9ae3e455f01c17ee5f6bfb1b33c10241aa --- /dev/null +++ b/game/modules/tome/data/general/npcs/snow-giant.lua @@ -0,0 +1,103 @@ +-- 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 Talents = require("engine.interface.ActorTalents") + +newEntity{ + define_as = "BASE_NPC_SNOW_GIANT", + type = "giant", subtype = "ice", + display = "P", color=colors.WHITE, + + combat = { dam=resolvers.rngavg(15,20), atk=15, apr=15, dammod={str=0.8} }, + + body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1 }, + resolvers.drops{chance=100, nb=1, {type="money"} }, + + infravision = 20, + life_rating = 12, + max_stamina = 90, + rank = 2, + size_category = 4, + + autolevel = "warrior", + ai = "dumb_talented_simple", ai_state = { ai_target="target_player_radius", sense_radius=6, talent_in=3, }, + energy = { mod=1 }, + stats = { str=20, dex=8, mag=6, con=16 }, + + resists = { [DamageType.PHYSICAL] = 20, [DamageType.FIRE] = 50, }, + + no_breath = 1, + confusion_immune = 1, + poison_immune = 1, +} + +newEntity{ base = "BASE_NPC_SNOW_GIANT", + name = "snow giant", color=colors.WHITE, + desc = [[A towering creature, humanoid but huge. It wield a giant maul and does not look friendly.]], + level_range = {10, 50}, exp_worth = 1, + rarity = 5, + max_life = resolvers.rngavg(100,120), + combat_armor = 0, combat_def = 0, + on_melee_hit = {[DamageType.COLD]=resolvers.mbonus(15, 5)}, + melee_project = {[DamageType.COLD]=resolvers.mbonus(15, 5)}, + resolvers.talents{ [Talents.T_MIND_DISRUPTION]=2, }, +} + +newEntity{ base = "BASE_NPC_SNOW_GIANT", + name = "snow giant thunderer", color=colors.LIGHT_BLUE, + desc = [[A towering creature, humanoid but huge. It wield a giant maul and does not look friendly. Lightning crackles over its body.]], + level_range = {14, 50}, exp_worth = 1, + rarity = 7, + max_life = resolvers.rngavg(100,120), + combat_armor = 0, combat_def = 0, + on_melee_hit = {[DamageType.COLD]=resolvers.mbonus(15, 5)}, + melee_project = {[DamageType.COLD]=resolvers.mbonus(15, 5)}, + autolevel = "warriormage", + resolvers.talents{ [Talents.T_LIGHTNING]=3, [Talents.T_CHAIN_LIGHTNING]=3, }, +} + +newEntity{ base = "BASE_NPC_SNOW_GIANT", + name = "snow giant boulder thrower", color=colors.LIGHT_UMBER, + desc = [[A towering creature, humanoid but huge. It wield a giant maul and does not look friendly.]], + level_range = {15, 50}, exp_worth = 1, + rarity = 7, + max_life = resolvers.rngavg(100,120), + combat_armor = 0, combat_def = 0, + on_melee_hit = {[DamageType.COLD]=resolvers.mbonus(15, 5)}, + melee_project = {[DamageType.COLD]=resolvers.mbonus(15, 5)}, + resolvers.talents{ [Talents.T_THROW_BOULDER]=3, }, +} + +newEntity{ base = "BASE_NPC_SNOW_GIANT", + name = "snow giant chieftain", color=colors.AQUAMARINE, + desc = [[A towering creature, humanoid but huge. It wield a giant maul and does not look friendly.]], + level_range = {15, 50}, exp_worth = 1, + rarity = 13, + rank = 3, + max_life = resolvers.rngavg(150,170), + combat_armor = 12, combat_def = 12, + on_melee_hit = {[DamageType.COLD]=resolvers.mbonus(15, 10)}, + melee_project = {[DamageType.COLD]=resolvers.mbonus(15, 10)}, + resolvers.talents{ [Talents.T_KNOCKBACK]=3, [Talents.T_STUN]=3, }, + make_escort = { + {type="giant", subtype="ice", number=3}, + }, + + resolvers.drops{chance=100, nb=1, {ego_chance=10} }, +} diff --git a/game/modules/tome/data/general/npcs/xorn.lua b/game/modules/tome/data/general/npcs/xorn.lua index db75ed8a8e653cb503113047935f68e9bb1e6e16..347f1aecff0baa43f2568e25c57642fbb55fab97 100644 --- a/game/modules/tome/data/general/npcs/xorn.lua +++ b/game/modules/tome/data/general/npcs/xorn.lua @@ -27,11 +27,11 @@ newEntity{ combat = { dam=resolvers.rngavg(15,20), atk=15, apr=15, dammod={str=0.8} }, body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1 }, - resolvers.drops{chance=20, nb=1, {} }, + resolvers.drops{chance=100, nb=1, {type="money"} }, resolvers.drops{chance=60, nb=1, {type="money"} }, + resolvers.drops{chance=40, nb=1, {type="money"} }, can_pass = {pass_wall=20}, - move_project = {[DamageType.DIG]=1}, infravision = 20, life_rating = 12, @@ -44,16 +44,42 @@ newEntity{ energy = { mod=1 }, stats = { str=20, dex=8, mag=6, con=16 }, + resists = { [DamageType.PHYSICAL] = 20, [DamageType.FIRE] = 50, }, + + no_breath = 1, confusion_immune = 1, poison_immune = 1, } newEntity{ base = "BASE_NPC_XORN", - name = "Umber Hulk", color=colors.UMBER, + name = "umber hulk", color=colors.LIGHT_UMBER, desc = [[This bizarre creature has glaring eyes and large mandibles capable of slicing through rock.]], level_range = {10, 50}, exp_worth = 1, rarity = 12, max_life = resolvers.rngavg(100,120), - combat_armor = 15, combat_def = 0, + combat_armor = 12, combat_def = 0, + move_project = {[DamageType.DIG]=1}, resolvers.talents{ [Talents.T_MIND_DISRUPTION]=2, }, } + +newEntity{ base = "BASE_NPC_XORN", + name = "xorn", color=colors.UMBER, + desc = [[A huge creature of the element Earth. Able to merge with its element, it has four huge arms protruding from its enormous torso.]], + level_range = {15, 50}, exp_worth = 1, + rarity = 12, + max_life = resolvers.rngavg(130,140), + combat_armor = 15, combat_def = 10, + combat = { damtype=DamageType.ACID }, + resolvers.talents{ [Talents.T_CONSTRICT]=4, }, +} + +newEntity{ base = "BASE_NPC_XORN", + name = "xaren", color=colors.SLATE, + desc = [[It is a tougher relative of the Xorn. Its hide glitters with metal ores.]], + level_range = {15, 50}, exp_worth = 1, + rarity = 12, + max_life = resolvers.rngavg(130,140), + combat_armor = 15, combat_def = 10, + combat = { damtype=DamageType.ACID }, + resolvers.talents{ [Talents.T_CONSTRICT]=4, [Talents.T_RUSH]=2, }, +} diff --git a/game/modules/tome/data/general/objects/quest-artifacts.lua b/game/modules/tome/data/general/objects/quest-artifacts.lua index fa58a7d2f101cc137e8ca23ffe0ac7cbed9b53c8..d28b5261ec28d47c3ca696f0eb6289629a7d09ff 100644 --- a/game/modules/tome/data/general/objects/quest-artifacts.lua +++ b/game/modules/tome/data/general/objects/quest-artifacts.lua @@ -72,7 +72,7 @@ newEntity{ define_as = "ORB_MANY_WAYS", display = "*", color=colors.VIOLET, encumber = 1, desc = [[The orb projects images of distance places, some that seem to not be of this world, switching rapidly. -If used near an portal it could probably activate it.]], +If used near a portal it could probably activate it.]], max_power = 50, power_regen = 1, use_power = { name = "activate a portal", power = 25, diff --git a/game/modules/tome/data/general/objects/wands.lua b/game/modules/tome/data/general/objects/wands.lua index 078c0769c8048992120e776bc0f6fbb4ac800f61..9239c1a5e5248301e338cac91bdf135b8c5cbdae 100644 --- a/game/modules/tome/data/general/objects/wands.lua +++ b/game/modules/tome/data/general/objects/wands.lua @@ -24,7 +24,7 @@ newEntity{ display = "_", color=colors.WHITE, encumber = 0.7, use_sound = "talents/spell_generic", - elec_destroy = 20, + elec_destroy = {{10,1}, {20,2}, {40,5}, {60,10}, {120,20}}, desc = [[Magical wands are made by powerful alchemists to store spells. Anybody can use them to release the spells.]], -- egos = "/data/general/objects/egos/wands.lua", egos_chance = resolvers.mbonus(10, 5), } diff --git a/game/modules/tome/data/talents/misc/npcs.lua b/game/modules/tome/data/talents/misc/npcs.lua index 3c475e75bcfeb62c40e61219f973062398caa927..669c7a1f5df99fe12641be3fb674c658af8fac6b 100644 --- a/game/modules/tome/data/talents/misc/npcs.lua +++ b/game/modules/tome/data/talents/misc/npcs.lua @@ -578,3 +578,27 @@ newTalent{ The damage will increase with the Dexterity stat]]):format(20 + (self:getDex() * self:getTalentLevel(t)) * 0.3) end, } + +newTalent{ + name = "Throw Boulder", + type = {"wild-gift/other", }, + points = 5, + equilibrium = 5, + cooldown = 3, + tactical = { + ATTACK = 10, + }, + range = 20, + action = function(self, t) + local tg = {type="ball", range=self:getTalentRange(t), radius=1, talent=t} + local x, y = self:getTarget(tg) + if not x or not y then return nil end + self:project(tg, x, y, DamageType.PHYSKNOCKBACK, {dist=3+self:getTalentLevelRaw(t), dam=self:spellCrit(12 + self:getStr(50) * self:getTalentLevel(t))}, {type="archery"}) + game:playSoundNear(self, "talents/ice") + return true + end, + info = function(self, t) + return ([[Throws a huge boulder at a target, damaging it for %0.2f and knocking it back. + The damage will increase with the Strength stat]]):format(12 + self:getStr(50) * self:getTalentLevel(t)) + end, +} diff --git a/game/modules/tome/data/zones/carn-dum/npcs.lua b/game/modules/tome/data/zones/carn-dum/npcs.lua index 6a40ad7f589251200cbb5c7c627fef6f2c397ef8..173d9a807dbb1dfd569f890b7c9fd6cd93b7d2b4 100644 --- a/game/modules/tome/data/zones/carn-dum/npcs.lua +++ b/game/modules/tome/data/zones/carn-dum/npcs.lua @@ -18,6 +18,8 @@ -- darkgod@te4.org load("/data/general/npcs/xorn.lua") +load("/data/general/npcs/canine.lua", function(e) if e.rarity then e.rarity = e.rarity * 2 end end) +load("/data/general/npcs/snow-giant.lua") local Talents = require("engine.interface.ActorTalents") diff --git a/src/core_lua.c b/src/core_lua.c index 286b3e5f0ef8199c45562ed51e897b3d74c033ff..d7b1dfe62dcf345e82fe50e37ad9d1bad4bc617e 100644 --- a/src/core_lua.c +++ b/src/core_lua.c @@ -270,6 +270,7 @@ static int lua_fovcache_set(lua_State *L) int y = luaL_checknumber(L, 3); bool opaque = lua_toboolean(L, 4); + if (x < 0 || y < 0 || x >= cache->w || y >= cache->h) return 0; cache->cache[x + y * cache->w] = opaque; return 0;