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

status update

git-svn-id: http://svn.net-core.org/repos/t-engine4@72 51575b47-30f0-44d4-a5cc-537603b46e54
parent 5d21765f
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,23 @@ function _M:move(map, x, y, force)
return true
end
function _M:teleportRandom(dist)
local poss = {}
for i = self.x - dist, self.x + dist do
for j = self.y - dist, self.y + dist do
if game.level.map:isBound(i, j) and
core.fov.distance(self.x, self.y, i, j) <= dist and
not game.level.map:checkAllEntities(i, j, "block_move") then
poss[#poss+1] = {i,j}
end
end
end
local pos = poss[rng.range(1, #poss)]
return self:move(pos[1], pos[2], true)
end
function _M:deleteFromMap(map)
if self.x and self.y and map then
map:remove(self.x, self.y, engine.Map.ACTOR)
......
......@@ -44,6 +44,11 @@ function _M:newTalent(t)
assert(t.mode == "activated" or t.mode == "sustained", "wrong talent mode, requires either 'activated' or 'sustained'")
assert(t.info, "no talent info")
-- Can pass a string, make it into a function
if type(t.info) == "string" then
local infostr = t.info
t.info = function() return infostr end
end
-- Remove line stat with tabs to be cleaner ..
local info = t.info
t.info = function(self) return info(self):gsub("\n\t+", "\n") end
......@@ -151,7 +156,7 @@ function _M:canLearnTalent(t)
-- Check talent type
local known = self:numberKnownTalent(t.type[1])
if known < t.type[2] - 1 then
if t.type[2] and known < t.type[2] - 1 then
return nil, "not enough talents of this type known"
end
......@@ -169,17 +174,21 @@ function _M:getTalentReqDesc(t_id)
local str = ""
if t.type[2] and t.type[2] > 1 then
str = str .. ("- Talents of the same category: %d\n"):format(t.type[2] - 1)
local known = self:numberKnownTalent(t.type[1])
local c = (known >= t.type[2] - 1) and "#00ff00#" or "#ff0000#"
str = str .. ("- %sTalents of the same category: %d\n"):format(c, t.type[2] - 1)
end
-- Obviously this requires the ActorStats interface
if req.stat then
for s, v in pairs(req.stat) do
str = str .. ("- %s %d\n"):format(self.stats_def[s].name, v)
local c = (self:getStat(s) >= v) and "#00ff00#" or "#ff0000#"
str = str .. ("- %s%s %d\n"):format(c, self.stats_def[s].name, v)
end
end
if req.level then
str = str .. ("- Level %d\n"):format(req.level)
local c = (self.level >= req.level) and "#00ff00#" or "#ff0000#"
str = str .. ("- %sLevel %d\n"):format(c, req.level)
end
return str
......
......@@ -194,3 +194,8 @@ function util.boundWrap(i, min, max)
elseif i > max then i = min end
return i
end
function util.bound(i, min, max)
if i < min then i = min
elseif i > max then i = max end
return i
end
......@@ -14,6 +14,7 @@ module(..., package.seeall, class.inherit(
engine.interface.ActorLevel,
engine.interface.ActorStats,
engine.interface.ActorTalents,
-- engine.interface.ActorResource,
engine.interface.BloodyDeath,
mod.class.interface.Combat
))
......@@ -24,6 +25,7 @@ function _M:init(t)
engine.interface.ActorLevel.init(self, t)
engine.interface.ActorStats.init(self, t)
engine.interface.ActorTalents.init(self, t)
-- engine.interface.ActorResouce.init(self, t)
self.unused_stats = 0
self.unused_talents = 0
......@@ -39,23 +41,6 @@ function _M:move(x, y, force)
return moved
end
function _M:teleportRandom(dist)
local poss = {}
for i = self.x - dist, self.x + dist do
for j = self.y - dist, self.y + dist do
if game.level.map:isBound(i, j) and
core.fov.distance(self.x, self.y, i, j) <= dist and
not game.level.map:checkAllEntities(i, j, "block_move") then
poss[#poss+1] = {i,j}
end
end
end
local pos = poss[rng.range(1, #poss)]
return self:move(pos[1], pos[2], true)
end
function _M:tooltip()
return ("%s\n#00ffff#Level: %d\nExp: %d/%d\n#ff0000#HP: %d"):format(self.name, self.level, self.exp, self:getExpChart(self.level+1) or "---", self.life)
end
......@@ -81,7 +66,7 @@ end
function _M:onStatChange(stat, v)
if stat == self.STAT_CON then
self.max_life = self.max_life + 5 * v
elseif stat == self.STAT_MAG then
elseif stat == self.STAT_WIL then
self.max_mana = self.max_mana + 5 * v
end
end
......
......@@ -78,7 +78,6 @@ function _M:newGame()
self.zone = Zone.new("ancient_ruins")
self.player = Player.new{
name=self.player_name, max_life=10000, image='player.png', display='@', color_r=230, color_g=230, color_b=230,
talents_types = {["spell/arcane"]=true,["spell/fire"]=true,["physical/1hweapon"]=true},
}
self:changeLevel(1)
end
......
......@@ -8,6 +8,8 @@ function _M:init(t)
self.player = true
self.faction = "players"
self.combat = { dam=10, atk=40, apr=2, def=6, armor=4 }
self.talents_types = {["spell/arcane"]=true,["spell/fire"]=true,["physical/1hweapon"]=true}
self.talents = {[self.T_MANA_POOL]=true, [self.T_STAMINA_POOL]=true}
end
function _M:move(x, y, force)
......
-- "classes"
newTalentType{ type="base/class", name = "class", description = "The basic talents defining a class." }
newTalentType{ type="base/race", name = "race", description = "The various racial bonuses a character can have." }
newTalent{
name = "Mana Pool",
type = {"base/class", 1},
info = "Allows you to have a mana pool. Mana is used to cast all spells.",
}
newTalent{
name = "Stamina Pool",
type = {"base/class", 1},
info = "Allows you to have a stamina pool. Stamina is used to activate special combat attacks.",
}
-- Spells
newTalentType{ type="spell/arcane", name = "arcane", description = "Arcane manipulates the raw magic energies to shape them into both offensive and defensive spells." }
newTalentType{ type="spell/fire", name = "fire", description = "Harness the power of fire to burn your foes to ashes." }
newTalentType{ type="spell/earth", name = "earth", description = "Harness the power of the earth to protect and destroy." }
......@@ -5,6 +22,7 @@ newTalentType{ type="spell/cold", name = "cold", description = "Harness the powe
newTalentType{ type="spell/lightning", name = "lightning", description = "Harness the power of lightnings to fry your foes." }
newTalentType{ type="spell/conveyance", name = "conveyance", description = "Conveyance is the school of travel. It allows you to travel faster and to track others." }
-- Physical combat
newTalentType{ type="physical/2hweapon", name = "two handed weapons", description = "Allows the user to be more proficient with two handed weapons." }
newTalentType{ type="physical/1hweapon", name = "one handed weapons", description = "Allows the user to be more proficient with one handed weapons." }
newTalentType{ type="physical/dualweapon", name = "dual wielding", description = "Allows the user to be more proficient with dual wielding weapons." }
......
......@@ -93,6 +93,10 @@ end
function _M:learnType(tt, v)
if v then
if self.actor:knowTalentType(tt) then
self:simplePopup("Impossible", "You do already know this talent category!")
return
end
if self.actor.unused_talents_types == 0 then
self:simplePopup("Not enough talent category points", "You have no talent category points left!")
return
......@@ -100,10 +104,14 @@ function _M:learnType(tt, v)
self.actor:learnTalentType(tt)
self.actor.unused_talents_types = self.actor.unused_talents_types - 1
else
if self.actor_dup:getStat(self.talentsel) == self.actor:getStat(self.talentsel) then
if self.actor_dup:knowTalentType(tt) == true and self.actor:knowTalentType(tt) == true then
self:simplePopup("Impossible", "You cannot take out more points!")
return
end
if not self.actor:knowTalentType(tt) then
self:simplePopup("Impossible", "You do not know this talent category!")
return
end
self.actor:unlearnTalentType(tt)
self.actor.unused_talents_types = self.actor.unused_talents_types + 1
end
......
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