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

quest ideas

Fix warriors archery mastery
Personal achievements showing up in character dump


git-svn-id: http://svn.net-core.org/repos/t-engine4@917 51575b47-30f0-44d4-a5cc-537603b46e54
parent 0d76d84c
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@ function _M:init(title, actor, filter, action)
self.action = action
self.filter = filter
self.actor = actor
engine.Dialog.init(self, title or "Inventory", game.w * 0.8, game.h * 0.8, nil, nil, nil, core.display.newFont("/data/font/VeraMono.ttf", 12))
self:generateList()
......
......@@ -56,6 +56,7 @@ end
function _M:loadAchievements()
self.achieved = {}
self.playerachieved = {}
for k, e in pairs(profile.mod) do
if k:find('^achievement%.') then
......@@ -71,13 +72,33 @@ function _M:getAchievementFromId(id)
return self.achiev_defs[id]
end
--- Gain Personal achievement for player only
-- @
-- @param id the achivement to gain
-- @param src who did it
function _M:gainPersonalAchievement(silent, id, src, ...)
local a = self.achiev_defs[id]
if src.resolveSource then src = src:resolveSource() end
src.achievements = src.achievements or {}
if src.achievements[id] then return end
src.achievements[id] = {turn=game.turn, when=os.date("%Y-%m-%d %H:%M:%S")}
if not silent then
game.log("#LIGHT_GREEN#Personal New Achievement: %s!", a.name)
Dialog:simplePopup("Personal New Achievement: #LIGHT_GREEN#"..a.name, a.desc)
end
end
--- Gain an achievement
-- @param id the achivement to gain
-- @param src who did it
function _M:gainAchievement(id, src, ...)
local a = self.achiev_defs[id]
if not a then error("Unknown achievement "..id) return end
if self.achieved[id] then return end
if self.achieved[id] and self.playerachieved[id] then return end
if a.can_gain then
local data = nil
......@@ -97,9 +118,11 @@ function _M:gainAchievement(id, src, ...)
if not a.can_gain(data, src, ...) then return end
end
if self.achieved[id] then self:gainPersonalAchievement(false, id, src, ...) return end
self:gainPersonalAchievement(true, id, src, ...)
self.achieved[id] = {turn=game.turn, who=self:achievementWho(src), when=os.date("%Y-%m-%d %H:%M:%S")}
profile:saveModuleProfile("achievement."..id, self.achieved[id])
game.log("#LIGHT_GREEN#New Achievement: %s!", a.name)
Dialog:simplePopup("New Achievement: #LIGHT_GREEN#"..a.name, a.desc)
end
......
......@@ -154,10 +154,7 @@ end
--- Gets the full textual desc of the object without the name and requirements
function _M:getTextualDesc()
local desc = {}
if self.encumber then
desc[#desc+1] = ("#67AD00#%0.2f Encumbrance."):format(self.encumber)
end
local desc = {}
desc[#desc+1] = ("Type: %s / %s"):format(self.type, self.subtype)
......@@ -315,6 +312,10 @@ function _M:getDesc()
if reqs then
desc[#desc+1] = reqs
end
if self.encumber then
desc[#desc+1] = ("#67AD00#%0.2f Encumbrance."):format(self.encumber)
end
local textdesc = table.concat(self:getTextualDesc(), "\n")
......
......@@ -49,7 +49,7 @@ newBirthDescriptor{
},
stats = { str=5, con=2, dex=2, },
talents_types = {
["technique/archery-training"]={false, 0.9},
["technique/archery-training"]={false, 0.1},
["technique/shield-offense"]={true, 0.3},
["technique/shield-defense"]={true, 0.3},
["technique/2hweapon-offense"]={false, -0.1},
......@@ -84,7 +84,7 @@ newBirthDescriptor{
},
stats = { str=5, con=3, dex=1, },
talents_types = {
["technique/archery-training"]={false, 0.9},
["technique/archery-training"]={false, 0.1},
["technique/shield-defense"]={false, -0.1},
["technique/2hweapon-offense"]={true, 0.3},
["technique/2hweapon-cripple"]={true, 0.3},
......
......@@ -94,3 +94,81 @@ If used near a portal it could probably activate it.]],
end
end,
}
-------------------- The four orbs of command
-- Rak'shor Pride
newEntity{ define_as = "ORB_UNDEATH",
unique = true, quest=true,
type = "jewelry", subtype="orb",
unided_name = "orb of command",
name = "Orb of Undeath (Orb of Command)",
level_range = {50, 50},
display = "*", color=colors.VIOLET,
encumber = 1,
desc = [[Dark visions fill you mind as you lift the orb. It is cold to the touch.]],
on_drop = function(self, who)
if who == game.player then
game.logPlayer(who, "You cannot bring yourself to drop the %s", self:getName())
return true
end
end,
}
-- Gorbat Pride
newEntity{ define_as = "ORB_DRAGON",
unique = true, quest=true,
type = "jewelry", subtype="orb",
unided_name = "orb of command",
name = "Dragon Orb (Orb of Command)",
level_range = {50, 50},
display = "*", color=colors.VIOLET,
encumber = 1,
desc = [[This orb is warm to the touch.]],
on_drop = function(self, who)
if who == game.player then
game.logPlayer(who, "You cannot bring yourself to drop the %s", self:getName())
return true
end
end,
}
-- Vor Pride
newEntity{ define_as = "ORB_ELEMENTS",
unique = true, quest=true,
type = "jewelry", subtype="orb",
unided_name = "orb of command",
name = "Elemental Orb (Orb of Command)",
level_range = {50, 50},
display = "*", color=colors.VIOLET,
encumber = 1,
desc = [[Flames swirl on the icy surface of this orb.]],
on_drop = function(self, who)
if who == game.player then
game.logPlayer(who, "You cannot bring yourself to drop the %s", self:getName())
return true
end
end,
}
-- Grushnak Pride
newEntity{ define_as = "ORB_DESTRUCTION",
unique = true, quest=true,
type = "jewelry", subtype="orb",
unided_name = "orb of command",
name = "Orb of Destruction (Orb of Command)",
level_range = {50, 50},
display = "*", color=colors.VIOLET,
encumber = 1,
desc = [[Visions of death and destruction fill your mind as you lift this orb.]],
on_drop = function(self, who)
if who == game.player then
game.logPlayer(who, "You cannot bring yourself to drop the %s", self:getName())
return true
end
end,
}
-- 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
name = "The Orbs of Command"
desc = function(self, who)
local desc = {}
desc[#desc+1] = "You have found an orb of command that seems to be used to open the shield protecting the High Peek."
desc[#desc+1] = "There seems to be a total of four of them, the more you have the weaker the shield will be."
end
return table.concat(desc, "\n")
end
......@@ -38,6 +38,10 @@ newTalent{
local tg = {type="bolt", range=self:getTalentRange(t), talent=t}
local x, y, target = self:getTarget(tg)
if not x or not y or not target then return nil end
local _ _, x, y = self:canProject(tg, x, y)
target = game.level.map(x, y, Map.ACTOR)
if not x or not y or not target then return nil end
self.combat_apr = self.combat_apr + 10000
self.combat_atk = self.combat_atk + 10000
local speed, hit = self:attackTargetWith(target, weapon.combat, nil, self:combatTalentWeaponDamage(t, 0.4, 1.1))
......
......@@ -262,6 +262,6 @@ newTalent{
return energy ~= self.energy.value
end,
info = function(self, t)
return ([[You fire multiple shots at the area, doing %d%% damage and stunning your targets for %d turns.]]):format(self:combatTalentWeaponDamage(t, 0.5, 1.5), 2 + self:getTalentLevelRaw(t))
return ([[You fire multiple shots at the area, doing %d%% damage and stunning your targets for %d turns.]]):format(self:combatTalentWeaponDamage(t, 0.5, 1.5), 2 + self:getTalentLevelRaw(t) * 100)
end,
}
......@@ -50,6 +50,7 @@ newEntity{ base="BASE_NPC_ORC_RAK_SHOR", define_as = "RAK_SHOR",
{type="weapon", subtype="staff", ego_change=100, autoreq=true},
{type="armor", subtype="cloth", defined="BLACK_ROBE", autoreq=true},
},
resolvers.drops{chance=100, nb=1, {defined="ORB_UNDEATH"} },
resolvers.drops{chance=100, nb=5, {ego_chance=100} },
summon = {
......
......@@ -399,6 +399,14 @@ function _M:dump()
end
end
nl()
nl(" [Player Achievments]")
nl()
for id, data in pairs(self.actor.achievements) do
local a = world:getAchievementFromId(id)
nl(("%s Was Achieved for %s At %s"):format(a.name,a.desc,data.when))
end
nl()
nl(" [Character Inventory]")
nl()
......
No preview for this file 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