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

inventory resolver

everybody starts with healing potions


git-svn-id: http://svn.net-core.org/repos/t-engine4@247 51575b47-30f0-44d4-a5cc-537603b46e54
parent e8b2a9f9
No related branches found
No related tags found
No related merge requests found
......@@ -399,7 +399,5 @@ end
--- Show usage dialog
function _M:useTalents()
local d = require("engine.dialogs.UseTalents").new(self)
-- Load the locales
d.key:loadLocaleConvertion("/data/locales/number_hotkey.lua")
game:registerDialog(d)
end
......@@ -8,9 +8,14 @@ newBirthDescriptor{
body = { INVEN = 1000, MAINHAND=1, OFFHAND=1, BODY=1 },
copy = {
equipment2 = resolvers.equip{
resolvers.equip{
{type="lite", subtype="lite", name="brass lantern"},
},
resolvers.inventory{
{type="potion", subtype="potion", name="potion of lesser healing"},
{type="potion", subtype="potion", name="potion of lesser healing"},
{type="potion", subtype="potion", name="potion of lesser healing"},
},
},
}
......
......@@ -40,7 +40,10 @@ newBirthDescriptor
},
stats = { str=-2, mag=2, wil=3, cun=1, dex=1, con=0 },
experience = 1.3,
talents = {},
talents = { [ActorTalents.T_NANDOR_SPEED]=1 },
copy = {
life_rating = 9,
},
}
newBirthDescriptor
......@@ -51,6 +54,5 @@ newBirthDescriptor
"The Avari are those elves who refused the summons of Orome to come to Valinor, and stayed behind in Middle-earth instead.",
},
stats = { str=-1, mag=1, wil=1, cun=3, dex=2, con=0 },
talents = { ActorTalents.DECREASED_HEALTH_I },
experience = 1.1,
}
......@@ -47,7 +47,10 @@ newBirthDescriptor
},
stats = { str=1, cun=1, dex=1, wil=1 },
experience = 1.25,
talents = { [ActorTalents.T_IMPROVED_HEALTH_I]=1, [ActorTalents.T_DUNADAN_HEAL]=1, },
talents = {
[ActorTalents.T_IMPROVED_HEALTH_I]=1,
[ActorTalents.T_DUNADAN_HEAL]=1,
},
copy = {
default_wilderness = {"wilderness/main", 41, 18},
},
......@@ -85,4 +88,3 @@ newBirthDescriptor
talents = {},
}
]]
......@@ -79,3 +79,19 @@ newTalent{
The life healed will increase with the Willpower stat]]):format(5 + self:getWil() * 0.5)
end,
}
-- Nandor's power, a temporary speedup
newTalent{
short_name = "NANDOR_SPEED",
name = "Grace of the Eldar",
type = {"base/class", 1},
cooldown = 50,
action = function(self, t)
self:setEffect(self.EFF_SPEED, 8, {power=0.20 + self:getDex() / 80})
return true
end,
info = function(self)
return ([[Call upon the grace of the Eldar to increase your general speed by %d%% for 8 turns.
The speed will increase with the Dexterity stat]]):format((0.20 + self:getDex() / 80) * 100)
end,
}
......@@ -124,14 +124,14 @@ newEffect{
desc = "Speed",
type = "magical",
status = "beneficial",
parameters = { power=10 },
parameters = { power=0.1 },
on_gain = function(self, err) return "#Target# speeds up.", "+Fast" end,
on_lose = function(self, err) return "#Target# slows down.", "-Fast" end,
activate = function(self, eff)
-- eff.tmpid = self:addTemporaryValue("mana_regen", eff.power)
eff.tmpid = self:addTemporaryValue("energy", {mod=eff.power})
end,
deactivate = function(self, eff)
-- self:removeTemporaryValue("mana_regen", eff.tmpid)
self:removeTemporaryValue("energy", eff.tmpid)
end,
}
......
......@@ -26,6 +26,31 @@ function resolvers.calc.equip(t, e)
return nil
end
--- Resolves inventory creation for an actor
function resolvers.inventory(t)
return {__resolver="inventory", t}
end
--- Actually resolve the inventory creation
function resolvers.calc.inventory(t, e)
-- Iterate of object requests, try to create them and equip them
for i, filter in ipairs(t[1]) do
print("Inventory resolver", filter.type, filter.subtype)
local o
if not filter.defined then
o = game.zone:makeEntity(game.level, "object", filter)
else
o = game.zone:makeEntityByName(game.level, "object", filter.defined)
end
if o then
print("Zone made us an inventory according to filter!", o:getName())
e:addObject(e.INVEN_INVEN, o)
end
end
e:sortInven()
-- Delete the origin field
return nil
end
--- Resolves drops creation for an actor
function resolvers.drops(t)
return {__resolver="drops", t}
......@@ -33,14 +58,14 @@ end
--- Actually resolve the drops creation
function resolvers.calc.drops(t, e)
t = t[1]
if not rng.percent(t.chance) then return nil end
if not rng.percent(t.chance or 100) then return nil end
-- Iterate of object requests, try to create them and drops them
for i = 1, (t.nb or 1) do
local filter = t[rng.range(1, #t)]
print("Drops resolver", filter.type, filter.subtype)
local o
if not filter.name then
if not filter.defined then
o = game.zone:makeEntity(game.level, "object", filter)
else
o = game.zone:makeEntityByName(game.level, "object", filter.name)
......
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