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

Sometimes the sandworm lair has a different layout and a different "guide" .....

Sometimes the sandworm lair has a different layout and a different "guide" .. don't fall of the trail !


git-svn-id: http://svn.net-core.org/repos/t-engine4@6680 51575b47-30f0-44d4-a5cc-537603b46e54
parent 740420cb
No related branches found
No related tags found
No related merge requests found
......@@ -110,3 +110,40 @@ newAI("sandworm_tunneler", function(self)
end
end
end)
-- Very special AI for sandworm tunnelers in the sandworm lair
-- Does not care about a target, simple crawl toward a level spot and when there, go for the next
newAI("sandworm_tunneler_huge", function(self)
-- Get a spot
if not self.ai_state.spot_x then
self.ai_state.next_spot = self.ai_state.next_spot + 1
local s = game.level.ordered_spots[self.ai_state.next_spot]
if not s then
game.logSeen(self, "#OLIVE_DRAB#The %s burrows into the ground and disappears.", self.name)
self:disappear()
return
end
self.ai_state.spot_x = s.x
self.ai_state.spot_y = s.y
end
-- Move toward it, digging your way to it
local lx, ly = tunnel(game.level, self.x, self.y, self.ai_state.spot_x, self.ai_state.spot_y)
if not lx then
self.ai_state.spot_x = nil
self.ai_state.spot_y = nil
self:useEnergy()
else
local feat = game.level.map(lx, ly, engine.Map.TERRAIN)
if feat:check("block_move") or feat:check("tunneler_dig") then
self:project({type="ball", radius=2}, lx, ly, DamageType.DIG, 1)
end
self:move(lx, ly)
-- if we could not move, find a new spot
if self.x ~= lx or self.y ~= ly then
self.ai_state.spot_x = nil
self.ai_state.spot_y = nil
end
end
end)
game/modules/tome/data/gfx/shockbolt/npc/vermin_sandworm_huge_sandworm_burrower.png

23.1 KiB

......@@ -52,6 +52,34 @@ Maybe following it is the only way to move around here...]],
ai = "sandworm_tunneler", ai_state = {},
}
-- They make the tunnels, temporarily
-- High life to not kill them by accident
newEntity{ define_as = "SANDWORM_TUNNELER_HUGE",
type = "vermin", subtype = "sandworm",
name = "huge sandworm burrower",
display_w = 2, display_h = 2, display_x = -0.5, display_y = -0.5,
display = "w", color=colors.GREEN,
desc = [[This sandworm seems to not care about your presence at all and simply continues digging its way through the sand.
Maybe following it is the only way to move around here...]],
level_range = {12, 50}, exp_worth = 0,
max_life = 10000,
faction = "sandworm-burrowers",
never_anger = true,
movement_speed = 0.7,
invulnerable = 1,
move_body = 1,
rank = 5,
size_category = 5,
no_breath = 1,
instakill_immune = 1,
sand_dweller = 1,
autolevel = "warrior",
ai = "sandworm_tunneler_huge", ai_state = {next_spot=1},
}
-- The boss of the sandworm lair, no "rarity" field means it will not be randomly generated
newEntity{ define_as = "SANDWORM_QUEEN",
allow_infinite_dungeon = true,
......
......@@ -17,6 +17,11 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
local layout = game.state:alternateZone(short_name, {"BIGWORM", 2})
local is_bigworm = layout == "BIGWORM"
if layout == "DEFAULT" then
return {
name = "Sandworm lair",
level_range = {7, 16},
......@@ -78,3 +83,123 @@ return {
game:placeRandomLoreObject("NOTE"..level.level)
end,
}
elseif layout == "BIGWORM" then
return {
name = "Sandworm lair",
level_range = {7, 16},
level_scheme = "player",
max_level = 2,
decay = {300, 800},
actor_adjust_level = function(zone, level, e) return zone.base_level + e:getRankLevelAdjust() + level.level-1 + rng.range(-1,2) end,
width = 350, height = 20,
no_level_connectivity = true,
-- all_remembered = true,
-- all_lited = true,
persistent = "zone",
no_autoexplore = true,
ambient_music = "Suspicion.ogg",
min_material_level = function() return game.state:isAdvanced() and 3 or 2 end,
max_material_level = function() return game.state:isAdvanced() and 4 or 3 end,
generator = {
map = {
class = "engine.generator.map.Roomer",
no_tunnels = true,
nb_rooms = 30,
lite_room_chance = 0,
rooms = {"forest_clearing"},
['.'] = "UNDERGROUND_SAND",
['#'] = "SANDWALL",
up = "UNDERGROUND_SAND",
down = "UNDERGROUND_SAND",
door = "UNDERGROUND_SAND",
},
actor = {
class = "mod.class.generator.actor.Random",
nb_npc = {70, 80},
},
object = {
class = "engine.generator.object.Random",
nb_object = {18, 27},
},
trap = {
class = "engine.generator.trap.Random",
nb_trap = {0, 0},
},
},
levels =
{
[2] = {
width = 50, height = 50,
generator = {
map = {
class = "engine.generator.map.Roomer",
no_tunnels = true,
nb_rooms = 10,
lite_room_chance = 0,
rooms = {"forest_clearing"},
['.'] = "UNDERGROUND_SAND",
['#'] = "SANDWALL",
up = "SAND_LADDER_UP",
down = "SAND_LADDER_DOWN",
door = "UNDERGROUND_SAND",
},
actor = {
class = "mod.class.generator.actor.Sandworm",
nb_npc = {20, 30},
guardian = "SANDWORM_QUEEN",
guardian_no_connectivity = true,
-- Number of tunnelers + 2 (one per stair)
nb_tunnelers = 7,
},
object = {
class = "engine.generator.object.Random",
nb_object = {6, 9},
filters = { {} }
},
},
},
},
post_process = function(level)
if level.level == 1 then
for uid, e in pairs(level.entities) do e:setEffect(e.EFF_VAULTED, 1, {}) end
local spots = {}
for i, spot in ipairs(level.spots) do
if spot.type == "room" and spot.subtype:find("^forest_clearing") then
local _, _, w, h = spot.subtype:find("^forest_clearing([0-9]+)x([0-9]+)$")
if w and h then spots[#spots+1] = {x=spot.x, y=spot.y, w=tonumber(w), h=tonumber(h)} end
end
end
table.sort(spots, "x")
level.ordered_spots = spots
level.default_up = {x=spots[1].x, y=spots[1].y}
level.default_down = {x=spots[#spots].x, y=spots[#spots].y}
level.map(level.default_up.x, level.default_up.y, engine.Map.TERRAIN, game.zone.grid_list.SAND_LADDER_UP_WILDERNESS)
level.map(level.default_down.x, level.default_down.y, engine.Map.TERRAIN, game.zone.grid_list.SAND_LADDER_DOWN)
local tx, ty = util.findFreeGrid(level.default_up.x+2, level.default_up.y, 5, true, {[engine.Map.ACTOR]=true})
if not tx then level.force_recreate = true return end
local m = game.zone:makeEntityByName(level, "actor", "SANDWORM_TUNNELER_HUGE")
if not m then level.force_recreate = true return end
game.zone:addEntity(level, m, "actor", tx, ty)
end
end,
on_turn = function(self)
if game.turn % 100 ~= 0 or game.level.level ~= 1 then return end
for uid, e in pairs(game.level.entities) do if e.define_as == "SANDWORM_TUNNELER_HUGE" then return end end
local tx, ty = util.findFreeGrid(game.level.default_up.x+2, game.level.default_up.y, 5, true, {[engine.Map.ACTOR]=true})
if not tx then return end
local m = game.zone:makeEntityByName(game.level, "actor", "SANDWORM_TUNNELER_HUGE")
if not m then return end
game.zone:addEntity(game.level, m, "actor", tx, ty)
game.log("#OLIVE_DRAB#You feel the ground shacking from the west.")
end,
}
end
\ No newline at end of file
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