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

all sandwalls make temporary tunnels

git-svn-id: http://svn.net-core.org/repos/t-engine4@316 51575b47-30f0-44d4-a5cc-537603b46e54
parent 92299042
No related branches found
No related tags found
No related merge requests found
local Object = require "engine.Object"
-- Ok some explanation, we make a new *OBJECT* because objects can have energy and act
-- it stores the current terrain in "old_feat" and restores it when it expires
-- We CAN set an object as a terrain because they are all entities
local sandbase = Object.new{
name = "unstable sand tunnel", image = "terrain/sand.png",
display = '.', color={r=203,g=189,b=72},
canAct = function() return true end,
act = function(self)
self:useEnergy()
self.temporary = self.temporary - 1
if self.temporary <= 0 then
game.level.map(self.x, self.y, Map.TERRAIN, self.old_feat)
game:removeEntity(self)
end
end
}
local DamageType = require "engine.DamageType"
-- 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
......@@ -37,16 +21,8 @@ newAI("sandworm_tunneler", function(self)
else
local feat = game.level.map(lx, ly, engine.Map.TERRAIN)
if feat:check("block_move") then
local sand = sandbase:clone()
sand.old_feat = feat
sand.temporary = 10
sand.x = lx
sand.y = ly
game:addEntity(sand)
game.level.map(lx, ly, engine.Map.TERRAIN, sand)
self:project({type="hit"}, lx, ly, DamageType.DIG, 1)
end
self:move(lx, ly)
end
end)
......@@ -250,10 +250,12 @@ newDamageType{
local feat = game.level.map(x, y, Map.TERRAIN)
if feat then
if feat.dig then
local newfeat_name = feat.dig
if type(feat.dig) == "function" then newfeat_name = feat.dig(self, x, y, feat) end
game.level.map(x, y, Map.TERRAIN, game.zone.grid_list[newfeat_name])
game.logSeen({x=x,y=y}, "%s turns into %s.", feat.name:capitalize(), game.zone.grid_list[newfeat_name].name)
local newfeat_name, newfeat, silence = feat.dig, nil, false
if type(feat.dig) == "function" then newfeat_name, newfeat, silence = feat.dig(src, x, y, feat) end
game.level.map(x, y, Map.TERRAIN, newfeat or game.zone.grid_list[newfeat_name])
if not silence then
game.logSeen({x=x,y=y}, "%s turns into %s.", feat.name:capitalize(), (newfeat or game.zone.grid_list[newfeat_name]).name)
end
end
end
end,
......
......@@ -11,5 +11,27 @@ newEntity{
always_remember = true,
block_move = true,
block_sight = true,
dig = "SAND",
-- Dig only makes unstable tunnels
dig = function(src, x, y, old)
local sand = require("engine.Object").new{
name = "unstable sand tunnel", image = "terrain/sand.png",
display = '.', color={r=203,g=189,b=72},
canAct = function() return true end,
act = function(self)
self:useEnergy()
self.temporary = self.temporary - 1
if self.temporary <= 0 then
game.level.map(self.x, self.y, engine.Map.TERRAIN, self.old_feat)
game:removeEntity(self)
game.logSeen(self, "The unstable sand tunnel collapses!")
end
end
}
sand.old_feat = old
sand.temporary = 10
sand.x = x
sand.y = y
game:addEntity(sand)
return nil, sand, true
end,
}
load("/data/general/grids/basic.lua")
load("/data/general/grids/sand.lua")
--load("/data/general/npcs/sandworm.lua")
local Talents = require("engine.interface.ActorTalents")
-- They make the tunnels, temporarily
-- High life to not kill them by accident
newEntity{ define_as = "SANDWORM_TUNNELER",
type = "vermin", subtype = "sandworm",
name = "sandworm tunneler",
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, 18}, exp_worth = 2,
max_life = 500,
energy = {mod=0.5},
autolevel = "warrior",
ai = "sandworm_tunneler", ai_state = {},
}
-- The boss of trollshaws, no "rarity" field means it will not be randomly generated
newEntity{ define_as = "SANDWORM_QUEEN",
type = "vermin", subtype = "sandworm", unique = true,
name = "Sandworm Queen",
display = "w", color=colors.VIOLET,
desc = [[]],
level_range = {12, 18}, exp_worth = 2,
max_life = 200, life_rating = 17, fixed_rating = true,
max_stamina = 85,
max_mana = 200,
stats = { str=25, dex=10, cun=8, mag=20, wil=20, con=20 },
resists = { [DamageType.FIRE] = -50 },
body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1 },
equipment = resolvers.equip{ {type="armor", subtype="shield", defined="OLD_MAN_WILLOW_SHIELD"}, },
drops = resolvers.drops{chance=100, nb=5, {ego_chance=100} },
talents = resolvers.talents{
[Talents.T_STAMINA_POOL]=1, [Talents.T_STUN]=2,
[Talents.T_MANA_POOL]=1,
[Talents.T_ICE_STORM]=1,
[Talents.T_TIDAL_WAVE]=1,
[Talents.T_FREEZE]=2,
},
autolevel = "caster",
ai = "dumb_talented_simple", ai_state = { talent_in=3, },
}
load("/data/general/objects/objects.lua")
-- Artifact, droped (and used!) by Bill the Stone Troll
newEntity{ base = "BASE_SHIELD",
define_as = "OLD_MAN_WILLOW_SHIELD",
name = "Old Man's Willow Barkwood", unique=true,
desc = [[The barkwood of the Old Man's Willow, made into roughtly the shape of a shield.]],
require = { stat = { str=25 }, },
cost = 20,
special_combat = {
dam = resolvers.rngavg(20,30),
physcrit = 2,
dammod = {str=1.5},
},
wielder = {
combat_armor = 5,
combat_def = 9,
fatigue = 14,
resists = {
[DamageType.FIRE] = -20,
[DamageType.COLD] = 20,
[DamageType.NATURE] = 20,
},
},
}
load("/data/general/traps/natural_forest.lua")
return {
name = "Sandworm lair",
level_range = {7, 18},
level_scheme = "player",
max_level = 7,
width = 50, height = 50,
all_remembered = true,
all_lited = true,
-- persistant = true,
generator = {
map = {
class = "engine.generator.map.Roomer",
no_tunnels = true,
nb_rooms = 10,
rooms = {"forest_clearing"},
['.'] = "SAND",
['#'] = "SANDWALL",
up = "UP",
down = "DOWN",
door = "SAND",
},
actor = {
class = "mod.class.generator.actor.Sandworm",
nb_npc = {20, 30},
adjust_level = {-1, 2},
guardian = "SANDWORM_QUEEN",
-- Number of tunnelers + 2 (one per stair)
nb_tunnelers = 2,
},
object = {
class = "engine.generator.object.Random",
nb_object = {6, 9},
filters = { {} }
},
trap = {
class = "engine.generator.trap.Random",
nb_trap = {9, 15},
},
},
levels =
{
[1] = {
generator = { map = {
up = "UP_WILDERNESS",
}, },
},
},
}
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