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

notfinished

git-svn-id: http://svn.net-core.org/repos/t-engine4@5227 51575b47-30f0-44d4-a5cc-537603b46e54
parent 2f2c79f7
No related branches found
No related tags found
No related merge requests found
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011, 2012 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 Map = require "engine.Map"
module(..., package.seeall, class.make)
function _M:init(font, size)
self.font = core.display.newFont(font, size)
self.text_shadow = 0.8
end
function _M:say(time, txt, ...)
txt = txt:format(...)
self.time = time or 60
self.list = self.font:draw(txt:toString(), math.floor(game.w * 0.8), 255, 255, 255)
self.list_y = (game.h - self.list[1].h * #self.list)
end
function _M:display(nb_keyframes)
if not self.list then return end
local y = self.list_y
for i = 1, #self.list do
local item = self.list[i]
if not item then break end
local x = (game.w - item.w) / 2
if self.text_shadow then item._tex:toScreenFull(x+4, y+4, item.w, item.h, item._tex_w, item._tex_h, 0, 0, 0, self.text_shadow) end
item._tex:toScreenFull(x, y, item.w, item.h, item._tex_w, item._tex_h)
y = y + item.h
end
self.time = self.time - nb_keyframes
if self.time < 0 then
self.time = nil
self.list = nil
end
end
......@@ -48,6 +48,7 @@ local NPC = require "mod.class.NPC"
local DebugConsole = require "engine.DebugConsole"
local FlyingText = require "engine.FlyingText"
local Tooltip = require "mod.class.Tooltip"
local BigNews = require "mod.class.BigNews"
local Calendar = require "engine.Calendar"
local Gestures = require "engine.ui.Gestures"
......@@ -96,6 +97,8 @@ function _M:run()
self.flyers:enableShadow(0.6)
game:setFlyingText(self.flyers)
self.bignews = BigNews.new("/data/font/DroidSansMono.ttf", 26)
self.nicer_tiles = NicerTiles.new()
-- Ok everything is good to go, activate the game in the engine!
......@@ -1124,6 +1127,9 @@ function _M:display(nb_keyframes)
-- Now the ui
self.uiset:display(nb_keyframes)
-- "Big News"
self.bignews:display(nb_keyframes)
if self.player then self.player.changed = false end
engine.GameTurnBased.display(self, nb_keyframes)
......
......@@ -1208,17 +1208,22 @@ end
------ Quest Events
function _M:on_quest_grant(quest)
game.logPlayer(game.player, "#LIGHT_GREEN#Accepted quest '%s'! #WHITE#(Press 'j' to see the quest log)", quest.name)
game.bignews:say(60, "#LIGHT_GREEN#Accepted quest '%s'!", quest.name)
end
function _M:on_quest_status(quest, status, sub)
if sub then
game.logPlayer(game.player, "#LIGHT_GREEN#Quest '%s' status updated! #WHITE#(Press 'j' to see the quest log)", quest.name)
game.bignews:say(60, "#LIGHT_GREEN#Quest '%s' updated!", quest.name)
elseif status == engine.Quest.COMPLETED then
game.logPlayer(game.player, "#LIGHT_GREEN#Quest '%s' completed! #WHITE#(Press 'j' to see the quest log)", quest.name)
game.bignews:say(60, "#LIGHT_GREEN#Quest '%s' completed!", quest.name)
elseif status == engine.Quest.DONE then
game.logPlayer(game.player, "#LIGHT_GREEN#Quest '%s' is done! #WHITE#(Press 'j' to see the quest log)", quest.name)
game.bignews:say(60, "#LIGHT_GREEN#Quest '%s' done!", quest.name)
elseif status == engine.Quest.FAILED then
game.logPlayer(game.player, "#LIGHT_RED#Quest '%s' is failed! #WHITE#(Press 'j' to see the quest log)", quest.name)
game.bignews:say(60, "#LIGHT_GREEN#Quest '%s' failed!", quest.name)
end
end
......
......@@ -782,7 +782,7 @@ local weapon_talents = {
--- Checks weapon training
function _M:combatCheckTraining(weapon)
if not weapon then return end
if not weapon then return 0 end
if not weapon.talented then return 0 end
if not weapon_talents[weapon.talented] then return 0 end
return self:getTalentLevel(weapon_talents[weapon.talented])
......
......@@ -426,7 +426,7 @@ newEntity{ base = "BASE_SHIELD",
combat_def = 9,
fatigue = 14,
resists = {
[DamageType.FIRE] = -20,
[DamageType.DARKNESS] = 20,
[DamageType.COLD] = 20,
[DamageType.NATURE] = 20,
},
......
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