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

Yeeks get their very own special game ending when beating the sorcerers

The endgame text can now vary based on various actions done in quests


git-svn-id: http://svn.net-core.org/repos/t-engine4@3065 51575b47-30f0-44d4-a5cc-537603b46e54
parent bbe21ef5
No related branches found
No related tags found
No related merge requests found
......@@ -83,6 +83,10 @@ newAchievement{
name = "Selfless", id = "WIN_SACRIFICE",
desc = [[Won ToME by closing the Void portal using yourself as a sacrifice.]],
}
newAchievement{
name = "Triumph of the Way", id = "YEEK_SACRIFICE",
desc = [[Won ToME by sacrificing yourself to forcefully spread the Way to every other sentient being on Eyal.]],
}
newAchievement{
name = "Tactical master", id = "SORCERER_NO_PORTAL",
desc = [[Fought the two Sorcerers without closing any invocation portals.]],
......
......@@ -17,6 +17,8 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
local p = game.party:findMember{main=true}
local function void_portal_open(npc, player)
-- Charred scar was successful
if player:hasQuest("charred-scar") and player:hasQuest("charred-scar"):isCompleted("stopped") then return false end
......@@ -28,8 +30,55 @@ local function aeryn_alive(npc, player)
end
end
--------------------------------------------------------
-- Yeeks have a .. plan
--------------------------------------------------------
if p.descriptor.race == "Yeek" then
newChat{ id="welcome",
text = [[#LIGHT_GREEN#*The two Sorcerers lie dead before you.*#WHITE#
#LIGHT_GREEN#*Their bodies vanish in a small cloud of mist, quickly fading away.*#WHITE#
#LIGHT_GREEN#*You feel the Way reaching out to you, the whole yeek race speaks to you.*#WHITE#
You have done something incredible ]]..(p.female and "sister" or "brother")..[[! You also have created a unique opportunity for the yeek race!
The energies of those farportals are incredible, using them we could make the Way radiate all over Eyal, forcing it down on the other races, bringing them the same peace and happiness we feel in the Way.
You must go through the farportal and willingly sacrifice yourself inside. Your mind will embed itself into the farportal network, spreading the Way far and wide!
Even though you will die you will bring the world, and the yeeks, ultimate peace.
The Way will never forget you. Now go and make history!
]],
answers = {
{"#LIGHT_GREEN#[sacrifice yourself to bring the Way to every sentient creature.]", action=function(npc, player)
player.no_resurrect = true
player:die(player)
player:setQuestStatus("high-peak", engine.Quest.COMPLETED, "yeek")
player:hasQuest("high-peak"):win("yeek-sacrifice")
end},
{"But... I did so much, I could do so much more for the Way by staying alive!", jump="yeek-unsure"},
}
}
newChat{ id="yeek-unsure",
text = [[#LIGHT_GREEN#*You feel the Way taking over your mind, your body.*#WHITE#
You will do as asked, for the good of all Yeeks! The Way is always right.
]],
answers = {
{"#LIGHT_GREEN#[sacrifice yourself to bring the Way to every sentient creature.]", action=function(npc, player)
player.no_resurrect = true
player:die(player)
player:setQuestStatus("high-peak", engine.Quest.COMPLETED, "yeek")
player:hasQuest("high-peak"):win("yeek-sacrifice")
end},
}
}
return "welcome"
end
--------------------------------------------------------
-- Default
--------------------------------------------------------
---------- If the void portal has been opened
if void_portal_open(nil, game.player) then
if void_portal_open(nil, p) then
newChat{ id="welcome",
text = [[#LIGHT_GREEN#*The two Sorcerers lie dead before you.*#WHITE#
#LIGHT_GREEN#*Their bodies vanish in a small cloud of mist, quickly fading away.*#WHITE#
......
......@@ -114,9 +114,51 @@ function win(self, how)
if how == "full" then world:gainAchievement("WIN_FULL", game.player)
elseif how == "aeryn-sacrifice" then world:gainAchievement("WIN_AERYN", game.player)
elseif how == "self-sacrifice" then world:gainAchievement("WIN_SACRIFICE", game.player)
elseif how == "yeek-sacrifice" then world:gainAchievement("YEEK_SACRIFICE", game.player)
end
game.player.winner = how
game:registerDialog(require("engine.dialogs.ShowText").new("Winner", "win", {playername=game.player.name, how=how}, game.w * 0.6))
end
function onWin(self, who)
local desc = {}
desc[#desc+1] = "#GOLD#Well done! You have won the Tales of Maj'Eyal: the Fourth Age#WHITE#"
desc[#desc+1] = ""
desc[#desc+1] = "The Sorcerers are dead, and the Orc Pride lies in ruins, thanks to your efforts."
desc[#desc+1] = ""
-- Yeeks are special
if who:isQuestStatus("high-peak", engine.Quest.COMPLETED, "yeek") then
desc[#desc+1] = "Your sacrifice worked, your mental energies were imbued with farportal energies. The Way radiated from the High Peak toward the rest of Eyal like a mental tidal wave."
desc[#desc+1] = "Every sentient being in Eyal is now part of the Way. Peace and happiness are enforced to all."
desc[#desc+1] = "Only the mages of Angolwen were able to withstand the mental shock and thus are the only unsafe people left. But what can they do against the migth of the Way?"
return 0, desc
end
if who.winner == "full" then
desc[#desc+1] = "You have prevented the portal to the Void from opening and thus stopped the Creator from bringing about the end of the world."
elseif who.winner == "aeryn-sacrifice" then
desc[#desc+1] = "In a selfless act, High Sun Paladin Aeryn sacrificed herself to close the portal to the Void and thus stopped the Creator from bringing about the end of the world."
elseif who.winner == "self-sacrifice" then
desc[#desc+1] = "In a selfless act, you sacrificed yourself to close the portal to the Void and thus stopped the Creator from bringing about the end of the world."
end
if who:isQuestStatus("high-peak", engine.Quest.COMPLETED, "gates-of-morning-destroyed") then
desc[#desc+1] = ""
desc[#desc+1] = "The Gates of Morning have been destroyed and the Sunwall has fallen. The last remnants of the free people in the Far East will surely diminish, and soon only orcs will inhabit this land."
else
desc[#desc+1] = ""
desc[#desc+1] = "The orc presence in the Far East has greatly been diminished by the loss of their leaders and the destruction of the Sorcerers. The free people of the Sunwall will be able to prosper and thrive on this land."
end
desc[#desc+1] = ""
desc[#desc+1] = "Maj'Eyal will once more know peace. Most of its inhabitants will never know they even were on the verge of destruction, but then this is what being a true hero means: to do the right thing even though nobody will know about it."
if who.winner ~= "self-sacrifice" then
desc[#desc+1] = ""
desc[#desc+1] = "You may continue playing and enjoy the rest of the world."
end
return 0, desc
end
......@@ -28,3 +28,11 @@ desc = function(self, who)
end
return table.concat(desc, "\n")
end
function onWin(self, who)
if who.dead then return end
return 10, {
"After your victory you came back to Last Hope and reunited with Melinda, who showned no signs of demonic corruption for the many years to come.",
"You lived together and led a happy life, Melinda even learned a few adventurers tricks and you both traveled Eyal, making new legends.",
}
end
......@@ -17,36 +17,24 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
local desc = {}
desc[#desc+1] = "#GOLD#Well done! You have won the Tales of Maj'Eyal: the Fourth Age#WHITE#"
desc[#desc+1] = ""
desc[#desc+1] = "The Sorcerers are dead, and the Orc Pride lies in ruins, thanks to your efforts."
desc[#desc+1] = ""
if game.player.winner == "full" then
desc[#desc+1] = "You have prevented the portal to the Void from opening and thus stopped the Creator from bringing about the end of the world."
elseif game.player.winner == "aeryn-sacrifice" then
desc[#desc+1] = "In a selfless act, High Sun Paladin Aeryn sacrificed herself to close the portal to the Void and thus stopped the Creator from bringing about the end of the world."
elseif game.player.winner == "self-sacrifice" then
desc[#desc+1] = "In a selfless act, you sacrificed yourself to close the portal to the Void and thus stopped the Creator from bringing about the end of the world."
end
local p = game.party:findMember{main=true}
if game.player:isQuestStatus("high-peak", engine.Quest.COMPLETED, "gates-of-morning-destroyed") then
desc[#desc+1] = ""
desc[#desc+1] = "The Gates of Morning have been destroyed and the Sunwall has fallen. The last remnants of the free people in the Far East will surely diminish, and soon only orcs will inhabit this land."
else
desc[#desc+1] = ""
desc[#desc+1] = "The orc presence in the Far East has greatly been diminished by the loss of their leaders and the destruction of the Sorcerers. The free people of the Sunwall will be able to prosper and thrive on this land."
local descs = {}
for name, q in pairs(p.quests) do
if q.onWin then
local order, d = q:onWin(p)
if order and d then descs[#descs+1] = {o=order, d=d} print("[ENDING] from quest", name, order, d[1]) end
end
end
table.sort(descs, function(a, b) return a.o < b.o end)
desc[#desc+1] = ""
desc[#desc+1] = "Maj'Eyal will once more know peace. Most of its inhabitants will never know they even were on the verge of destruction, but then this is what being a true hero means: to do the right thing even though nobody will know about it."
if game.player.winner ~= "self-sacrifice" then
local desc = {}
for i, d in ipairs(descs) do
for j, line in ipairs(d.d) do
desc[#desc+1] = line
end
desc[#desc+1] = ""
desc[#desc+1] = "You may continue playing and enjoy the rest of the world."
end
game.player.winner_text = desc
p.winner_text = desc
return table.concat(desc, "\n")
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