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

some kobolds to kill

git-svn-id: http://svn.net-core.org/repos/t-engine4@643 51575b47-30f0-44d4-a5cc-537603b46e54
parent 4ca5cde3
No related branches found
No related tags found
No related merge requests found
Showing
with 82 additions and 442 deletions
......@@ -20,6 +20,7 @@
require "engine.class"
require "engine.Actor"
require "engine.Autolevel"
require "engine.interface.ActorTemporaryEffects"
require "engine.interface.ActorLife"
require "engine.interface.ActorProject"
require "engine.interface.ActorLevel"
......@@ -32,6 +33,7 @@ local Map = require "engine.Map"
module(..., package.seeall, class.inherit(
engine.Actor,
engine.interface.ActorTemporaryEffects,
engine.interface.ActorLife,
engine.interface.ActorProject,
engine.interface.ActorLevel,
......@@ -51,9 +53,10 @@ function _M:init(t, no_default)
t.life_regen = t.life_regen or 0.25 -- Life regen real slow
-- Default melee barehanded damage
self.combat = { dam=1, dammod={str=1} }
self.combat = { dam=1 }
engine.Actor.init(self, t, no_default)
engine.interface.ActorTemporaryEffects.init(self, t)
engine.interface.ActorLife.init(self, t)
engine.interface.ActorProject.init(self, t)
engine.interface.ActorTalents.init(self, t)
......@@ -73,6 +76,8 @@ function _M:act()
-- Regen resources
self:regenLife()
self:regenResources()
-- Compute timed effects
self:timedEffects()
-- Still enough energy to act ?
if self.energy.value < game.energy_to_act then return false end
......@@ -101,10 +106,15 @@ Stats: %d / %d / %d
self.life, self.life * 100 / self.max_life,
self:getStr(),
self:getDex(),
self:getCon()
self:getCon(),
self.desc or ""
)
end
function _M:onTakeHit(value, src)
return value
end
function _M:die(src)
engine.interface.ActorLife.die(self, src)
......@@ -117,9 +127,9 @@ function _M:die(src)
end
function _M:levelup()
self.max_life = self.max_life + 5
self.max_life = self.max_life + 2
self:incMaxEnergy(3)
self:incMaxPower(3)
-- Healp up on new level
self.life = self.max_life
......
......@@ -106,7 +106,7 @@ function _M:loaded()
engine.GameTurnBased.loaded(self)
Zone:setup{npc_class="mod.class.NPC", grid_class="mod.class.Grid", }
Map:setViewerActor(self.player)
Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 32, 32, nil, 20, true)
self:setupDisplayMode()
self.key = engine.KeyBind.new()
end
......@@ -123,11 +123,6 @@ function _M:setupDisplayMode()
Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 32, 32, nil, 22, true, true)
Map:resetTiles()
Map.tiles.use_images = false
self:setupMiniMap()
end
function _M:setupMiniMap()
if self.level and self.level.map then self.level.map._map:setupMiniMapGridSize(4) end
end
function _M:save()
......@@ -175,8 +170,6 @@ function _M:changeLevel(lev, zone)
self.player:move(self.level.downs[1].x, self.level.downs[1].y, true)
end
self.level:addEntity(self.player)
self:setupMiniMap()
end
function _M:getPlayer()
......
......@@ -53,18 +53,11 @@ function _M:onTakeHit(value, src)
end
function _M:tooltip()
local factcolor, factstate = "#ANTIQUE_WHITE#", "neutral"
if self:reactionToward(game.player) < 0 then factcolor, factstate = "#LIGHT_RED#", "hostile"
elseif self:reactionToward(game.player) > 0 then factcolor, factstate = "#LIGHT_GREEN#", "friendly"
end
local str = mod.class.Actor.tooltip(self)
return str..([[
Faction: %s%s (%s)
Target: %s
UID: %d]]):format(
factcolor, Faction.factions[self.faction].name, factstate,
self.ai_target.actor and self.ai_target.actor.name or "none",
self.uid)
end
......@@ -20,7 +20,6 @@
require "engine.class"
local DamageType = require "engine.DamageType"
local Map = require "engine.Map"
local Chat = require "engine.Chat"
local Target = require "engine.Target"
local Talents = require "engine.interface.ActorTalents"
......@@ -46,20 +45,12 @@ function _M:bumpInto(target)
end
--- Makes the death happen!
function _M:attackTarget(target, damtype, mult, noenergy)
local speed, hit = nil, false
function _M:attackTarget(target, mult)
if self.combat then
local s, h = self:attackTargetWith(target, self.combat, damtype, mult)
speed = math.max(speed or 0, s)
hit = hit or h
local dam = self.combat.dam + self:getStr() - target.combat_armor
DamageType:get(DamageType.PHYSICAL).projector(self, target.x, target.y, DamageType.PHYSICAL, math.max(0, dam))
end
-- We use up our own energy
if speed and not noenergy then
self:useEnergy(game.energy_to_act * speed)
self.did_energy = true
end
return hit
self:useEnergy(game.energy_to_act)
end
......@@ -27,6 +27,7 @@ newBirthDescriptor{
copy = {
max_level = 10,
lite = 4,
max_life = 25,
},
}
......
......@@ -20,7 +20,7 @@
newEntity{
define_as = "UP_WILDERNESS",
name = "exit to the wilds",
display = '<', color_r=255, color_g=0, color_b=255,
display = '<', color_r=255, color_g=0, color_b=255, back_color=colors.DARK_GREY,
always_remember = true,
notice = true,
change_level = 1,
......@@ -30,7 +30,7 @@ newEntity{
newEntity{
define_as = "UP",
name = "previous level",
display = '<', color_r=255, color_g=255, color_b=0,
display = '<', color_r=255, color_g=255, color_b=0, back_color=colors.DARK_GREY,
notice = true,
always_remember = true,
change_level = -1,
......@@ -39,7 +39,7 @@ newEntity{
newEntity{
define_as = "DOWN",
name = "next level",
display = '>', color_r=255, color_g=255, color_b=0,
display = '>', color_r=255, color_g=255, color_b=0, back_color=colors.DARK_GREY,
notice = true,
always_remember = true,
change_level = 1,
......@@ -48,7 +48,7 @@ newEntity{
newEntity{
define_as = "FLOOR",
name = "floor", image = "terrain/marble_floor.png",
display = '.', color_r=255, color_g=255, color_b=255, back_color=colors.DARK_GREY,
display = ' ', color_r=255, color_g=255, color_b=255, back_color=colors.DARK_GREY,
}
newEntity{
......@@ -81,19 +81,3 @@ newEntity{
always_remember = true,
door_closed = "DOOR",
}
newEntity{
define_as = "OLD_FLOOR",
name = "floor", image = "terrain/maze_floor.png",
display = '.', color_r=255, color_g=255, color_b=255, back_color=colors.DARK_GREY,
}
newEntity{
define_as = "OLD_WALL",
name = "wall", image = "terrain/granite_wall_lichen.png", back_color=colors.GREY,
display = '#', color_r=255, color_g=255, color_b=255,
always_remember = true,
does_block_move = true,
block_sight = true,
air_level = -20,
}
......@@ -19,97 +19,30 @@
local Talents = require("engine.interface.ActorTalents")
newEntity{ --rodent base
define_as = "BASE_NPC_RODENT",
type = "vermin", subtype = "rodent",
display = "r", color=colors.WHITE,
can_multiply = 2,
body = { INVEN = 10 },
newEntity{
define_as = "BASE_NPC_KOBOLD",
type = "humanoid", subtype = "kobold",
display = "k", color=colors.WHITE,
desc = [[Ugly and green!]],
autolevel = "warrior",
ai = "dumb_talented_simple", ai_state = { talent_in=3, },
energy = { mod=1 },
stats = { str=8, dex=15, mag=3, con=5 },
combat_armor = 1, combat_def = 1,
rank = 1,
size_category = 1,
stats = { str=5, dex=5, con=5 },
combat_armor = 0,
}
newEntity{ base = "BASE_NPC_RODENT",
name = "giant white mouse", color=colors.WHITE,
level_range = {1, 3}, exp_worth = 1,
newEntity{ base = "BASE_NPC_KOBOLD",
name = "kobold warrior", color=colors.GREEN,
level_range = {1, 4}, exp_worth = 1,
rarity = 4,
max_life = resolvers.rngavg(5,9),
combat = { dam=5, atk=15, apr=10 },
combat = { dam=2 },
}
newEntity{ base = "BASE_NPC_RODENT",
name = "giant brown mouse", color=colors.UMBER,
level_range = {1, 3}, exp_worth = 1,
newEntity{ base = "BASE_NPC_KOBOLD",
name = "armoured kobold warrior", color=colors.AQUAMARINE,
level_range = {6, 10}, exp_worth = 1,
rarity = 4,
max_life = resolvers.rngavg(5,9),
combat = { dam=5, atk=15, apr=10 },
}
newEntity{ base = "BASE_NPC_RODENT",
name = "giant white rat", color=colors.WHITE,
level_range = {1, 4}, exp_worth = 1,
rarity = 5,
max_life = resolvers.rngavg(15,20),
combat = { dam=7, atk=15, apr=10 },
}
newEntity{ base = "BASE_NPC_RODENT",
name = "giant brown rat", color=colors.UMBER,
level_range = {1, 4}, exp_worth = 1,
rarity = 5,
max_life = resolvers.rngavg(15,20),
combat = { dam=7, atk=15, apr=10 },
}
newEntity{ base = "BASE_NPC_RODENT",
name = "giant rabbit", color=colors.UMBER,
desc = [[Kill the wabbit, kill the wabbit, kill the wabbbbbiiiiiit.]],
level_range = {1, 4}, exp_worth = 1,
rarity = 6,
max_life = resolvers.rngavg(20,30),
combat = { dam=8, atk=16, apr=10 },
}
newEntity{ base = "BASE_NPC_RODENT",
name = "giant crystal rat", color=colors.PINK,
desc = [[Instead of fur this rat has crystals growing on its back which provide extra protection.]],
level_range = {1, 5}, exp_worth = 1,
rarity = 6,
max_life = resolvers.rngavg(35,50),
combat = { dam=7, atk=15, apr=10 },
combat_armor = 4, combat_def = 2,
}
newEntity{ base = "BASE_NPC_RODENT",
name = "cute little bunny", color=colors.SALMON,
desc = [[It looks at you with cute little eyes before jumping at you with razor sharp teeth.]],
level_range = {1, 15}, exp_worth = 3,
rarity = 200,
max_life = resolvers.rngavg(15,20),
combat = { dam=50, atk=15, apr=10 },
combat_armor = 1, combat_def = 20,
}
newEntity{ base = "BASE_NPC_RODENT",
name = "giant grey mouse", color=colors.SLATE,
level_range = {1, 3}, exp_worth = 1,
rarity = 6,
max_life = resolvers.rngavg(5,9),
combat = { dam=5, atk=15, apr=10 },
resolvers.talents{ [Talents.T_CRAWL_POISON]=1 },
}
newEntity{ base = "BASE_NPC_RODENT",
name = "giant grey rat", color=colors.SLATE,
level_range = {1, 4}, exp_worth = 1,
rarity = 7,
max_life = resolvers.rngavg(15,20),
combat = { dam=7, atk=15, apr=10 },
resolvers.talents{ [Talents.T_CRAWL_POISON]=1 },
max_life = resolvers.rngavg(10,12),
combat_armor = 3,
combat = { dam=5 },
}
-- ToME - Tales of Middle-Earth
-- Copyright (C) 2009, 2010 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
local Stats = require "engine.interface.ActorStats"
newEffect{
name = "ACIDBURN",
desc = "Burning from acid",
type = "physical",
status = "detrimental",
parameters = { power=1 },
on_gain = function(self, err) return "#Target# is covered in acid!", "+Acid" end,
on_lose = function(self, err) return "#Target# is free from the acid.", "-Acid" end,
on_timeout = function(self, eff)
DamageType:get(DamageType.ACID).projector(eff.src or self, self.x, self.y, DamageType.ACID, eff.power)
end,
}
......@@ -17,4 +17,4 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
--load("/data/general/npcs/rodent.lua")
load("/data/general/npcs/kobold.lua")
-- ToME - Tales of Middle-Earth
-- Copyright (C) 2009, 2010 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
require "engine.class"
local Dialog = require "engine.Dialog"
local DamageType = require "engine.DamageType"
local Talents = require "engine.interface.ActorTalents"
module(..., package.seeall, class.inherit(engine.Dialog))
function _M:init(actor)
self.actor = actor
engine.Dialog.init(self, "Character Sheet: "..self.actor.name.." (Press 'd' to save)", 800, 400, nil, nil, nil, core.display.newFont("/data/font/VeraMono.ttf", 12))
self:keyCommands({
__TEXTINPUT = function(c)
if c == 'd' or c == 'D' then
self:dump()
end
end,
}, {
ACCEPT = "EXIT",
EXIT = function()
game:unregisterDialog(self)
end,
})
end
function _M:drawDialog(s)
local cur_exp, max_exp = game.player.exp, game.player:getExpChart(game.player.level+1)
local h = 0
local w = 0
s:drawString(self.font, "Sex: "..game.player.descriptor.sex, w, h, 0, 200, 255) h = h + self.font_h
s:drawString(self.font, "Race: "..game.player.descriptor.subrace, w, h, 0, 200, 255) h = h + self.font_h
s:drawString(self.font, "Class: "..game.player.descriptor.subclass, w, h, 0, 200, 255) h = h + self.font_h
h = h + self.font_h
s:drawColorString(self.font, "Level: #00ff00#"..game.player.level, w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("Exp: #00ff00#%2d%%"):format(100 * cur_exp / max_exp), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("Gold: #00ff00#%0.2f"):format(game.player.money), w, h, 255, 255, 255) h = h + self.font_h
h = h + self.font_h
s:drawColorString(self.font, ("#c00000#Life: #00ff00#%d/%d"):format(game.player.life, game.player.max_life), w, h, 255, 255, 255) h = h + self.font_h
if game.player:knowTalent(game.player.T_STAMINA_POOL) then
s:drawColorString(self.font, ("#ffcc80#Stamina: #00ff00#%d/%d"):format(game.player:getStamina(), game.player.max_stamina), w, h, 255, 255, 255) h = h + self.font_h
end
if game.player:knowTalent(game.player.T_MANA_POOL) then
s:drawColorString(self.font, ("#7fffd4#Mana: #00ff00#%d/%d"):format(game.player:getMana(), game.player.max_mana), w, h, 255, 255, 255) h = h + self.font_h
end
if game.player:knowTalent(game.player.T_SOUL_POOL) then
s:drawColorString(self.font, ("#777777#Soul: #00ff00#%d/%d"):format(game.player:getSoul(), game.player.max_soul), w, h, 255, 255, 255) h = h + self.font_h
end
if game.player:knowTalent(game.player.T_EQUILIBRIUM_POOL) then
s:drawColorString(self.font, ("#00ff74#Equi: #00ff00#%d"):format(game.player:getEquilibrium()), w, h, 255, 255, 255) h = h + self.font_h
end
h = h + self.font_h
s:drawColorString(self.font, ("STR: #00ff00#%3d"):format(game.player:getStr()), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("DEX: #00ff00#%3d"):format(game.player:getDex()), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("MAG: #00ff00#%3d"):format(game.player:getMag()), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("WIL: #00ff00#%3d"):format(game.player:getWil()), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("CUN: #00ff00#%3d"):format(game.player:getCun()), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("CON: #00ff00#%3d"):format(game.player:getCon()), w, h, 255, 255, 255) h = h + self.font_h
h = 0
w = 200
-- All weapons in main hands
if self.actor:getInven(self.actor.INVEN_MAINHAND) then
for i, o in ipairs(self.actor:getInven(self.actor.INVEN_MAINHAND)) do
if o.combat then
s:drawColorString(self.font, ("Attack(Main Hand): #00ff00#%3d"):format(game.player:combatAttack(o.combat)), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("Damage(Main Hand): #00ff00#%3d"):format(game.player:combatDamage(o.combat)), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("APR (Main Hand): #00ff00#%3d"):format(game.player:combatAPR(o.combat)), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("Crit (Main Hand): #00ff00#%3d%%"):format(game.player:combatCrit(o.combat)), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("Speed (Main Hand): #00ff00#%0.2f"):format(game.player:combatSpeed(o.combat)), w, h, 255, 255, 255) h = h + self.font_h
end
end
end
h = h + self.font_h
-- All wpeaons in off hands
-- Offhand atatcks are with a damage penality, taht can be reduced by talents
if self.actor:getInven(self.actor.INVEN_OFFHAND) then
local offmult = (mult or 1) / 2
if self.actor:knowTalent(Talents.T_DUAL_WEAPON_TRAINING) then
offmult = (mult or 1) / (2 - (self.actor:getTalentLevel(Talents.T_DUAL_WEAPON_TRAINING) / 6))
end
for i, o in ipairs(self.actor:getInven(self.actor.INVEN_OFFHAND)) do
if o.combat then
s:drawColorString(self.font, ("Attack (Off Hand): #00ff00#%3d"):format(game.player:combatAttack(o.combat)), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("Damage (Off Hand): #00ff00#%3d"):format(game.player:combatDamage(o.combat) * offmult), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("APR (Off Hand): #00ff00#%3d"):format(game.player:combatAPR(o.combat)), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("Crit (Off Hand): #00ff00#%3d%%"):format(game.player:combatCrit(o.combat)), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("Speed (Off Hand): #00ff00#%0.2f"):format(game.player:combatSpeed(o.combat)), w, h, 255, 255, 255) h = h + self.font_h
end
end
end
h = h + self.font_h
s:drawColorString(self.font, ("Spellpower: #00ff00#%3d"):format(game.player:combatSpellpower()), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("Spell Crit: #00ff00#%3d%%"):format(game.player:combatSpellCrit()), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("Spell Speed: #00ff00#%3d"):format(game.player:combatSpellSpeed()), w, h, 255, 255, 255) h = h + self.font_h
h = h + self.font_h
for i, t in ipairs(DamageType.dam_def) do
if self.actor.inc_damage[DamageType[t.type]] and self.actor.inc_damage[DamageType[t.type]] ~= 0 then
s:drawColorString(self.font, ("%s damage: #00ff00#%3d%%"):format(t.name:capitalize(), self.actor.inc_damage[DamageType[t.type]]), w, h, 255, 255, 255) h = h + self.font_h
end
end
h = 0
w = 400
s:drawColorString(self.font, ("Fatigue: #00ff00#%3d%%"):format(game.player.fatigue), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("Armor: #00ff00#%3d"):format(game.player:combatArmor()), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("Defence: #00ff00#%3d"):format(game.player:combatDefense()), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("Ranged Defence: #00ff00#%3d"):format(game.player:combatDefenseRanged()), w, h, 255, 255, 255) h = h + self.font_h
h = h + self.font_h
s:drawColorString(self.font, ("Physical Resist: #00ff00#%3d"):format(game.player:combatPhysicalResist()), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("Spell Resist: #00ff00#%3d"):format(game.player:combatSpellResist()), w, h, 255, 255, 255) h = h + self.font_h
s:drawColorString(self.font, ("Mental Resist: #00ff00#%3d"):format(game.player:combatMentalResist()), w, h, 255, 255, 255) h = h + self.font_h
h = h + self.font_h
for i, t in ipairs(DamageType.dam_def) do
if self.actor.resists[DamageType[t.type]] and self.actor.resists[DamageType[t.type]] ~= 0 then
s:drawColorString(self.font, ("%s Resist: #00ff00#%3d%%"):format(t.name:capitalize(), self.actor.resists[DamageType[t.type]]), w, h, 255, 255, 255) h = h + self.font_h
end
end
h = 0
w = 600
s:drawColorString(self.font, "#LIGHT_BLUE#Current effects:", w, h, 255, 255, 255) h = h + self.font_h
for tid, act in pairs(game.player.sustain_talents) do
if act then s:drawColorString(self.font, ("#LIGHT_GREEN#%s"):format(game.player:getTalentFromId(tid).name), w, h, 255, 255, 255) h = h + self.font_h end
end
for eff_id, p in pairs(game.player.tmp) do
local e = game.player.tempeffect_def[eff_id]
if e.status == "detrimental" then
s:drawColorString(self.font, ("#LIGHT_RED#%s"):format(e.desc), w, h, 255, 255, 255) h = h + self.font_h
else
s:drawColorString(self.font, ("#LIGHT_GREEN#%s"):format(e.desc), w, h, 255, 255, 255) h = h + self.font_h
end
end
self.changed = false
end
function _M:dump()
fs.mkdir("/character-dumps")
local file = "/character-dumps/"..(game.player.name:gsub("[^a-zA-Z0-9_-.]", "_")).."-"..os.date("%Y%m%d-%H%M%S")..".txt"
local fff = fs.open(file, "w")
local nl = function(s) fff:write(s or "") fff:write("\n") end
local nnl = function(s) fff:write(s or "") end
nl("Sex: "..game.player.descriptor.sex)
nl("Race: "..game.player.descriptor.subrace)
nl("Class: "..game.player.descriptor.subclass)
nl("Level: "..game.player.level)
nl()
local cur_exp, max_exp = game.player.exp, game.player:getExpChart(game.player.level+1)
nl(("Exp: %2d%%"):format(100 * cur_exp / max_exp))
nl(("Gold: %0.2f"):format(game.player.money))
nl()
nl(("Life: %d/%d"):format(game.player.life, game.player.max_life))
if game.player:knowTalent(game.player.T_STAMINA_POOL) then
nl(("Stamina: %d/%d"):format(game.player:getStamina(), game.player.max_stamina))
end
if game.player:knowTalent(game.player.T_MANA_POOL) then
nl(("Mana: %d/%d"):format(game.player:getMana(), game.player.max_mana))
end
if game.player:knowTalent(game.player.T_SOUL_POOL) then
nl(("Soul: %d/%d"):format(game.player:getSoul(), game.player.max_soul))
end
if game.player:knowTalent(game.player.T_EQUILIBRIUM_POOL) then
nl(("Equi: %d"):format(game.player:getEquilibrium()))
end
nl()
nl(("STR: %3d"):format(game.player:getStr()))
nl(("DEX: %3d"):format(game.player:getDex()))
nl(("MAG: %3d"):format(game.player:getMag()))
nl(("WIL: %3d"):format(game.player:getWil()))
nl(("CUN: %3d"):format(game.player:getCun()))
nl(("CON: %3d"):format(game.player:getCon()))
-- All weapons in main hands
if self.actor:getInven(self.actor.INVEN_MAINHAND) then
for i, o in ipairs(self.actor:getInven(self.actor.INVEN_MAINHAND)) do
if o.combat then
nl()
nl(("Attack(Main Hand): %3d"):format(game.player:combatAttack(o.combat)))
nl(("Damage(Main Hand): %3d"):format(game.player:combatDamage(o.combat)))
nl(("APR (Main Hand): %3d"):format(game.player:combatAPR(o.combat)))
nl(("Crit (Main Hand): %3d%%"):format(game.player:combatCrit(o.combat)))
nl(("Speed (Main Hand): %0.2f"):format(game.player:combatSpeed(o.combat)))
end
end
end
-- All wpeaons in off hands
-- Offhand atatcks are with a damage penality, taht can be reduced by talents
if self.actor:getInven(self.actor.INVEN_OFFHAND) then
local offmult = (mult or 1) / 2
if self.actor:knowTalent(Talents.T_DUAL_WEAPON_TRAINING) then
offmult = (mult or 1) / (2 - (self.actor:getTalentLevel(Talents.T_DUAL_WEAPON_TRAINING) / 6))
end
for i, o in ipairs(self.actor:getInven(self.actor.INVEN_OFFHAND)) do
if o.combat then
nl()
nl(("Attack (Off Hand): %3d"):format(game.player:combatAttack(o.combat)))
nl(("Damage (Off Hand): %3d"):format(game.player:combatDamage(o.combat) * offmult))
nl(("APR (Off Hand): %3d"):format(game.player:combatAPR(o.combat)))
nl(("Crit (Off Hand): %3d%%"):format(game.player:combatCrit(o.combat)))
nl(("Speed (Off Hand): %0.2f"):format(game.player:combatSpeed(o.combat)))
end
end
end
nl()
nl(("Spellpower: %3d"):format(game.player:combatSpellpower()))
nl(("Spell Crit: %3d%%"):format(game.player:combatSpellCrit()))
nl(("Spell Speed: %3d"):format(game.player:combatSpellSpeed()))
nl()
for i, t in ipairs(DamageType.dam_def) do
if self.actor.inc_damage[DamageType[t.type]] and self.actor.inc_damage[DamageType[t.type]] ~= 0 then
nl(("%s damage: %3d%%"):format(t.name:capitalize(), self.actor.inc_damage[DamageType[t.type]]))
end
end
nl()
nl(("Fatigue: %3d%%"):format(game.player.fatigue))
nl(("Armor: %3d"):format(game.player:combatArmor()))
nl(("Defence: %3d"):format(game.player:combatDefense()))
nl(("Ranged Defence: %3d"):format(game.player:combatDefenseRanged()))
nl()
nl(("Physical Resist: %3d"):format(game.player:combatPhysicalResist()))
nl(("Spell Resist: %3d"):format(game.player:combatSpellResist()))
nl(("Mental Resist: %3d"):format(game.player:combatMentalResist()))
nl()
for i, t in ipairs(DamageType.dam_def) do
if self.actor.resists[DamageType[t.type]] and self.actor.resists[DamageType[t.type]] ~= 0 then
nl(("%s Resist: %3d%%"):format(t.name:capitalize(), self.actor.resists[DamageType[t.type]]))
end
end
nl()
local most_kill, most_kill_max = "none", 0
local total_kill = 0
for name, nb in pairs(game.player.all_kills or {}) do
if nb > most_kill_max then most_kill_max = nb most_kill = name end
total_kill = total_kill + nb
end
nl(("Number of NPC killed: %s"):format(total_kill))
nl(("Most killed NPC: %s (%d)"):format(most_kill, most_kill_max))
fff:close()
Dialog:simplePopup("Character dump complete", "File: "..fs.getRealPath(file))
end
......@@ -85,10 +85,7 @@ end
--- Restore ressources
function _M:restoreRessources()
self.actor.life = self.actor.max_life
self.actor.mana = self.actor.max_mana
self.actor.stamina = self.actor.max_stamina
self.actor.equilibrium = 0
self.actor.air = self.actor.max_air
self.actor.power = self.actor.max_power
self.actor.energy.value = game.energy_to_act
end
......@@ -106,8 +103,6 @@ function _M:resurrectBasic()
game.level:addEntity(self.actor)
game:unregisterDialog(self)
game.level.map:redisplay()
world:gainAchievement("UNSTOPPABLE", self.actor)
end
function _M:use()
......@@ -119,25 +114,9 @@ function _M:use()
save:delete()
save:close()
util.showMainMenu()
elseif act == "dump" then
game:registerDialog(require("mod.dialogs.CharacterSheet").new(self.actor))
elseif act == "cheat" then
game.logPlayer(self.actor, "#LIGHT_BLUE#You resurrect! CHEATER !")
self:cleanActor()
self:restoreRessources()
self:resurrectBasic()
elseif act == "blood_life" then
self.actor.blood_life = false
game.logPlayer(self.actor, "#LIGHT_RED#The Blood of Life rushes through your dead body. You come back to life!")
self:cleanActor()
self:restoreRessources()
self:resurrectBasic()
elseif act == "skeleton" then
self.actor:attr("re-assembled", 1)
game.logPlayer(self.actor, "#YELLOW#Your bones magically come back together. You are once more able to dish pain to your foes!")
self:cleanActor()
self:restoreRessources()
self:resurrectBasic()
......@@ -148,8 +127,6 @@ function _M:generateList()
local list = {}
if config.settings.tome.cheat then list[#list+1] = {name="Resurrect by cheating", action="cheat"} end
if self.actor:attr("blood_life") and not self.actor:attr("undead") then list[#list+1] = {name="Resurrect with the Blood of Life", action="blood_life"} end
if self.actor:getTalentLevelRaw(self.actor.T_SKELETON_REASSEMBLE) >= 5 and not self.actor:attr("re-assembled") then list[#list+1] = {name="Re-assemble your bones ad resurrect (Skeleton ability)", action="skeleton"} end
list[#list+1] = {name="Character dump", action="dump"}
list[#list+1] = {name="Exit to main menu", action="exit"}
......@@ -159,7 +136,7 @@ end
function _M:drawDialog(s)
local help = ([[You have #LIGHT_RED#died#LAST#!
Death in T.o.M.E. is usually permanent, but if you have a means of resurrection it will be proposed in the menu below.
Death in Example is usually permanent, but if you have a means of resurrection it will be proposed in the menu below.
You can dump your character data to a file to remember her/him forever, or you can exit and try again to survive in the wilds!
]]):splitLines(self.iw - 10, self.font)
......
......@@ -24,7 +24,7 @@ local Savefile = require "engine.Savefile"
module(..., package.seeall, class.inherit(engine.Dialog))
function _M:init()
engine.Dialog.init(self, "Realy exit ToME?", 300, 100)
engine.Dialog.init(self, "Realy exit Example Module?", 300, 100)
self:keyCommands({
__DEFAULT = function()
game:unregisterDialog(self)
......
......@@ -25,6 +25,7 @@ local ActorResource = require "engine.interface.ActorResource"
local ActorTalents = require "engine.interface.ActorTalents"
local ActorAI = require "engine.interface.ActorAI"
local ActorLevel = require "engine.interface.ActorLevel"
local ActorTemporaryEffects = require "engine.interface.ActorTemporaryEffects"
local Birther = require "engine.Birther"
-- Usefull keybinds
......@@ -36,6 +37,9 @@ DamageType:loadDefinition("/data/damage_types.lua")
-- Talents
ActorTalents:loadDefinition("/data/talents.lua")
-- Timed Effects
ActorTemporaryEffects:loadDefinition("/data/timed_effects.lua")
-- Actor resources
ActorResource:defineResource("Power", "power", nil, "power_regen", "Power represent your ability to use special talents.")
......
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