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

For 25 fortress energy you can now have the transmogrification chest...

For 25 fortress energy you can now have the transmogrification chest automatically extract gems (if you know the talent) to increase gold gain


git-svn-id: http://svn.net-core.org/repos/t-engine4@5947 51575b47-30f0-44d4-a5cc-537603b46e54
parent 567073a6
No related branches found
No related tags found
No related merge requests found
......@@ -4432,6 +4432,22 @@ function _M:transmoInven(inven, idx, o)
price = math.floor(price * 100) / 100 -- Make sure we get at most 2 digit precision
if price ~= price or not tostring(price):find("^[0-9]") then price = 1 end -- NaN is the only value that does not equals itself, this is the way to check it since we do not have a math.isnan method
if inven and idx then self:removeObject(inven, idx, true) end
if self.hasQuest and self:hasQuest("shertul-fortress") and self:isQuestStatus("shertul-fortress", engine.Quest.COMPLETED, "transmo-chest-extract-gems") and self:knowTalent(self.T_EXTRACT_GEMS) and self:callTalent(self.T_EXTRACT_GEMS, "filterGem", o) then
local gem = self:callTalent(self.T_EXTRACT_GEMS, "getGem", o)
local gprice = math.min(gem:getPrice() * self:transmoPricemod(gem), 25) * gem:getNumber()
local gprice = math.min(gem:getPrice() * self:transmoPricemod(gem), 25) * gem:getNumber()
gprice = math.floor(gprice * 100) / 100 -- Make sure we get at most 2 digit precision
if gprice ~= gprice or not tostring(gprice):find("^[0-9]") then gprice = 1 end -- NaN is the only value that does not equals itself, this is the way to check it since we do not have a math.isnan method
if gprice > price then
price = gprice
game.logPlayer(self, "You extract %s from %s", gem:getName{do_color=true, do_count=true}, o:getName{do_color=true, do_count=true})
o = gem
end
end
self:sortInven()
self:incMoney(price)
if self.hasQuest and self:hasQuest("shertul-fortress") and self:isQuestStatus("shertul-fortress", engine.Quest.COMPLETED, "transmo-chest") then self:hasQuest("shertul-fortress"):gain_energy(price/10) end
......
......@@ -28,6 +28,7 @@ Welcome, master.]],
answers = {
{"You asked me to come, about a farportal?", jump="farportal", cond=function() return q:isCompleted("farportal") and not q:isCompleted("farportal-spawn") end},
{"You asked me to come, about the rod of recall?", jump="recall", cond=function() return q:isCompleted("recall") and not q:isCompleted("recall-done") end},
{"Would it be possible for my Transmogrification Chest to automatically extract gems?", jump="transmo-gems", cond=function(npc, player) return not q:isCompleted("transmo-chest-extract-gems") and q:isCompleted("transmo-chest") and player:knowTalent(player.T_EXTRACT_GEMS) end},
{"I find your appearance unsettling, any way you can change it?", jump="changetile", cond=function() return q:isCompleted("recall-done") end},
{"What are you and what is this place?", jump="what", cond=isNotSet"what", action=set"what"},
{"Master? I am not your mas..", jump="master", cond=isNotSet"master", action=set"master"},
......@@ -132,6 +133,15 @@ The Fortress now has enough energy to upgrade it. It can be changed to recall yo
}
}
newChat{ id="transmo-gems",
text = [[Ah yes, you seem to master the simple art of alchemy. I can change the chest to automatically use your power to extract a gem if the transmogrification of the gem would reward more energy.
However I will need to use 25 energy to do this.]],
answers = {
{"Maybe sometime later."},
{"That could be quite useful yes, please do it.", cond=function() return q.shertul_energy >= 25 end, action=function() q:upgrade_transmo_gems() end},
}
}
newChat{ id="changetile",
text = [[I can alter the Fortress holographic projection matrix to accomodate to your race tastes. This will require 60 energy however.]],
answers = {
......@@ -144,6 +154,7 @@ newChat{ id="changetile",
}
npc:removeAllMOs()
game.level.map:updateMap(npc.x, npc.y)
game.level.map:particleEmitter(npc.x, npc.y, 1, "demon_teleport")
end},
{"Can you try for a human male appearance please?", cond=function() return q.shertul_energy >= 60 end, action=function(npc, player)
q.shertul_energy = q.shertul_energy - 60
......@@ -155,12 +166,14 @@ newChat{ id="changetile",
}
npc:removeAllMOs()
game.level.map:updateMap(npc.x, npc.y)
game.level.map:particleEmitter(npc.x, npc.y, 1, "demon_teleport")
end},
{"Please revert to your default appearance.", cond=function() return q.shertul_energy >= 60 end, action=function(npc, player)
q.shertul_energy = q.shertul_energy - 60
npc.replace_display = nil
npc:removeAllMOs()
game.level.map:updateMap(npc.x, npc.y)
game.level.map:particleEmitter(npc.x, npc.y, 1, "demon_teleport")
end},
{"Well you do not look so bad actually, let it be for now."},
}
......
......@@ -23,39 +23,45 @@ desc = function(self, who)
desc[#desc+1] = "You found notes from an explorer inside the Old Forest. He spoke about Sher'Tul ruins sunken below the surface of the lake of Nur, at the forest's center."
desc[#desc+1] = "With one of the notes there was a small gem that looks like a key."
if self:isCompleted("entered") then
desc[#desc+1] = "You used the key inside the ruins of Nur and found a way into the fortress of old."
desc[#desc+1] = "#LIGHT_GREEN#* You used the key inside the ruins of Nur and found a way into the fortress of old.#WHITE#"
end
if self:isCompleted("weirdling") then
desc[#desc+1] = "The Weirdling Beast is dead, freeing the way into the fortress itself."
desc[#desc+1] = "#LIGHT_GREEN#* The Weirdling Beast is dead, freeing the way into the fortress itself.#WHITE#"
end
if self:isCompleted("butler") then
desc[#desc+1] = "You have activated what seems to be a ... butler? with your rod of recall."
desc[#desc+1] = "#LIGHT_GREEN#* You have activated what seems to be a ... butler? with your rod of recall.#WHITE#"
end
if self:isCompleted("transmo-chest") then
desc[#desc+1] = "#LIGHT_GREEN#* You have bound the transmogrification chest to the Fortress pwoer system.#WHITE#"
end
if self:isCompleted("transmo-chest-extract-gems") then
desc[#desc+1] = "#LIGHT_GREEN#* You have upgraded the transmogrification chest to automatically transmute metallic items into gems before transmogrifying them.#WHITE#"
end
if self:isCompleted("recall") then
if self:isCompleted("recall-done") then
desc[#desc+1] = "You have upgraded your rod of recall to transport you to the fortress."
desc[#desc+1] = "#LIGHT_GREEN#* You have upgraded your rod of recall to transport you to the fortress.#WHITE#"
else
desc[#desc+1] = "The fortress shadow has asked that you come back as soon as possible."
desc[#desc+1] = "#SLATE#* The fortress shadow has asked that you come back as soon as possible.#WHITE#"
end
end
if self:isCompleted("farportal") then
if self:isCompleted("farportal-broken") then
desc[#desc+1] = "You have forced a recall while into an exploratory farportal zone, the farportal was rendered unusable in the process."
desc[#desc+1] = "#RED#* You have forced a recall while into an exploratory farportal zone, the farportal was rendered unusable in the process.#WHITE#"
elseif self:isCompleted("farportal-done") then
desc[#desc+1] = "You have entered the exploratory farportal room and defeated the horror lurking there, you can now use the farportal."
desc[#desc+1] = "#LIGHT_GREEN#* You have entered the exploratory farportal room and defeated the horror lurking there, you can now use the farportal.#WHITE#"
else
desc[#desc+1] = "The fortress shadow has asked that you come back as soon as possible."
desc[#desc+1] = "#SLATE#* The fortress shadow has asked that you come back as soon as possible.#WHITE#"
end
end
if self:isCompleted("flight") then
if self:isCompleted("flight-done") then
desc[#desc+1] = "You have re-enabled the fortress flight systems. You can now fly around in your fortress!"
desc[#desc+1] = "#LIGHT_GREEN#* You have re-enabled the fortress flight systems. You can now fly around in your fortress!#WHITE#"
else
desc[#desc+1] = "The fortress shadow has asked that you find an Ancient Storm Saphir, along with at least 250 energy, to re-enable the fortress flight systems."
desc[#desc+1] = "#SLATE#* The fortress shadow has asked that you find an Ancient Storm Saphir, along with at least 250 energy, to re-enable the fortress flight systems.#WHITE#"
end
end
if self.shertul_energy > 0 then
desc[#desc+1] = ("The fortress's current energy level is: %d."):format(self.shertul_energy)
desc[#desc+1] = ("\nThe fortress's current energy level is: #LIGHT_GREEN#%d#WHITE#."):format(self.shertul_energy)
end
return table.concat(desc, "\n")
end
......@@ -158,6 +164,18 @@ upgrade_rod = function(self)
game.log("#VIOLET#Your rod of recall glows brightly for a moment.")
end
upgrade_transmo_gems = function(self)
if self.shertul_energy < 25 then
local Dialog = require "engine.ui.Dialog"
Dialog:simplePopup("Fortress Shadow", "The energy is too low. It needs to be at least 25.")
return
end
self.shertul_energy = self.shertul_energy - 25
game.player:setQuestStatus("shertul-fortress", self.COMPLETED, "transmo-chest-extract-gems")
game.log("#VIOLET#Your transmogrification chest glows brightly for a moment.")
end
fly = function(self)
game.player:learnLore("shertul-fortress-takeoff")
......
......@@ -70,7 +70,6 @@ newTalent{
type = {"spell/stone-alchemy", 1},
require = spells_req1,
points = 5,
mana = 5,
no_npc_use = true,
no_unlearn_last = true,
on_learn = function(self, t)
......@@ -83,21 +82,30 @@ newTalent{
self:unlearnTalent(self.T_CREATE_ALCHEMIST_GEMS)
end
end,
action = function(self, t)
local d d = 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)
if not o then return end
self:removeObject(inven, item)
filterGem = function(self, t, o) return o.metallic and (o.material_level or 1) <= self:getTalentLevelRaw(t) end,
getGem = function(self, t, o)
if not o then return end
local level = o.material_level or 1
local gem = game.zone:makeEntity(game.level, "object", {ingore_material_restriction=true, type="gem", special=function(e) return not e.unique and 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})
self:sortInven()
d.used_talent = true
end
return true
end)
local level = o.material_level or 1
local gem = game.zone:makeEntity(game.level, "object", {ingore_material_restriction=true, type="gem", special=function(e) return not e.unique and e.material_level == level end}, nil, true)
if gem then return gem end
end,
extractGem = function(self, t, o, inven, item, d)
if not o then return end
self:removeObject(inven, item)
local level = o.material_level or 1
local gem = t.getGem(self, t, o)
if gem then
self:addObject(self.INVEN_INVEN, gem)
game.logPlayer(self, "You extract %s from %s", gem:getName{do_color=true, do_count=true}, o:getName{do_color=true, do_count=true})
self:sortInven()
if d then d.used_talent = true end
end
return true
end,
action = function(self, t)
local d d = self:showEquipInven("Try to extract gems from which metallic item?", function(o) return t.filterGem(self, t, o) end, function(o, inven, item) return t.extractGem(self, t, o, inven, item, d) end)
local co = coroutine.running()
d.unload = function(self) coroutine.resume(co, self.used_talent) end
if not coroutine.yield() then return nil end
......
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