From e653de6e74488a38133f41da68ca38e5fc215f56 Mon Sep 17 00:00:00 2001 From: DarkGod <darkgod@net-core.org> Date: Fri, 1 Nov 2013 21:50:18 +0100 Subject: [PATCH] New achievement for winning the game without ever going west. --- game/engines/default/engine/PlayerProfile.lua | 12 ++++++++---- game/modules/tome/data/achievements/quests.lua | 5 +++++ game/modules/tome/data/quests/high-peak.lua | 2 ++ game/modules/tome/data/wda/eyal.lua | 1 + .../tome/data/zones/unremarkable-cave/npcs.lua | 1 + 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/game/engines/default/engine/PlayerProfile.lua b/game/engines/default/engine/PlayerProfile.lua index f3aa4f2657..b27a5adb74 100644 --- a/game/engines/default/engine/PlayerProfile.lua +++ b/game/engines/default/engine/PlayerProfile.lua @@ -293,8 +293,10 @@ function _M:saveGenericProfile(name, data, nosync, nowrite) if not nowrite then local pop = self:mountProfile(true) local f = fs.open("/generic/"..name..".profile", "w") - f:write(serialize(dataenv)) - f:close() + if f then + f:write(serialize(dataenv)) + f:close() + end self:umountProfile(true, pop) end @@ -340,8 +342,10 @@ function _M:saveModuleProfile(name, data, nosync, nowrite) local online = self:filterSaveData(name) local pop = self:mountProfile(online, module) local f = fs.open("/modules/"..module.."/"..name..".profile", "w") - f:write(serialize(dataenv)) - f:close() + if f then + f:write(serialize(dataenv)) + f:close() + end self:umountProfile(online, pop) end diff --git a/game/modules/tome/data/achievements/quests.lua b/game/modules/tome/data/achievements/quests.lua index 36260f00b9..fdef1e4f0c 100644 --- a/game/modules/tome/data/achievements/quests.lua +++ b/game/modules/tome/data/achievements/quests.lua @@ -131,6 +131,11 @@ newAchievement{ show = "name", huge=true, desc = [[Fought the two Sorcerers and closed four invocation portals.]], } +newAchievement{ + name = "Never Look Back And There Again", id = "WIN_NEVER_WEST", + show = "full", huge=true, + desc = [[Win the game without ever setting foot on Maj'Eyal.]], +} -------------- Other quests newAchievement{ diff --git a/game/modules/tome/data/quests/high-peak.lua b/game/modules/tome/data/quests/high-peak.lua index 8bb812f88b..81f7c6c7fe 100644 --- a/game/modules/tome/data/quests/high-peak.lua +++ b/game/modules/tome/data/quests/high-peak.lua @@ -121,6 +121,8 @@ function win(self, how) elseif how == "yeek-sacrifice" then world:gainAchievement("YEEK_SACRIFICE", game.player) end + if not game.state.gone_west then world:gainAchievement("WIN_NEVER_WEST", game.player) end + game:setAllowedBuild("adventurer", true) if game.difficulty == game.DIFFICULTY_NIGHTMARE then game:setAllowedBuild("difficulty_insane", true) end if game.difficulty == game.DIFFICULTY_INSANE then game:setAllowedBuild("difficulty_madness", true) end diff --git a/game/modules/tome/data/wda/eyal.lua b/game/modules/tome/data/wda/eyal.lua index 2da1a6c6c6..c019c67e23 100644 --- a/game/modules/tome/data/wda/eyal.lua +++ b/game/modules/tome/data/wda/eyal.lua @@ -41,6 +41,7 @@ end if zone == "Maj'Eyal" then wda.cur_patrols = wda.cur_patrols or 0 wda.cur_hostiles = wda.cur_hostiles or 0 + game.state.gone_west = true -- Spawn random encounters local g = game.level.map(game.player.x, game.player.y, Map.TERRAIN) diff --git a/game/modules/tome/data/zones/unremarkable-cave/npcs.lua b/game/modules/tome/data/zones/unremarkable-cave/npcs.lua index 1c38af7a89..e75d12f3b9 100644 --- a/game/modules/tome/data/zones/unremarkable-cave/npcs.lua +++ b/game/modules/tome/data/zones/unremarkable-cave/npcs.lua @@ -114,6 +114,7 @@ newEntity{ define_as = "CORRUPTOR", {type="armor", subtype="heavy", force_drop=true, tome_drops="boss", forbid_power_source={antimagic=true}, autoreq=true}, }, resolvers.drops{chance=100, nb=3, {tome_drops="boss"} }, + resolvers.drops{chance=100, nb=1, {type="jewelry", subtype="orb", defined="ORB_MANY_WAYS"} }, resolvers.talents{ [Talents.T_ARMOUR_TRAINING]=2, -- GitLab