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

Talent category points can be used to gain at most two more infusion/rune slots

Only two of the same kind of infusion/rune can be inscribed at once


git-svn-id: http://svn.net-core.org/repos/t-engine4@1938 51575b47-30f0-44d4-a5cc-537603b46e54
parent bb142a2c
No related branches found
No related tags found
No related merge requests found
......@@ -679,7 +679,7 @@ function _M:setupCommands()
if config.settings.tome.cheat then
self.player:incStat("str", 100) self.player:incStat("dex", 100) self.player:incStat("mag", 100) self.player:incStat("wil", 100) self.player:incStat("cun", 100) self.player:incStat("con", 100)
self.player:learnTalent(self.player.T_HEAVY_ARMOUR_TRAINING, true) self.player:learnTalent(self.player.T_MASSIVE_ARMOUR_TRAINING, true)
-- [[
--[[
for i, e in ipairs(self.zone.object_list) do
if e.unique and e.define_as ~= "VOICE_SARUMAN" and e.define_as ~= "ORB_MANY_WAYS_DEMON" then
local a = self.zone:finishEntity(self.level, "object", e)
......@@ -689,9 +689,9 @@ function _M:setupCommands()
end
end
--]]
--[[
-- [[
for i = 1, 50 do
local a = self.zone:makeEntity(self.level, "object", {type="weapon", ego_chance=100, add_levels=50}, nil, true)
local a = self.zone:makeEntity(self.level, "object", {type="scroll", ego_chance=100, add_levels=50}, nil, true)
if a then
a:identify(true)
self.zone:addEntity(self.level, a, "object", self.player.x, self.player.y)
......
......@@ -28,9 +28,30 @@ function _M:init(t)
self.inscriptions = {}
self.inscriptions_data = {}
self.max_inscriptions = 3
self.inscriptions_slots_added = 0
end
function _M:setInscription(id, name, data, cooldown, vocal, src)
function _M:setInscription(id, name, data, cooldown, vocal, src, bypass_max_same)
-- Count occurences
local nb_same = 0
for i = 1, self.max_inscriptions do
if self.inscriptions[i] and self.inscriptions[i] == name.."_"..i then nb_same = nb_same + 1 end
end
if nb_same >= 2 and not bypass_max_same then
if vocal then game.logPlayer(self, "You already have too many of this inscription.") end
-- Replace chat
if self.player and src then
local t = self:getTalentFromId(self["T_"..name.."_1"])
src.player = self
src.iname = name
src.idata = data
src.replace_same = name
local chat = Chat.new("player-inscription", {name=t.name}, self, src)
chat:invoke()
end
return
end
-- Find a spot
if not id then
for i = 1, self.max_inscriptions do
......
......@@ -22,23 +22,38 @@ local idata = idata
local obj = obj
local inven = inven
local item = item
local replace_same = replace_same
local answers = {}
for i = 1, player.max_inscriptions do
local name = player.inscriptions[i]
local t = player:getTalentFromId("T_"..name)
answers[#answers+1] = {t.name, action=function(npc, player)
player:setInscription(i, iname, idata, true, true, {obj=obj})
player:removeObject(inven, item)
end, on_select=function(npc, player)
game.tooltip_x, game.tooltip_y = 1, 1
game.tooltip:displayAtMap(nil, nil, game.w, game.h, "#GOLD#"..t.name.."#LAST#\n"..tostring(player:getTalentFullDescription(t, 1)))
end, }
if not replace_same or replace_same.."_"..i == name then
answers[#answers+1] = {t.name, action=function(npc, player)
player:setInscription(i, iname, idata, true, true, {obj=obj}, replace_same)
player:removeObject(inven, item)
end, on_select=function(npc, player)
game.tooltip_x, game.tooltip_y = 1, 1
game.tooltip:displayAtMap(nil, nil, game.w, game.h, "#GOLD#"..t.name.."#LAST#\n"..tostring(player:getTalentFullDescription(t, 1)))
end, }
end
end
if player.inscriptions_slots_added < 2 and player.unused_talents_types > 0 then
answers[#answers+1] = {"Buy a new slot with one #{bold}#talent category point#{normal}#.", action=function(npc, player)
player.unused_talents_types = player.unused_talents_types - 1
player.max_inscriptions = player.max_inscriptions + 1
player.inscriptions_slots_added = player.inscriptions_slots_added + 1
player:setInscription(nil, iname, idata, true, true, {obj=obj})
end}
end
answers[#answers+1] = {"Cancel"}
newChat{ id="welcome",
text = [[You have reached your maximun number of inscriptions(infusions/runes).
text = replace_same and [[You have too many of this type of inscription. You can only override an existing one.]]
or [[You have reached your maximun number of inscriptions(infusions/runes).
If you have unassigned #{bold}#talent category point#{normal}# you can use one to create a new slot.
You can replace an existing one or cancel.]],
answers = answers,
}
......
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