Commit 7a78c6f4ddb61bf4f02c34f5d943f23d82e0543d

Authored by DarkGod
1 parent edfe1b96

updated lichform quest

... ... @@ -299,6 +299,10 @@ newBirthDescriptor{
299 299 {type="weapon", subtype="staff", name="elm staff", autoreq=true, ego_chance=-1000},
300 300 {type="armor", subtype="cloth", name="linen robe", autoreq=true, ego_chance=-1000},
301 301 },
  302 + resolvers.for_campaign("Maj'Eyal", function()
  303 + local p = game:getPlayer(true)
  304 + if p:callTalent(p.T_LICH, "canGrantQuest") then p:grantQuest("lichform") end
  305 + end)
302 306 },
303 307 copy_add = {
304 308 life_rating = -3,
... ...
... ... @@ -24,8 +24,8 @@ desc = function(self, who)
24 24 desc[#desc+1] = _t"Your studies have uncovered much surrounding this subject, but now you must prepare for your glorious rebirth."
25 25 desc[#desc+1] = _t"You will need:"
26 26
27   - if who.level >= 25 then desc[#desc+1] = _t"#LIGHT_GREEN#* You are experienced enough.#WHITE#"
28   - else desc[#desc+1] = _t"#SLATE#* The ceremony will require that you are worthy, experienced, and possessed of a certain amount of power#WHITE#" end
  27 + if who.level >= 25 and who.unused_prodigies >= 1 and who:getMag() >= 50 and who:getWil() >= 25 then desc[#desc+1] = _t"#LIGHT_GREEN#* You are experienced enough.#WHITE#"
  28 + else desc[#desc+1] = _t"#SLATE#* The ceremony will require that you are worthy, experienced, and possessed of a certain amount of power (level 25, Magic over 50, Willpower over 25 and one prodigy point available).#WHITE#" end
29 29
30 30 if self:isCompleted("heart") then desc[#desc+1] = _t"#LIGHT_GREEN#* You have 'extracted' the heart of one of your fellow necromancers.#WHITE#"
31 31 else desc[#desc+1] = _t"#SLATE#* The beating heart of a powerful necromancer.#WHITE#" end
... ... @@ -36,7 +36,7 @@ desc = function(self, who)
36 36 if who:hasQuest("shertul-fortress").shertul_energy >= 40 then
37 37 desc[#desc+1] = _t"#LIGHT_GREEN#* Yiilkgur has enough energy.#WHITE#"
38 38
39   - if who:knowTalent(who.T_LICHFORM) then desc[#desc+1] = _t"#LIGHT_GREEN#* You are now on the path of lichdom.#WHITE#"
  39 + if who:knowTalent(who.T_LICH) then desc[#desc+1] = _t"#LIGHT_GREEN#* You are now on the path of lichdom.#WHITE#"
40 40 else desc[#desc+1] = _t"#SLATE#* Use the control orb of Yiilkgur to begin the ceremony.#WHITE#" end
41 41 else desc[#desc+1] = _t"#SLATE#* Your lair must amass enough energy to use in your rebirth (40 energy).#WHITE#" end
42 42 else
... ... @@ -49,20 +49,33 @@ end
49 49 on_status_change = function(self, who, status, sub)
50 50 if self:isCompleted() then
51 51 who:setQuestStatus(self.id, engine.Quest.DONE)
52   - who:learnTalent(who.T_LICHFORM, true, 1, {no_unlearn=true})
53   - require("engine.ui.Dialog"):simplePopup(_t"Lichform", _t"The secrets of death lay open to you! The skill 'Lichform' has been unlocked!")
  52 + who.unused_prodigies = who.unused_prodigies - 1
  53 + who:learnTalent(who.T_LICH, true, 1, {no_unlearn=true})
  54 + require("engine.ui.Dialog"):simplePopup(_t"Lichform", _t"The secrets of death lay open to you! You are to become a Lich upon your next death!")
54 55 end
55 56 end
56 57
57 58 check_lichform = function(self, who)
58 59 if self:isStatus(self.DONE) then return end
  60 +
59 61 if who.level < 25 then return end
  62 + if who:getMag() < 50 then return end
  63 + if who:getWil() < 25 then return end
  64 + if who.unused_prodigies < 1 then return end
  65 +
  66 + local t = who:getTalentFromId(who.T_LICH)
  67 + who.lichform_quest_checker = true
  68 + who:learnTalentType("uber/magic", true)
  69 + local res, err = who:canLearnTalent(t)
  70 + who.lichform_quest_checker = nil
  71 + if not res then return end
  72 +
60 73 if not self:isCompleted("heart") then return end
  74 +
61 75 local q = who:hasQuest("shertul-fortress")
62 76 if not q then return end
63 77 if not q:isCompleted("butler") then return end
64 78 if q.shertul_energy < 40 then return end
65   - if not who:knowTalentType("spell/necrosis") then return end
66 79
67 80 return true
68 81 end
... ...
... ... @@ -349,16 +349,22 @@ uberTalent{
349 349 return not self:attr("true_undead") and nb > 0
350 350 end},
351 351 special2={desc=_t"Have completed the ritual", fct=function(self)
  352 + if self.lichform_quest_checker then return true end
352 353 if not game.state.birth.supports_lich_transform then return true else return self:isQuestStatus(game.state.birth.supports_lich_transform, engine.Quest.DONE) end
353 354 end},
354 355 stat = {wil=25},
355 356 },
356 357 is_race_evolution = function(self, t)
357   - if self:attr("necromancy_immune") then return false end
358   - if self:attr("greater_undead") then return false end
  358 + if not t:_canGrantQuest(self) then return false end
359 359 local nb = 0
360 360 for tid, lvl in pairs(self.talents) do local t = self:getTalentFromId(tid) if t.is_necromancy then nb = nb + lvl end end
361   - return not self:attr("true_undead") and nb > 0
  361 + return nb > 0
  362 + end,
  363 + canGrantQuest = function(self, t)
  364 + if self:attr("necromancy_immune") then return false end
  365 + if self:attr("greater_undead") then return false end
  366 + if self:attr("true_undead") then return false end
  367 + return true
362 368 end,
363 369 cant_steal = true,
364 370 is_spell = true,
... ... @@ -399,7 +405,6 @@ uberTalent{
399 405
400 406 self:attr("undead", 1)
401 407 self:attr("true_undead", 1)
402   - self:attr("greater_undead", 1)
403 408
404 409 self:learnTalentType("undead/lich", true)
405 410
... ... @@ -421,6 +426,7 @@ uberTalent{
421 426 game.level.map:particleEmitter(self.x, self.y, 1, "demon_teleport")
422 427 end,
423 428 on_learn = function(self, t)
  429 + self:attr("greater_undead", 1) -- Set that here so that the player cant become an Exarch while waiting for their death to become a Lich
424 430 self:learnTalent(self.T_NEVERENDING_UNLIFE, true, 1)
425 431 game.bignews:say(120, "#DARK_ORCHID#You are on your way to Lichdom. #{bold}#Your next death will finish the ritual.#{normal}#")
426 432 end,
... ...
... ... @@ -1392,3 +1392,11 @@ function resolvers.calc.robe_stats(t, e)
1392 1392 e.wielder.resists = e.wielder.resists or {}
1393 1393 e.wielder.resists.all = (e.wielder.resists.all or 0) + 5 + ((e.material_level or 1) * 2)
1394 1394 end
  1395 +
  1396 +--- Make robes great again
  1397 +function resolvers.for_campaign(id, fct)
  1398 + return {__resolver="for_campaign", __resolve_last=true, id, fct}
  1399 +end
  1400 +function resolvers.calc.for_campaign(t, e)
  1401 + if game:isCampaign(t[1]) then t[2](e) end
  1402 +end
... ...