Skip to content
Snippets Groups Projects
Commit b87b4b33 authored by dg's avatar dg
Browse files

Gemology: Imbue body armours with gems

git-svn-id: http://svn.net-core.org/repos/t-engine4@903 51575b47-30f0-44d4-a5cc-537603b46e54
parent bb3e4a25
No related branches found
No related tags found
No related merge requests found
Showing
with 292 additions and 28 deletions
......@@ -144,6 +144,7 @@ function _M:checkFilter(e, filter)
if filter.subtype and filter.subtype ~= e.subtype then return false end
if filter.name and filter.name ~= e.name then return false end
if e.checkFilter and not e:checkFilter(filter) then return end
if filter.special and not filter.special(e) then return end
if e.unique then print("accepted unique", e.name, e.__CLASSNAME.."/"..e.unique) end
......
......@@ -740,6 +740,7 @@ function _M:setupCommands()
-- Toggle monster list
TOGGLE_NPC_LIST = function()
self.show_npc_list = not self.show_npc_list
self.player.changed = true
end,
EXIT = function()
......
......@@ -207,7 +207,7 @@ function _M:getTextualDesc()
if w.resists then
local rs = {}
for res, i in pairs(w.resists) do
rs[#rs+1] = ("%d%% %s"):format(i, DamageType.dam_def[res].name)
rs[#rs+1] = ("%d%% %s"):format(i, res == "all" and "all" or DamageType.dam_def[res].name)
end
desc[#desc+1] = ("Increases resistances: %s."):format(table.concat(rs, ','))
end
......@@ -215,7 +215,7 @@ function _M:getTextualDesc()
if w.inc_damage then
local rs = {}
for res, i in pairs(w.inc_damage) do
rs[#rs+1] = ("%d%% %s"):format(i, DamageType.dam_def[res].name)
rs[#rs+1] = ("%d%% %s"):format(i, res == "all" and "all" or DamageType.dam_def[res].name)
end
desc[#desc+1] = ("Increases damage type: %s."):format(table.concat(rs, ','))
end
......
......@@ -26,6 +26,7 @@ newEntity{
display = "/", color=colors.SLATE,
encumber = 3,
rarity = 5,
metallic = true,
combat = { talented = "axe", damrange = 1.5, sound = "actions/melee", sound_miss = "actions/melee_miss", },
desc = [[Massive two-handed battleaxes.]],
twohanded = true,
......
......@@ -26,6 +26,7 @@ newEntity{
display = "\\", color=colors.SLATE,
encumber = 5,
rarity = 5,
metallic = true,
combat = { talented = "mace", damrange = 1.5, physspeed=1.2, sound = "actions/melee", sound_miss = "actions/melee_miss", },
desc = [[Massive two-handed maul.]],
twohanded = true,
......
......@@ -29,6 +29,7 @@ newEntity{
combat = { talented = "sword", damrange = 1.6, sound = "actions/melee", sound_miss = "actions/melee_miss", },
desc = [[Massive two-handed swords.]],
twohanded = true,
metallic = true,
egos = "/data/general/objects/egos/weapon.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
}
......
......@@ -25,6 +25,7 @@ newEntity{
display = "/", color=colors.SLATE,
encumber = 3,
rarity = 3,
metallic = true,
combat = { talented = "axe", damrange = 1.4, sound = "actions/melee", sound_miss = "actions/melee_miss",},
desc = [[One-handed war axes.]],
egos = "/data/general/objects/egos/weapon.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
......
......@@ -17,6 +17,8 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
local Stats = require "engine.interface.ActorStats"
newEntity{
define_as = "BASE_GEM",
type = "gem", subtype="white",
......@@ -27,7 +29,7 @@ newEntity{
desc = [[Gems can be sold for money or used in arcane rituals.]],
}
local function newGem(name, cost, rarity, color, min_level, max_level, tier, power)
local function newGem(name, cost, rarity, color, min_level, max_level, tier, power, imbue, bomb)
-- Gems, randomly lootable
newEntity{ base = "BASE_GEM", define_as = "GEM_"..name:upper(),
name = name:lower(), subtype = color,
......@@ -35,6 +37,7 @@ local function newGem(name, cost, rarity, color, min_level, max_level, tier, pow
level_range = {min_level, max_level},
rarity = rarity, cost = cost,
material_level = tier,
imbue_powers = imbue,
}
-- Alchemist gems, not lootable, only created by talents
newEntity{ base = "BASE_GEM", define_as = "ALCHEMIST_GEM_"..name:upper(),
......@@ -44,30 +47,103 @@ local function newGem(name, cost, rarity, color, min_level, max_level, tier, pow
cost = 0,
material_level = tier,
alchemist_power = power,
alchemist_bomb = bomb,
}
end
newGem("Diamond", 5, 18, "white", 40, 50, 5, 70)
newGem("Pearl", 5, 18, "white", 40, 50, 5, 70)
newGem("Moonstone", 5, 18, "white", 40, 50, 5, 70)
newGem("Fire Opal", 5, 18, "red", 40, 50, 5, 70)
newGem("Bloodstone", 5, 18, "red", 40, 50, 5, 70)
newGem("Ruby", 4, 16, "red", 30, 40, 4, 65)
newGem("Amber", 4, 16, "yellow", 30, 40, 4, 65)
newGem("Turquoise", 4, 16, "green", 30, 40, 4, 65)
newGem("Jade", 4, 16, "green", 30, 40, 4, 65)
newGem("Sapphire", 4, 16, "blue", 30, 40, 4, 65)
newGem("Quartz", 3, 12, "white", 20, 30, 3, 50)
newGem("Emerald", 3, 12, "green", 20, 30, 3, 50)
newGem("Lapis Lazuli", 3, 12, "blue", 20, 30, 3, 50)
newGem("Garnets", 3, 12, "red", 20, 30, 3, 50)
newGem("Onyx", 3, 12, "black", 20, 30, 3, 50)
newGem("Amethyst", 2, 10, "violet", 10, 20, 2, 35)
newGem("Opal", 2, 10, "blue", 10, 20, 2, 35)
newGem("Topaz", 2, 10, "blue", 10, 20, 2, 35)
newGem("Aquamarine", 2, 10, "blue", 10, 20, 2, 35)
newGem("Ametrine", 1, 8, "yellow", 1, 10, 1, 20)
newGem("Zircon", 1, 8, "yellow", 1, 10, 1, 20)
newGem("Spinel", 1, 8, "green", 1, 10, 1, 20)
newGem("Citrine", 1, 8, "yellow", 1, 10, 1, 20)
newGem("Agate", 1, 8, "black", 1, 10, 1, 20)
newGem("Diamond", 5, 18, "white", 40, 50, 5, 70,
{ inc_stats = { [Stats.STAT_STR] = 5, [Stats.STAT_DEX] = 5, [Stats.STAT_MAG] = 5, [Stats.STAT_WIL] = 5, [Stats.STAT_CUN] = 5, [Stats.STAT_CUN] = 5, } },
{}
)
newGem("Pearl", 5, 18, "white", 40, 50, 5, 70,
{ resists = {all=10} },
{}
)
newGem("Moonstone", 5, 18, "white", 40, 50, 5, 70,
{ combat_def=10 },
{}
)
newGem("Fire Opal", 5, 18, "red", 40, 50, 5, 70,
{ inc_damage = {all=10} },
{}
)
newGem("Bloodstone", 5, 18, "red", 40, 50, 5, 70,
{ stun_immune=0.6 },
{}
)
newGem("Ruby", 4, 16, "red", 30, 40, 4, 65,
{ inc_stats = { [Stats.STAT_STR] = 4, [Stats.STAT_DEX] = 4, [Stats.STAT_MAG] = 4, [Stats.STAT_WIL] = 4, [Stats.STAT_CUN] = 4, [Stats.STAT_CUN] = 4, } },
{}
)
newGem("Amber", 4, 16, "yellow", 30, 40, 4, 65,
{ inc_damage = {all=8} },
{}
)
newGem("Turquoise", 4, 16, "green", 30, 40, 4, 65,
{ see_invisible=10 },
{}
)
newGem("Jade", 4, 16, "green", 30, 40, 4, 65,
{ resists = {all=8} },
{}
)
newGem("Sapphire", 4, 16, "blue", 30, 40, 4, 65,
{ combat_def=8 },
{}
)
newGem("Quartz", 3, 12, "white", 20, 30, 3, 50,
{ stun_immune=0.3 },
{}
)
newGem("Emerald", 3, 12, "green", 20, 30, 3, 50,
{ resists = {all=6} },
{}
)
newGem("Lapis Lazuli", 3, 12, "blue", 20, 30, 3, 50,
{ combat_def=6 },
{}
)
newGem("Garnets", 3, 12, "red", 20, 30, 3, 50,
{ inc_damage = {all=6} },
{}
)
newGem("Onyx", 3, 12, "black", 20, 30, 3, 50,
{ inc_stats = { [Stats.STAT_STR] = 3, [Stats.STAT_DEX] = 3, [Stats.STAT_MAG] = 3, [Stats.STAT_WIL] = 3, [Stats.STAT_CUN] = 3, [Stats.STAT_CUN] = 3, } },
{}
)
newGem("Amethyst", 2, 10, "violet", 10, 20, 2, 35,
{ inc_damage = {all=4} },
{}
)
newGem("Opal", 2, 10, "blue", 10, 20, 2, 35,
{ inc_stats = { [Stats.STAT_STR] = 2, [Stats.STAT_DEX] = 2, [Stats.STAT_MAG] = 2, [Stats.STAT_WIL] = 2, [Stats.STAT_CUN] = 2, [Stats.STAT_CUN] = 2, } },
{}
)
newGem("Topaz", 2, 10, "blue", 10, 20, 2, 35,
{ combat_def=4 },
{}
)
newGem("Aquamarine", 2, 10, "blue", 10, 20, 2, 35,
{ resists = {all=4} },
{}
)
newGem("Ametrine", 1, 8, "yellow", 1, 10, 1, 20,
{ inc_damage = {all=2} },
{}
)
newGem("Zircon", 1, 8, "yellow", 1, 10, 1, 20,
{ resists = {all=2} },
{}
)
newGem("Spinel", 1, 8, "green", 1, 10, 1, 20,
{ combat_def=2 },
{}
)
newGem("Citrine", 1, 8, "yellow", 1, 10, 1, 20,
{ lite=1 },
{}
)
newGem("Agate", 1, 8, "black", 1, 10, 1, 20,
{ inc_stats = { [Stats.STAT_STR] = 1, [Stats.STAT_DEX] = 1, [Stats.STAT_MAG] = 1, [Stats.STAT_WIL] = 1, [Stats.STAT_CUN] = 1, [Stats.STAT_CUN] = 1, } },
{}
)
......@@ -28,6 +28,7 @@ newEntity{
require = { talent = { Talents.T_HEAVY_ARMOUR_TRAINING }, },
encumber = 17,
rarity = 5,
metallic = true,
desc = [[A suit of armour made of mail.]],
egos = "/data/general/objects/egos/armor.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
}
......
......@@ -28,6 +28,7 @@ newEntity{
require = { talent = { Talents.T_HEAVY_ARMOUR_TRAINING }, },
encumber = 3,
rarity = 7,
metallic = true,
desc = [[Heavy boots, with metal strips at the toes, heels and other vulnerable parts, to better protect the wearer's feet from harm.]],
}
......
......@@ -28,6 +28,7 @@ newEntity{
require = { talent = { Talents.T_HEAVY_ARMOUR_TRAINING }, },
encumber = 3,
rarity = 7,
metallic = true,
desc = [[A large helmet that can protect the entire head. Ventilation and bad vision can be a problem, however.]],
}
......
......@@ -25,6 +25,7 @@ newEntity{
display = "/", color=colors.WHITE,
encumber = 1,
rarity = 5,
metallic = true,
combat = { talented = "knife", damrange = 1.3, sound = "actions/melee", sound_miss = "actions/melee_miss", },
desc = [[Sharp, long, and deadly.]],
egos = "/data/general/objects/egos/weapon.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
......
......@@ -25,6 +25,7 @@ newEntity{
display = "/", color=colors.SLATE,
encumber = 3,
rarity = 5,
metallic = true,
combat = { talented = "mace", damrange = 1.4, sound = "actions/melee", sound_miss = "actions/melee_miss",},
desc = [[Blunt and deadly.]],
egos = "/data/general/objects/egos/weapon.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
......
......@@ -28,6 +28,7 @@ newEntity{
require = { talent = { Talents.T_MASSIVE_ARMOUR_TRAINING }, },
encumber = 17,
rarity = 5,
metallic = true,
desc = [[A suit of armour made of metal plates.]],
egos = "/data/general/objects/egos/armor.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
}
......
......@@ -25,6 +25,7 @@ newEntity{
display = ")", color=colors.UMBER,
rarity = 5,
encumber = 7,
metallic = true,
desc = [[Handheld deflection devices]],
egos = "/data/general/objects/egos/shield.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
}
......
......@@ -25,6 +25,7 @@ newEntity{
display = "/", color=colors.SLATE,
encumber = 3,
rarity = 5,
metallic = true,
combat = { talented = "sword", damrange = 1.4, sound = "actions/melee", sound_miss = "actions/melee_miss",},
desc = [[Sharp, long, and deadly.]],
egos = "/data/general/objects/egos/weapon.lua", egos_chance = { prefix=resolvers.mbonus(40, 5), suffix=resolvers.mbonus(40, 5) },
......
-- 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
newTalent{
name = "Create Alchemist Gems",
type = {"spell/gemology-base", 1},
require = spells_req1,
points = 1,
range = function(self, t)
return math.ceil(5 + self:getDex(12))
end,
mana = 30,
make_gem = function(self, t, base_define)
local nb = rng.range(40, 80)
local gem = game.zone:makeEntityByName(game.level, "object", "ALCHEMIST_" .. base_define)
local s = {}
while nb > 0 do
s[#s+1] = gem:clone()
nb = nb - 1
end
for i = 1, #s do gem:stack(s[i]) end
return gem
end,
action = function(self, t)
self:showEquipInven("Use which gem?", function(o) return o.type == "gem" end, function(o, inven, item)
local gem = t.make_gem(self, t, o.define_as)
self:addObject(self.INVEN_INVEN, gem)
self:removeObject(inven, item)
game.logPlayer(self, "You create: %s", gem:getName{do_color=true, do_count=true})
return true
end)
game:playSoundNear(self, "talents/arcane")
return true
end,
info = function(self, t)
return ([[Carve %d to %d alchemist gems out of natural gems.
Alchemists gems are used for lots of other spells.]]):format(40, 80)
end,
}
newTalent{
name = "Extract Gems",
type = {"spell/gemology", 1},
require = spells_req1,
points = 5,
mana = 5,
cooldown = 20,
action = function(self, t)
self:showEquipInven("Try to extract gems from which metallic item?", function(o) return o.metallic and (o.material_level or 1) <= self:getTalentLevelRaw(t) end, function(o, inven, item)
self:removeObject(inven, item)
local level = o.material_level or 1
local gem = game.zone:makeEntity(game.level, "object", {type="gem", special=function(e) return e.material_level == level end}, nil, true)
if gem then
self:addObject(self.INVEN_INVEN, gem)
game.logPlayer(self, "You extract: %s", gem:getName{do_color=true, do_count=true})
end
return true
end)
return true
end,
info = function(self, t)
return ([[Extract magical gems from metal weapons and armours, the higher your skill the higher level items you can work with.]])
end,
}
newTalent{
name = "Imbue Item",
type = {"spell/gemology", 2},
require = spells_req2,
points = 5,
mana = 80,
cooldown = 100,
action = function(self, t)
self:showInventory("Use which gem?", self:getInven("INVEN"), function(gem) return gem.type == "gem" and gem.material_level <= self:getTalentLevelRaw(t) end, function(gem, gem_item)
self:showInventory("Imbue which armour?", self:getInven("INVEN"), function(o) return o.type == "armor" and o.slot == "BODY" and not o.been_imbued end, function(o, item)
self:removeObject(self:getInven("INVEN"), gem_item)
o.wielder = o.wielder or {}
table.mergeAdd(o.wielder, gem.imbue_powers)
o.been_imbued = true
game.logPlayer(self, "You imbue your %s with %s.", o:getName{do_colour=true, no_count=true}, gem:getName{do_colour=true, no_count=true})
end)
end)
return true
end,
info = function(self, t)
return ([[Imbue an body armour with a gem, granting it additional powers.
You can only imbue items once, and it is permanent.]])
end,
}
newTalent{
name = "Gem Vision",
type = {"spell/gemology", 3},
require = spells_req3,
cooldown = 10,
mana = 15,
points = 5,
action = function(self, t)
local ammo = self:hasAlchemistWeapon()
if not ammo or ammo:getNumber() < 2 then
game.logPlayer(self, "You need to ready 2 alchemist gems in your quiver.")
return
end
local x, y = self:getTarget{type="ball", nolock=true, no_restrict=true, range=100, radius=3 + self:getTalentLevel(t)}
if not x then return nil end
for i = 1, 2 do self:removeObject(self:getInven("QUIVER"), 1) end
self:magicMap(3 + self:getTalentLevel(t), x, y)
game:playSoundNear(self, "talents/spell_generic2")
return true
end,
info = function(self, t)
return ([[Consumes two alchemist gems to see remote areas in a radius of %d.]]):
format(3 + self:getTalentLevel(t))
end,
}
newTalent{
name = "Gem Portal",
type = {"spell/gemology",4},
require = spells_req4,
cooldown = 20,
mana = 20,
points = 5,
range = 1,
action = function(self, t)
local ammo = self:hasAlchemistWeapon()
if not ammo or ammo:getNumber() < 5 then
game.logPlayer(self, "You need to ready 2 alchemist gems in your quiver.")
return
end
local tg = {type="bolt", range=self:getTalentRange(t), nolock=true, talent=t}
local x, y = self:getTarget(tg)
if not x or not y then return nil end
local _ _, x, y = self:canProject(tg, x, y)
for i = 1, 5 do self:removeObject(self:getInven("QUIVER"), 1) end
local power = math.floor(4 + self:combatSpellpower(0.06) * self:getTalentLevel(t))
self:probabilityTravel(x, y, power)
game:playSoundNear(self, "talents/arcane")
return true
end,
info = function(self, t)
return ([[Crush 5 alchemists gems into dust to mark an impassable terrain, you immediately enter it and appear on the other side of the obstacle.
Works up to %d grids away.]]):
format(math.floor(4 + self:combatSpellpower(0.06) * self:getTalentLevel(t)))
end,
}
......@@ -82,3 +82,4 @@ load("/data/talents/spells/infusion.lua")
load("/data/talents/spells/golemancy.lua")
load("/data/talents/spells/advanced-golemancy.lua")
load("/data/talents/spells/staff-combat.lua")
load("/data/talents/spells/gemology.lua")
......@@ -19,7 +19,7 @@
return {
name = "Gates of Morning",
level_range = {1, 1},
level_range = {33, 33},
max_level = 1,
width = 196, height = 80,
persistant = "zone",
......
......@@ -117,6 +117,7 @@ function _M:drawDialog(s)
s:drawColorStringBlended(self.font, ("Spell Speed: #00ff00#%3d"):format(game.player:combatSpellSpeed()), w, h, 255, 255, 255) h = h + self.font_h
h = h + self.font_h
if self.actor.inc_damage.all then s:drawColorStringBlended(self.font, ("All damage: #00ff00#%3d%%"):format(self.actor.inc_damage.all), w, h, 255, 255, 255) h = h + self.font_h end
for i, t in ipairs(DamageType.dam_def) do
if self.actor.inc_damage[DamageType[t.type]] and self.actor.inc_damage[DamageType[t.type]] ~= 0 then
s:drawColorStringBlended(self.font, ("%s damage: #00ff00#%3d%%"):format(t.name:capitalize(), self.actor.inc_damage[DamageType[t.type]]), w, h, 255, 255, 255) h = h + self.font_h
......@@ -136,6 +137,7 @@ function _M:drawDialog(s)
s:drawColorStringBlended(self.font, ("Mental Resist: #00ff00#%3d"):format(game.player:combatMentalResist()), w, h, 255, 255, 255) h = h + self.font_h
h = h + self.font_h
if self.actor.resists.all then s:drawColorStringBlended(self.font, ("All Resists: #00ff00#%3d%%"):format(self.actor.resists.all), w, h, 255, 255, 255) h = h + self.font_h end
for i, t in ipairs(DamageType.dam_def) do
if self.actor.resists[DamageType[t.type]] and self.actor.resists[DamageType[t.type]] ~= 0 then
s:drawColorStringBlended(self.font, ("%s Resist: #00ff00#%3d%%"):format(t.name:capitalize(), self.actor.resists[DamageType[t.type]]), w, h, 255, 255, 255) h = h + self.font_h
......@@ -272,6 +274,7 @@ function _M:dump()
nl()
nl()
if self.actor.inc_damage.all then nl(makelabel("All damage", self.actor.inc_damage.all.."%")) end
for i, t in ipairs(DamageType.dam_def) do
if self.actor.inc_damage[DamageType[t.type]] and self.actor.inc_damage[DamageType[t.type]] ~= 0 then
nl(makelabel(t.name:capitalize().." damage", self.actor.inc_damage[DamageType[t.type]].."%"))
......@@ -284,6 +287,7 @@ function _M:dump()
nl(makelabel("Mental Resist",game.player:combatMentalResist() ..""))
nl()
if self.actor.resists.all then nl(("All Resists: %3d%%"):format(self.actor.resists.all)) end
for i, t in ipairs(DamageType.dam_def) do
if self.actor.resists[DamageType[t.type]] and self.actor.resists[DamageType[t.type]] ~= 0 then
nl(("%s Resist: %3d%%"):format(t.name:capitalize(), self.actor.resists[DamageType[t.type]]))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment