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

naga invasion event -- NOT COMPLETE !

git-svn-id: http://svn.net-core.org/repos/t-engine4@5210 51575b47-30f0-44d4-a5cc-537603b46e54
parent 288f51b1
No related branches found
No related tags found
No related merge requests found
......@@ -292,6 +292,7 @@ function _M:makeEntity(level, type, filter, force_level, prob_filter)
if type == "actor" then base_list = self.npc_list
elseif type == "object" then base_list = self.object_list
elseif type == "trap" then base_list = self.trap_list
elseif filter.base_list then base_list = filter.base_list end
else base_list = self:getEntities(level, type) if not base_list then return nil end end
local list = self:computeRarities(type, base_list, level, function(e) return self:checkFilter(e, filter, type) end, filter.add_levels, filter.special_rarity)
e = self:pickEntity(list)
......
......@@ -1513,7 +1513,11 @@ function _M:createRandomBoss(base, data)
ngd = NameGenerator.new(randart_name_rules.default)
name = ngd:generate()
end
b.name = name.." the "..b.name
if data.name_scheme then
b.name = data.name_scheme:gsub("#rng#", name):gsub("#base#", b.name)
else
b.name = name.." the "..b.name
end
b.unique = b.name
b.randboss = true
local boss_id = "RND_BOSS_"..b.name:upper():gsub("[^A-Z]", "_")
......@@ -1759,7 +1763,7 @@ function _M:startEvents()
local levels = {}
for i = 1, game.zone.max_level do levels[i] = {} end
for i, e in ipairs(evts) do
for i, e in ipairs(evts) do
if e.always or rng.percent(e.percent) then
local lev = nil
if e.one_per_level then
......
......@@ -120,10 +120,7 @@ newBirthDescriptor{
end
end,
-- Give the orb of knowledge
resolvers.inventory{ id=true, {defined="ORB_KNOWLEDGE"}},
resolvers.equip{ id=true, {name="iron pickaxe", ego_chance=-1000}},
resolvers.generic(function(e) e.hotkey[12] = {"inventory", "Orb of Knowledge"} end),
-- Override normal stuff
before_starting_zone = function(self)
self.starting_level = 1
......
......@@ -19,34 +19,35 @@
-- CSV export
local src = [[
,Enemies,Undead,Allied Kingdoms,Shalore,Thalore,Iron Throne,The Way,Angolwen,Dreadfell,,Temple of Creation|H,Water lair|H,Assassin lair|H,Rhalore,Zigur,,Sunwall,Orc Pride,,Sandworm Burrowers,Victim,Slavers,,Sorcerers,Fearscape,,Sher'Tul
Enemies,,,,,,,,,,,,,,,,,,,,,,,,,,,
Undead,-1,,,,,,,,,,,,,,,,,,,,,,,,,,
Allied Kingdoms,-1,-1,,,,,,,,,,,,,,,,,,,,,,,,,
Shalore,-1,-1,0.5,,,,,,,,,,,,,,,,,,,,,,,,
Thalore,-1,-1,0.7,0.2,,,,,,,,,,,,,,,,,,,,,,,
Iron Throne,-1,-1,0.2,0.2,0.2,,,,,,,,,,,,,,,,,,,,,,
The Way,-1,-1,0,0,0,0,,,,,,,,,,,,,,,,,,,,,
Angolwen,-1,-1,,,,,,,,,,,,,,,,,,,,,,,,,
Dreadfell,,-1,-1,-1,-1,-1,-1,-1,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,
Temple of Creation|H,,,,,,,,,,,,,,,,,,,,,,,,,,,
Water lair|H,-1,,,,,,,,,,-1,,,,,,,,,,,,,,,,
Assassin lair|H,,,,,,,,,,,,,,,,,,,,,,,,,,,
Rhalore,-1,-1,-1,-1,-1,-1,-1,-1,-1,,-1,-1,-1,,,,,,,,,,,,,,
Zigur,-1,-1,1,1,1,1,0.2,-1,-1,,,,,-1,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,
Sunwall,-1,-1,,,,,,,-1,,,,-1,-1,,,,,,,,,,,,,
Orc Pride,,-1,-1,-1,-1,-1,-1,-1,-1,,,,,-1,-1,,-1,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,
Sandworm Burrowers,,,,,,,,,,,,,,,,,,,,,,,,,,,
Victim,,,,,,,,,,,,,,,,,,,,,,,,,,,
Slavers,-1,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,
Sorcerers,,-1,-1,-1,-1,-1,-1,-1,-1,,,,,-1,-1,,-1,1,,,,,,,,,
Fearscape,,-1,-1,-1,-1,-1,-1,-1,,,-1,-1,-1,-1,-1,,-1,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,
Sher'Tul,,,,,,,,,,,,,,,,,,,,,,,,,-1,,
,Enemies,Undead,Allied Kingdoms,Shalore,Thalore,Iron Throne,The Way,Angolwen,Dreadfell,,Temple of Creation|H,Water lair|H,Assassin lair|H,Rhalore,Zigur,,Vargh Republic,Sunwall,Orc Pride,,Sandworm Burrowers,Victim,Slavers,,Sorcerers,Fearscape,,Sher'Tul
Enemies,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Undead,-1,,,,,,,,,,,,,,,,,,,,,,,,,,,
Allied Kingdoms,-1,-1,,,,,,,,,,,,,,,,,,,,,,,,,,
Shalore,-1,-1,0.5,,,,,,,,,,,,,,,,,,,,,,,,,
Thalore,-1,-1,0.7,0.2,,,,,,,,,,,,,,,,,,,,,,,,
Iron Throne,-1,-1,0.2,0.2,0.2,,,,,,,,,,,,,,,,,,,,,,,
The Way,-1,-1,0,0,0,0,,,,,,,,,,,,,,,,,,,,,,
Angolwen,-1,-1,,,,,,,,,,,,,,,,,,,,,,,,,,
Dreadfell,,-1,-1,-1,-1,-1,-1,-1,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Temple of Creation|H,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Water lair|H,-1,,,,,,,,,,-1,,,,,,,,,,,,,,,,,
Assassin lair|H,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Rhalore,-1,-1,-1,-1,-1,-1,-1,-1,-1,,-1,-1,-1,,,,,,,,,,,,,,,
Zigur,-1,-1,1,1,1,1,0.2,-1,-1,,,,,-1,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Vargh Republic,-1,-1,-1,-1,-1,-1,-1,-1,-1,,-1,,-1,-1,-1,,,,,,,,,,,,,
Sunwall,-1,-1,,,,,,,-1,,,,-1,-1,,,-1,,,,,,,,,,,
Orc Pride,,-1,-1,-1,-1,-1,-1,-1,-1,,,,,-1,-1,,-1,-1,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Sandworm Burrowers,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Victim,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Slavers,-1,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Sorcerers,,-1,-1,-1,-1,-1,-1,-1,-1,,,,,-1,-1,,-1,-1,1,,,,,,,,,
Fearscape,,-1,-1,-1,-1,-1,-1,-1,,,-1,-1,-1,-1,-1,,-1,-1,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Sher'Tul,,,,,,,,,,,,,,,,,,,,,,,,,,-1,,
]]
local facts = {}
......
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011, 2012 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
-- Find a random spot
local x, y = rng.range(1, level.map.w - 2), rng.range(1, level.map.h - 2)
local tries = 0
while (not game.player:canMove(x, y) or level.map.attrs(x, y, "no_teleport")) and tries < 100 do
x, y = rng.range(1, level.map.w - 2), rng.range(1, level.map.h - 2)
tries = tries + 1
end
if tries >= 100 then return false end
local id = "naga-invasion-"..game.turn
local changer = function(id)
local npcs = mod.class.NPC:loadList{"/data/general/npcs/naga.lua"}
local objects = mod.class.Object:loadList("/data/general/objects/objects.lua")
local terrains = mod.class.Grid:loadList{"/data/general/grids/basic.lua", "/data/general/grids/water.lua"}
terrains.WATER_UP_WILDERNESS.change_level_shift_back = true
terrains.WATER_UP_WILDERNESS.change_zone_auto_stairs = true
local zone = mod.class.Zone.new(id, {
name = "water cavern",
level_range = {zone:level_adjust_level(level, zone, "actor"), zone:level_adjust_level(level, zone, "actor")},
level_scheme = "player",
max_level = 1,
actor_adjust_level = function(zone, level, e) return zone.base_level + e:getRankLevelAdjust() + level.level-1 + rng.range(-1,2) end,
width = 30, height = 30,
ambient_music = "Dark Secrets.ogg",
reload_lists = false,
color_shown = {0.5, 1, 0.8, 1},
color_obscure = {0.5*0.6, 1*0.6, 0.8*0.6, 0.6},
persistent = "zone",
generator = {
map = {
class = "engine.generator.map.Cavern",
zoom = 12,
min_floor = 250,
floor = "WATER_FLOOR",
wall = "WATER_WALL",
up = "WATER_UP",
down = "WATER_DOWN",
door = "WATER_FLOOR",
},
actor = {
class = "mod.class.generator.actor.Random",
nb_npc = {12, 12},
guardian = {random_elite={life_rating=function(v) return v * 1.5 + 4 end, nb_rares=4, name_scheme="#rng# the Tidebender"}},
},
object = {
class = "engine.generator.object.Random",
filters = {{type="gem"}},
nb_object = {6, 9},
},
trap = {
class = "engine.generator.trap.Random",
nb_trap = {6, 9},
},
},
post_process = function(level) for uid, e in pairs(level.entities) do e.faction = e.hard_faction or "vargh-republic" end end,
-- levels = { [1] = { generator = { map = { up = "CAVEFLOOR", }, }, }, },
npc_list = npcs,
grid_list = terrains,
object_list = objects,
trap_list = mod.class.Trap:loadList("/data/general/traps/water.lua"),
})
return zone
end
local g = game.level.map(x, y, engine.Map.TERRAIN):cloneFull()
g.name = "naga invasion coral portal"
g.display='&' g.color_r=0 g.color_g=0 g.color_b=255 g.notice = true
g.change_level=1 g.change_zone=id g.glow=true
g.add_displays = g.add_displays or {}
g.add_displays[#g.add_displays+1] = mod.class.Grid.new{z=18, image="terrain/naga_portal.png", display_h=2, display_y=-1, embed_particles = {
{name="naga_portal_smoke", rad=2, args={smoke="particles_images/smoke_whispery_bright"}},
{name="naga_portal_smoke", rad=2, args={smoke="particles_images/smoke_heavy_bright"}},
{name="naga_portal_smoke", rad=2, args={smoke="particles_images/smoke_dark"}},
}}
g.nice_tiler = nil
g:initGlow()
g.real_change = changer
g.change_level_check = function(self)
game:changeLevel(1, self.real_change(self.change_zone), {temporary_zone_shift=true})
self.change_level_check = nil
self.real_change = nil
return true
end
g.block_move = function(self, x, y, who, act, couldpass)
if not who or not who.player or not act then return false end
if self.broken then
game.log("#VIOLET#The portal is already broken!")
return false
end
require("engine.ui.Dialog"):yesnoPopup("Coral Portal", "Do you wish to enter the portal or just destroy it?", function(ret)
game.log("#VIOLET#The portal is broken!")
if ret then
self:change_level_check()
end
self.broken = true
self.change_level = nil
end, "Destroy", "Enter")
return false
end
game.zone:addEntity(game.level, g, "terrain", x, y)
local respawn = function(self)
local i, j = util.findFreeGrid(self.naga_portal_x, self.naga_portal_y, 10, true, {[engine.Map.ACTOR]=true})
if not i then return end
local npcs = mod.class.NPC:loadList{"/data/general/npcs/naga.lua"}
local m = game.zone:makeEntity(game.level, "actor", {base_list=npcs}, nil, true)
if not m then return end
m.naga_portal_x = self.naga_portal_x
m.naga_portal_y = self.naga_portal_y
m.naga_respawn = self.naga_respawn
m.exp_worth = 0
m.no_drops = true
m.faction = "vargh-republic"
m.on_die = function(self) self:naga_respawn() end
game.zone:addEntity(game.level, m, "actor", i, j)
game.logSeen(m, "#VIOLET#A naga steps out of the coral portal!")
end
-- Spawn two that will keep on being replenished
local base = {naga_portal_x=x, naga_portal_y=y, naga_respawn=respawn}
respawn(base)
respawn(base)
return true
......@@ -35,7 +35,7 @@ while not check(x, y) and tries < 100 do
x, y = rng.range(3, level.map.w - 4), rng.range(3, level.map.h - 4)
tries = tries + 1
end
if tries < 100 then
if tries < 100 then
local id = "old-battle-field-"..game.turn
local changer = function(id)
......@@ -79,6 +79,17 @@ if tries < 100 then
local g = game.zone:makeEntityByName(game.level, "terrain", "CAVE_LADDER_UP_WILDERNESS")
game.zone:addEntity(game.level, g, "terrain", spot.x, spot.y)
-- A "boss" comes
local nb = 20
while nb > 0 do
local spot = game.level:pickSpot{type="pop", subtype="undead"}
if not game.level.map(spot.x, spot.y, game.level.map.ACTOR) then
local m = game.zone:makeEntity(game.level, "actor", {random_elite={life_rating=function(v) return v * 1.5 + 4 end, nb_rares=6}}, nil, true)
if m then game.zone:addEntity(game.level, m, "actor", spot.x, spot.y) m:setTarget(game.player) break end
end
nb = nb - 1
end
require("engine.ui.Dialog"):simpleLongPopup("Onslaught", "You have survived the onslaught of undeads, you notice a way to climb up you had not seen before in a wall nearby.", 400)
elseif game.level.turn_counter % 50 == 0 then
for i = 1, math.floor(game.level.nb_pop) do
......
......@@ -18,42 +18,3 @@
-- darkgod@te4.org
load("/data/general/objects/objects.lua")
-- Id stuff
newEntity{ define_as = "ORB_KNOWLEDGE",
power_source = {unknown=true},
unique = true, quest=true,
type = "orb", subtype="orb",
unided_name = "orb", no_unique_lore = true,
name = "Orb of Knowledge", identified = true,
display = "*", color=colors.VIOLET, image = "object/ruby.png",
encumber = 1,
save_hotkey = true,
desc = [[This orb was given to you by Elisa the halfling scryer, it will automatically identify normal and rare items for you and can be activated to identify all others.]],
on_drop = function(self, who)
if who == game.player then
game.logPlayer(who, "You cannot bring yourself to drop the %s", self:getName())
return true
end
end,
max_power = 1, power_regen = 1,
use_power = { name = "use the orb", power = 1,
use = function(self, who)
for inven_id, inven in pairs(who.inven) do
for item, o in ipairs(inven) do
if not o:isIdentified() then
o:identify(true)
game.logPlayer(who, "You have: %s", o:getName{do_colour=true})
end
end
end
return {id=true, used=true}
end
},
carrier = {
auto_id = 2,
},
}
......@@ -2,9 +2,9 @@
* naga invasion portal: nagas pouring out: enter the water portal; end up in a water cave (provide air bubbles) and defeat the naga leader
* 3 pedesrals, stay on each for 3 turns; each time a rare pops; when all 3 dead a portal pops and a randboss pops from it
* 7 neutral cultists are spread on the level with a back stone nearby; when one is killed a timer starts, if all killed before timer is out a stair to a secret cave is revealed with an artifact inside
* a few tombstones that can be interraced with; if disturbed a random undead (rare or randboss) may pop
* old battle field: many tombs in close space, if disturbed the player falls into the ground into a small cave; for 100 turns undeads pop faster and faster, if survived a pile of treasure is generated
* damp cave: filled with thieves & bandits with some rares; uses building generator; hosts a pile of gems
++ a few tombstones that can be interraced with; if disturbed a random undead (rare or randboss) may pop
++ old battle field: many tombs in close space, if disturbed the player falls into the ground into a small cave; for 100 turns undeads pop faster and faster, if survived a pile of treasure is generated
++ damp cave: filled with thieves & bandits with some rares; uses building generator; hosts a pile of gems
* a necromancer starts on the other side of the level (not on boss levels); kills npcs, when enough killed he makes a huge bone golem rare
* a huge meteor falls near the player, destroying anything and poping losgoroths
* zone appropriate battle fields: yeachs vs. yeeks; zigur vs corrupters, ...
......
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