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

NPCs have a limit on the maximun types of inscriptions they can get at once...

NPCs have a limit on the maximun types of inscriptions they can get at once (like they can never have more than one healing, never more than one protection, ...)


git-svn-id: http://svn.net-core.org/repos/t-engine4@2578 51575b47-30f0-44d4-a5cc-537603b46e54
parent 36e4cb94
No related branches found
No related tags found
No related merge requests found
......@@ -118,6 +118,7 @@ newEntity{ base = "BASE_INFUSION",
cost = 10,
material_level = 1,
inscription_kind = "heal",
inscription_data = {
cooldown = resolvers.rngrange(12, 17),
heal = resolvers.mbonus_level(400, 40, function(e, v) return v * 0.06 end),
......@@ -133,6 +134,7 @@ newEntity{ base = "BASE_INFUSION",
cost = 10,
material_level = 1,
inscription_kind = "heal",
inscription_data = {
cooldown = resolvers.rngrange(12, 17),
dur = 5,
......@@ -149,6 +151,7 @@ newEntity{ base = "BASE_INFUSION",
cost = 20,
material_level = 1,
inscription_kind = "protect",
inscription_data = resolvers.generic(function(e)
return {
cooldown = rng.range(12, 17),
......@@ -176,6 +179,7 @@ newEntity{ base = "BASE_INFUSION",
cost = 30,
material_level = 3,
inscription_kind = "movement",
inscription_data = {
cooldown = resolvers.rngrange(10, 15),
dur = resolvers.mbonus_level(5, 2, function(e, v) return v * 1 end),
......@@ -191,6 +195,7 @@ newEntity{ base = "BASE_INFUSION",
cost = 10,
material_level = 1,
inscription_kind = "utility",
inscription_data = {
cooldown = resolvers.rngrange(6, 12),
range = resolvers.mbonus_level(5, 5, function(e, v) return v * 0.1 end),
......@@ -206,6 +211,7 @@ newEntity{ base = "BASE_INFUSION",
cost = 40,
material_level = 3,
inscription_kind = "utility",
inscription_data = {
cooldown = resolvers.rngrange(20, 30),
dur = resolvers.mbonus_level(7, 7),
......@@ -222,6 +228,7 @@ newEntity{ base = "BASE_INFUSION",
cost = 40,
material_level = 3,
inscription_kind = "utility",
inscription_data = {
cooldown = resolvers.rngrange(20, 30),
dur = resolvers.mbonus_level(7, 7),
......@@ -238,6 +245,7 @@ newEntity{ base = "BASE_INFUSION",
cost = 20,
material_level = 2,
inscription_kind = "attack",
inscription_data = {
cooldown = resolvers.rngrange(15, 25),
range = resolvers.mbonus_level(3, 3),
......@@ -258,6 +266,7 @@ newEntity{ base = "BASE_RUNE",
cost = 10,
material_level = 1,
inscription_kind = "movement",
inscription_data = {
cooldown = resolvers.rngrange(8, 10),
range = resolvers.mbonus_level(10, 5, function(e, v) return v * 1 end),
......@@ -273,6 +282,7 @@ newEntity{ base = "BASE_RUNE",
cost = 50,
material_level = 4,
inscription_kind = "movement",
inscription_data = {
cooldown = resolvers.rngrange(10, 12),
range = resolvers.mbonus_level(6, 5, function(e, v) return v * 3 end),
......@@ -288,6 +298,7 @@ newEntity{ base = "BASE_RUNE",
cost = 10,
material_level = 2,
inscription_kind = "movement",
inscription_data = {
cooldown = resolvers.rngrange(14, 19),
range = resolvers.mbonus_level(100, 20, function(e, v) return v * 0.03 end),
......@@ -303,6 +314,7 @@ newEntity{ base = "BASE_RUNE",
cost = 20,
material_level = 3,
inscription_kind = "protect",
inscription_data = {
cooldown = resolvers.rngrange(14, 24),
dur = resolvers.mbonus_level(5, 3),
......@@ -319,6 +331,7 @@ newEntity{ base = "BASE_RUNE",
cost = 40,
material_level = 3,
inscription_kind = "utility",
inscription_data = {
cooldown = resolvers.rngrange(14, 24),
dur = resolvers.mbonus_level(9, 4, function(e, v) return v * 1 end),
......@@ -336,6 +349,7 @@ newEntity{ base = "BASE_RUNE",
cost = 40,
material_level = 3,
inscription_kind = "utility",
inscription_data = {
cooldown = resolvers.rngrange(14, 24),
dur = resolvers.mbonus_level(4, 3),
......@@ -353,6 +367,7 @@ newEntity{ base = "BASE_RUNE",
cost = 30,
material_level = 2,
inscription_kind = "detection",
inscription_data = {
cooldown = resolvers.rngrange(20, 30),
range = resolvers.mbonus_level(10, 8),
......@@ -370,6 +385,7 @@ newEntity{ base = "BASE_RUNE",
cost = 20,
material_level = 3,
inscription_kind = "attack",
inscription_data = {
cooldown = resolvers.rngrange(15, 25),
range = resolvers.mbonus_level(5, 4),
......@@ -386,6 +402,7 @@ newEntity{ base = "BASE_RUNE",
cost = 20,
material_level = 3,
inscription_kind = "attack",
inscription_data = {
cooldown = resolvers.rngrange(15, 25),
range = resolvers.mbonus_level(5, 4),
......@@ -402,6 +419,7 @@ newEntity{ base = "BASE_RUNE",
cost = 20,
material_level = 3,
inscription_kind = "attack",
inscription_data = {
cooldown = resolvers.rngrange(15, 25),
range = resolvers.mbonus_level(3, 2),
......@@ -418,6 +436,7 @@ newEntity{ base = "BASE_RUNE",
cost = 20,
material_level = 3,
inscription_kind = "attack",
inscription_data = {
cooldown = resolvers.rngrange(15, 25),
range = resolvers.mbonus_level(5, 4),
......@@ -434,6 +453,7 @@ newEntity{ base = "BASE_RUNE",
cost = 10,
material_level = 1,
inscription_kind = "utility",
inscription_data = {
cooldown = resolvers.rngrange(20, 30),
dur = 10,
......@@ -454,6 +474,7 @@ newEntity{ base = "BASE_TAINT",
cost = 10,
material_level = 1,
inscription_kind = "heal",
inscription_data = {
cooldown = resolvers.rngrange(12, 17),
effects = resolvers.mbonus_level(3, 2, function(e, v) return v * 0.06 end),
......
......@@ -371,27 +371,53 @@ function resolvers.calc.inscription(t, e)
end
--- Random inscription resolver
function resolvers.inscriptions(nb, list)
return {__resolver="inscriptions", nb, list}
local inscriptions_max = {
heal = 1,
protect = 1,
attack = 4,
movement = 1,
utility = 6,
}
function resolvers.inscriptions(nb, list, kind)
return {__resolver="inscriptions", nb, list, kind}
end
function resolvers.calc.inscriptions(t, e)
local kind = nil
if t[3] then
kind = function(o)
if o.incription_kind == t[3] and
(e.__npc_inscription_kinds[o.inscription_kind] or 0) < (inscriptions_max[o.inscription_kind] or 0)
then return true
end return false
end
else
kind = function(o)
if (e.__npc_inscription_kinds[o.inscription_kind] or 0) < (inscriptions_max[o.inscription_kind] or 0)
then return true
end return false
end
end
e.__npc_inscription_kinds = e.__npc_inscription_kinds or {}
for i = 1, t[1] do
local o
if type(t[2]) == "table" then
if #t[2] then
local name = rng.tableRemove(t[2])
if not name then return nil end
o = game.zone:makeEntity(game.level, "object", {name=name}, nil, true)
o = game.zone:makeEntity(game.level, "object", {special=kind, name=name}, nil, true)
else
o = game.zone:makeEntity(game.level, "object", {type="scroll"}, nil, true)
o = game.zone:makeEntity(game.level, "object", {special=kind, type="scroll"}, nil, true)
end
else
o = game.zone:makeEntity(game.level, "object", {type="scroll", subtype=t[2]}, nil, true)
o = game.zone:makeEntity(game.level, "object", {special=kind, type="scroll", subtype=t[2]}, nil, true)
end
if o and o.inscription_talent and o.inscription_data then
o.inscription_data.use_any_stat = 0.3 -- Cheat a beat to scale inscriptions nicely
o.inscription_data.cooldown = math.ceil(o.inscription_data.cooldown * 1.7)
o.inscription_data.use_any_stat = 0.5 -- Cheat a bit to scale inscriptions nicely
o.inscription_data.cooldown = math.ceil(o.inscription_data.cooldown * 1.6)
e:setInscription(nil, o.inscription_talent, o.inscription_data, false, false, nil, true, true)
e.__npc_inscription_kinds[o.inscription_kind] = (e.__npc_inscription_kinds[o.inscription_kind] or 0) + 1
end
end
return nil
......
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