Commit 6d089a4b33530130faec23587cc947f9401cac34

Authored by dg
1 parent 9ca0e0ef

Fixed rod of recall/teleport: angolwen to not make stuff appear on the worldmap

Added a new random unique


git-svn-id: http://svn.net-core.org/repos/t-engine4@1810 51575b47-30f0-44d4-a5cc-537603b46e54
... ... @@ -100,6 +100,9 @@ function _M:run()
100 100
101 101 self.log(self.flash.GOOD, "Welcome to #00FF00#Tales of Maj'Eyal!")
102 102
  103 + -- List of stuff to do on tick end
  104 + self.on_tick_end = {}
  105 +
103 106 -- Setup inputs
104 107 self:setupCommands()
105 108 self:setupMouse()
... ... @@ -492,10 +495,23 @@ function _M:tick()
492 495 -- (since display is on a set FPS while tick() ticks as much as possible
493 496 -- engine.GameEnergyBased.tick(self)
494 497 end
  498 +
  499 + -- Run tick end stuff
  500 + if #self.on_tick_end > 0 then
  501 + for i = 1, #self.on_tick_end do self.on_tick_end[i]() end
  502 + self.on_tick_end = {}
  503 + end
  504 +
495 505 if savefile_pipe.saving then self.player.changed = true end
496 506 if self.paused and not savefile_pipe.saving then return true end
497 507 end
498 508
  509 +--- Register things to do on tick end
  510 +-- This is used for recall spells to let the tick finish before switching levels
  511 +function _M:onTickEnd(f)
  512 + self.on_tick_end[#self.on_tick_end+1] = f
  513 +end
  514 +
499 515 --- Called every game turns
500 516 -- Does nothing, you can override it
501 517 function _M:onTurn()
... ...
... ... @@ -36,6 +36,7 @@ loadIfNot("/data/general/npcs/fire-drake.lua")
36 36 loadIfNot("/data/general/npcs/ghost.lua")
37 37 loadIfNot("/data/general/npcs/ghoul.lua")
38 38 --loadIfNot("/data/general/npcs/gwelgoroth.lua")
  39 +loadIfNot("/data/general/npcs/horror.lua")
39 40 loadIfNot("/data/general/npcs/jelly.lua")
40 41 loadIfNot("/data/general/npcs/minor-demon.lua")
41 42 loadIfNot("/data/general/npcs/major-demon.lua")
... ...
  1 +-- ToME - Tales of Maj'Eyal
  2 +-- Copyright (C) 2009, 2010 Nicolas Casalini
  3 +--
  4 +-- This program is free software: you can redistribute it and/or modify
  5 +-- it under the terms of the GNU General Public License as published by
  6 +-- the Free Software Foundation, either version 3 of the License, or
  7 +-- (at your option) any later version.
  8 +--
  9 +-- This program is distributed in the hope that it will be useful,
  10 +-- but WITHOUT ANY WARRANTY; without even the implied warranty of
  11 +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12 +-- GNU General Public License for more details.
  13 +--
  14 +-- You should have received a copy of the GNU General Public License
  15 +-- along with this program. If not, see <http://www.gnu.org/licenses/>.
  16 +--
  17 +-- Nicolas Casalini "DarkGod"
  18 +-- darkgod@te4.org
  19 +
  20 +-- last updated: 10:46 AM 2/3/2010
  21 +
  22 +local Talents = require("engine.interface.ActorTalents")
  23 +
  24 +newEntity{
  25 + define_as = "BASE_NPC_HORROR",
  26 + type = "horror", subtype = "eldritch",
  27 + display = "h", color=colors.WHITE,
  28 + body = { INVEN = 10 },
  29 + autolevel = "warrior",
  30 + ai = "dumb_talented_simple", ai_state = { ai_move="move_dmap", talent_in=3, },
  31 +
  32 + stats = { str=22, dex=20, wil=15, con=15 },
  33 + energy = { mod=1 },
  34 + combat_armor = 0, combat_def = 0,
  35 + combat = { dam=5, atk=15, apr=7, dammod={str=0.6} },
  36 + infravision = 20,
  37 + max_life = resolvers.rngavg(10,20),
  38 + rank = 2,
  39 + size_category = 3,
  40 +}
  41 +
  42 +newEntity{ base="BASE_NPC_HORROR", define_as = "GRGGLCK_TENTACLE",
  43 + name = "Grgglck's Tentacle",
  44 + color = colors.GREY,
  45 + desc = [[This is one of Grgglck's tentacle, it looks more vulnerable than the main body.]],
  46 + level_range = {20, nil}, exp_worth = 0,
  47 + max_life = 100, life_rating = 3, fixed_rating = true,
  48 + equilibrium_regen = -20,
  49 + rank = 3,
  50 + no_breath = 1,
  51 + size_category = 2,
  52 +
  53 + stun_immune = 1,
  54 + knockback_immune = 1,
  55 + teleport_immune = 1,
  56 +
  57 + resists = { all=50, [DamageType.DARKNESS] = 100 },
  58 +
  59 + combat = { dam=resolvers.mbonus(25, 15), atk=500, apr=500, dammod={str=1} },
  60 +
  61 + autolevel = "warrior",
  62 + ai = "dumb_talented_simple", ai_state = { talent_in=3, ai_move="move_astar" },
  63 +
  64 + on_act = function(self)
  65 + if self.summoner.dead then
  66 + self:die()
  67 + game.logSeen(self, "#AQUAMARINE#With Grgglck's death its tentacle also falls lifeless on the ground!")
  68 + end
  69 + end,
  70 +
  71 + on_die = function(self, who)
  72 + if self.summoner and not self.summoner.dead then
  73 + game.logSeen(self, "#AQUAMARINE#As %s falls you notice that %s seems to shudder in pain!", self.name, self.summoner.name)
  74 + self.summoner:takeHit(self.max_life, who)
  75 + end
  76 + end,
  77 +}
  78 +
  79 +newEntity{ base="BASE_NPC_HORROR", define_as = "TEST",
  80 + name = "Grgglck the Devouring Darkness", unique = true,
  81 + color = colors.DARK_GREY,
  82 + rarity = 50,
  83 + desc = [[An horror from the deepest pits of the earth. It looks like a huge pile of tentacles all trying to reach for you.
  84 +You can discern a huge ruond mouth covered in razor-sharp teeth.]],
  85 + level_range = {20, nil}, exp_worth = 2,
  86 + max_life = 300, life_rating = 25, fixed_rating = true,
  87 + equilibrium_regen = -20,
  88 + negative_regen = 20,
  89 + rank = 3.5,
  90 + no_breath = 1,
  91 + size_category = 4,
  92 + movement_speed = 0.5,
  93 +
  94 + stun_immune = 1,
  95 + knockback_immune = 1,
  96 +
  97 + combat = { dam=resolvers.mbonus(100, 15), atk=500, apr=0, dammod={str=1.2} },
  98 +
  99 + body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1 },
  100 + resolvers.drops{chance=100, nb=1, {unique=true} },
  101 + resolvers.drops{chance=100, nb=5, {ego_chance=100} },
  102 +
  103 + resists = { all=500 },
  104 +
  105 + resolvers.talents{
  106 + [Talents.T_STARFALL]=4,
  107 + [Talents.T_MOONLIGHT_RAY]=4,
  108 + [Talents.T_PACIFICATION_HEX]=4,
  109 + [Talents.T_BURNING_HEX]=4,
  110 + [Talents.T_INVOKE_TENTACLE]=1,
  111 + },
  112 + resolvers.sustains_at_birth(),
  113 +
  114 + autolevel = "warriormage",
  115 + ai = "dumb_talented_simple", ai_state = { talent_in=3, ai_move="move_astar" },
  116 +}
... ...
... ... @@ -131,7 +131,7 @@ newEntity{ base = "BASE_NPC_MULTIHUED_DRAKE",
131 131 },
132 132 }
133 133
134   -newEntity{ base = "BASE_NPC_MULTIHUED_DRAKE", define_as="TEST",
  134 +newEntity{ base = "BASE_NPC_MULTIHUED_DRAKE",
135 135 unique = true,
136 136 name = "Ureslak the Prismatic", color=colors.VIOLET, display="D",
137 137 desc = [[A huge multi-hued drake. It seems to shift color rapidly.]],
... ...
... ... @@ -26,7 +26,7 @@ newLore{
26 26 category = "ruined dungeon",
27 27 name = "clue (ruined dungeon)",
28 28 lore = [[There is an inscription here:
29   -#{italic}#"The river flows in its bed of stone...#{normal}#]],
  29 +#{italic}#The river flows in its bed of stone...#{normal}#]],
30 30 }
31 31
32 32 newLore{
... ... @@ -35,7 +35,7 @@ newLore{
35 35 name = "clue (ruined dungeon)",
36 36 lore = [[There is an inscription here:
37 37 #{italic}#...The feather flies gently in the wind.
38   -The tree's root run deep...#{normal}#]],
  38 +The tree's roots run deep...#{normal}#]],
39 39 }
40 40
41 41 newLore{
... ...
... ... @@ -1002,3 +1002,42 @@ newTalent{
1002 1002 The damage will increase with Magic stat.]]):format(self:combatTalentSpellDamage(t, 10, 170), 20 + self:getTalentLevel(t) * 10, self:combatTalentSpellDamage(t, 10, 220))
1003 1003 end,
1004 1004 }
  1005 +
  1006 +newTalent{
  1007 + name = "Invoke Tentacle",
  1008 + type = {"wild-gift/other", 1},
  1009 + cooldown = 1,
  1010 + range = 20,
  1011 + direct_hit = true,
  1012 + action = function(self, t)
  1013 + local tg = {type="hit", range=self:getTalentRange(t), talent=t}
  1014 + local tx, ty = self:getTarget(tg)
  1015 + if not tx or not ty then return nil end
  1016 +
  1017 + -- Find space
  1018 + local x, y = util.findFreeGrid(tx, ty, 3, true, {[Map.ACTOR]=true})
  1019 + if not x then
  1020 + game.logPlayer(self, "Not enough space to invoke!")
  1021 + return
  1022 + end
  1023 +
  1024 + -- Find an actor with that filter
  1025 + local m = game.zone:makeEntityByName(game.level, "actor", "GRGGLCK_TENTACLE")
  1026 + if m then
  1027 + m.exp_worth = 0
  1028 + m:resolve()
  1029 +
  1030 + m.summoner = self
  1031 + m.summon_time = 10
  1032 +
  1033 + game.zone:addEntity(game.level, m, "actor", x, y)
  1034 +
  1035 + game.logSeen(self, "%s spawns one of its tentacle!", self.name:capitalize())
  1036 + end
  1037 +
  1038 + return true
  1039 + end,
  1040 + info = function(self, t)
  1041 + return ([[Invoke your tentacles on your victim.]])
  1042 + end,
  1043 +}
... ...
... ... @@ -1825,8 +1825,10 @@ newEffect{
1825 1825 end,
1826 1826 deactivate = function(self, eff)
1827 1827 if self:canBe("worldport") then
1828   - game.logPlayer(self, "You are yanked out of this place!")
1829   - game:changeLevel(1, game.player.last_wilderness)
  1828 + game:onTickEnd(function()
  1829 + game.logPlayer(self, "You are yanked out of this place!")
  1830 + game:changeLevel(1, game.player.last_wilderness)
  1831 + end)
1830 1832 else
1831 1833 game.logPlayer(self, "Space restabilizes around you.")
1832 1834 end
... ... @@ -1855,8 +1857,10 @@ newEffect{
1855 1857 end
1856 1858
1857 1859 if self:canBe("worldport") then
1858   - game.logPlayer(self, "You are yanked out of this place!")
1859   - game:changeLevel(1, "town-angolwen")
  1860 + game:onTickEnd(function()
  1861 + game.logPlayer(self, "You are yanked out of this place!")
  1862 + game:changeLevel(1, "town-angolwen")
  1863 + end)
1860 1864 else
1861 1865 game.logPlayer(self, "Space restabilizes around you.")
1862 1866 end
... ...
No preview for this file type