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

mage quest can now accept rings/amulets too

if mages are unlocked the staff of Angmar Fall will be enough too


git-svn-id: http://svn.net-core.org/repos/t-engine4@783 51575b47-30f0-44d4-a5cc-537603b46e54
parent f97d7f5b
No related branches found
No related tags found
No related merge requests found
......@@ -27,13 +27,18 @@ Good day to you fellow traveller!]],
cond=function(npc, player) return player:hasQuest("mage-apprentice") and player:hasQuest("mage-apprentice"):can_offer(player) end,
action=function(npc, player, dialog) player:hasQuest("mage-apprentice"):collect_staff(player, dialog) end
},
{"I have found this staff, it looks powerful maybe it would be enough?",
jump="angmar_fall",
cond=function(npc, player) return player:hasQuest("mage-apprentice") and player:hasQuest("mage-apprentice"):can_offer_angmar(player) end,
action=function(npc, player, dialog) player:hasQuest("mage-apprentice"):collect_staff_angmar(player, dialog) end
},
-- Reward for non-mages: access to Angolwen
{"So you have enough staves now?",
jump="thanks",
cond=function(npc, player) return player:hasQuest("mage-apprentice") and player:hasQuest("mage-apprentice"):isCompleted() and player.descriptor.class ~= "Mage" end,
},
-- Reward for mages: upgrade a talent mastery
{"So you have enough staves now?",
{"So you have enough items now?",
jump="thanks_mage",
cond=function(npc, player) return player:hasQuest("mage-apprentice") and player:hasQuest("mage-apprentice"):isCompleted() and player.descriptor.class == "Mage" end,
},
......@@ -60,7 +65,7 @@ I am a novice mage, as you might have noticed, and my goal is to be accepted by
}
newChat{ id="quest3",
text = [[The keepers of ar... err I do not think I am supposed to talk about them sorry my friend...
Anyway, I must collect 15 magic staves and I have yet to find one. If you could bring me some should you find any, I would be grateful]],
Anyway, I must collect 15 magic staves, rings or amulets and I have yet to find one. If you could bring me some should you find any, I would be grateful]],
answers = {
{"I will keep that in mind", action=function(npc, player) player:grantQuest("mage-apprentice") end},
{"No way, bye!"},
......@@ -68,13 +73,21 @@ Anyway, I must collect 15 magic staves and I have yet to find one. If you could
}
newChat{ id="quest3_mage",
text = [[I hope I will too ...
Anyway, I must collect 15 magic staves and I have yet to find one. If you could bring me some should you find any, I would be grateful]],
Anyway, I must collect 15 magic staves, rings or amulets and I have yet to find one. If you could bring me some should you find any, I would be grateful]],
answers = {
{"I will keep that in mind", action=function(npc, player) player:grantQuest("mage-apprentice") end},
{"No way, bye!"},
}
}
newChat{ id="angmar_fall",
text = [[Let me examine it.
Oh yes my friend this is indeed a powerful staff, I think that alone should suffice to complete my quest! Many thanks!]],
answers = {
{"Well I can not use it anyway.", jump="welcome"},
}
}
newChat{ id="thanks",
text = [[Ah yes! I am so glad! I will be able to go back to Angolw...err. Oh well I guess I can tell you, you deserve it for helping me.
During the late years of Sauron, more than one hundred years ago, Gandalf the Grey worried that magic could disappear with him and would be lost to mortals should they need it again.
......
......@@ -20,7 +20,7 @@
name = "An apprentice task"
desc = function(self, who)
local desc = {}
desc[#desc+1] = "You met a novice mage who was tasked to collect many staves."
desc[#desc+1] = "You met a novice mage who was tasked to collect many staves or jewelry."
desc[#desc+1] = "He asked for your help should you collect some that you do not use."
if self:isCompleted() then
else
......@@ -42,8 +42,8 @@ on_status_change = function(self, who, status, sub)
end
collect_staff = function(self, who, dialog)
who:showEquipInven("Offer which staff?",
function(o) return o.type == "weapon" and o.subtype == "staff" end,
who:showEquipInven("Offer which item?",
function(o) return (o.type == "weapon" and o.subtype == "staff" and (not o.define_as or o.define_as ~= "STAFF_ANGMAR")) or (o.type == "jewelry" and o.subtype == "ring") or (o.type == "jewelry" and o.subtype == "amulet") end,
function(o, inven, item)
self.nb_collect = self.nb_collect + 1
if self.nb_collect >= 15 then who:setQuestStatus(self, self.COMPLETED) end
......@@ -61,7 +61,34 @@ can_offer = function(self, who)
for inven_id, inven in pairs(who.inven) do
for item, o in ipairs(inven) do
if o.type == "weapon" and o.subtype == "staff" then return true end
if (o.type == "weapon" and o.subtype == "staff" and (not o.define_as or o.define_as ~= "STAFF_ANGMAR")) or (o.type == "jewelry" and o.subtype == "ring") or (o.type == "jewelry" and o.subtype == "amulet") then return true end
end
end
end
collect_staff_angmar = function(self, who, dialog)
who:showEquipInven("Offer which item?",
function(o) return o.type == "weapon" and o.subtype == "staff" and o.define_as == "STAFF_ANGMAR" end,
function(o, inven, item)
self.nb_collect = self.nb_collect + 15
if self.nb_collect >= 15 then who:setQuestStatus(self, self.COMPLETED) end
who:removeObject(who:getInven(inven), item)
game.log("You have no more %s", o:getName{no_count=true, do_color=true})
who:sortInven(who:getInven(inven))
dialog:regen()
return true
end
)
end
can_offer_angmar = function(self, who)
if self.nb_collect >= 15 then return end
-- Only works after mages are unlocked
if not profile.mod.allow_build.mage then return end
for inven_id, inven in pairs(who.inven) do
for item, o in ipairs(inven) do
if o.type == "weapon" and o.subtype == "staff" and o.define_as == "STAFF_ANGMAR" then return true end
end
end
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