Skip to content
Snippets Groups Projects
Commit 48c54153 authored by dg's avatar dg
Browse files

lost merchant quest, not done

git-svn-id: http://svn.net-core.org/repos/t-engine4@646 51575b47-30f0-44d4-a5cc-537603b46e54
parent 5bba8241
No related branches found
No related tags found
No related merge requests found
Showing
with 202 additions and 15 deletions
......@@ -45,6 +45,40 @@ function _M:simplePopup(title, text, fct, no_leave)
return d
end
--- Requests a simple yes-no dialog
function _M:yesnoPopup(title, text, fct)
local font = core.display.newFont("/data/font/Vera.ttf", 12)
local w, h = font:size(text)
local tw, th = font:size(title)
local d = new(title, math.max(w, tw) + 8, h + 75, nil, nil, nil, font)
d.sel = 0
d:keyCommands({},
{
ACCEPT = function() game:unregisterDialog(d) if fct then fct(d.sel == 0) end end,
MOVE_LEFT = "MOVE_UP",
MOVE_RIGHT = "MOVE_DOWN",
MOVE_UP = function() d.sel = 0 d.changed = true end,
MOVE_DOWN = function() d.sel = 1 d.changed = true end,
})
d:mouseZones{{x=2, y=0, w=d.iw, h=d.ih, fct=function(b, _, _, _, _, x, y)
d.sel = (x < d.iw / 2) and 0 or 1
d.changed = true
if b ~= "none" then game:unregisterDialog(d) if fct then fct(d.sel == 0) end end
end}}
d.drawDialog = function(self, s)
s:drawColorStringCentered(self.font, text, 2, 2, self.iw - 2, 25 - 2)
if d.sel == 0 then
s:drawColorStringCentered(self.font, "Yes", 2, 25, self.iw / 2 - 2, 50 - 2, 0, 255, 255)
s:drawColorStringCentered(self.font, "No", 2 + self.iw / 2, 25, self.iw / 2 - 2, 50 - 2, 255, 255, 255)
else
s:drawColorStringCentered(self.font, "Yes", 2, 25, self.iw / 2 - 2, 50 - 2, 255, 255, 255)
s:drawColorStringCentered(self.font, "No", 2 + self.iw / 2, 25, self.iw / 2 - 2, 50 - 2, 0, 255, 255)
end
end
game:registerDialog(d)
return d
end
--- Create a Dialog
function _M:init(title, w, h, x, y, alpha, font)
self.title = title
......
......@@ -241,8 +241,8 @@ function _M:loadList(file, no_default, res, mod)
-- Do we inherit things ?
if t.base then
-- Append array part
for i = 1, #t.base do
local b = t.base[i]
for i = 1, #res[t.base] do
local b = res[t.base][i]
if type(b) == "table" and not b.__CLASSNAME then b = table.clone(b, true)
elseif type(b) == "table" and b.__CLASSNAME then b = b:clone()
end
......
......@@ -294,6 +294,7 @@ function _M:addEntity(level, e, typ, x, y)
elseif typ == "terrain" then
if x and y then level.map(x, y, Map.TERRAIN, e) end
end
e:check("on_added", level, x, y)
end
function _M:load(dynamic)
......
......@@ -22,6 +22,9 @@ local Map = require "engine.Map"
require "engine.Generator"
module(..., package.seeall, class.inherit(engine.Generator))
-- Deactaivte too many prints
local print = function() end
function _M:init(zone, map, level, data)
engine.Generator.init(self, zone, map, level)
self.data = data
......
......@@ -859,6 +859,7 @@ function _M:canBe(what)
if what == "fear" and rng.percent(100 * (self:attr("fear_immune") or 0)) then return false end
if what == "knockback" and rng.percent(100 * (self:attr("knockback_immune") or 0)) then return false end
if what == "instakill" and rng.percent(100 * (self:attr("instakill_immune") or 0)) then return false end
if what == "worldport" and game.zone.no_worldport then return false end
return true
end
......
......@@ -165,7 +165,7 @@ function _M:setupDisplayMode()
Map.tiles.use_images = true
elseif self.gfxmode == 3 then
print("[DISPLAY MODE] 32x32 ASCII")
Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 32, 32, nil, 22, true, false)
Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 32, 32, nil, 22, false, false)
Map:resetTiles()
Map.tiles.use_images = false
elseif self.gfxmode == 4 then
......@@ -180,7 +180,7 @@ function _M:setupDisplayMode()
Map.tiles.use_images = false
elseif self.gfxmode == 6 then
print("[DISPLAY MODE] 16x16 ASCII/background")
Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 16, 16, nil, 14, false, true)
Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 16, 16, nil, 14, true, true)
Map:resetTiles()
Map.tiles.use_images = false
else
......
......@@ -19,7 +19,7 @@
newEntity{
name = "Novice mage",
type = "harmless", subtype = "quest", unique = true,
type = "harmless", subtype = "special", unique = true,
level_range = {1, 10},
rarity = 3,
coords = {{ x=10, y=23, likelymap={
......@@ -55,12 +55,62 @@ newEntity{
newEntity{
name = "Lost merchant",
type = "harmless", subtype = "quest", unique = true,
level_range = {10, 20},
rarity = 4,
type = "hostile", subtype = "special", unique = true,
level_range = {1, 2},
rarity = 1,
coords = {{ x=0, y=0, w=40, h=40}},
on_encounter = function(self, who)
who:runStop()
engine.Dialog:yesnoPopup("Encounter", "You find an hidden trap door, and hear cries for help from within... Enter ?", function(ok)
if not ok then
engine.Dialog:simplePopup("Encounter", "You carefully get away without making a sound.")
else
engine.Dialog:simplePopup("Encounter", "You carefully open the trap door and enter the underground tunnels...")
local zone = engine.Zone.new("ambush", {
name = "Unknown tunnels",
level_range = {8, 18},
level_scheme = "player",
max_level = 2,
actor_adjust_level = function(zone, level, e) return zone.base_level + e:getRankLevelAdjust() + level.level-1 + rng.range(-1,2) end,
width = 20, height = 20,
no_worldport = true,
ambiant_music = "a_lomos_del_dragon_blanco.ogg",
generator = {
map = {
class = "engine.generator.map.TileSet",
tileset = {"3x3/base", "3x3/tunnel", "3x3/windy_tunnel"},
tunnel_chance = 100,
['.'] = "OLD_FLOOR",
['#'] = "OLD_WALL",
['+'] = "DOOR",
["'"] = "DOOR",
up = "OLD_FLOOR",
down = "DOWN",
},
actor = { class = "engine.generator.actor.Random",nb_npc = {5, 7}, },
trap = { class = "engine.generator.trap.Random", nb_trap = {3, 3}, },
},
npc_list = mod.class.NPC:loadList("/data/general/npcs/thieve.lua"),
grid_list = mod.class.Grid:loadList("/data/general/grids/basic.lua"),
object_list = mod.class.Object:loadList("/data/general/objects/objects.lua"),
trap_list = mod.class.Trap:loadList("/data/general/traps/alarm.lua"),
levels = { [2] = {
all_lited=true, all_remembered=true,
generator = {
map = { class = "engine.generator.map.Static", map = "quests/lost-merchant",},
actor = {
nb_npc = {1, 1},
post_generation = function(e) e.faction="assassin-lair" end,
},
},
}, },
})
game:changeLevel(1, zone)
game.logPlayer(who, "#LIGHT_RED#As you enter you notice the trap door has no visible handle on the inside. You are stuck here!")
who:grantQuest("lost-merchant")
end
end)
return true
end,
}
......
......@@ -27,7 +27,7 @@ newEntity{
display = "p", color=colors.BLUE,
body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1 },
drops = resolvers.drops{chance=20, nb=1, {} },
resolvers.drops{chance=20, nb=1, {} },
resolvers.equip{
{type="weapon", subtype="dagger", autoreq=true},
{type="weapon", subtype="dagger", autoreq=true},
......@@ -65,6 +65,7 @@ newEntity{ base = "BASE_NPC_THIEF",
rarity = 5,
combat_armor = 2, combat_def = 5,
resolvers.talents{ [Talents.T_STEALTH]=1, },
on_added = function(self) self.energy.value = game.energy_to_act self:useTalent(self.T_STEALTH) end,
max_life = resolvers.rngavg(70,90),
}
......@@ -75,16 +76,18 @@ newEntity{ base = "BASE_NPC_THIEF",
rarity = 5,
combat_armor = 3, combat_def = 5,
resolvers.talents{ [Talents.T_STEALTH]=2, },
on_added = function(self) self.energy.value = game.energy_to_act self:useTalent(self.T_STEALTH) end,
max_life = resolvers.rngavg(70,90),
}
newEntity{ base = "BASE_NPC_THIEF",
newEntity{ base = "BASE_NPC_THIEF", define_as = "THIEF_BANDIT",
name = "bandit", color_r=0, color_g=0, color_b=resolvers.rngrange(175, 195),
desc = [[These ruffians often employ brute force over thievery but they are capable of stealing as well.]],
level_range = {5, 50}, exp_worth = 1,
rarity = 7,
combat_armor = 4, combat_def = 6,
resolvers.talents{ [Talents.T_STEALTH]=3, [Talents.T_LETHALITY]=2, },
on_added = function(self) self.energy.value = game.energy_to_act self:useTalent(self.T_STEALTH) end,
max_life = resolvers.rngavg(80,100),
}
......@@ -97,20 +100,22 @@ newEntity{ base = "BASE_NPC_THIEF",
max_life = resolvers.rngavg(90,100),
combat = { dam=resolvers.rngavg(6,7), atk=10, apr=4},
summon = {
{type="human", subtype="thief", name="bandit", number=1, hasxp=false},
{type="human", subtype="thief", name="bandit", number=1, hasxp=false},
{type="human", subtype="thief", name="thief", number=1, hasxp=false},
{type="human", subtype="thief", name="rogue", number=2, hasxp=false},
{type="humanoid", subtype="human", name="bandit", number=1, hasxp=false},
{type="humanoid", subtype="human", name="bandit", number=1, hasxp=false},
{type="humanoid", subtype="human", name="thief", number=1, hasxp=false},
{type="humanoid", subtype="human", name="rogue", number=2, hasxp=false},
},
resolvers.talents{ [Talents.T_STEALTH]=3, [Talents.T_SUMMON]=1, [Talents.T_LETHALITY]=3, },
on_added = function(self) self.energy.value = game.energy_to_act self:useTalent(self.T_STEALTH) end,
}
newEntity{ base = "BASE_NPC_THIEF",
newEntity{ base = "BASE_NPC_THIEF", define_as = "THIEF_ASSASSIN",
name = "assassin", color_r=resolvers.rngrange(0, 10), color_g=resolvers.rngrange(0, 10), color_b=resolvers.rngrange(0, 10),
desc = [[Before you looms a pair of eyes... A glint of steel... death.]],
level_range = {12, 50}, exp_worth = 1,
rarity = 12,
combat_armor = 3, combat_def = 10,
resolvers.talents{ [Talents.T_STEALTH]=3, [Talents.T_PRECISION]=3, [Talents.T_DUAL_WEAPON_TRAINING]=2, [Talents.T_DUAL_WEAPON_DEFENSE]=2, [Talents.T_DUAL_STRIKE]=1, [Talents.T_SWEEP]=1, [Talents.T_SHADOWSTRIKE]=2, [Talents.T_LETHALITY]=5, },
on_added = function(self) self.energy.value = game.energy_to_act self:useTalent(self.T_STEALTH) end,
max_life = resolvers.rngavg(70,90),
}
-- 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
defineTile('<', "UP_WILDERNESS")
defineTile(' ', "FLOOR")
defineTile('#', "WALL")
defineTile('a', "FLOOR", nil, "THIEF_ASSASSIN")
defineTile('p', "FLOOR", nil, "THIEF_BANDIT")
defineTile('P', "FLOOR", nil, "")
defineTile('@', "FLOOR", nil, "")
startx = 1
starty = 9
return [[
####################
####################
## ##
## ###### ##
## # # #+### ##
## # # # # ##
## ####+# p ##### ##
## a ##
## @ ##
#< P ##
## a ##
## p #+##### ##
## ##### # # ##
## # # ####### ##
## # # ##
## # + ##
## ##### ##
## ##
####################
####################]]
-- 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 = "Trapped!"
desc = function(self, who)
local desc = {}
desc[#desc+1] = "You heard a plea for help and decided to investigate..."
desc[#desc+1] = "Only to find yourself trapped inside an unknown tunnel complex."
return table.concat(desc, "\n")
end
on_status_change = function(self, who, status, sub)
if sub then
if self:isCompleted() then
who:setQuestStatus(self.id, engine.Quest.DONE)
end
end
end
......@@ -103,6 +103,11 @@ newTalent{
type = {"base/class", 1},
cooldown = 1000,
action = function(self, t)
if not self:canBe("worldport") then
game.logPlayer(self, "The spell fizzles...")
return
end
local seen = false
-- Check for visible monsters, only see LOS actors, so telepathy wont prevent it
core.fov.calc_circle(self.x, self.y, 20, function(_, x, y) return game.level.map:opaque(x, y) end, function(_, x, y)
......
......@@ -24,6 +24,7 @@ return {
max_level = 1,
actor_adjust_level = function(zone, level, e) return zone.base_level + 20 end,
width = 50, height = 50,
no_worldport = true,
-- all_remembered = true,
all_lited = true,
-- persistant = true,
......
......@@ -91,6 +91,7 @@ ActorLevel:defineMaxLevel(75)
-- Factions
Faction:add{ name="water lair", reaction={} }
Faction:add{ name="assassin lair", reaction={} }
-- Actor autolevel schemes
dofile("/data/autolevel_schemes.lua")
......
......@@ -23,6 +23,7 @@ function resolvers.equip(t)
end
--- Actually resolve the equipment creation
function resolvers.calc.equip(t, e)
print("Equipment resolver for", e.name)
-- Iterate of object requests, try to create them and equip them
for i, filter in ipairs(t[1]) do
print("Equipment resolver", e.name, filter.type, filter.subtype)
......
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