From df79202872024e20cdece935308f3c5fce053453 Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Thu, 28 Oct 2010 23:57:35 +0000 Subject: [PATCH] plop git-svn-id: http://svn.net-core.org/repos/t-engine4@1689 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/modules/tome/class/WorldNPC.lua | 1 + .../data/general/encounters/maj-eyal-npcs.lua | 10 ++++----- .../tome/data/general/encounters/maj-eyal.lua | 3 ++- game/modules/tome/data/wda/maj-eyal.lua | 22 +++++++++++-------- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/game/modules/tome/class/WorldNPC.lua b/game/modules/tome/class/WorldNPC.lua index 7bdf3f99cd..18f5701345 100644 --- a/game/modules/tome/class/WorldNPC.lua +++ b/game/modules/tome/class/WorldNPC.lua @@ -26,6 +26,7 @@ require "mod.class.Actor" module(..., package.seeall, class.inherit(mod.class.Actor, engine.interface.ActorAI)) function _M:init(t, no_default) + if type(t.cant_be_moved) == "nil" then t.cant_be_moved = true end mod.class.Actor.init(self, t, no_default) ActorAI.init(self, t) end diff --git a/game/modules/tome/data/general/encounters/maj-eyal-npcs.lua b/game/modules/tome/data/general/encounters/maj-eyal-npcs.lua index 2ab5f27cb6..fee87bfe60 100644 --- a/game/modules/tome/data/general/encounters/maj-eyal-npcs.lua +++ b/game/modules/tome/data/general/encounters/maj-eyal-npcs.lua @@ -21,7 +21,7 @@ class = require("mod.class.WorldNPC") newEntity{ name = "Allied Kingdoms human patrol", - type = "patrol", subtype = "allied kingdoms", cant_be_moved=true, + type = "patrol", subtype = "allied kingdoms", display = 'p', color = colors.LIGHT_UMBER, faction = "allied-kingdoms", level_range = {1, nil}, @@ -33,7 +33,7 @@ newEntity{ newEntity{ name = "Allied Kingdoms halfling patrol", - type = "patrol", subtype = "allied kingdoms", cant_be_moved=true, + type = "patrol", subtype = "allied kingdoms", display = 'p', color = colors.UMBER, faction = "allied-kingdoms", level_range = {1, nil}, @@ -45,7 +45,7 @@ newEntity{ newEntity{ name = "lone bear", - type = "hostile", subtype = "animal", cant_be_moved=true, + type = "hostile", subtype = "animal", display = 'q', color = colors.UMBER, level_range = {1, nil}, sight = 3, @@ -57,7 +57,7 @@ newEntity{ newEntity{ name = "pack of wolves", - type = "hostile", subtype = "animal", cant_be_moved=true, + type = "hostile", subtype = "animal", display = 'c', color = colors.RED, image="npc/canine_w.png", level_range = {1, nil}, sight = 3, @@ -69,7 +69,7 @@ newEntity{ newEntity{ name = "dragon", - type = "hostile", subtype = "dragon", cant_be_moved=true, + type = "hostile", subtype = "dragon", display = 'D', color = colors.RED, level_range = {12, nil}, sight = 3, diff --git a/game/modules/tome/data/general/encounters/maj-eyal.lua b/game/modules/tome/data/general/encounters/maj-eyal.lua index 8a101c8146..7a9705b4c8 100644 --- a/game/modules/tome/data/general/encounters/maj-eyal.lua +++ b/game/modules/tome/data/general/encounters/maj-eyal.lua @@ -40,11 +40,12 @@ newEntity{ local x, y = self:findSpot(who) if not x then return end - local g = mod.class.NPC.new{ + local g = mod.class.WorldNPC.new{ name="Novice mage", type="humanoid", subtype="elf", faction="angolwen", display='@', color=colors.RED, can_talk = "mage-apprentice-quest", + unit_power = 300, } g:resolve() g:resolve(nil, true) game.zone:addEntity(game.level, g, "actor", x, y) diff --git a/game/modules/tome/data/wda/maj-eyal.lua b/game/modules/tome/data/wda/maj-eyal.lua index 06a1c25749..cae717a155 100644 --- a/game/modules/tome/data/wda/maj-eyal.lua +++ b/game/modules/tome/data/wda/maj-eyal.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org --- Maj'Eyal world map directory AI +-- Maj'Eyal worldmap directory AI wda.cur_patrols = wda.cur_patrols or 0 wda.cur_hostiles = wda.cur_hostiles or 0 @@ -27,10 +27,12 @@ if wda.cur_patrols < 3 then local e = game.zone:makeEntity(game.level, "encounters_npcs", {type="patrol"}, nil, true) if e then local spot = game.level:pickSpot{type="patrol", "allied-kingdoms"} - print("Spawned allied kingdom patrol", spot.x, spot.y, e.name) - game.zone:addEntity(game.level, e, "actor", spot.x, spot.y) - wda.cur_patrols = wda.cur_patrols + 1 - e.on_die = function() game.level.data.wda.cur_patrols = game.level.data.wda.cur_patrols - 1 end + if spot and not game.level.map(spot.x, spot.y, engine.Map.ACTOR) and not game.level.map.seens(spot.x, spot.y) then + print("Spawned allied kingdom patrol", spot.x, spot.y, e.name) + game.zone:addEntity(game.level, e, "actor", spot.x, spot.y) + wda.cur_patrols = wda.cur_patrols + 1 + e.on_die = function() game.level.data.wda.cur_patrols = game.level.data.wda.cur_patrols - 1 end + end end end @@ -39,9 +41,11 @@ if wda.cur_hostiles < 4 and rng.percent(5) then local e = game.zone:makeEntity(game.level, "encounters_npcs", {type="hostile"}, nil, true) if e then local spot = game.level:pickSpot{type="hostile", "random"} - print("Spawned hostile", spot.x, spot.y, e.name) - game.zone:addEntity(game.level, e, "actor", spot.x, spot.y) - wda.cur_hostiles = wda.cur_hostiles + 1 - e.on_die = function() game.level.data.wda.cur_hostiles = game.level.data.wda.cur_hostiles - 1 end + if spot and not game.level.map(spot.x, spot.y, engine.Map.ACTOR) and not game.level.map.seens(spot.x, spot.y) then + print("Spawned hostile", spot.x, spot.y, e.name) + game.zone:addEntity(game.level, e, "actor", spot.x, spot.y) + wda.cur_hostiles = wda.cur_hostiles + 1 + e.on_die = function() game.level.data.wda.cur_hostiles = game.level.data.wda.cur_hostiles - 1 end + end end end -- GitLab