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

test

git-svn-id: http://svn.net-core.org/repos/t-engine4@3768 51575b47-30f0-44d4-a5cc-537603b46e54
parent 8c596f7d
No related branches found
No related tags found
No related merge requests found
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011 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"
require "engine.Entity"
require "mod.class.Player"
module(..., package.seeall, class.inherit(mod.class.Player))
function _M:init(t, no_default)
mod.class.Player.init(self, t, no_default)
self.name = "Yiilkgur, the Sher'Tul Fortress"
self.faction = game:getPlayer(true).faction
self.no_party_class = true
self.no_leave_control = true
self.can_change_level = true
self.can_change_zone = true
self.display = ' '
self.moddable_tile = nil
self.can_pass = {water=500, wall=500}
self.image="terrain/shertul_flying_castle.png"
self.display_h = 2
self.display_y = -1
self.z = 18
self.max_life = 10000
self.life = 10000
end
function _M:tooltip(x, y, seen_by)
return tstring{{"color", "GOLD"}, self.name, {"color", "WHITE"}}
end
function _M:die(src, death_note)
return self:onPartyDeath(src, death_note)
end
--- Attach or remove a display callback
-- Defines particles to display
function _M:defineDisplayCallback()
do return end
if not self._mo then return end
local ps = self:getParticlesList()
local f_self = nil
local f_danger = nil
local f_powerful = nil
local f_friend = nil
local f_enemy = nil
local f_neutral = nil
self._mo:displayCallback(function(x, y, w, h, zoom, on_map)
-- Tactical info
if game.level and game.level.map.view_faction then
local map = game.level.map
if on_map then
if not f_self then
f_self = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_self)
f_powerful = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_powerful)
f_danger = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_danger)
f_friend = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_friend)
f_enemy = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_enemy)
f_neutral = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_neutral)
end
if self.faction then
local friend
if not map.actor_player then friend = Faction:factionReaction(map.view_faction, self.faction)
else friend = map.actor_player:reactionToward(self) end
if self == map.actor_player then
f_self:toScreen(x, y, w, h)
elseif map:faction_danger_check(self) then
if friend >= 0 then f_powerful:toScreen(x, y, w, h)
else f_danger:toScreen(x, y, w, h) end
elseif friend > 0 then
f_friend:toScreen(x, y, w, h)
elseif friend < 0 then
f_enemy:toScreen(x, y, w, h)
else
f_neutral:toScreen(x, y, w, h)
end
end
end
end
local e
for i = 1, #ps do
e = ps[i]
e:checkDisplay()
if e.ps:isAlive() then e.ps:toScreen(x + w / 2, y + h / 2, true, w / (game.level and game.level.map.tile_w or w))
else self:removeParticles(e)
end
end
return true
end)
end
......@@ -492,6 +492,8 @@ function _M:changeLevel(lev, zone, keep_old_lev, force_down)
return
end
if self.zone and self.level then self.party:leftLevel() end
if game.player:isTalentActive(game.player.T_JUMPGATE) then
game.player:forceUseTalent(game.player.T_JUMPGATE, {ignore_energy=true})
end
......@@ -971,12 +973,12 @@ function _M:setupCommands()
--]]
end end,
[{"_g","ctrl"}] = function() if config.settings.cheat then
game.player:setEffect(game.player.EFF_BONE_SHIELD, 30, {nb=3})
-- game.player:setEffect(game.player.EFF_BONE_SHIELD, 30, {nb=3})
-- self.state:debugRandomZone()
-- local m = game.zone:makeEntity(game.level, "actor", {random_boss=true}, nil, true)
-- if m then game.zone:addEntity(game.level, m, "actor", game.player.x, game.player.y + 1) end
-- self:changeLevel(1, "test")
-- self.level.map:particleEmitter(game.player.x, game.player.y, 1, "eagle")
self.level.map:particleEmitter(game.player.x, game.player.y, 1, "flame")
end end,
}
......
......@@ -57,7 +57,9 @@ function _M:addMember(actor, def)
end
-- Turn NPCs into party members
actor:replaceWith(require("mod.class.PartyMember").new(actor))
if not actor.no_party_class then
actor:replaceWith(require("mod.class.PartyMember").new(actor))
end
-- Notify the UI
if game.player then game.player.changed = true end
......@@ -84,6 +86,23 @@ function _M:removeMember(actor, silent)
game.player.changed = true
end
function _M:leftLevel()
local todel = {}
local newplayer = false
for i, actor in ipairs(self.m_list) do
local def = self.members[actor]
if def.temporary_level then
todel[#todel+1] = actor
if actor == game.player then newplayer = true end
end
end
for i = 1, #todel do
self:removeMember(todel[i])
todel[i]:disappear()
end
self:findSuitablePlayer()
end
function _M:hasMember(actor)
return self.members[actor]
end
......@@ -122,6 +141,10 @@ function _M:canControl(actor, vocal)
if not actor then return false end
if actor == game.player then return false end
if game.player and game.player.no_leave_control then
-- print("[PARTY] error trying to set player but current player is modal")
return false
end
if not self.members[actor] then
-- print("[PARTY] error trying to set player, not a member of party: ", actor.uid, actor.name)
return false
......@@ -153,7 +176,7 @@ function _M:setPlayer(actor, bypass)
self.player = actor
-- Convert the class to always be a player
if actor.__CLASSNAME ~= "mod.class.Player" then
if actor.__CLASSNAME ~= "mod.class.Player" and not actor.no_party_class then
actor.__PREVIOUS_CLASSNAME = actor.__CLASSNAME
actor:replaceWith(mod.class.Player.new(actor))
actor.changed = true
......
......@@ -27,6 +27,7 @@ You do not understand the inscriptions there.#WHITE#*
Rokzz krilt copru.]],
answers = {
{"[Examine the orb]", jump="examine", cond=has_rod},
{"[Fly the fortress]", action=function(npc, player) player:hasQuest("shertul-fortress"):fly() end},
{"[Leave the orb alone]"},
}
}
......
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011 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
base_size = 64
return {
system_rotation = 225 + math.deg(math.atan2(proj_y-src_y, proj_x-src_x)), system_rotationv = 0,
base = 1000,
angle = { 0, 0 }, anglev = { 0, 0 }, anglea = { 0, 0 },
life = { 100, 100 },
size = { 64, 64 }, sizev = {0, 0}, sizea = {0, 0},
r = {255, 255}, rv = {0, 0}, ra = {0, 0},
g = {255, 255}, gv = {0, 0}, ga = {0, 0},
b = {255, 255}, bv = {0, 0}, ba = {0, 0},
a = {255, 255}, av = {0, 0}, aa = {0, 0},
}, function(self)
self.ps:emit(1)
end, 1, tile, true
......@@ -149,3 +149,14 @@ upgrade_rod = function(self)
rod.shertul_fortress = true
game.log("#VIOLET#Your rod of recall glows brightly for a moment.")
end
fly = function(self)
local f = require("mod.class.FortressPC").new{}
game:changeLevel(1, "wilderness")
game.party:addMember(f, {temporary_level=1, control="full"})
f.x = game.player.x
f.y = game.player.y
game.party:setPlayer(f, true)
game.level:addEntity(f)
f:move(f.x, f.y, true)
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