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

- generic resolver

- amulet of mastery
- slime powers work
- objects can improve masteres


git-svn-id: http://svn.net-core.org/repos/t-engine4@257 51575b47-30f0-44d4-a5cc-537603b46e54
parent c4a50061
No related branches found
No related tags found
No related merge requests found
......@@ -160,6 +160,8 @@ function _M:makeEntityByName(level, type, name)
end
if not e then return nil end
if e.unique and game.uniques[e.unique] then print("refused unique", e.name, e.unique) return nil end
e = self:finishEntity(level, type, e)
return e
......
......@@ -49,3 +49,11 @@ function resolvers.calc.tmasteries(t, e)
end
return nil
end
--- Generic resolver, takes a function
function resolvers.generic(fct)
return {__resolver="generic", fct}
end
function resolvers.calc.generic(t, e)
return t[1](e)
end
......@@ -401,18 +401,12 @@ function _M:setupCommands()
end,
LEVELUP = function()
local none = true
if self.player.unused_stats > 0 then
local ds = LevelupStatsDialog.new(self.player)
self:registerDialog(ds)
none = false
elseif self.player.unused_talents > 0 or self.player.unused_talents_types > 0 then
else
local dt = LevelupTalentsDialog.new(self.player)
self:registerDialog(dt)
none = false
end
if none then
engine.Dialog:simplePopup("Nothing to level", "You character has no stat or talent points to spend. Levelup and try again.")
end
end,
......
......@@ -3,6 +3,7 @@ require "engine.Object"
require "engine.interface.ObjectActivable"
local Stats = require("engine.interface.ActorStats")
local Talents = require("engine.interface.ActorTalents")
local DamageType = require("engine.DamageType")
module(..., package.seeall, class.inherit(engine.Object, engine.interface.ObjectActivable))
......@@ -101,6 +102,17 @@ function _M:getDesc()
desc[#desc+1] = ("Increases resistances: %s."):format(table.concat(rs, ','))
end
if w.talents_types_mastery then
local tms = {}
for ttn, i in pairs(w.talents_types_mastery) do
local tt = Talents.talents_types_def[ttn]
local cat = tt.type:gsub("/.*", "")
local name = cat:capitalize().." / "..tt.name:capitalize()
tms[#tms+1] = ("%0.2f %s"):format(i, name)
end
desc[#desc+1] = ("Increases talent masteries: %s."):format(table.concat(tms, ','))
end
if w.combat_physresist then desc[#desc+1] = ("Increases physical resistance: %s."):format(w.combat_physresist) end
if w.combat_spellresist then desc[#desc+1] = ("Increases spell resistance: %s."):format(w.combat_spellresist) end
......
......@@ -19,3 +19,40 @@ newEntity{
inc_stats = { [Stats.STAT_WIL] = resolvers.mbonus(8, 2) },
},
}
newEntity{
name = " of mastery",
level_range = {1, 50},
rarity = 3,
cost = 2,
wielder = {},
resolvers.generic(function(e)
local tts = {
"physical/2hweapon",
"physical/dualweapon",
"physical/shield",
"physical/weapon-training",
"physical/combat-training",
"cunning/stealth",
"cunning/traps",
"cunning/dirty",
"spell/arcane",
"spell/fire",
"spell/earth",
"spell/water",
"spell/air",
"spell/conveyance",
"spell/nature",
"spell/meta",
"spell/divination",
"spell/temporal",
"spell/phantasm",
"spell/necromancy",
}
local tt = tts[rng.range(1, #tts)]
e.wielder.talents_types_mastery = {}
e.wielder.talents_types_mastery[tt] = (10 + rng.mbonus(30, resolvers.current_level, 50)) / 100
end),
}
......@@ -161,7 +161,7 @@ newEntity{ base = "BASE_POTION",
game.logSeen(who, "%s quaff the slime juice. Yuck.", who.name:capitalize())
-- 1% chance of gaining slime mold powers
if rng.percent(1) then
who:learnTalentType("physical/slime", true)
who:learnTalentType("slime/slime", true)
game.logSeen(who, "%s is transformed by the slime mold juice.", who.name:capitalize())
game.logPlayer(who, "#00FF00#You gain an affinity for the molds. You can now learn new slime talents (press G).")
end
......
......@@ -9,7 +9,7 @@ newTalentType{ type="spell/nature", name = "nature", description = "Summons the
newTalentType{ type="spell/meta", name = "meta", description = "Meta spells alter the working of magic itself." }
newTalentType{ type="spell/divination", name = "divination", description = "Divination allows the caster to sense its surroundings, find hidden things." }
newTalentType{ type="spell/temporal", name = "temporal", description = "Temporal the school of time manipulation." }
newTalentType{ type="spell/mind", name = "mind", description = "Mind the caster to directly attack the mind of its foes." }
newTalentType{ type="spell/phantasm", name = "phantasm", description = "Control the power of tricks and illusions." }
newTalentType{ type="spell/necromancy", name = "necromancy", description = "Necromancy is a dark school of magic dealing with death, and undeath." }
-- Generic requires for spells based on talent level
......@@ -45,5 +45,5 @@ load("/data/talents/spells/nature.lua")
load("/data/talents/spells/meta.lua")
load("/data/talents/spells/divination.lua")
load("/data/talents/spells/temporal.lua")
load("/data/talents/spells/mind.lua")
load("/data/talents/spells/phantasm.lua")
load("/data/talents/spells/necromancy.lua")
......@@ -27,7 +27,7 @@ return {
},
object = {
class = "engine.generator.object.Random",
nb_object = {400, 600},
nb_object = {4, 6},
filters = { {type="potion" }, {type="potion" }, {type="potion" }, {type="scroll" }, {}, {} }
},
},
......
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