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

snakes and wolvs

git-svn-id: http://svn.net-core.org/repos/t-engine4@218 51575b47-30f0-44d4-a5cc-537603b46e54
parent d2e20b09
No related branches found
No related tags found
No related merge requests found
......@@ -46,14 +46,30 @@ local coords = {
[9] = { 8, 6, 7, 3 },
}
function _M:aiCanPass(x, y)
-- Nothing blocks, just go on
if not game.level.map:checkAllEntities(x, y, "block_move", self) then return true end
-- If there is an otehr actor, check hostility, if hostile, we move to attack
local target = game.level.map(x, y, Map.ACTOR)
if target and self:reactionToward(target) < 0 then return true end
-- If there is a target (not hostile) and we can move it, do so
if target and self:attr("move_body") then return true end
return false
end
--- Move one step to the given target if possible
-- This tries the most direct route, if not available it checks sides and always tries to get closer
function _M:moveDirection(x, y)
local l = line.new(self.x, self.y, x, y)
local lx, ly = l()
if lx and ly then
local target = game.level.map(lx, ly, Map.ACTOR)
-- if we are blocked, try some other way
if game.level.map:checkEntity(lx, ly, Map.TERRAIN, "block_move") then
if not self:aiCanPass(lx, ly) then
local dirx = lx - self.x
local diry = ly - self.y
local dir = coord_to_dir[dirx][diry]
......@@ -63,7 +79,7 @@ function _M:moveDirection(x, y)
-- Find posiblities
for i = 1, #list do
local dx, dy = self.x + dir_to_coord[list[i]][1], self.y + dir_to_coord[list[i]][2]
if not game.level.map:checkEntity(dx, dy, Map.TERRAIN, "block_move") then
if self:aiCanPass(dx, dy) then
l[#l+1] = {dx,dy, (dx-x)^2 + (dy-y)^2}
end
end
......
......@@ -218,7 +218,7 @@ newDamageType{
-- Poisoning damage
newDamageType{
name = "dig", type = "DIG",
projector = function(src, x, y, type, dam)
projector = function(src, x, y, typ, dam)
local feat = game.level.map(x, y, Map.TERRAIN)
if feat then
if feat.dig then
......
local Talents = require("engine.interface.ActorTalents")
newEntity{
define_as = "BASE_NPC_SNAKE",
type = "animal", subtype = "snake",
display = "J", color=colors.WHITE,
body = { INVEN = 10 },
max_stamina = 110,
autolevel = "warrior",
ai = "dumb_talented_simple", ai_state = { talent_in=3, },
energy = { mod=1.3 },
stats = { str=5, dex=23, mag=5, con=5 },
combat_armor = 1, combat_def = 1,
}
newEntity{ base = "BASE_NPC_SNAKE",
name = "large brown snake", color=colors.UMBER,
desc = [[This large snake hisses at you, angry at being disturbed.]],
level_range = {1, 50}, exp_worth = 1,
rarity = 3,
max_life = resolvers.rngavg(20,30),
combat_armor = 1, combat_def = 3,
combat = { dam=2, atk=30, apr=10 },
}
newEntity{ base = "BASE_NPC_SNAKE",
name = "large white snake", color=colors.WHITE,
desc = [[This large snake hisses at you, angry at being disturbed.]],
level_range = {1, 50}, exp_worth = 1,
rarity = 3,
max_life = resolvers.rngavg(20,30),
combat_armor = 1, combat_def = 3,
combat = { dam=2, atk=30, apr=10 },
}
newEntity{ base = "BASE_NPC_SNAKE",
name = "copperhead snake", color=colors.SALMON,
desc = [[It has a copper head and sharp venomous fangs.]],
level_range = {2, 50}, exp_worth = 1,
rarity = 3,
max_life = resolvers.rngavg(30,40),
combat_armor = 2, combat_def = 5,
combat = { dam=3, atk=30, apr=10 },
talents = resolvers.talents{ [Talents.T_BITE_POISON]=1 },
}
newEntity{ base = "BASE_NPC_SNAKE",
name = "rattlesnake", color=colors.FIREBRICK,
desc = [[As you approach, the snake coils up and rattles its tail threateningly.]],
level_range = {4, 50}, exp_worth = 1,
rarity = 3,
max_life = resolvers.rngavg(30,50),
combat_armor = 2, combat_def = 8,
combat = { dam=5, atk=30, apr=10 },
talents = resolvers.talents{ [Talents.T_BITE_POISON]=1 },
}
newEntity{ base = "BASE_NPC_SNAKE",
name = "king cobra", color=colors.GREEN,
desc = [[It is a large snake with a hooded face.]],
level_range = {5, 50}, exp_worth = 1,
rarity = 6,
max_life = resolvers.rngavg(40,70),
combat_armor = 3, combat_def = 11,
combat = { dam=7, atk=30, apr=10 },
talents = resolvers.talents{ [Talents.T_BITE_POISON]=2 },
}
newEntity{ base = "BASE_NPC_SNAKE",
name = "black mamba", color=colors.BLACK,
desc = [[It has glistening black skin, a sleek body, and highly venomous fangs.]],
level_range = {7, 50}, exp_worth = 1,
rarity = 7,
max_life = resolvers.rngavg(50,80),
combat_armor = 4, combat_def = 12,
combat = { dam=10, atk=30, apr=10 },
talents = resolvers.talents{ [Talents.T_BITE_POISON]=3 },
}
newEntity{ base = "BASE_NPC_SNAKE",
name = "anaconda", color=colors.YELLOW_GREEN,
desc = [[You recoil in fear as you notice this huge, 10 meter long snake. It seeks to crush the life out of you.]],
level_range = {10, 50}, exp_worth = 1,
rarity = 11,
max_life = resolvers.rngavg(100,120),
combat_armor = 14, combat_def = 5,
combat = { dam=12, atk=10, apr=10 },
energy = { mod=0.8 },
talents = resolvers.talents{ [Talents.T_STUN]=5 },
}
newEntity{
define_as = "BASE_NPC_WOLF",
type = "animal", subtype = "wolf",
display = "C", color=colors.WHITE,
body = { INVEN = 10 },
max_stamina = 150,
autolevel = "warrior",
ai = "dumb_talented_simple", ai_state = { talent_in=3, },
energy = { mod=1.2 },
stats = { str=10, dex=17, mag=3, con=7 },
combat_armor = 1, combat_def = 1,
}
newEntity{ base = "BASE_NPC_WOLF",
name = "wolf", color=colors.UMBER,
desc = [[Lean, mean and shaggy, it stares at you with hungry eyes.]],
level_range = {1, 50}, exp_worth = 1,
rarity = 4,
max_life = resolvers.rngavg(40,70),
combat_armor = 1, combat_def = 3,
combat = { dam=5, atk=15, apr=10 },
}
newEntity{ base = "BASE_NPC_WOLF",
name = "great wolf", color=colors.UMBER,
desc = [[Larger than a normal wolf, it prowls and snaps at you.]],
level_range = {3, 50}, exp_worth = 1,
rarity = 6,
max_life = resolvers.rngavg(60,90),
combat_armor =2, combat_def = 4,
combat = { dam=7, atk=15, apr=10 },
}
newEntity{ base = "BASE_NPC_WOLF",
name = "dire wolf", color=colors.DARK_UMBER,
desc = [[Easily as big as a horse, this wolf menaces you with its claws and fangs.]],
level_range = {4, 50}, exp_worth = 1,
rarity = 7,
max_life = resolvers.rngavg(80,110),
combat_armor = 3, combat_def = 5,
combat = { dam=13, atk=15, apr=10 },
}
newEntity{ base = "BASE_NPC_WOLF",
name = "white wolf", color=colors.WHITE,
desc = [[A large and muscled wolf from the northern wastes. Its breath is cold and icy and its fur coated in frost.]],
level_range = {4, 50}, exp_worth = 1,
rarity = 7,
max_life = resolvers.rngavg(70,100),
combat_armor = 3, combat_def = 4,
combat = { dam=8, atk=15, apr=10 },
resists = { [DamageType.FIRE] = -50, [DamageType.COLD] = 100 },
}
newEntity{ base = "BASE_NPC_WOLF",
name = "warg", color=colors.BLACK,
desc = [[It is a large wolf with eyes full of cunning.]],
level_range = {5, 50}, exp_worth = 1,
rarity = 7,
max_life = resolvers.rngavg(60,100),
combat_armor = 5, combat_def = 7,
combat = { dam=15, atk=17, apr=10 },
}
......@@ -182,3 +182,22 @@ newTalent{
return ([[Hits the target with your weapon doing %d%% damage, if the atatck hits, the target is knocked back.]]):format(100 * (1.5 + self:getTalentLevel(t) / 10))
end,
}
newTalent{
short_name = "BITE_POISON",
name = "Poisonous Bite",
type = {"physical/other", 1},
points = 5,
message = "@Source@ bites poison into @target@.",
cooldown = 5,
range = 1,
action = function(self, t)
local x, y, target = self:getTarget()
if math.floor(core.fov.distance(self.x, self.y, x, y)) > 1 then return nil end
self:attackTarget(target, DamageType.POISON, 2 + self:getTalentLevel(t), true)
return true
end,
info = function(self)
return ([[Bites the target, infecting ti with poison.]])
end,
}
......@@ -82,12 +82,9 @@ newTalent{
action = function(self, t)
local x, y = self.x, self.y
if self:getTalentLevel(t) >= 4 then
-- local tg = {type="bolt", range=self:getTalentRange(t), nolock=true}
-- local x, y = self:getTarget(tg)
-- if not x or not y then return nil end
-- for i = 1, self:getTalentLevelRaw(t) do
-- self:project(tg, x, y, DamageType.DIG, 1)
-- end
local tg = {type="bolt", range=self:getTalentRange(t), nolock=true}
x, y = self:getTarget(tg)
if not x or not y then return nil end
end
for i = -1, 1 do for j = -1, 1 do if game.level.map:isBound(x + i, y + j) then
......
load("/data/general/npcs/vermin.lua")
load("/data/general/npcs/molds.lua")
load("/data/general/npcs/skeleton.lua")
load("/data/general/npcs/snake.lua")
local Talents = require("engine.interface.ActorTalents")
......
load("/data/general/npcs/vermin.lua")
load("/data/general/npcs/wolf.lua")
load("/data/general/npcs/troll.lua")
load("/data/general/npcs/snake.lua")
local Talents = require("engine.interface.ActorTalents")
......
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